Last modified: 2013-03-22 11:24:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T48426, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 46426 - [Regression] MediaWiki:Common.js not being loaded if it contains a syntax error
[Regression] MediaWiki:Common.js not being loaded if it contains a syntax error
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
unspecified
All All
: High major with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-21 16:40 UTC by JackPotte
Modified: 2013-03-22 11:24 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description JackPotte 2013-03-21 16:40:22 UTC
Hello,
Since around the Scribunto installation on http://fr.wikiversity.org, we've noticed that our many toggle bars were out of order.

We didn't change anything in the templates, Common.css and Common.js before the bug. Copying the same ones from Wikibooks or into my personal wiki shows that the current http://fr.wikiversity.org is the only site which doesn't work:

Error: JavaScript parse error: Parse error: Missing ; before statement in file 'MediaWiki:Common.js' on line 1149 @
Comment 2 Andre Klapper 2013-03-21 19:14:30 UTC
[Tentatively moving to the Scribunto component]

JackPotte: Thanks for reporting. Which toggle bars exactly? Could you attach a screenshot here please, and provide an URL where to see it?
Comment 4 Brad Jorsch 2013-03-21 22:44:29 UTC
Much more likely to be something changed in ResourceLoader that it now chokes on the unclosed comment at the end of their MediaWiki:Common.js. I can't see any possible way this could be related to Scribunto.

The "Error: JavaScript parse error: Parse error: Missing ; before statement in file 'MediaWiki:Common.js' on line 1149" message comes from includes/resourceloader/ResourceLoaderModule.php line 422.

I'm going to reassign this to ResourceLoader, where hopefully someone knows more about what might have made this start failing where it didn't before.
Comment 5 Krinkle 2013-03-21 23:44:47 UTC
(In reply to comment #4)
> Much more likely to be something changed in ResourceLoader that it now chokes
> on the unclosed comment at the end of their MediaWiki:Common.js. I can't see
> any possible way this could be related to Scribunto.
> 
> The "Error: JavaScript parse error: Parse error: Missing ; before statement
> in file 'MediaWiki:Common.js' on line 1149" message comes from
> includes/resourceloader/ResourceLoaderModule.php line 422.
> 
> I'm going to reassign this to ResourceLoader, where hopefully someone knows
> more about what might have made this start failing where it didn't before.

Afaik this behaviour has not changed in ResourceLoader for over a year. If it did change, it seems like it fixed a bug, not introduced a bug.

An unclosed comment in javascript (not the validation by ResourceLoader, but when executing code in a real browser engine I mean) results in a "SyntaxError: Unexpected token ILLEGAL". Try executing the following in your browser's javascript console:

function foo() { return 4; }
alert(foo);
/* bla

Which means, if ResourceLoader hadn't detected this on the server side (it has a javascript parser that detects syntax errors like this) one of two things would've happened:
1) It gets minified against something else which (if you're lucky) causes a big chunk of code to be incorrectly commented out until it finds a */ token somewhere that closes it. This will break code in weird and unexpected ways

2) There is no future */ token, it is the last script in the row. It gets delivered and causes a fatal error. The entire script package (anything concatenated before this) is ignored and not executed.

Both are bad. What ResourceLoader does in this case:
Replace the code of the wiki page that caused the error with a line that logs the error to the console. That way everything else still works and a developer can find the error without breaking the site.

Again, afaik nothing changed and this never worked in the first place. If it did, it was likely by very lucky accident.
Comment 6 Krinkle 2013-03-21 23:48:31 UTC
(In reply to comment #5)
> Again, afaik nothing changed and this never worked in the first place. If it
> did, it was likely by very lucky accident.

Either way, it's unlikely to change (at least not unless we figure out what made it work in the first place).

You now basically have a built-in linter, use it! I'd say just fix the syntax error and be done with it.
Comment 7 JackPotte 2013-03-22 11:24:16 UTC
Thanks a lot for your the reparation on the site http://fr.wikiversity.org/w/index.php?title=MediaWiki%3ACommon.js&diff=377601&oldid=377568.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links