GlobalStorage on Firefox 3.0pre (April 2 nightly)

18 views
Skip to first unread message

Anders

unread,
Apr 2, 2008, 10:04:42 PM4/2/08
to greasemonkey-users
Hi,

I'm using globalStorage in one of my scripts to save settings and to
save temporary data between page views. In Firefox 2 this worked:
var storage =
unsafeWindow.globalStorage.namedItem('domain').wrappedJSObject;

In early Firefox 3 betas, this worked:
var storage = unsafeWindow.globalStorage['domain'];

Now I get an error when I try any of these:
[Exception... "Security error" code: "1000" nsresult: "0x805303e8
(NS_ERROR_DOM_SECURITY_ERR)" location: "XPCSafeJSObjectWrapper.cpp
Line: 445"]

I had the same error in Firefox 3.0 beta 5 pre.

Is there any way I can use globalStorage from scripts again, or is
this not something userscripts are suppose to do?

Shog9

unread,
Apr 3, 2008, 11:50:00 AM4/3/08
to greasemonkey-users
For some reason, beta 5 introduced new restrictions on what you can
actually use for 'domain'. It now must be the full domain... so, for
instance, 'google.com' won't work for 'groups.google.com'.

Pass in document.location.host and it should work. I haven't managed
to figure out any way of migrating values set with previous versions
though (short of opening up webappsstore.sqlite and moving them around
manually).

-josh

Anders

unread,
Apr 3, 2008, 1:20:16 PM4/3/08
to greasemonkey-users
That worked great, thank you very much.

RodMcguire

unread,
Apr 3, 2008, 1:56:13 PM4/3/08
to greasemonkey-users
On Apr 3, 1:20 pm, Anders <anders.gunnars...@gmail.com> wrote:
> That worked great, thank you very much.
>
> On Apr 3, 5:50 pm, Shog9 <shogn...@gmail.com> wrote:
>
> > For some reason, beta 5 introduced new restrictions on what you can
> > actually use for 'domain'.

http://developer.mozilla.org/en/docs/DOM:Storage

says:

Firefox 3 note

Firefox 2 permitted access to storage objects higher in the domain
hierarchy than the current document. This is no longer allowed in
Firefox 3, for security reasons. In addition, this proposed addition
to HTML 5 has been removed from the HTML 5 specification in favor of
localStorage, which is not yet implemented in Firefox.
Reply all
Reply to author
Forward
0 new messages