Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
deps: update ChakraCore to chakra-core/ChakraCore@aec9a9c70a
Browse files Browse the repository at this point in the history
[1.8>1.9] [MERGE #4651 @dilijev] OS#14101048: Fixes #249: built-in functions should not have caller/arguments (and related fixes)

Merge pull request #4651 from dilijev:func-restricted-props

Replaces #4639

Several tests and test baselines needed to be updated to reflect the change in behavior. This change improves caller/arguments behavior without regressing any previous Chakra behavior. Chakra still differs from the spec and other engines on some aspects of caller/arguments.

See: https://tc39.github.io/ecma262/#sec-forbidden-extensions

Fixes #249
Fixes OS#14101048

---

Test262 results strictly improved.

Using test262 commit tc39/test262@03da228:

Previously 44130 passed, now 44138 passed out of 57102. (Duplicates below are strict and non-strict versions of the tests.)

```
+PASS e:/dd/test262/test262/test/built-ins/Function/prototype/restricted-property-arguments.js
+PASS e:/dd/test262/test262/test/built-ins/Function/prototype/restricted-property-arguments.js
+PASS e:/dd/test262/test262/test/built-ins/Function/prototype/restricted-property-caller.js
+PASS e:/dd/test262/test262/test/built-ins/Function/prototype/restricted-property-caller.js
+PASS e:/dd/test262/test262/test/built-ins/ThrowTypeError/forbidden-arguments.js
+PASS e:/dd/test262/test262/test/built-ins/ThrowTypeError/forbidden-arguments.js
+PASS e:/dd/test262/test262/test/built-ins/ThrowTypeError/forbidden-caller.js
+PASS e:/dd/test262/test262/test/built-ins/ThrowTypeError/forbidden-caller.js
```

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
dilijev authored and chakrabot committed Feb 9, 2018
1 parent 6d92a2a commit c7429c7
Show file tree
Hide file tree
Showing 24 changed files with 521 additions and 871 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2467,8 +2467,10 @@ void __cdecl _alloca_probe_16()
this->functionInfo->IsLambda() ||
this->functionInfo->IsAsync() ||
this->IsGeneratorFunction() ||
this->IsBoundFunction() ||
this->IsStrictMode()
this->IsStrictMode() ||
!this->IsScriptFunction() || // -> (BoundFunction || RuntimeFunction) // (RuntimeFunction = Native-defined built-in library functions)
this->IsLibraryCode() || // JS-defined built-in library functions
this == this->GetLibrary()->GetFunctionPrototype() // the intrinsic %FunctionPrototype% (original value of Function.prototype)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2811,6 +2811,11 @@ namespace Js
functionPrototype->SetConfigurable(PropertyIds::_symbolHasInstance, false);
}

functionPrototype->DynamicObject::SetAccessors(PropertyIds::caller, library->throwTypeErrorRestrictedPropertyAccessorFunction, library->throwTypeErrorRestrictedPropertyAccessorFunction);
functionPrototype->SetEnumerable(PropertyIds::caller, false);
functionPrototype->DynamicObject::SetAccessors(PropertyIds::arguments, library->throwTypeErrorRestrictedPropertyAccessorFunction, library->throwTypeErrorRestrictedPropertyAccessorFunction);
functionPrototype->SetEnumerable(PropertyIds::arguments, false);

DebugOnly(CheckRegisteredBuiltIns(builtinFuncs, scriptContext));

functionPrototype->SetHasNoEnumerableProperties(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ namespace Js
scriptFunction->GetFunctionBody()->SetJsBuiltInForceInline();
}
scriptFunction->SetPropertyWithAttributes(PropertyIds::length, TaggedInt::ToVarUnchecked(argumentsCount), PropertyConfigurable, nullptr);
scriptFunction->SetPropertyWithAttributes(PropertyIds::caller, library->nullValue, PropertyNone, nullptr);
scriptFunction->SetPropertyWithAttributes(PropertyIds::arguments, library->nullValue, PropertyNone, nullptr);

