Title: [126809] trunk/Source/WebCore
Revision
126809
Author
[email protected]
Date
2012-08-27 15:36:09 -0700 (Mon, 27 Aug 2012)

Log Message

[V8] Clean up V8DOMWindowShell's findFrame
https://bugs.webkit.org/show_bug.cgi?id=95130

Reviewed by Eric Seidel.

This patch just deletes a bunch of unneeded variables from findFrame
and adds an ASSERT for what a comment claims to be true.

* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::findFrame):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126808 => 126809)


--- trunk/Source/WebCore/ChangeLog	2012-08-27 22:34:17 UTC (rev 126808)
+++ trunk/Source/WebCore/ChangeLog	2012-08-27 22:36:09 UTC (rev 126809)
@@ -1,3 +1,16 @@
+2012-08-27  Adam Barth  <[email protected]>
+
+        [V8] Clean up V8DOMWindowShell's findFrame
+        https://bugs.webkit.org/show_bug.cgi?id=95130
+
+        Reviewed by Eric Seidel.
+
+        This patch just deletes a bunch of unneeded variables from findFrame
+        and adds an ASSERT for what a comment claims to be true.
+
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::findFrame):
+
 2012-08-27  Roger Fong  <[email protected]>
 
         Hook procedure should check to see if hook has already been removed before attempting removal.

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (126808 => 126809)


--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-27 22:34:17 UTC (rev 126808)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-27 22:36:09 UTC (rev 126809)
@@ -108,27 +108,26 @@
     firstWindow->document()->reportException(errorMessage, message->GetLineNumber(), resource, callStack);
 }
 
-// Returns the owner frame pointer of a DOM wrapper object. It only works for
-// these DOM objects requiring cross-domain access check.
 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data)
 {
-    Frame* target = 0;
     WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
-    if (V8DOMWindow::info.equals(type)) {
-        v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
-        if (window.IsEmpty())
-            return target;
 
-        DOMWindow* targetWindow = V8DOMWindow::toNative(window);
-        target = targetWindow->frame();
-    } else if (V8History::info.equals(type)) {
-        History* history = V8History::toNative(host);
-        target = history->frame();
-    } else if (V8Location::info.equals(type)) {
-        Location* location = V8Location::toNative(host);
-        target = location->frame();
+    if (V8DOMWindow::info.equals(type)) {
+        v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
+        if (windowWrapper.IsEmpty())
+            return 0;
+        return V8DOMWindow::toNative(windowWrapper)->frame();
     }
-    return target;
+
+    if (V8History::info.equals(type))
+        return V8History::toNative(host)->frame();
+
+    if (V8Location::info.equals(type))
+        return V8Location::toNative(host)->frame();
+
+    // This function can handle only those types listed above.
+    ASSERT_NOT_REACHED();
+    return 0;
 }
 
 static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessType type, v8::Local<v8::Value> data)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to