Closed
Bug 270497
Opened 20 years ago
Closed 20 years ago
getters/setters for attributes in JS components return NS_ERROR_FAILURE in xpcshell
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 239969
People
(Reporter: vlad, Assigned: dbradley)
Details
Attachments
(1 file)
|
1.86 KB,
application/x-javascript
|
Details |
NS_ERROR_FAILURE is thrown when a pure-JS component implements an attribute using a getter/setter pair. Stick the attached sampleComp.js in a components directory and run xpcshell, then: var e = Components.classes["@mozilla.org/test/sample;1"].createInstance(Components.interfaces.nsISample); e.value The e.value will throw NS_ERROR_FAILURE.
| Reporter | ||
Comment 1•20 years ago
|
||
| Reporter | ||
Comment 2•20 years ago
|
||
Note that removing the value getter/setter and changing it to just 'value: "foo"' causes e.value to work fine.
Comment 3•20 years ago
|
||
So, this fails because the script security manager can't find the subject principal:
nsresult
nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
nsCOMPtr<nsIPrincipal> subjectPrincipal;
if (NS_FAILED(GetSubjectPrincipal(cx, getter_AddRefs(subjectPrincipal))))
return NS_ERROR_FAILURE;
So it works in chrome or with UniversalXPConnect, but not in xpcshell.
Didn't this used to work? Did someone dork with the xpcshell security manager?
(Same behaviour on aviary, so it wouldn't be recent.)Summary: getters/setters for attributes in JS components return NS_ERROR_FAILURE → getters/setters for attributes in JS components return NS_ERROR_FAILURE in xpcshell
i think i reported this somewhere, there's a proposed fix lying around somewhere too.
Comment 5•20 years ago
|
||
I wonder if this is the same as http://groups.google.com/groups?hl=en&lr=&threadm=ced6ui%242cd1%40ripley.netscape.com&rnum=1&prev=/groups%3Fq%3Dmozilla%2Bautoconfig%2Bsetter%26hl%3Den%26lr%3D%26selm%3Dced6ui%25242cd1%2540ripley.netscape.com%26rnum%3D1
Comment 6•20 years ago
|
||
also see bug 239969
| Reporter | ||
Comment 7•20 years ago
|
||
*** This bug has been marked as a duplicate of 239969 ***
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•