Closed Bug 987669 Opened 11 years ago Closed 10 years ago

Implement Xrays to Error objects

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: bholley, Assigned: bholley)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

This is a kind of object that often crosses privilege boundaries. For example, in bug 987222, exceptions that propagate into XBL end up looking like this: System JS : ERROR (null):0 - uncaught exception: [Opaque] We should implement useful Xrays here, which will at least make the [Opaque] say something more useful.
Blocks: 987222
I don't think we should be exposing info about an exception to a scope that couldn't normally read that info....
(In reply to Boris Zbarsky [:bz] from comment #1) > I don't think we should be exposing info about an exception to a scope that > couldn't normally read that info.... Oh, for sure. The filtering policy will take care of that. The issue here is with the inverse wrapper, whereby we protect privileged code from less-privileged code by making the wrappers opaque (we do this for XBL scopes, where we don't have the compatibility burden we have in the general case). The issue in bug 987222 is that the page throws an exception, but it gets reported in the XBL scope, where stringifying it gives "[Opaque]". Xrays will fix that for us.
Depends on: 1029933
Depends on: 1036507
Attachment #8453285 - Flags: review?(luke)
Attachment #8453288 - Flags: review?(gkrizsanits)
Attachment #8453290 - Flags: review?(gkrizsanits)
Attached patch Part 6 - Tests. v1 (deleted) — Splinter Review
Attachment #8453291 - Flags: review?(gkrizsanits)
Blocks: 856067
Attachment #8453285 - Flags: review?(luke) → review+
Attachment #8453286 - Flags: review?(gkrizsanits) → review+
Comment on attachment 8453287 [details] [diff] [review] Part 3 - Implement Xray support for the data properties on ErrorObject instances. v1 Review of attachment 8453287 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/xpconnect/wrappers/XrayWrapper.cpp @@ +621,5 @@ > + if (isErrorIntProperty || isErrorStringProperty) { > + RootedObject waiver(cx, wrapper); > + if (!WrapperFactory::WaiveXrayAndWrap(cx, &waiver)) > + return false; > + if (!JS_GetOwnPropertyDescriptorById(cx, waiver, id, desc)) This might be a stupid question, but is there a way that the underlying object has a proxy in its proto chain that can interrupt this? Normally that would not be an issue but after the waiving it... r=me with either adding an isJSProxy call here, or explaining me why this cannot be an issue and/or adding a test for it.
Attachment #8453287 - Flags: review?(gkrizsanits) → review+
Attachment #8453288 - Flags: review?(gkrizsanits) → review+
Attachment #8453290 - Flags: review?(gkrizsanits) → review+
Attachment #8453291 - Flags: review?(gkrizsanits) → review+
(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #10) > > + if (isErrorIntProperty || isErrorStringProperty) { > > + RootedObject waiver(cx, wrapper); > > + if (!WrapperFactory::WaiveXrayAndWrap(cx, &waiver)) > > + return false; > > + if (!JS_GetOwnPropertyDescriptorById(cx, waiver, id, desc)) > > This might be a stupid question, but is there a way that the underlying > object has a proxy in its proto chain that can interrupt this? Normally that > would not be an issue but after the waiving it... r=me with either adding an > isJSProxy call here, or explaining me why this cannot be an issue and/or > adding a test for it. It's a non-issue because we know the JSClass of target is ErrorObject::class_, and the lookup is |own|, which means we never hit the proto.
Ah right, I forgot about the own part! Nevermind then.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: