Closed Bug 1085566 Opened 10 years ago Closed 10 years ago

Make the preventExtensions hook return succeeded/failed rather than always indicate failure by reporting an error

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: Waldo, Assigned: Waldo)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

This'll be necessary to implement Reflect.preventExtensions, eventually, and the current signature is misleading people as to how this hook should work.
Attached patch PatchSplinter Review
Attachment #8508143 - Flags: review?(efaustbmo)
Comment on attachment 8508143 [details] [diff] [review]
Patch

Review of attachment 8508143 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with return value changed. Glad to see the stupidity in the SDPH method go away, and us get closer to spec.

::: dom/base/nsGlobalWindow.cpp
@@ +727,1 @@
>    return false;

This should now return true, no? This doesn't actually throw, just "recommends throwing to the caller", right? As written, this is likely to assert on a JS_ASSERT_IF(!ok, cx->pendingException) or some such, I would think
Attachment #8508143 - Flags: review?(efaustbmo) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/9e900e87b4bb
https://hg.mozilla.org/integration/mozilla-inbound/rev/e1f3364485a1

Second patch is a test for this.  It's mostly invisible, but if you try to do Object.preventExtensions on a cross-compartment wrapper to a proxy that sets the outparam to false but doesn't return false, the compartment of the throw exception differs, pre- and post-patch.

There are a few other little flourishes I want to do to the preventExtensions hooks (mostly make the ones that should flat-out throw, that I didn't think to make do it here, do so again).  I'll file a new bug with that patch.
My suspicion is that IPC code requires outparams to be initialized even for failure cases.  Retrying:

https://tbpl.mozilla.org/?tree=Try&rev=cea02b701e36
https://hg.mozilla.org/mozilla-central/rev/e1f3364485a1
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Relanded the backed-out part, with the missing |*succeeded = false;| (or true, doesn't matter as long as it's one of the two :-\ ) added to WrapperAnswer::RecvPreventExtensions:

https://hg.mozilla.org/integration/mozilla-inbound/rev/7bfc7cabc457

(The bit in comment 6 is a test that landed separately from this, that doesn't run on main tinderbox displays and so wasn't backed out when this was backed out.  ^-^ )

https://tbpl.mozilla.org/?tree=Try&rev=c179dacb0844 is a try run that was green wrt the one failure mentioned as responsible for the backout.  The dt oranges there are from the pe-fup.diff patch there, that was *not* landed at this time.  (Those are the "few other little flourishes" from comment 3, destined for another bug.)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
https://hg.mozilla.org/mozilla-central/rev/7bfc7cabc457
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: