Greasemonkey access violation

34 views
Skip to first unread message

Yansky

unread,
May 13, 2012, 10:35:06 PM5/13/12
to greasemon...@googlegroups.com
Hi, I'm getting the following error and I'm not sure why: Error: Greasemonkey access violation: unsafeWindow cannot call GM_getResourceText.

My script is here: http://userscripts.org/scripts/show/133203
source: http://userscripts.org/scripts/review/133203

I've temporarily commented out the line that's causing the error and replaced it with a hard-link to the image:
//img.src = GM_getResourceText("downloadIcon");
img.src = 'http://img.photobucket.com/albums/v215/thegooddale/49569412.png';

Anyone have any ideas as to why I'm getting this error?

Anthony Lieuallen

unread,
May 13, 2012, 10:56:25 PM5/13/12
to greasemon...@googlegroups.com
Because you're doing it inside a DOMNodeInserted callback.  This is issue https://github.com/greasemonkey/greasemonkey/issues/1001 with documented workaround http://wiki.greasespot.net/0.7.20080121.0_compatibility#Workaround (which is the first result from a search for https://www.google.com/search?q=%22Greasemonkey+access+violation%22 "Greasemonkey access violation").

You should probably call GM_getResourceText at the top level, and store it in a variable that will be accessible at callback time.


--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/greasemonkey-users/-/edj8igQr2NoJ.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.

Loading image

Click anywhere to cancel

Image unavailable

Yansky

unread,
May 16, 2012, 4:43:23 AM5/16/12
to greasemon...@googlegroups.com
Hi, thanks for the help, that fixed it. :)

btw, I had googled and I did read that page on the greasmonkey wiki, but I mistakenly assumed it was about people using callbacks with unsafeWindow.

Cheers,
Yansky.


On Monday, May 14, 2012 12:56:25 PM UTC+10, Anthony Lieuallen wrote:
Because you're doing it inside a DOMNodeInserted callback.  This is issue https://github.com/greasemonkey/greasemonkey/issues/1001 with documented workaround http://wiki.greasespot.net/0.7.20080121.0_compatibility#Workaround (which is the first result from a search for https://www.google.com/search?q=%22Greasemonkey+access+violation%22 "Greasemonkey access violation").

You should probably call GM_getResourceText at the top level, and store it in a variable that will be accessible at callback time.

On Sun, May 13, 2012 at 10:35 PM, Yansky <thego...@gmail.com> wrote:
Hi, I'm getting the following error and I'm not sure why: Error: Greasemonkey access violation: unsafeWindow cannot call GM_getResourceText.

My script is here: http://userscripts.org/scripts/show/133203
source: http://userscripts.org/scripts/review/133203

I've temporarily commented out the line that's causing the error and replaced it with a hard-link to the image:
//img.src = GM_getResourceText("downloadIcon");
img.src = 'http://img.photobucket.com/albums/v215/thegooddale/49569412.png';

Anyone have any ideas as to why I'm getting this error?

--


Reply all
Reply to author
Forward
0 new messages