Title: [181914] trunk/Source/_javascript_Core
Revision
181914
Author
[email protected]
Date
2015-03-24 15:56:03 -0700 (Tue, 24 Mar 2015)

Log Message

The ExecutionTimeLimit test should use its own JSGlobalContextRef.
<https://webkit.org/b/143024>

Reviewed by Geoffrey Garen.

Currently, the ExecutionTimeLimit test is using a JSGlobalContextRef
passed in from testapi.c.  It should create its own for better
encapsulation of the test.

* API/tests/ExecutionTimeLimitTest.cpp:
(currentCPUTimeAsJSFunctionCallback):
(testExecutionTimeLimit):
* API/tests/ExecutionTimeLimitTest.h:
* API/tests/testapi.c:
(main):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp (181913 => 181914)


--- trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp	2015-03-24 22:55:23 UTC (rev 181913)
+++ trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp	2015-03-24 22:56:03 UTC (rev 181914)
@@ -28,6 +28,7 @@
 
 #if OS(DARWIN)
 
+#include "JSContextRefPrivate.h"
 #include "_javascript_Core.h"
 
 #include <mach/mach.h>
@@ -35,7 +36,7 @@
 #include <stdio.h>
 #include <sys/time.h>
 
-static JSGlobalContextRef* currentContextForAssertion = nullptr;
+static JSGlobalContextRef context = nullptr;
 
 static double currentCPUTime()
 {
@@ -61,7 +62,7 @@
     UNUSED_PARAM(arguments);
     UNUSED_PARAM(exception);
     
-    ASSERT(JSContextGetGlobalContext(ctx) == *currentContextForAssertion);
+    ASSERT(JSContextGetGlobalContext(ctx) == context);
     return JSValueMakeNumber(ctx, currentCPUTime());
 }
 
@@ -97,10 +98,9 @@
 }
 
 
-int testExecutionTimeLimit(JSGlobalContextRef* globalContext)
+int testExecutionTimeLimit()
 {
-    JSGlobalContextRef& context = *globalContext;
-    currentContextForAssertion = globalContext;
+    context = JSGlobalContextCreateInGroup(nullptr, nullptr);
 
     JSContextGroupRef contextGroup = JSContextGetGroup(context);
     JSObjectRef globalObject = JSContextGetGlobalObject(context);
@@ -261,6 +261,7 @@
         }
     }
 
+    JSGlobalContextRelease(context);
     return failed;
 }
 

Modified: trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.h (181913 => 181914)


--- trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.h	2015-03-24 22:55:23 UTC (rev 181913)
+++ trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.h	2015-03-24 22:56:03 UTC (rev 181914)
@@ -26,15 +26,13 @@
 #ifndef ExecutionTimeLimitTest_h
 #define ExecutionTimeLimitTest_h
 
-#include "JSContextRefPrivate.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /* Returns 1 if failures were encountered.  Else, returns 0. */
-int testExecutionTimeLimit(JSGlobalContextRef*);
-    
+int testExecutionTimeLimit();
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif

Modified: trunk/Source/_javascript_Core/API/tests/testapi.c (181913 => 181914)


--- trunk/Source/_javascript_Core/API/tests/testapi.c	2015-03-24 22:55:23 UTC (rev 181913)
+++ trunk/Source/_javascript_Core/API/tests/testapi.c	2015-03-24 22:56:03 UTC (rev 181914)
@@ -1857,7 +1857,7 @@
     }
 
 #if OS(DARWIN)
-    failed = testExecutionTimeLimit(&context) || failed;
+    failed = testExecutionTimeLimit() || failed;
 #endif /* OS(DARWIN) */
     failed = testGlobalContextWithFinalizer() || failed;
 

Modified: trunk/Source/_javascript_Core/ChangeLog (181913 => 181914)


--- trunk/Source/_javascript_Core/ChangeLog	2015-03-24 22:55:23 UTC (rev 181913)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-03-24 22:56:03 UTC (rev 181914)
@@ -1,3 +1,21 @@
+2015-03-24  Mark Lam  <[email protected]>
+
+        The ExecutionTimeLimit test should use its own JSGlobalContextRef.
+        <https://webkit.org/b/143024>
+
+        Reviewed by Geoffrey Garen.
+
+        Currently, the ExecutionTimeLimit test is using a JSGlobalContextRef
+        passed in from testapi.c.  It should create its own for better
+        encapsulation of the test.
+
+        * API/tests/ExecutionTimeLimitTest.cpp:
+        (currentCPUTimeAsJSFunctionCallback):
+        (testExecutionTimeLimit):
+        * API/tests/ExecutionTimeLimitTest.h:
+        * API/tests/testapi.c:
+        (main):
+
 2015-03-24  Joseph Pecoraro  <[email protected]>
 
         ES6: Object Literal Methods toString is missing method name
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to