Iulian Onofrei
Iulian Onofrei

Reputation: 9730

Greasemonkey access violation: unsafeWindow cannot call GM_getResourceText

I recently started to get this error when trying to read a resource file using GM_getResourceText("filename.txt") after upgrading my browser to Firefox 30, if it matters.

I believe it's a bug but I can't find anything about it, because in Firefox 29 it worked perfectly. And even now, it worked a few times, without changing anything, just refreshing the page. And also, I don't even use unsafeWindow!

My script looks something like this:

// ==UserScript==
// @resource    file file.txt
// @grant       GM_getResourceText
// ==/UserScript==

if(!isOnIframe()) {
    test();
}

function isOnIframe() {
    return !(window.self === window.top);
}

function test() {
    var file = GM_getResourceText(name);
}

Edit: I noticed it doesn't work on Facebook and on other sites it works. Did the changed something? How can I find out?

Upvotes: 0

Views: 420

Answers (1)

Pinke Helga
Pinke Helga

Reputation: 6682

I can confirm, Scriptish 0.1.11 (GM fork) doesn't work with Firefox 30 on Linux. Same issue was reported with Fox version 20. https://bugzilla.mozilla.org/show_bug.cgi?id=844406

Internal function apiLeakCheck checks for user space code (not sandboxed) on the stack and seems to fail in Fox 30 again.

Official latest Scriptish version is 0.1.11, but there's a version 0.1.12 available just yet. https://addons.mozilla.org/de/firefox/addon/scriptish/versions/

This fixes the problem for me. I don't know the current state of Greasymonkey (pre)releases.

Upvotes: 1

Related Questions