Closed Bug 1198352 Opened 9 years ago Closed 9 years ago

WeakSet methods are missing CallNonGenericMethod

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox43 --- affected
firefox44 --- fixed

People

(Reporter: anba, Assigned: evilpie)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Test case:
---
newGlobal().WeakSet.prototype.add.call(new WeakSet, {});
---


Expected: No error 
Actual: "TypeError: WeakSet.prototype.add called on incompatible object"
Blocks: es6
Assignee: nobody → evilpies
Attachment #8676409 - Flags: review?(jwalden+bmo)
Attachment #8676409 - Flags: review?(jwalden+bmo) → review?(till)
Comment on attachment 8676409 [details] [diff] [review]
Handle cross-compartment WeakSets

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

Stealing back because I can't type well and so should do less-typy things.

::: js/src/builtin/WeakSet.js
@@ +6,5 @@
>  function WeakSet_add(value) {
>      // Steps 1-3.
>      var S = this;
>      if (!IsObject(S) || !IsWeakSet(S))
> +        return callFunction(CallWeakSetMethodIfWrapped, this, value, "WeakSet_add");

If memory serves and the last string goes into user-visible error messages, make this "WeakSet.prototype.add", and so on for the others.  The "_" name is internal, shouldn't be mentioned.
Attachment #8676409 - Flags: review?(till) → review+
Comment on attachment 8676409 [details] [diff] [review]
Handle cross-compartment WeakSets

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

I am not going to complain about a quick review :)

::: js/src/builtin/WeakSet.js
@@ +6,5 @@
>  function WeakSet_add(value) {
>      // Steps 1-3.
>      var S = this;
>      if (!IsObject(S) || !IsWeakSet(S))
> +        return callFunction(CallWeakSetMethodIfWrapped, this, value, "WeakSet_add");

This is actually how CallWeakSetMethodIfWrapped knows what to invoke.
https://hg.mozilla.org/mozilla-central/rev/dc1467aff5e4
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: