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?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
w35l3y
  • 8,613
  • 3
  • 39
  • 51

2 Answers2

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 */
}
w35l3y
  • 8,613
  • 3
  • 39
  • 51
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.

Community
  • 1
  • 1
Spudley
  • 166,037
  • 39
  • 233
  • 307