eval.call from XPCOM gives NS_ERROR_XPC_NOT_ENOUGH_ARGS calling from XPCOM in FF3




JavaScript Engine
10 years ago
4 years ago


(Reporter: gyuri, Unassigned)


Firefox Tracking Flags

(Not tracked)




10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080702 Firefox/
Build Identifier: 3.0 final, 3.0.1

I was advised to report this as a bug. Original topic:
another topic might be useful identifying the issue:
I have started both topics

Reproducible: Always

I have a javascript XPCOM extension, having a toolbar button as an user interface, whenever the button is clicked, I need to inject some javascript code into every frame of the actual webpage. 

I have found that eval is the appropriate canditate for this. 
Obviously, I cannot use window.eval(code) from XPCOM (I would get this: "function eval must be called directly, and not by way of a function")
So, I found working fine eval.call(window, code) in FF2. 

However it does not work in FF3, I get NS_ERROR_XPC_NOT_ENOUGH_ARGS, but only when I put the call in try/catch. Otherwise, nothing happens,  no error, and no injection of code of course.

I would give as much details as I can about my extension / if you need it / but note, that this extension is part of a commercial product. 

So, it would be very appreciated if this could work in FF3.

Comment 1

10 years ago
It turned out that the problem looks similar to https://bugzilla.mozilla.org/show_bug.cgi?id=435151

The NS_ERROR_XPC_NOT_ENOUGH_ARGS error is not for the eval itself, but for the code to be evaled. All of the new Something() throws this exception.
The problem is eliminated when new Array() is replaced by [] and new Object() is replaced by {}, however I have no idea how to replace new Date() or new RegExp() or new MyClass()...

Not sure if this the desired behaviour, though..


4 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.