Firefox's LocalStorage extends the Operation Unsafe cast. an exception

I am developing a Firefox add-on that uses localStorage to store user data in a website context. It accesses local storage through injectable content scripts using standard methods:

localStorage.getItem(key);
localStorage.setItem(key, value);

The code that calls localStorege is injected into the website using PageMod:

pageMod.PageMod({
    contentScriptFile: [
        self.data.url("app.js")
    ]})

When the getItem / setItem method is called, a security exception is thrown:

[Exception ... "The operation is unsafe." code: "18" nsresult: "0x80530012 (SecurityError)" location: ""]

, . , - FireFox, : http://meyerweb.com/eric/thoughts/2012/04/25/firefox-failing-localstorage/

- , ?

:

  • Addon SDK 1.16
  • FF 29.0 RC1 ( FF 28)
+4
3

. 29, @basarat , CORS. Aurora Nightly . Mozilla.

+2

The operation is insecure. JavaScript. , JS, CORS: http://en.wikipedia.org/wiki/Cross-origin_resource_sharing

+1

, Firefox 29 30: https://bugzilla.mozilla.org/show_bug.cgi?id=980023

, localStorage, script:

var localStorage = unsafeWindow.localStorage;
+1

Source: https://habr.com/ru/post/1537888/


All Articles