Closed
Bug 1468524
Opened 6 years ago
Closed 6 years ago
Instances of TypedObject types are not 'instanceof' their constructors
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla63
People
(Reporter: lth, Assigned: lth)
References
Details
Attachments
(1 file)
6.61 KB,
patch
|
till
:
review+
|
Details | Diff | Splinter Review |
This yields false but should not: var Box = new TypedObject.StructType({x:TypedObject.int32}) var box = new Box({x:37}) box instanceof Box Till speculated that this might be a regression brought on by a rewrite around some hasInstance functionality. I'm marking this as blocking the Wasm GC MVP because we probably want TypedObjects to behave sanely for that, but it's not critical for anything at this point.
Assignee | ||
Comment 1•6 years ago
|
||
We end up in fun_symbolHasInstance() which subsequently fails because OrdinaryHasInstance() finds that the this object is not callable, ie, Box() is not. So either it should be, or it should be flagged as some kind of primitive so that the guard earlier in fun_symbolHasInstance will handle it, though the latter case seems wrong (the result would be false). Normally constructors are callable of course.
Assignee | ||
Comment 2•6 years ago
|
||
It really is not callable: js> var Box = new TypedObject.StructType({x:TypedObject.int32}) js> Box(1) typein:4:1 TypeError: Box is not a function Stack: @typein:4:1
Assignee | ||
Comment 3•6 years ago
|
||
A simple fix that only fixes instanceof for TypedObject struct types. If this meets with approval I will also investigate the situation for arrays, which I suspect are similarly borked.
Updated•6 years ago
|
status-firefox63:
--- → affected
Priority: -- → P1
Assignee | ||
Comment 5•6 years ago
|
||
Also, without this fix, if we create an instance s of a StructType and then try to print s.constructor, we get an error: TypeError: Function.prototype.toString called on incompatible object
Comment 6•6 years ago
|
||
Comment on attachment 8988488 [details] [diff] [review] bug1468524-typedobj-struct-instanceof.patch Review of attachment 8988488 [details] [diff] [review]: ----------------------------------------------------------------- Sorry for inexplicably dragging my feet on this very obvious fix :(
Attachment #8988488 -
Flags: review?(till) → review+
Updated•6 years ago
|
Flags: needinfo?(till)
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/3858eb122b9f Fix instanceof for TypedObject 'struct' instances. r=till
Comment 8•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3858eb122b9f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Comment 9•6 years ago
|
||
:sdetar Are these SM bustages related to this bug? https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=76b09340b737a4babc322ef57de548ed1dee1407&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-classifiedState=unclassified&selectedJob=192048178
Flags: needinfo?(sdetar)
Comment 10•6 years ago
|
||
Lars, would you be able to answer Noemi's question?
Flags: needinfo?(sdetar) → needinfo?(lhansen)
Assignee | ||
Comment 11•6 years ago
|
||
Intermittents would be a strange outcome from that change, but I'll give it some attention, probably tomorrow.
Assignee | ||
Comment 12•6 years ago
|
||
Steven/Noemi, more likely the culprit is bug 1480963, which has a patch now.
Flags: needinfo?(lhansen)
Updated•6 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•