Title: [279810] trunk/Source/_javascript_Core
Revision
279810
Author
[email protected]
Date
2021-07-10 17:05:22 -0700 (Sat, 10 Jul 2021)

Log Message

[JSC] Workaround test262.report bug by making $ properties enumerable
https://bugs.webkit.org/show_bug.cgi?id=227855

Reviewed by Alexey Shvayka.

test262.report's harness has a bug and it reports incorrect results for JSC on tests using $262 properties.
This patch introduces a workaround which makes properties of $ enumerable.

* jsc.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (279809 => 279810)


--- trunk/Source/_javascript_Core/ChangeLog	2021-07-10 21:00:38 UTC (rev 279809)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-07-11 00:05:22 UTC (rev 279810)
@@ -1,3 +1,15 @@
+2021-07-10  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Workaround test262.report bug by making $ properties enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=227855
+
+        Reviewed by Alexey Shvayka.
+
+        test262.report's harness has a bug and it reports incorrect results for JSC on tests using $262 properties.
+        This patch introduces a workaround which makes properties of $ enumerable.
+
+        * jsc.cpp:
+
 2021-07-08  Yijia Huang  <[email protected]>
 
         Add Air opcode add/sub-and-shift for ARM64 and select this instruction in Air

Modified: trunk/Source/_javascript_Core/jsc.cpp (279809 => 279810)


--- trunk/Source/_javascript_Core/jsc.cpp	2021-07-10 21:00:38 UTC (rev 279809)
+++ trunk/Source/_javascript_Core/jsc.cpp	2021-07-11 00:05:22 UTC (rev 279810)
@@ -632,13 +632,13 @@
         putDirect(vm, Identifier::fromString(vm, "$"), dollar, DontEnum);
         putDirect(vm, Identifier::fromString(vm, "$262"), dollar, DontEnum);
         
-        addFunction(vm, dollar, "createRealm", functionDollarCreateRealm, 0);
-        addFunction(vm, dollar, "detachArrayBuffer", functionTransferArrayBuffer, 1);
-        addFunction(vm, dollar, "evalScript", functionDollarEvalScript, 1);
-        addFunction(vm, dollar, "gc", functionDollarGC, 0);
-        addFunction(vm, dollar, "clearKeptObjects", functionDollarClearKeptObjects, 0);
+        addFunction(vm, dollar, "createRealm", functionDollarCreateRealm, 0, static_cast<unsigned>(PropertyAttribute::None));
+        addFunction(vm, dollar, "detachArrayBuffer", functionTransferArrayBuffer, 1, static_cast<unsigned>(PropertyAttribute::None));
+        addFunction(vm, dollar, "evalScript", functionDollarEvalScript, 1, static_cast<unsigned>(PropertyAttribute::None));
+        addFunction(vm, dollar, "gc", functionDollarGC, 0, static_cast<unsigned>(PropertyAttribute::None));
+        addFunction(vm, dollar, "clearKeptObjects", functionDollarClearKeptObjects, 0, static_cast<unsigned>(PropertyAttribute::None));
         
-        dollar->putDirect(vm, Identifier::fromString(vm, "global"), globalThis(), DontEnum);
+        dollar->putDirect(vm, Identifier::fromString(vm, "global"), globalThis());
         dollar->putDirectCustomAccessor(vm, Identifier::fromString(vm, "IsHTMLDDA"),
             CustomGetterSetter::create(vm, accessorMakeMasquerader, nullptr),
             static_cast<unsigned>(PropertyAttribute::CustomValue)
@@ -645,7 +645,7 @@
         );
 
         JSObject* agent = JSFinalObject::create(vm, plainObjectStructure);
-        dollar->putDirect(vm, Identifier::fromString(vm, "agent"), agent, DontEnum);
+        dollar->putDirect(vm, Identifier::fromString(vm, "agent"), agent);
         
         // The test262 INTERPRETING.md document says that some of these functions are just in the main
         // thread and some are in the other threads. We just put them in all threads.
@@ -700,15 +700,15 @@
     }
 
 private:
-    void addFunction(VM& vm, JSObject* object, const char* name, NativeFunction function, unsigned arguments)
+    void addFunction(VM& vm, JSObject* object, const char* name, NativeFunction function, unsigned arguments, unsigned attributes = static_cast<unsigned>(PropertyAttribute::DontEnum))
     {
         Identifier identifier = Identifier::fromString(vm, name);
-        object->putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function), DontEnum);
+        object->putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function), attributes);
     }
 
-    void addFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments)
+    void addFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments, unsigned attributes = static_cast<unsigned>(PropertyAttribute::DontEnum))
     {
-        addFunction(vm, this, name, function, arguments);
+        addFunction(vm, this, name, function, arguments, attributes);
     }
     
     static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, JSModuleLoader*, JSString*, JSValue, const SourceOrigin&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to