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

Krinkle <krinklem...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|JavaScript syntax error     |ResourceLoader: Module
                   |when mw.loader.store        |storage containing invalid
                   |enabled when using Opera 12 |script should not cause
                   |                            |invalid loader state

--- Comment #17 from Krinkle <krinklem...@gmail.com> ---
## Similar handling for server error

To simulate the handling for invalid syntax from the server (instead of module
storage):

* Change ResourceLoader::makeLoaderImplementScript():
  -     $scripts = new XmlJsCode( "function () {\n{$scripts}\n}" );
  +     $scripts = new XmlJsCode( "function () {throw new
Error('Wee');\n{$scripts}\n}" );
* Set $wgResourceLoaderStorageEnabled = false; in LocalSettings.php
* Refresh page

Result:

  (i) Exception thrown by jquery.hidpi
  (i) [x] Error: Wee Error {stack: (...), message: "Wee"}
  > mw.loader.getState('jquery.hidpi')
    "error"
  > jQuery.byteLength
    undefined

## Steps to simulate bug with client error

* Visit page that will load module x (e.g. jquery.byteLength, loaded on every
page by default in the Vector skin)
* Execute from console:

  var storeKey = mw.loader.store.getStoreKey();
  localStorage[storeKey] =
localStorage[storeKey].replace('mw.loader.implement(\\"jquery.byteLength\\"',
'throw new Error(\\"infected module store\\");
mw.loader.implement(\\"jquery.byteLength\\"');

* Refresh page

Current result in console:

  [x] Uncaught Error: infected module store 
  > mw.loader.getState('jquery.byteLength')
    "loading" // indefinitely !
  > jQuery.byteLength
    undefined

After this patch:

  (i) Error while evaluating data from mw.loader.store
  (i) [x] Error: infected store Error {stack: (...), message: "infected store"} 

  > mw.loader.getState('jquery.byteLength')
    "ready"
  > jQuery.byteLength
    function (str) { ... }

-- 
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
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to