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
+25 -29
View File
@@ -8,8 +8,6 @@
#include "jsapi.h"
#include "vm/PropDesc.h"
#include "jsobjinlines.h"
using namespace js;
@@ -31,8 +29,8 @@ IsAccessorDescriptor(const PropertyDescriptor& desc)
// Since we are actually performing 9.1.6.2 IsCompatiblePropertyDescriptor(Extensible, Desc,
// Current), some parameters are omitted.
static bool
ValidatePropertyDescriptor(JSContext* cx, bool extensible, Handle<PropDesc> desc,
Handle<PropertyDescriptor> current, bool* bp)
ValidatePropertyDescriptor(JSContext *cx, bool extensible, Handle<PropertyDescriptor> desc,
Handle<PropertyDescriptor> current, bool *bp)
{
// step 2
if (!current.object()) {
@@ -42,7 +40,8 @@ ValidatePropertyDescriptor(JSContext* cx, bool extensible, Handle<PropDesc> desc
}
// step 3
if (!desc.hasValue() && !desc.hasWritable() && !desc.hasGet() && !desc.hasSet() &&
if (!desc.hasValue() && !desc.hasWritable() &&
!desc.hasGetterObject() && !desc.hasSetterObject() &&
!desc.hasEnumerable() && !desc.hasConfigurable())
{
*bp = true;
@@ -51,10 +50,10 @@ ValidatePropertyDescriptor(JSContext* cx, bool extensible, Handle<PropDesc> desc
// step 4
if ((!desc.hasWritable() || desc.writable() == !current.isReadonly()) &&
(!desc.hasGet() || desc.getter() == current.getter()) &&
(!desc.hasSet() || desc.setter() == current.setter()) &&
(!desc.hasEnumerable() || desc.enumerable() == current.isEnumerable()) &&
(!desc.hasConfigurable() || desc.configurable() == !current.isPermanent()))
(!desc.hasGetterObject() || desc.getter() == current.getter()) &&
(!desc.hasSetterObject() || desc.setter() == current.setter()) &&
(!desc.hasEnumerable() || desc.enumerable() == current.enumerable()) &&
(!desc.hasConfigurable() || desc.configurable() == current.configurable()))
{
if (!desc.hasValue()) {
*bp = true;
@@ -70,15 +69,13 @@ ValidatePropertyDescriptor(JSContext* cx, bool extensible, Handle<PropDesc> desc
}
// step 5
if (current.isPermanent()) {
if (!current.configurable()) {
if (desc.hasConfigurable() && desc.configurable()) {
*bp = false;
return true;
}
if (desc.hasEnumerable() &&
desc.enumerable() != current.isEnumerable())
{
if (desc.hasEnumerable() && desc.enumerable() != current.enumerable()) {
*bp = false;
return true;
}
@@ -91,15 +88,15 @@ ValidatePropertyDescriptor(JSContext* cx, bool extensible, Handle<PropDesc> desc
}
// step 7a
if (IsDataDescriptor(current) != desc.isDataDescriptor()) {
*bp = !current.isPermanent();
if (current.isDataDescriptor() != desc.isDataDescriptor()) {
*bp = current.configurable();
return true;
}
// step 8
if (IsDataDescriptor(current)) {
if (current.isDataDescriptor()) {
MOZ_ASSERT(desc.isDataDescriptor()); // by step 7a
if (current.isPermanent() && current.isReadonly()) {
if (!current.configurable() && !current.writable()) {
if (desc.hasWritable() && desc.writable()) {
*bp = false;
return true;
@@ -121,11 +118,11 @@ ValidatePropertyDescriptor(JSContext* cx, bool extensible, Handle<PropDesc> desc
}
// step 9
MOZ_ASSERT(IsAccessorDescriptor(current)); // by step 8
MOZ_ASSERT(current.isAccessorDescriptor()); // by step 8
MOZ_ASSERT(desc.isAccessorDescriptor()); // by step 7a
*bp = (!current.isPermanent() ||
((!desc.hasSet() || desc.setter() == current.setter()) &&
(!desc.hasGet() || desc.getter() == current.getter())));
*bp = (current.configurable() ||
((!desc.hasSetterObject() || desc.setter() == current.setter()) &&
(!desc.hasGetterObject() || desc.getter() == current.getter())));
return true;
}
@@ -512,12 +509,12 @@ ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject
return false;
// step 16-17
Rooted<PropDesc> resultDesc(cx);
if (!resultDesc.initialize(cx, trapResult))
Rooted<PropertyDescriptor> resultDesc(cx);
if (!ToPropertyDescriptor(cx, trapResult, true, &resultDesc))
return false;
// step 18
resultDesc.complete();
CompletePropertyDescriptor(&resultDesc);
// step 19
bool valid;
@@ -544,7 +541,8 @@ ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject
}
// step 22
resultDesc.populatePropertyDescriptor(proxy, desc);
desc.set(resultDesc);
desc.object().set(proxy);
return true;
}
@@ -575,7 +573,7 @@ ScriptedDirectProxyHandler::defineProperty(JSContext* cx, HandleObject proxy, Ha
// step 9
RootedValue descObj(cx);
if (!NewPropertyDescriptorObject(cx, desc, &descObj))
if (!FromPropertyDescriptor(cx, desc, &descObj))
return false;
// steps 10-11
@@ -624,9 +622,7 @@ ScriptedDirectProxyHandler::defineProperty(JSContext* cx, HandleObject proxy, Ha
} else {
// step 20
bool valid;
Rooted<PropDesc> pd(cx);
pd.initFromPropertyDescriptor(desc);
if (!ValidatePropertyDescriptor(cx, extensibleTarget, pd, targetDesc, &valid))
if (!ValidatePropertyDescriptor(cx, extensibleTarget, desc, targetDesc, &valid))
return false;
if (!valid || (settingConfigFalse && !targetDesc.isPermanent())) {
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_DEFINE_INVALID);