mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 02:09:28 +00:00
Bug 1417962 - Don't unbox proxies when reporting strict assignment error. r=jandem
This commit is contained in:
parent
d6ec9137a6
commit
77e0a65f28
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
load(libdir + 'asserts.js');
|
||||
|
||||
let hook = {}
|
||||
let Base = function() {}
|
||||
Base.prototype = new Proxy(Base.prototype, hook);
|
||||
class Derived extends Base {
|
||||
testPrimitiveReceiver() {
|
||||
super.foo = "Derived";
|
||||
}
|
||||
}
|
||||
assertTypeErrorMessage(() => Derived.prototype.testPrimitiveReceiver.call(null),
|
||||
`can't assign to property "foo" on ({}): not an object`)
|
@ -182,9 +182,11 @@ JS::ObjectOpResult::reportStrictErrorOrWarning(JSContext* cx, HandleObject obj,
|
||||
|
||||
if (code_ == JSMSG_SET_NON_OBJECT_RECEIVER) {
|
||||
// We know that the original receiver was a primitive, so unbox it.
|
||||
RootedValue val(cx);
|
||||
if (!Unbox(cx, obj, &val))
|
||||
return false;
|
||||
RootedValue val(cx, ObjectValue(*obj));
|
||||
if (!obj->is<ProxyObject>()) {
|
||||
if (!Unbox(cx, obj, &val))
|
||||
return false;
|
||||
}
|
||||
return ReportValueErrorFlags(cx, flags, code_, JSDVG_IGNORE_STACK, val,
|
||||
nullptr, propName.ptr(), nullptr);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user