Modified: trunk/JSTests/ChangeLog (273633 => 273634)
--- trunk/JSTests/ChangeLog 2021-02-27 23:07:44 UTC (rev 273633)
+++ trunk/JSTests/ChangeLog 2021-02-28 10:15:48 UTC (rev 273634)
@@ -1,3 +1,12 @@
+2021-02-28 Yusuke Suzuki <[email protected]>
+
+ [JSC] Update test262 host environments
+ https://bugs.webkit.org/show_bug.cgi?id=222525
+
+ Reviewed by Ross Kirsling.
+
+ * test262/expectations.yaml:
+
2021-02-26 Michael Saboff <[email protected]>
Followup test fix to r273594
Modified: trunk/JSTests/test262/expectations.yaml (273633 => 273634)
--- trunk/JSTests/test262/expectations.yaml 2021-02-27 23:07:44 UTC (rev 273633)
+++ trunk/JSTests/test262/expectations.yaml 2021-02-28 10:15:48 UTC (rev 273634)
@@ -606,9 +606,6 @@
test/built-ins/Date/UTC/fp-evaluation-order.js:
default: 'Test262Error: order of operations / precision in MakeTime Expected SameValue(«NaN», «29312») to be true'
strict mode: 'Test262Error: order of operations / precision in MakeTime Expected SameValue(«NaN», «29312») to be true'
-test/built-ins/Function/call-bind-this-realm-undef.js:
- default: 'Test262Error: implicit undefined Expected SameValue(«[object global]», «[object Undefined]») to be true'
- strict mode: 'Test262Error: implicit undefined Expected SameValue(«[object global]», «[object Undefined]») to be true'
test/built-ins/Function/internals/Call/class-ctor-realm.js:
default: 'Test262Error: Expected a TypeError but got a TypeError'
strict mode: 'Test262Error: Expected a TypeError but got a TypeError'
Modified: trunk/Source/_javascript_Core/ChangeLog (273633 => 273634)
--- trunk/Source/_javascript_Core/ChangeLog 2021-02-27 23:07:44 UTC (rev 273633)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-02-28 10:15:48 UTC (rev 273634)
@@ -1,3 +1,18 @@
+2021-02-28 Yusuke Suzuki <[email protected]>
+
+ [JSC] Update test262 host environments
+ https://bugs.webkit.org/show_bug.cgi?id=222525
+
+ Reviewed by Ross Kirsling.
+
+ 1. $262.global should be `globalThis` of the realm according to test/built-ins/Function/call-bind-this-realm-undef.js
+ 2. $262.evalScript should uwrap JSProxy to get GlobalObject.
+
+ This fixes test262 test/built-ins/Function/call-bind-this-realm-undef.js, it was wrongly tested and failing.
+
+ * jsc.cpp:
+ (JSC_DEFINE_HOST_FUNCTION):
+
2021-02-27 Rob Buis <[email protected]>
Null check ArrayBufferView RefPtr
Modified: trunk/Source/_javascript_Core/jsc.cpp (273633 => 273634)
--- trunk/Source/_javascript_Core/jsc.cpp 2021-02-27 23:07:44 UTC (rev 273633)
+++ trunk/Source/_javascript_Core/jsc.cpp 2021-02-28 10:15:48 UTC (rev 273634)
@@ -629,7 +629,7 @@
addFunction(vm, dollar, "detachArrayBuffer", functionTransferArrayBuffer, 1);
addFunction(vm, dollar, "evalScript", functionDollarEvalScript, 1);
- dollar->putDirect(vm, Identifier::fromString(vm, "global"), this, DontEnum);
+ dollar->putDirect(vm, Identifier::fromString(vm, "global"), globalThis(), DontEnum);
dollar->putDirectCustomAccessor(vm, Identifier::fromString(vm, "IsHTMLDDA"),
CustomGetterSetter::create(vm, accessorMakeMasquerader, nullptr),
static_cast<unsigned>(PropertyAttribute::CustomValue)
@@ -1908,11 +1908,12 @@
JSValue global = callFrame->thisValue().get(globalObject, Identifier::fromString(vm, "global"));
RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ while (global.inherits<JSProxy>(vm))
+ global = jsCast<JSProxy*>(global)->target();
GlobalObject* realm = jsDynamicCast<GlobalObject*>(vm, global);
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
if (!realm)
return JSValue::encode(throwException(globalObject, scope, createError(globalObject, "Expected global to point to a global object"_s)));
-
+
NakedPtr<Exception> evaluationException;
JSValue result = evaluate(realm, jscSource(sourceCode, callFrame->callerSourceOrigin(vm)), JSValue(), evaluationException);
if (evaluationException)