Title: [126798] trunk/Source/WebCore
Revision
126798
Author
[email protected]
Date
2012-08-27 14:37:37 -0700 (Mon, 27 Aug 2012)

Log Message

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

Reviewed by Eric Seidel.

This patch changes reportUncaughtException to operate in terms of a
DOMWindow rather than a Frame. In general, the bindings should use
DOMWindows rather than Frames because a DOMWindow is specific to a
given Document whereas a Frame displays many Documents over its
lifetime.

I've also updated some variable names to be more consistent with WebKit
naming conventions.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126797 => 126798)


--- trunk/Source/WebCore/ChangeLog	2012-08-27 21:29:29 UTC (rev 126797)
+++ trunk/Source/WebCore/ChangeLog	2012-08-27 21:37:37 UTC (rev 126798)
@@ -1,5 +1,24 @@
 2012-08-27  Adam Barth  <[email protected]>
 
+        [V8] Clean up V8DOMWindowShell's reportUncaughtException
+        https://bugs.webkit.org/show_bug.cgi?id=95126
+
+        Reviewed by Eric Seidel.
+
+        This patch changes reportUncaughtException to operate in terms of a
+        DOMWindow rather than a Frame. In general, the bindings should use
+        DOMWindows rather than Frames because a DOMWindow is specific to a
+        given Document whereas a Frame displays many Documents over its
+        lifetime.
+
+        I've also updated some variable names to be more consistent with WebKit
+        naming conventions.
+
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::reportUncaughtException):
+
+2012-08-27  Adam Barth  <[email protected]>
+
         The static functions in V8DOMWindowShell.cpp are poorly named
         https://bugs.webkit.org/show_bug.cgi?id=95122
 

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (126797 => 126798)


--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-27 21:29:29 UTC (rev 126797)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-27 21:37:37 UTC (rev 126798)
@@ -98,14 +98,11 @@
 
 static void reportUncaughtException(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
 {
-    // Use the frame where _javascript_ is called from.
-    Frame* frame = firstFrame(BindingState::instance());
-    if (!frame)
+    DOMWindow* firstWindow = firstDOMWindow(BindingState::instance());
+    if (!firstWindow->isCurrentlyDisplayedInFrame())
         return;
 
-    v8::Handle<v8::String> errorMessageString = message->Get();
-    ASSERT(!errorMessageString.IsEmpty());
-    String errorMessage = toWebCoreString(errorMessageString);
+    String errorMessage = toWebCoreString(message->Get());
 
     v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
     RefPtr<ScriptCallStack> callStack;
@@ -114,10 +111,9 @@
         callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
 
     v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
-    bool useURL = resourceName.IsEmpty() || !resourceName->IsString();
-    Document* document = frame->document();
-    String resourceNameString = useURL ? document->url() : toWebCoreString(resourceName);
-    document->reportException(errorMessage, message->GetLineNumber(), resourceNameString, callStack);
+    bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
+    String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName);
+    firstWindow->document()->reportException(errorMessage, message->GetLineNumber(), resource, callStack);
 }
 
 // Returns the owner frame pointer of a DOM wrapper object. It only works for
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to