Web-bugs: discordapp.com - invite button is not working

Created on 11 Dec 2017  路  20Comments  路  Source: webcompat/web-bugs



URL: https://discordapp.com/invite/CjfKBzQ

Browser / Version: Firefox Mobile 59.0
Operating System: Android 7.1.2
Tested Another Browser: Yes

Problem type: Site is not usable
Description: can't join, doesnt respond
Steps to Reproduce:

_From webcompat.com with 鉂わ笍_

browser-firefox-mobile engine-gecko priority-important q4-2019-outreach severity-critical type-js-timing

Most helpful comment

Hi. A fix for this should arrive this week. Thanks for everyone's patience on this.

All 20 comments

Screenshot Description

<button type="button"
    style="flex: 0 0 auto;"
    class="buttonBrandFilledDefault-2Rs6u5 buttonFilledDefault-AELjWf buttonDefault-2OLW-v button-2t3of8 buttonFilled-29g7b5 buttonBrandFilled-3Mv0Ra largeGrow-2_1w2U button-Xr3WOY elevated-3pg9ul flexChild-1KGW5q">
    <div class="contentsDefault-nt2Ym5 contents-4L4hQM contentsFilled-3M8HCx contents-4L4hQM"><span class="medium-2KnC-N size16-3IvaX_ height20-165WbF weightSemiBold-T8sxWH">Join The Capital of Beasts</span></div>
</button>

empty event?

This doesn't help

Screenshot Description

But I wonder if it's another case of https://bugzilla.mozilla.org/show_bug.cgi?id=1089326

ping @wisniewskit

The invite has expired, and I can't seem to log into Discord to make a new one (the page either spins a loading indicator forever on the login page, or sits there "connecting" forever, no matter what browsers I use). So no diagnosis is forthcoming unless someone generate another invite, or Discord starts letting me log in.

I just managed to score another invite link from a friend (they expire in a day, and they would rather not make it public to begin with).

In Firefox the "Accept Invite" button on the page indeed does nothing, while in Chrome it opens the Google Play Store to get you to install their Android app.

It turns out that there is a click handler added to the document which handles this, which is indeed being called. It generates a URL (something at https://qv7cu.app.goo.gl?lots_of_params), then calls this function in this script to open it:

function s(e, t) {
    var n = document.createElement("iframe");
    document.body.appendChild(n);
    try {
        n.contentWindow.location.href = e, r.nextTick(function() {
            return t(!0)
        })
    } catch (e) {
        "NS_ERROR_UNKNOWN_PROTOCOL" === e.name && r.nextTick(function() {
            return t(!1)
        })
    }
    document.body.removeChild(n)
}

That is, it creates an iframe, sets its document's location to the URL, then removes the iframe.

If I comment out that last removeChild call, then both browsers open the Play Store as expected. But then this test-case also works on both browsers:

<!doctype html>
<html><body>
<script>
  var n = document.createElement("iframe");
  document.body.appendChild(n);
  n.contentWindow.location.href = "market://details?id=org.mozilla.firefox";
  document.body.removeChild(n);
</script>
</body></html> 

Both seem to contradict each other, unless Chrome is handling other URLs than just market: ones in a special way and opening the Play Store app, or Firefox is somehow just not quick enough to visit the URL before the frame is removed (but that doesn't seem likely to me, because in both my above test-case and the live page, the framedoc's readyState is uninitialized just before removeChild is about to be called).

@DenSchub, @miketaylr, do you perhaps have any more insight here, or should we just try to ask Discord to not bother removing the iframe?

And if you remove the nextTick?

It was worth a shot, but unfortunately it didn't help.

Thanks for digging into this - I don't really have any magical insight, but a difference in intent handling or app-specific URIs would seem like a potential culprit here.

What URI is returned from https://qv7cu.app.goo.gl?lots_of_params, and is it the same for Chrome and Firefox?

@miketaylr, what happens is that when Firefox or Chrome visit that URL for the iframe src, it gets 302-redirected to essentially the same URL, just with the intent: protocol and some extra metadata. For instance, this:

https://qv7cu.app.goo.gl/?link=https%3A%2F%2Fdiscord.gg%2FasG6rF%3Ffingerprint%3Dxxx%26username%3D&utm_source=invite&apn=com.discord&isi=12341234&ibi=com.hammerandchisel.discord&efr=1

Returns a redirect to this:

intent://qv7cu.app.goo.gl/?link=https://discord.gg/asG6rF?fingerprint%3Dxxx%26username%3D&apn=com.discord&isi=12341234&ibi=com.hammerandchisel.discord&utm_source=invite&efr=1#Intent;package=com.google.android.gms;scheme=https;S.browser_fallback_url=https://play.google.com/store/apps/details%3Fid%3Dcom.discord&pcampaignid%3Dfdl_long&url%3Dhttps://discord.gg/asG6rF%3Ffingerprint%253Dxxx%2526username%2526utm_source%253Dinvite;end;

But again, as long as the iframe is still there, it loads fine in Firefox. So what might be happening is that on Firefox, it's not getting to the redirect quickly enough on the live page before the iframe is removed and that navigation is terminated.

I suppose they could just not use an iframe for the initial XHR, and then open one only for the intent: URL (or just not remove the iframe), but it's hard to gauge whether this is an actionable interop issue, or "site error". I suppose it all depends on whether there's a chance that Chrome might also remove the iframe before it completes the redirected navigation, but I wouldn't know that for sure. They may just be getting lucky on Chrome.

@wisniewskit maybe worth pinging someone with Android + Gecko experience.

Sure. @snorp, perhaps you have some ideas or clues here (or know who might)?

(trying to find someone on the geckoview or mobile teams to take a look)

reping @miketaylr on finding someone ;)

Promise I tried. :)

Given we have a hard time finding a Mobile engineer to look at this, I had a look instead. To me, this indeed seems like a timing issue where Firefox either never reaching the redirects target, or canceling the request because the iFrame has been removed. If I replace the URL in Tom's testcase in https://github.com/webcompat/web-bugs/issues/14172#issuecomment-420383529 with an URL that redirects to the market, Firefox indeed becomes less reliable at reaching that.

There could be a lot of things going on here, but as we doesn't seem to have any look in debugging the Fennec side of it, and given this seems like a really weird edge-case, we might try getting in touch with Discord first. To me, it seems like simply setting window.location to the URL that is supposed to redirect to the Play Store should work just fine, but there might be a reason why they don't do that, byt only Discord engineers would know that!

Let's try getting in touch with them, setting needscontact.

They can be contacted at https://support.discordapp.com/hc/en-us/requests/new?ticket_form_id=360000029212

We just want to confirm that we've received your message (5517488). Our support team is slamming away and will tackle your request as soon as their rocket boosted finger tips can get to it.

Hi. A fix for this should arrive this week. Thanks for everyone's patience on this.

@jhgg thanks for letting us know.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vickychin picture vickychin  路  4Comments

IngrownMink4 picture IngrownMink4  路  3Comments

oksas picture oksas  路  5Comments

GeorgeWL picture GeorgeWL  路  5Comments

webcompat-bot picture webcompat-bot  路  5Comments