UploadWizard broken in Opera 12.15
Closed, ResolvedPublic

Description

UploadWizard currently errors out on the first screen. Error console with debug mode enabled shows the error "Undefined variable: UploadWizardConfig" is triggered in line 24 of mw.LanguageUpWiz.js. This is with Opera 12.15 on Ubuntu.


Version: unspecified
Severity: critical
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=48515

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz48091.
Eloquence created this task.Via LegacyMay 5 2013, 1:53 AM
bzimport added a comment.Via ConduitMay 6 2013, 11:43 AM

indeedous wrote:

The same problem with XP and Win7 with Opera 12.15 (Build 1748). UploadWizard doesn't work at all for about 1 week.

gerritbot added a comment.Via ConduitMay 6 2013, 7:56 PM

Related URL: https://gerrit.wikimedia.org/r/62480 (Gerrit Change Iaf23ae56d610471a8ac2b49b303a96adb957cd48)

Nischayn22 added a comment.Via ConduitMay 6 2013, 9:06 PM

The change is based just on the error shown above and has to be verified with the browser. I don't have a Opera installation yet.

Nischayn22 added a comment.Via ConduitMay 16 2013, 12:43 PM

I updated my copy of UW and the error didn't show, then updated core to master and its there. The patch doesn't solve the problem for me.

Rillke added a comment.Via ConduitMay 17 2013, 4:38 PM

Created attachment 12331
HTML DOM of Special:UploadWizard in debug mode

If you set the config *after* calling mw.loader.load for ext.uploadWizard, this might happen:

  • Browser sees "mw.loader.load"
  • RL creates script tags and inserts them directly after the script node containing the call (creating new script nodes which are above the config)
  • Browser loads all these scripts (requested by RL) synchronously and "sees" the UpWiz config after all scripts have been loaded. Most browsers do this async for scripts inside <body> now, but Opera might behave differently.

As soon as mw.config is available, the UpWiz config can be set.

UpWiz config is shipped directly within the HTML (no separate script). Since mw.config is available as soon as the head-scripts are loaded (which always happens synchronously [except when using a special attribute]) and UpWiz config contains only constants, you can put it directly at the beginning of the body or better, as the last node into the head.

I will upload another image showing the HTML DOM of a browser having JS disabled. You will see that, indeed Opera wrote all script requests directly below the call to mw.loader which is highlighted here.

Attached:

Rillke added a comment.Via ConduitMay 17 2013, 4:42 PM

Created attachment 12332
HTML DOM of Special:UploadWizard in debug mode with JS disabled

Attached:

Rillke added a comment.Via ConduitMay 17 2013, 5:41 PM

Well, all this requires messing with OutputPage.php or https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/UploadWizard.git;a=blob;f=includes/specials/SpecialUploadWizard.php;hb=master#l212
with which I am not familiar and therefore exceeds my time limit.

Nischayn22 added a comment.Via ConduitMay 19 2013, 4:45 AM

(In reply to comment #5)

So you suggest that the config should be added into the head, I can try this but how is this done? currently its being added using

		$this->getOutput()->addScript(
TheDJ added a comment.Via ConduitMay 19 2013, 10:35 AM

I think this is what you would want for that: http://www.mediawiki.org/wiki/Manual:Hooks/MakeGlobalVariablesScript

Nischayn22 added a comment.Via ConduitMay 19 2013, 2:10 PM

(In reply to comment #9)

I think this is what you would want for that:
http://www.mediawiki.org/wiki/Manual:Hooks/MakeGlobalVariablesScript

I tried to hack in https://gerrit.wikimedia.org/r/#/c/64520/ but didn't work in Opera yet.

Rillke added a comment.Via ConduitMay 29 2013, 9:11 PM

(In reply to comment #10)

I tried to hack in https://gerrit.wikimedia.org/r/#/c/64520/ but didn't work in
Opera yet.

Please be more specific: What did not work?

Here is what I did:

  1. Installed a local proxy (Fiddler2)

1a) Configurated Opera to use the local proxy
1b) went to http://commons.wikimedia.org/wiki/Special:UploadWizard in Opera

  1. Dumped the UploadWizard HTML page
  2. Enabled auto-response for UploadWizard from the dump; other requests were passed through to the WMF servers
  3. Verified that the Upload Wizard still "hangs" and threw the same error at the JS Error console
  4. MODIFIED THE DUMP:

5a) Moved
<script>if(window.mw){
mw.config.set({"UploadWizardConfig":{ [...]

directly before the loading call

<script>if(window.mw){
mw.loader.load(["mediawiki.htmlform","ext.uploadWizard"
AND IT WORKED!
5b) Moved the config into the head but below the other config so it looks like this:
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"Special" [...]
<script>if(window.mw){
mw.loader.implement("user.options" [...]
<script>if(window.mw){
mw.config.set({"UploadWizardConfig":
AND IT WORKED!

Conclusion: There are many points where you can insert the config, you just have to care that:
a) mw.config is there
b) it must be *before* telling RL to load ext.UploadWizard

Is this that difficult? Isn't there anyone who developed this OutPage.php monster?

Nischayn22 added a comment.Via ConduitMay 30 2013, 6:08 AM

(In reply to comment #11)

Please be more specific: What did not work?

My comment could be understood if you read the previous comments in that order.
Anyways, I tried to put the config variable above the load calls in a *hacky* way and couldn't make it work on Opera; that's what I meant.

Rillke added a comment.Via ConduitMay 30 2013, 11:05 AM

(In reply to comment #12)

and couldn't make it work on Opera

Sorry for the misunderstanding. I would be still curious what the issue was exactly. Was the error message in Opera Dragonfly the same? Did you inspect the HTML DOM before and after it was altered by the JS engine?

gerritbot added a comment.Via ConduitJun 5 2013, 2:36 PM

Related URL: https://gerrit.wikimedia.org/r/67090 (Gerrit Change I14b231bfb73e8382c59f34331b822837c651a34e)

Nischayn22 added a comment.Via ConduitJun 5 2013, 2:37 PM

(In reply to comment #14)
The following change demonstrates possible solution

Rillke added a comment.Via ConduitJun 5 2013, 3:02 PM

(In reply to comment #15)
Both provided "solutions" are a no-go.

Timeouts and listening for DOMready are not suitable checks for determining whether a script was executed. jQuery event listeners may be but since the UpWiz config is written directly into the output page, it must be possible to place it before the loader-call.

Nischayn22 added a comment.Via ConduitJun 5 2013, 3:06 PM

(In reply to comment #16)
Actually they aren't solutions, but more of a analysis of the problem.
Surely the config should be before the load call but I was able to see different results on Chrome and Opera confusing me what the fix would be.

On Opera I was seeing window.load getting called while on Chrome both were getting called.

gerritbot added a comment.Via ConduitJun 13 2013, 6:31 PM

Related URL: https://gerrit.wikimedia.org/r/68475 (Gerrit Change Ia09ace5dc985524634ee2c225207ee5050a046c2)

MarkTraceur added a comment.Via ConduitJun 13 2013, 11:17 PM

Fixed, deployed to commons, reopen if you see more problems.

Thanks all!

Gilles added a project: Multimedia.Via WebDec 4 2014, 10:15 AM
Gilles raised the priority of this task from "High" to "Unbreak Now!".Via WebDec 4 2014, 10:21 AM
Gilles moved this task to Closed on the Multimedia workboard.
Gilles lowered the priority of this task from "Unbreak Now!" to "High".Via ConduitDec 4 2014, 11:20 AM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.