Closed Bug 1270746 Opened 9 years ago Closed 3 years ago

Remove hasInstance class hooks.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: mrrrgn, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

      No description provided.
Depends on: 1054906
evilpie asked about the DOM.  As I understand it, we'd just need to replace the current hasInstance class hooks on the DOM classes with JSNatives implementing the same logic that are defined as a property on the relevant constructor objects, right?
Depends on: 1278583
Depends on: 1448218
Assignee: nobody → jdemooij
Blocks: 1759867
Status: NEW → ASSIGNED

We can instead rely on the default behavior for instanceof in JS::OrdinaryHasInstance.

This works because these objects are callable (since the JSClass has a call-hook) and
they have a .prototype property that returns the value in the proto slot.

Resolve a Symbol.hasInstance native function that works like the class hook.

Depends on D141343

This can be changed more later on, but for now this ensures no change in behavior.

Depends on D141344

Code should use Symbol.hasInstance to customize instanceof behavior.

Depends on D141345

Blocks: 1448400
No longer depends on: 1448218
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/910c5efb495b
part 1 - Remove hasInstance hook from CType objects. r=iain
https://hg.mozilla.org/integration/autoland/rev/261afd35a438
part 2 - Add AutoSetResolvingWrapper helper RAII class. r=mccr8
https://hg.mozilla.org/integration/autoland/rev/18c2025ccfab
part 3 - Replace hasInstance JSClass hook on wrapped natives with a Symbol.hasInstance native. r=peterv
https://hg.mozilla.org/integration/autoland/rev/31122b75a592
part 4 - Inline Proxy::hasInstance call instead of using a class hook. r=iain
https://hg.mozilla.org/integration/autoland/rev/cb11b00621a2
part 5 - Remove hasInstance class hook. r=iain
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: