What are the differences between Fx 3.x and Fx 4.x that made many userscripts stop working?

1

I develop scripts for userscripts.org and just upgraded my fx from 3.6.16 to 4.0, but many scripts of mine stopped working with the following message error:

Error: Component returned failure code: 0x8007000e (NS_ERROR_OUT_OF_MEMORY) [nsIXPCComponents_Utils.evalInSandbox]
Source code: file:///xxx.user.js

I know this message means some kind of "infinite" process, but it doesn't appear any line number that can help me to figure it out.

Any help/answer/link is welcome.

Operating System: Windows 7 64-bit
Greasemonkey version: 0.9.1
Example of script that is not working:
Userscripts : Beautifier + Deobfuscator target: http://userscripts.org/scripts/review/58687
(I will add more examples as soon as I get back home from work)

Other sources that made me think about the problem:
Lots of scripts no longer working?

firefox
greasemonkey
userscripts
asked on Stack Overflow Mar 24, 2011 by w35l3y • edited May 4, 2014 by Brock Adams

2 Answers

0

The only feature I know of that's been removed in Firefox 4 is the ability to use XUL directly within a web page (ie using the -moz-binding CSS style).

I don't know if that's what's affected your scripts. It has affected one fairly well-known Firefox hack (see text-overflow:ellipsis in Firefox 4? (and FF5)), but I wasn't aware of any other impact of this change.

answered on Stack Overflow Mar 24, 2011 by Spudley • edited May 23, 2017 by Community
0

Since Firefox 4, you can't use RegExp as a loop condition because a new instance will be created for each iteration, causing the infinite loop. (lastIndex = 0)

while (/.../g.exec("...")) {  // used to work
    /* your code goes here */
}

To prevent this from happening, create a separate variable with the RegExp:

var re = /.../g;
while (re.exec("...")) {  // works perfectly
    /* your code goes here */
}
answered on Stack Overflow Sep 9, 2013 by w35l3y

User contributions licensed under CC BY-SA 3.0