[V8] V8HTMLDocument::write and friends should not indirect through Frame
https://bugs.webkit.org/show_bug.cgi?id=96289
Patch by Adam Barth <abarth@chromium.org> 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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 13926af..73497e5 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,25 @@
2012-09-10 Adam Barth <abarth@chromium.org>
+ [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 <abarth@chromium.org>
+
[V8] Constructors try to handle errors that cannot occur
https://bugs.webkit.org/show_bug.cgi?id=96304
diff --git a/Source/WebCore/bindings/v8/BindingState.cpp b/Source/WebCore/bindings/v8/BindingState.cpp
index c59bb89..f4d503f 100644
--- a/Source/WebCore/bindings/v8/BindingState.cpp
+++ b/Source/WebCore/bindings/v8/BindingState.cpp
@@ -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();
diff --git a/Source/WebCore/bindings/v8/BindingState.h b/Source/WebCore/bindings/v8/BindingState.h
index 9564224..19e844f 100644
--- a/Source/WebCore/bindings/v8/BindingState.h
+++ b/Source/WebCore/bindings/v8/BindingState.h
@@ -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
diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index ca39754..be53431 100644
--- a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -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();
}