https://bugzilla.wikimedia.org/show_bug.cgi?id=47457

--- Comment #28 from Brad Jorsch <[email protected]> ---
I can reproduce it easily enough in Firefox 20 on Commons. When it occurs,
Firebug's "net" window shows 7 connections to various
https://commons.wikimedia.org/w/index.php?title=$TITLE&action=raw&ctype=text/javascript
URLs, and occasionally one with the same pattern at meta. A tcpdump shows no
attempts to actually load these pages, though. I also see the error mentioned
in comment #14, and confirm that disabling WikiLove causes the bug to not
occur.

I've also found some other conditions:
* There seems to be some sort of cache involvement: if I clear the browser's
cache, the first attempted load of one of the affected userpages works fine
while subsequent attempts fail. Also, the error from comment #14 doesn't occur
in this case.
* It only occurs when the page is loading in a background tab. A normal click
works fine, as does opening in a foreground tab. OTOH, a normal click and then
quickly switching tabs before the page starts to load *will* show the bug, as
will hitting enter in the URL bar and then quickly switching tabs. And opening
in a background tab and then quickly switching to that tab before the page
starts to load does not show the bug.
* HTTPS is *not* required here, it occurs for me when using HTTP as well.
* Unfortunately, adding "?debug=true" to one of the affected userpage links
makes the bug stop occurring.

But the most interesting bit is that it seems the document.write inside
resources/mediawiki/mediawiki.js is somehow going awry: inspecting the DOM of
the bugged page shows that the DOM contains only a script tag, rather than all
the HTML of the page.

After some further debugging with a local proxy that rewrites the downloaded
jQuery on the fly to inject console.log statements, it appears that this is
more or less the same thing as bug 31895: somehow or other the document.write
call is sneaking in between the "closing" of the document and the calling of
the DOMContentLoaded callback that sets $.isReady.

I suspect that gerrit change Ib54a3e78 somehow or other caused this, but the
real bug is that $.isReady (even after the fix for bug 31895) is still not
reliable for whether document.write can be safely used. I don't know whether
it's a correct fix, but I do note that adjusting the "if ( $.isReady || async
)" on line 849 of resources/mediawiki/mediawiki.js to "if ( document.body ||
$.isReady || async )" makes it so I can no longer reproduce the bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to