Fix fallback prototype behavior in remaining cases
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
People
(Reporter: jorendorff, Unassigned)
References
(Blocks 1 open bug)
Details
Reporter | ||
Comment 1•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 2•6 years ago
|
||
(Following up on conversation in bug 1317416)
We have this code in js::GetPrototypeFromConstructor
:
} else if (intrinsicDefaultProto == JSProto_Null) {
// Bug 1317416. The caller did not pass a reasonable JSProtoKey, so let the
// caller select a prototype object. Most likely they will choose one from
// the wrong realm.
proto.set(nullptr);
} else {
// Step 4.a: Let realm be ? GetFunctionRealm(constructor);
JSObject* unwrappedConstructor = CheckedUnwrap(newTarget);
if (!unwrappedConstructor) {
ReportAccessDenied(cx);
return false;
}
...
}
Both of these cases have bugs.
In the first, the bug is that the caller didn't pass in a good JSProtoKey
, and that's because we currently don't have a JSProtoKey
enumerator for every prototype we want to get using this function.
In the else
branch, the bug is that we don't do a full implementation of GetFunctionRealm. I can't remember why not. Maybe for some reason I was thinking newTarget had to be an actual Function (or CCW to one), but it can be any object that passes IsConstructor.
Reporter | ||
Comment 3•5 years ago
|
||
(In reply to Jason Orendorff [:jorendorff] from comment #0)
but not for
- %AsyncFunction%
- %AsyncGeneratorFunction%
- the various Intl constructors, like Intl.PluralRules
The test262 import I'm doing right now adds tests (which we also fail) for these three cases.
Comment 4•5 years ago
|
||
bug 1288457 should have fixed these cases. Perhaps this was tested with an old build?
Reporter | ||
Comment 5•5 years ago
|
||
Yep, this is fixed. Two tests still fail for an unrelated reason (bug 1591099).
Description
•