Title: [128095] trunk/Source/WebCore
Revision
128095
Author
[email protected]
Date
2012-09-10 13:21:33 -0700 (Mon, 10 Sep 2012)

Log Message

[V8] V8HTMLDocument::write and friends should not indirect through Frame
https://bugs.webkit.org/show_bug.cgi?id=96289

Patch by Adam Barth <[email protected]> on 2012-09-10
Reviewed by Eric Seidel.

There is no reason why document.write and friends need to indirect
through the Frame to find the active document. This patch makes these
functions work the same as the JSC versions.

* bindings/v8/BindingState.cpp:
* bindings/v8/BindingState.h:
    - This patch removes the last callers of activeFrame, so we can
      remove the function entirely.
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:
(WebCore::V8HTMLDocument::writeCallback):
(WebCore::V8HTMLDocument::writelnCallback):
(WebCore::V8HTMLDocument::openCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (128094 => 128095)


--- trunk/Source/WebCore/ChangeLog	2012-09-10 20:20:58 UTC (rev 128094)
+++ trunk/Source/WebCore/ChangeLog	2012-09-10 20:21:33 UTC (rev 128095)
@@ -1,5 +1,25 @@
 2012-09-10  Adam Barth  <[email protected]>
 
+        [V8] V8HTMLDocument::write and friends should not indirect through Frame
+        https://bugs.webkit.org/show_bug.cgi?id=96289
+
+        Reviewed by Eric Seidel.
+
+        There is no reason why document.write and friends need to indirect
+        through the Frame to find the active document. This patch makes these
+        functions work the same as the JSC versions.
+
+        * bindings/v8/BindingState.cpp:
+        * bindings/v8/BindingState.h:
+            - This patch removes the last callers of activeFrame, so we can
+              remove the function entirely.
+        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+        (WebCore::V8HTMLDocument::writeCallback):
+        (WebCore::V8HTMLDocument::writelnCallback):
+        (WebCore::V8HTMLDocument::openCallback):
+
+2012-09-10  Adam Barth  <[email protected]>
+
         [V8] Constructors try to handle errors that cannot occur
         https://bugs.webkit.org/show_bug.cgi?id=96304
 

Modified: trunk/Source/WebCore/bindings/v8/BindingState.cpp (128094 => 128095)


--- trunk/Source/WebCore/bindings/v8/BindingState.cpp	2012-09-10 20:20:58 UTC (rev 128094)
+++ trunk/Source/WebCore/bindings/v8/BindingState.cpp	2012-09-10 20:21:33 UTC (rev 128095)
@@ -66,14 +66,6 @@
     return toDOMWindow(v8::Context::GetEntered());
 }
 
-Frame* activeFrame(BindingState*)
-{
-    v8::Handle<v8::Context> context = activeContext();
-    if (context.IsEmpty())
-        return 0;
-    return toFrameIfNotDetached(context);
-}
-
 Frame* firstFrame(BindingState*)
 {
     v8::Handle<v8::Context> context = v8::Context::GetEntered();

Modified: trunk/Source/WebCore/bindings/v8/BindingState.h (128094 => 128095)


--- trunk/Source/WebCore/bindings/v8/BindingState.h	2012-09-10 20:20:58 UTC (rev 128094)
+++ trunk/Source/WebCore/bindings/v8/BindingState.h	2012-09-10 20:21:33 UTC (rev 128095)
@@ -49,7 +49,6 @@
 DOMWindow* activeDOMWindow(BindingState*);
 DOMWindow* firstDOMWindow(BindingState*);
 
-Frame* activeFrame(BindingState*);
 Frame* firstFrame(BindingState*);
 
 // FIXME: When implementing this function for JSC, we need to understand if there

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp (128094 => 128095)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp	2012-09-10 20:20:58 UTC (rev 128094)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp	2012-09-10 20:21:33 UTC (rev 128095)
@@ -119,8 +119,7 @@
 {
     INC_STATS("DOM.HTMLDocument.write()");
     HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
-    Frame* frame = activeFrame(BindingState::instance());
-    htmlDocument->write(writeHelperGetString(args), frame ? frame->document() : NULL);
+    htmlDocument->write(writeHelperGetString(args), activeDOMWindow(BindingState::instance())->document());
     return v8::Undefined();
 }
 
@@ -128,8 +127,7 @@
 {
     INC_STATS("DOM.HTMLDocument.writeln()");
     HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
-    Frame* frame = activeFrame(BindingState::instance());
-    htmlDocument->writeln(writeHelperGetString(args), frame ? frame->document() : NULL);
+    htmlDocument->writeln(writeHelperGetString(args), activeDOMWindow(BindingState::instance())->document());
     return v8::Undefined();
 }
 
@@ -160,9 +158,7 @@
         }
     }
 
-    Frame* frame = activeFrame(BindingState::instance());
-    htmlDocument->open(frame ? frame->document() : NULL);
-    // Return the document.
+    htmlDocument->open(activeDOMWindow(BindingState::instance())->document());
     return args.Holder();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to