Mozilla Extension error

-1

I'm getting this error

Timestamp: 4/2/12 11:56:36 AM
Error: uncaught exception: 
   [Exception... "Component returned failure code: 0x80040111 
   (NS_ERROR_NOT_AVAILABLE) [nsIDOMWindow.localStorage]"  
   nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  
   location: "JS frame :: chrome://myextension/content/users.js 
   :: startFBP :: line 6"  data: no]

My files:

chrome.manifest

content myextension chrome/content/
content myextension chrome/content/ contentaccessible=yes
overlay chrome://browser/content/browser.xul chrome://myextension/content/tracker.xul

install.rdf

<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <Description about="urn:mozilla:install-manifest">
    <em:id>firefox@myextension.fourbananas</em:id>
    <em:version>2.0</em:version>
    <em:type>2</em:type>

    <!-- Target Application this extension can install into, 
         with minimum and maximum supported versions. --> 
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>1.5</em:minVersion>
        <em:maxVersion>13.0.*</em:maxVersion>
      </Description>
    </em:targetApplication>

    <!-- Front End MetaData -->
    <em:name>myextension</em:name>
    <em:description>My Extension! Una extensión que te permite añadir funciones únicas a tus redes sociales</em:description>
    <em:creator>Four Bananas</em:creator>
    <em:homepageURL>http://myextension.me/</em:homepageURL>
  </Description>      
</RDF>
xml
firefox
firefox-addon
xul
asked on Stack Overflow Apr 2, 2012 by Luis

1 Answer

3

Even though there is almost no useful information in the question, the exception indicates that there is an error accessing window.localStorage. My psychic powers tell me that you are attempting to access window.localStorage in a document loaded from chrome://, probably the browser window's XUL document. This will not work: localStorage is always bound to a server host name, meaning that you only have it for documents loaded from http://.

In an extension you can use different mechanisms to store data persistently, most common being preferences.

answered on Stack Overflow Apr 3, 2012 by Wladimir Palant

User contributions licensed under CC BY-SA 3.0