import change from rmottola/Arctic-Fox:

- further pointer style tweak for patching (90943bf7a)
- Bug 1137910 part 1. Don't lose track of the original 'this' object in THIS_SAVEDFRAME, so we can actually do things based on the principal of the object we're working with. (0c6bf89dc)
- Bug 1137910 part 2. Give chrome callers that are indirectly (e.g. via nsIStackFrame) poking at content-captured stacks the content view of the stack. (9b9d8981d)
- more pointer style to pach easier (210ef0c78)
- even more pointer style (8dad567c6)
- Bug 1130576 - Rename JSPropertyOp -> JSGetterOp and JSStrictPropertyOp -> JSSetterOp. (0714aa290)
- Bug 1083359 - Part 1 - Add the asyncCause and asyncParent properties to the native SavedFrame object. (1c99ec1bc)
- more pointerstyle (21148a28d)
- Bug 1135827 - Don't root more times than necessary in js::SavedStacks::insertFrames. (904461ae0)
- comment fix (9401372c6)
- Bug 1083359 - Part 2 - Allow C++ code to provide an async stack when calling a JS function. (e5ce833fa)
- Bug 1133081, part 1 - Switch from js::PropDesc to JSPropertyDescriptor for all users of js::StandardDefineProperty (mainly Object.defineProperty/Properties and the corresponding Debugger.Object methods). (4754703df)
- pointer style (58e1befc2)
- Bug 1133094 - Object.defineProperty() on scripted proxy incorrectly sets {[[Configurable]]: true} if it's missing. (c4da7e6c6)
- Bug 1133081, part 2 - Switch from js::PropDesc to JSPropertyDescriptor for js::StandardDefineProperty implementation. (07efac725)
- Bug 1133081, part 3 - Switch from js::PropDesc to JSPropertyDescriptor for more odds and ends. (119b5711e)
- more pointer style (b2c2a8383)
- Bug 1133294 - Object.getOwnPropertyDescriptor(obj, key) must always return either undefined or a complete property descriptor, even if obj is a proxy. (39bc723a7)
- Bug 1133081, part 4 - Reimplement the remaining PropDesc methods and delete PropDesc. (3b447fb7b)
- Bug 1130537 - Reimplement js::SetPropertyIgnoringNamedGetter to follow ES6 draft rev 32 9.1.9 [[Set]]. (7a681465a)
This commit is contained in:
2019-03-31 19:41:12 +08:00
parent d86d78c8b6
commit e1ef2cd0b3
66 changed files with 1760 additions and 1371 deletions
+51 -10
View File
@@ -176,9 +176,9 @@ ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext* cx, HandleObject
RootedValue fval(cx), value(cx);
return GetFundamentalTrap(cx, handler, cx->names().getPropertyDescriptor, &fval) &&
Trap1(cx, handler, fval, id, &value) &&
((value.get().isUndefined() && IndicatePropertyNotFound(desc)) ||
((value.isUndefined() && IndicatePropertyNotFound(desc)) ||
(ReturnedValueMustNotBePrimitive(cx, proxy, cx->names().getPropertyDescriptor, value) &&
ParsePropertyDescriptorObject(cx, proxy, value, desc)));
ObjectToCompletePropertyDescriptor(cx, proxy, value, desc)));
}
bool
@@ -189,27 +189,27 @@ ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObje
RootedValue fval(cx), value(cx);
return GetFundamentalTrap(cx, handler, cx->names().getOwnPropertyDescriptor, &fval) &&
Trap1(cx, handler, fval, id, &value) &&
((value.get().isUndefined() && IndicatePropertyNotFound(desc)) ||
((value.isUndefined() && IndicatePropertyNotFound(desc)) ||
(ReturnedValueMustNotBePrimitive(cx, proxy, cx->names().getPropertyDescriptor, value) &&
ParsePropertyDescriptorObject(cx, proxy, value, desc)));
ObjectToCompletePropertyDescriptor(cx, proxy, value, desc)));
}
bool
ScriptedIndirectProxyHandler::defineProperty(JSContext* cx, HandleObject proxy, HandleId id,
ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
ObjectOpResult &result) const
{
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
RootedValue fval(cx), value(cx);
return GetFundamentalTrap(cx, handler, cx->names().defineProperty, &fval) &&
NewPropertyDescriptorObject(cx, desc, &value) &&
FromPropertyDescriptor(cx, desc, &value) &&
Trap2(cx, handler, fval, id, value, &value) &&
result.succeed();
}
bool
ScriptedIndirectProxyHandler::ownPropertyKeys(JSContext* cx, HandleObject proxy,
AutoIdVector& props) const
ScriptedIndirectProxyHandler::ownPropertyKeys(JSContext *cx, HandleObject proxy,
AutoIdVector &props) const
{
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
RootedValue fval(cx), value(cx);
@@ -332,6 +332,12 @@ ScriptedIndirectProxyHandler::derivedSet(JSContext* cx, HandleObject proxy, Hand
// Find an own or inherited property. The code here is strange for maximum
// backward compatibility with earlier code written before ES6 and before
// SetPropertyIgnoringNamedGetter.
//
// As of March 2015, testing/specialpowers/content/specialpowersAPI.js
// depends on the call to getPropertyDescriptor below, because it does
// support inherited setters but makes no attempt to provide a meaningful
// prototype chain.
Rooted<PropertyDescriptor> desc(cx);
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc))
return false;
@@ -341,8 +347,43 @@ ScriptedIndirectProxyHandler::derivedSet(JSContext* cx, HandleObject proxy, Hand
return false;
}
return SetPropertyIgnoringNamedGetter(cx, this, proxy, receiver, id, &desc, descIsOwn, vp,
result);
MOZ_ASSERT_IF(descIsOwn, desc.object());
if (desc.object()) {
MOZ_ASSERT(desc.getter() != JS_PropertyStub);
MOZ_ASSERT(desc.setter() != JS_StrictPropertyStub);
// Check for read-only properties.
if (desc.isReadonly())
return result.fail(descIsOwn ? JSMSG_READ_ONLY : JSMSG_CANT_REDEFINE_PROP);
if (desc.hasSetterObject() || desc.setter()) {
if (!CallSetter(cx, receiver, id, desc.setter(), desc.attributes(), vp, result))
return false;
if (!result)
return true;
if (!proxy->is<ProxyObject>() ||
proxy->as<ProxyObject>().handler() != this ||
desc.isShared())
{
return result.succeed();
}
}
desc.value().set(vp.get());
if (descIsOwn) {
MOZ_ASSERT(desc.object() == proxy);
return this->defineProperty(cx, proxy, id, &desc, result);
}
return DefineProperty(cx, receiver, id, desc.value(), desc.getter(), desc.setter(),
desc.attributes(), result);
}
desc.object().set(receiver);
desc.value().set(vp.get());
desc.setAttributes(JSPROP_ENUMERATE);
desc.setGetter(nullptr);
desc.setSetter(nullptr); // Pick up the class getter/setter.
return DefineProperty(cx, receiver, id, desc.value(), nullptr, nullptr, JSPROP_ENUMERATE,
result);
}
bool