Title: [212452] trunk/Source/_javascript_Core
Revision
212452
Author
[email protected]
Date
2017-02-16 11:43:42 -0800 (Thu, 16 Feb 2017)

Log Message

JSONParseTest needs to hold the lock when the VM is destroyed
https://bugs.webkit.org/show_bug.cgi?id=168450

Rubber stamped by Alex Christensen.

* API/tests/JSONParseTest.cpp:
(testJSONParse):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/tests/JSONParseTest.cpp (212451 => 212452)


--- trunk/Source/_javascript_Core/API/tests/JSONParseTest.cpp	2017-02-16 19:40:43 UTC (rev 212451)
+++ trunk/Source/_javascript_Core/API/tests/JSONParseTest.cpp	2017-02-16 19:43:42 UTC (rev 212452)
@@ -38,28 +38,28 @@
 {
     bool failed = false;
 
-    {
-        Ref<VM> vm = VM::create();
+    RefPtr<VM> vm = VM::create();
+    
+    JSLockHolder locker(vm.get());
+    JSGlobalObject* globalObject = JSGlobalObject::create(*vm, JSGlobalObject::createStructure(*vm, jsNull()));
+    
+    ExecState* exec = globalObject->globalExec();
+    JSValue v0 = JSONParse(exec, "");
+    JSValue v1 = JSONParse(exec, "#$%^");
+    JSValue v2 = JSONParse(exec, String());
+    UChar emptyUCharArray[1] = { '\0' };
+    JSValue v3 = JSONParse(exec, String(emptyUCharArray, 0));
+    JSValue v4;
+    JSValue v5 = JSONParse(exec, "123");
+    
+    failed = failed || (v0 != v1);
+    failed = failed || (v1 != v2);
+    failed = failed || (v2 != v3);
+    failed = failed || (v3 != v4);
+    failed = failed || (v4 == v5);
 
-        JSLockHolder locker(vm.ptr());
-        JSGlobalObject* globalObject = JSGlobalObject::create(vm.get(), JSGlobalObject::createStructure(vm.get(), jsNull()));
+    vm = nullptr;
 
-        ExecState* exec = globalObject->globalExec();
-        JSValue v0 = JSONParse(exec, "");
-        JSValue v1 = JSONParse(exec, "#$%^");
-        JSValue v2 = JSONParse(exec, String());
-        UChar emptyUCharArray[1] = { '\0' };
-        JSValue v3 = JSONParse(exec, String(emptyUCharArray, 0));
-        JSValue v4;
-        JSValue v5 = JSONParse(exec, "123");
-
-        failed = failed || (v0 != v1);
-        failed = failed || (v1 != v2);
-        failed = failed || (v2 != v3);
-        failed = failed || (v3 != v4);
-        failed = failed || (v4 == v5);
-    }
-
     if (failed)
         printf("FAIL: JSONParse String test.\n");
     else

Modified: trunk/Source/_javascript_Core/ChangeLog (212451 => 212452)


--- trunk/Source/_javascript_Core/ChangeLog	2017-02-16 19:40:43 UTC (rev 212451)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-02-16 19:43:42 UTC (rev 212452)
@@ -1,3 +1,13 @@
+2017-02-16  Filip Pizlo  <[email protected]>
+
+        JSONParseTest needs to hold the lock when the VM is destroyed
+        https://bugs.webkit.org/show_bug.cgi?id=168450
+
+        Rubber stamped by Alex Christensen.
+
+        * API/tests/JSONParseTest.cpp:
+        (testJSONParse):
+
 2017-02-16  Yusuke Suzuki  <[email protected]>
 
         [JSC] Drop PassRefPtr in inspector/
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to