Closed Bug 1270746 Opened 8 years ago Closed 2 years ago

Remove hasInstance class hooks.


(Core :: JavaScript Engine, defect)

Not set



100 Branch
Tracking Status
firefox100 --- fixed


(Reporter: mrrrgn, Assigned: jandem)


(Blocks 1 open bug)



(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

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
part 1 - Remove hasInstance hook from CType objects. r=iain
part 2 - Add AutoSetResolvingWrapper helper RAII class. r=mccr8
part 3 - Replace hasInstance JSClass hook on wrapped natives with a Symbol.hasInstance native. r=peterv
part 4 - Inline Proxy::hasInstance call instead of using a class hook. r=iain
part 5 - Remove hasInstance class hook. r=iain
You need to log in before you can comment on or make changes to this bug.