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

       Web browser: ---
             Bug #: 34036
           Summary: [regression] mw.loader.load doesn't works as
                    importScriptURI for some kinds of URLs
           Product: MediaWiki
           Version: (wikimedia-deployment)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Javascript
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
            Blocks: 33837
    Classification: Unclassified


After I openned the page
https://pt.wikipedia.org/wiki/MediaWiki:Edittools.js
on Google Chrome (16.0.912.77 m) and typed the commands below I got the
following results:

----
> typeof EditTools
"undefined"

> mw.loader.load(mw.config.get( 'wgScript' ) + 
> '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=005');
true

> typeof EditTools
"undefined"

> importScriptURI(mw.config.get( 'wgScript' ) + 
> '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=005');
<script
src=​"/​w/​index.php?title=MediaWiki:​Edittools.js&action=raw&ctype=text/​javascript&nocache=005"
type=​"text/​javascript">​</script>​

> typeof EditTools
"object"
----

So, although mw.loader.load is supposed to be a replacement for
importScriptURI, it doesn't woks in every case where importScriptURI worked.

For comparison, notice that it works if I use the full URL like this:
----
> typeof EditTools
"undefined"

> mw.loader.load('https://pt.wikipedia.org/w/index.php?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=005')
true

> typeof EditTools
"object"
----

or a protocol relative URL like this:
----
> typeof EditTools
"undefined"

> mw.loader.load('//pt.wikipedia.org/w/index.php?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=005')
true

> typeof EditTools
"object"
----

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- 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