我收到此错误
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]
我的文件:
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>
答案 0 :(得分:3)
即使问题中几乎没有有用的信息,但异常表示访问window.localStorage
时出错。我的通灵能力告诉我,您正试图访问从window.localStorage
加载的文档中的chrome://
,可能是浏览器窗口的XUL文档。这不起作用:localStorage
始终绑定到服务器主机名,这意味着您只能将其用于从http://
加载的文档。
在扩展程序中,您可以使用不同的机制持久存储数据,最常见的是preferences。