Closed
Bug 1242082
Opened 9 years ago
Closed 7 years ago
Objects with native prototypes throw error with toString
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
INACTIVE
Tracking | Status | |
---|---|---|
firefox46 | --- | affected |
People
(Reporter: rkent, Unassigned)
Details
Somewhere between gecko 41 and gecko 44, objects that have a prototype that is a native wrapper started throwing errors instead of returning a value when converted to a string.
Take this simple code (nsIArray is only used here as a demo, my real use case would extend a different object):
let dummyProto = Components.classes["@mozilla.org/array;1"]
.createInstance(Components.interfaces.nsIArray);
let self = Object.create(dummyProto);
dump("self is " + self + "\n");
Previously, this returned:
self is [xpconnect wrapped native prototype]
Now this returns:
Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)"
The printing of an object is a frequently used debug printout. Now I have to look for any of these and remove them, as they are now throwing errors.
I don't know if this is intentional (or a variant of bug 928701) but it is a change.
Comment 1•9 years ago
|
||
In general, putting native objects (especially XPCWNs) on prototypes and having them behave in a useful manner isn't really supported, though we've been trying to avoid widescale addon bustage in the process of cleaning up this stuff.
In general, the more situations where we can get away with throwing for these cases the better, since it decreases the likelihood that someone will depend on something that we'll need to break late on. However, if the bustage here were widespread that would certainly be a problem. That seems unlikely given that this is the first I've heard about it though.
Comment 2•7 years ago
|
||
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•