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

Jesús Martínez Novo (Ciencia Al Poder) <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected],
                   |                            |[email protected]
          Component|JavaScript                  |ResourceLoader

--- Comment #3 from Jesús Martínez Novo (Ciencia Al Poder) 
<[email protected]> ---
I've helped Sid-G to diagnose the problem on IRC.

The exception "JavaScript parse error: Parse error: Illegal token in file
'MediaWiki:Gadget-Twinkle.js' on line 3757" is not thrown by the browser when
parsing the file. That exception is *injected* into the code output by the
Resource Loader (so changing component accordingly).

See at the end of this file:

http://bits.wikimedia.org/hi.wikipedia.org/load.php?debug=true&lang=hi&modules=ext.gadget.Twinkle&only=scripts&skin=vector&version=20130715T110222Z

You can see the following:

 /* MediaWiki:Gadget-Twinkle.js */
 throw new Error("JavaScript parse error: Parse error: Illegal token in file
  'MediaWiki:Gadget-Twinkle.js' on line 3757");

So my suspect is that there's some tool or PHP code that parses each JavaScript
file looking for syntax errors and detects an error on that file, injecting
that exception instead of the actual code.

I've tried myself to copy the code of [[:hi:Mediawiki:Gadget-Twinkle.js]] to my
personal /skinname.js file for testing and the browser didn't throw any parse
error, just a runtime error because of a missing dependency. My conclusion is
that the tool that is parsing those JavaScript files is more strict than
browsers, and may need tweaking or handling this special case.

I think the problem is not really the BOM characters, but another issue. The
line 3757 is after this:

Twinkle.config.commonSets = {
    csdCriteria: {
        शीह: "विशिष्ट कारण ({{शीह}})",

I suspect the problem is that the key name of the "csdCriteria" object has
non-ascii characters on it, and that's the issue with the tool that is parsing
the file. Maybe surrounding those key names between quotes would fix it. 

Example:

Twinkle.config.commonSets = {
    csdCriteria: {
        "शीह": "विशिष्ट कारण ({{शीह}})",

As I said, executing that code on the browser causes no parse errors (Firefox
22.0). I'm not sure if ecma 262 standard allows this.

-- 
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