Title: [127976] trunk/Source/WebCore
Revision
127976
Author
[email protected]
Date
2012-09-08 23:48:14 -0700 (Sat, 08 Sep 2012)

Log Message

[V8] unsafeHandleToCurrentWorldContext doesn't need to exist
https://bugs.webkit.org/show_bug.cgi?id=96191

Reviewed by Kentaro Hara.

Previously, we used this function when instantiating DOM wrappers. Now
we get the context from the creationContext, so we don't need access to
this unsafe handle. This patch inlines the function into its one other
caller.

* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::currentWorldContext):
* bindings/v8/ScriptController.h:
(ScriptController):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127975 => 127976)


--- trunk/Source/WebCore/ChangeLog	2012-09-09 04:29:19 UTC (rev 127975)
+++ trunk/Source/WebCore/ChangeLog	2012-09-09 06:48:14 UTC (rev 127976)
@@ -1,3 +1,20 @@
+2012-09-08  Adam Barth  <[email protected]>
+
+        [V8] unsafeHandleToCurrentWorldContext doesn't need to exist
+        https://bugs.webkit.org/show_bug.cgi?id=96191
+
+        Reviewed by Kentaro Hara.
+
+        Previously, we used this function when instantiating DOM wrappers. Now
+        we get the context from the creationContext, so we don't need access to
+        this unsafe handle. This patch inlines the function into its one other
+        caller.
+
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::ScriptController::currentWorldContext):
+        * bindings/v8/ScriptController.h:
+        (ScriptController):
+
 2012-09-08  Benjamin Poulain  <[email protected]>
 
         Specialize nextBreakablePosition depending on breakNBSP

Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (127975 => 127976)


--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-09-09 04:29:19 UTC (rev 127975)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-09-09 06:48:14 UTC (rev 127976)
@@ -411,23 +411,18 @@
 {
 }
 
-v8::Persistent<v8::Context> ScriptController::unsafeHandleToCurrentWorldContext()
+v8::Local<v8::Context> ScriptController::currentWorldContext()
 {
     if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) {
         RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext();
         if (m_frame != toFrameIfNotDetached(context->get()))
-            return v8::Persistent<v8::Context>();
-        return context->get();
+            return v8::Local<v8::Context>();
+        return v8::Local<v8::Context>::New(context->get());
     }
     windowShell()->initializeIfNeeded();
-    return windowShell()->context();
+    return v8::Local<v8::Context>::New(windowShell()->context());
 }
 
-v8::Local<v8::Context> ScriptController::currentWorldContext()
-{
-    return v8::Local<v8::Context>::New(unsafeHandleToCurrentWorldContext());
-}
-
 v8::Local<v8::Context> ScriptController::mainWorldContext()
 {
     windowShell()->initializeIfNeeded();

Modified: trunk/Source/WebCore/bindings/v8/ScriptController.h (127975 => 127976)


--- trunk/Source/WebCore/bindings/v8/ScriptController.h	2012-09-09 04:29:19 UTC (rev 127975)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.h	2012-09-09 06:48:14 UTC (rev 127976)
@@ -172,9 +172,6 @@
     v8::Local<v8::Context> mainWorldContext();
     v8::Local<v8::Context> currentWorldContext();
 
-    // WARNING! The handle returned by this function might be Disposed() when _javascript_ is executed.
-    v8::Persistent<v8::Context> unsafeHandleToCurrentWorldContext();
-
     // Pass command-line flags to the JS engine.
     static void setFlags(const char* string, int length);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to