Closed Bug 519901 Opened 13 years ago Closed 12 years ago

delete node.prop; gives "Security Manager vetoed action" (XPCNativeWrapper)

Categories

(Core :: XPConnect, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1

People

(Reporter: johnjbarton, Assigned: mrbkap)

Details

(Keywords: dev-doc-complete, Whiteboard: [doc-waiting-1.9.3])

Attachments

(1 file)

On 9/30/09 12:55 AM, John J. Barton wrote:
> I hit a problem, I get an error message "Security Manager vetoed action"
> with the line number point to:
> delete node.__walkingAnonymousChildren; // unmark looping
> Here node is in an nsIDOMDocumentXBL document loaded in a content
> browser.

I assume |node| is just something that looks like a DOM node to you (as in, you didn't do wrappedJSObject on it or anything?

If so, looks like the issue is that XPC_NW_DelProperty will throw NS_ERROR_XPC_SECURITY_MANAGER_VETO, in general, when touching content from chrome.  Not sure why that code is as it is; this was part of the initial XPCNativeWrapper landing.  Looks wrong to me; worth filing a bug on and ccing ":jst" and "brendan@moz" and probably "mrbkap" and ":bz". Minimal-ish testcase:

javascript: var foo = new XPCNativeWrapper(document.body); foo.bar = 'x'; delete foo.bar;

Of course I'm not quite sure why you need the __walkingAnonymousChildren thing at all... Why do you need it?

-Boris
This code was probably working when the js was running in extensions space on extension nodes, but fails when the js is in extension space but the node is content.

Blocks nothing, I wrote different code.
I was talking about this with Blake, and we see no reason to forbid deletes on an XPCNativeWrapper from deleting own properties.  Brendan, jst, can you think of any such reasons?
Attached patch Proposed fixSplinter Review
Note that unlike the other wrappers, XPCNativeWrapper doesn't forward the delete to its underlying object. If you delete an IDL-declared property, we'll simply re-resolve it the next time you ask for it. Expandos get nuked until you recreate them.
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #405965 - Flags: review?(bzbarsky)
Comment on attachment 405965 [details] [diff] [review]
Proposed fix

r=bzbarsky
Attachment #405965 - Flags: review?(bzbarsky) → review+
http://hg.mozilla.org/mozilla-central/rev/fae00beb30ff
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
So is this a fix for this limitation:
https://developer.mozilla.org/en/XPCNativeWrapper#Limitations_of_XPCNativeWrapper
"16. Using the delete operator on "expando" properties of an XPCNativeWrapper throws a security exception."
?
Keywords: dev-doc-needed
Summary: delete node.prop; gives "Security Manager vetoed action" → delete node.prop; gives "Security Manager vetoed action" (XPCNativeWrapper)
Target Milestone: --- → mozilla1.9.3a1
Yes, it is.
Whiteboard: [doc-waiting-1.9.3]
You need to log in before you can comment on or make changes to this bug.