scriptFunction->SetConfigurable(PropertyIds::prototype, true);
scriptFunction->DeleteProperty(PropertyIds::prototype, Js::PropertyOperationFlags::PropertyOperation_None);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{
"this": {
"Run": "function <large string>",
"x": "undefined undefined"
"x": "undefined undefined",
"Run": "function <large string>"
},
"arguments": {
"#__proto__": "Object {...}",
Expand All @@ -22,8 +22,8 @@
}
},
"globals": {
"Run": "function <large string>",
"x": "undefined undefined"
"x": "undefined undefined",
"Run": "function <large string>"
}
},
{
Expand Down Expand Up @@ -55,80 +55,58 @@
"is": "function <large string>",
"assign": "function <large string>",
"values": "function <large string>",
"entries": "function <large string>",
"caller": "object null",
"arguments": "object null"
"entries": "function <large string>"
},
"hasOwnProperty": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string hasOwnProperty",
"caller": "object null",
"arguments": "object null"
"name": "string hasOwnProperty"
},
"propertyIsEnumerable": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string <large string>",
"caller": "object null",
"arguments": "object null"
"name": "string <large string>"
},
"isPrototypeOf": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string isPrototypeOf",
"caller": "object null",
"arguments": "object null"
"name": "string isPrototypeOf"
},
"toLocaleString": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string toLocaleString",
"caller": "object null",
"arguments": "object null"
"name": "string toLocaleString"
},
"toString": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string toString",
"caller": "object null",
"arguments": "object null"
"name": "string toString"
},
"valueOf": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string valueOf",
"caller": "object null",
"arguments": "object null"
"name": "string valueOf"
},
"#__proto__": "object null",
"__defineGetter__": {
"#__proto__": "function <large string>",
"length": "number 2",
"name": "string __defineGetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __defineGetter__"
},
"__defineSetter__": {
"#__proto__": "function <large string>",
"length": "number 2",
"name": "string __defineSetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __defineSetter__"
},
"__lookupGetter__": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string __lookupGetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __lookupGetter__"
},
"__lookupSetter__": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string __lookupSetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __lookupSetter__"
}
},
"constructor": {
Expand Down Expand Up @@ -225,80 +203,58 @@
"is": "function <large string>",
"assign": "function <large string>",
"values": "function <large string>",
"entries": "function <large string>",
"caller": "object null",
"arguments": "object null"
"entries": "function <large string>"
},
"hasOwnProperty": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string hasOwnProperty",
"caller": "object null",
"arguments": "object null"
"name": "string hasOwnProperty"
},
"propertyIsEnumerable": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string <large string>",
"caller": "object null",
"arguments": "object null"
"name": "string <large string>"
},
"isPrototypeOf": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string isPrototypeOf",
"caller": "object null",
"arguments": "object null"
"name": "string isPrototypeOf"
},
"toLocaleString": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string toLocaleString",
"caller": "object null",
"arguments": "object null"
"name": "string toLocaleString"
},
"toString": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string toString",
"caller": "object null",
"arguments": "object null"
"name": "string toString"
},
"valueOf": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string valueOf",
"caller": "object null",
"arguments": "object null"
"name": "string valueOf"
},
"#__proto__": "object null",
"__defineGetter__": {
"#__proto__": "function <large string>",
"length": "number 2",
"name": "string __defineGetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __defineGetter__"
},
"__defineSetter__": {
"#__proto__": "function <large string>",
"length": "number 2",
"name": "string __defineSetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __defineSetter__"
},
"__lookupGetter__": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string __lookupGetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __lookupGetter__"
},
"__lookupSetter__": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string __lookupSetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __lookupSetter__"
}
},
"constructor": {
Expand Down Expand Up @@ -395,80 +351,58 @@
"is": "function <large string>",
"assign": "function <large string>",
"values": "function <large string>",
"entries": "function <large string>",
"caller": "object null",
"arguments": "object null"
"entries": "function <large string>"
},
"hasOwnProperty": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string hasOwnProperty",
"caller": "object null",
"arguments": "object null"
"name": "string hasOwnProperty"
},
"propertyIsEnumerable": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string <large string>",
"caller": "object null",
"arguments": "object null"
"name": "string <large string>"
},
"isPrototypeOf": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string isPrototypeOf",
"caller": "object null",
"arguments": "object null"
"name": "string isPrototypeOf"
},
"toLocaleString": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string toLocaleString",
"caller": "object null",
"arguments": "object null"
"name": "string toLocaleString"
},
"toString": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string toString",
"caller": "object null",
"arguments": "object null"
"name": "string toString"
},
"valueOf": {
"#__proto__": "function <large string>",
"length": "number 0",
"name": "string valueOf",
"caller": "object null",
"arguments": "object null"
"name": "string valueOf"
},
"#__proto__": "object null",
"__defineGetter__": {
"#__proto__": "function <large string>",
"length": "number 2",
"name": "string __defineGetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __defineGetter__"
},
"__defineSetter__": {
"#__proto__": "function <large string>",
"length": "number 2",
"name": "string __defineSetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __defineSetter__"
},
"__lookupGetter__": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string __lookupGetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __lookupGetter__"
},
"__lookupSetter__": {
"#__proto__": "function <large string>",
"length": "number 1",
"name": "string __lookupSetter__",
"caller": "object null",
"arguments": "object null"
"name": "string __lookupSetter__"
}
},
"constructor": {
Expand Down
Loading

0 comments on commit c7429c7

Please sign in to comment.