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

UNCONFIRMED
Unassigned

Status

()

Core
JavaScript Engine
UNCONFIRMED
10 years ago
4 years ago

People

(Reporter: gyuri, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

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

I was advised to report this as a bug. Original topic:
http://groups.google.com/group/mozilla.dev.tech.js-engine/browse_thread/thread/99dd11508bf0f795?hl=en#
another topic might be useful identifying the issue:
http://groups.google.com/group/mozilla.dev.tech.xpcom/browse_thread/thread/a47aecba7945be38?hl=en#
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.
(Reporter)

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..
(Assignee)

Updated

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