Title: [138003] trunk
Revision
138003
Author
[email protected]
Date
2012-12-18 02:47:41 -0800 (Tue, 18 Dec 2012)

Log Message

Web Inspector: MediaQueryList listener silently catches errors
https://bugs.webkit.org/show_bug.cgi?id=105162

Reviewed by Alexander Pavlov.

Source/WebCore:

Drive-by: removed unused ScriptCallback::call(bool).

Test: inspector-protocol/media-query-listener-exception.html

* bindings/js/ScriptFunctionCall.cpp:
(WebCore::ScriptCallback::call):
* bindings/js/ScriptFunctionCall.h:
(ScriptCallback):
* bindings/v8/ScriptFunctionCall.cpp: report uncaught exception to the inspector
if it was thrown during the function call.
(WebCore::ScriptCallback::call):
* bindings/v8/ScriptFunctionCall.h:
(ScriptCallback):

LayoutTests:

Test that uncaught exception in MediaQueryListListener will be logged to the console.

* http/tests/inspector-protocol/resources/protocol-test.js:
(runTest):
* inspector-protocol/media-query-listener-exception-expected.txt: Added.
* inspector-protocol/media-query-listener-exception.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138002 => 138003)


--- trunk/LayoutTests/ChangeLog	2012-12-18 10:40:18 UTC (rev 138002)
+++ trunk/LayoutTests/ChangeLog	2012-12-18 10:47:41 UTC (rev 138003)
@@ -1,3 +1,17 @@
+2012-12-17  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: MediaQueryList listener silently catches errors
+        https://bugs.webkit.org/show_bug.cgi?id=105162
+
+        Reviewed by Alexander Pavlov.
+
+        Test that uncaught exception in MediaQueryListListener will be logged to the console.
+
+        * http/tests/inspector-protocol/resources/protocol-test.js:
+        (runTest):
+        * inspector-protocol/media-query-listener-exception-expected.txt: Added.
+        * inspector-protocol/media-query-listener-exception.html: Added.
+
 2012-12-18  Dominik Röttsches  <[email protected]>
 
         webaudio/oscillator* tests should use OfflineAudioContext

Modified: trunk/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js (138002 => 138003)


--- trunk/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js	2012-12-18 10:40:18 UTC (rev 138002)
+++ trunk/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js	2012-12-18 10:47:41 UTC (rev 138003)
@@ -63,6 +63,10 @@
 
 function runTest()
 {
+    if (!window.testRunner) {
+        console.error("This test requires DumpRenderTree");
+        return;
+    }
     testRunner.dumpAsText();
     testRunner.waitUntilDone();
     testRunner.setCanOpenWindows(true);

Added: trunk/LayoutTests/inspector-protocol/media-query-listener-exception-expected.txt (0 => 138003)


--- trunk/LayoutTests/inspector-protocol/media-query-listener-exception-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/media-query-listener-exception-expected.txt	2012-12-18 10:47:41 UTC (rev 138003)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 13: Uncaught ReferenceError: objectThatDoesNotExist is not defined
+CONSOLE MESSAGE: line 13: Uncaught ReferenceError: objectThatDoesNotExist is not defined
+Test that uncaught exception in MediaQueryListListener will be reported to the console. On success you should see two exceptions in the listener logged to the console (first time when the media type is overridden and second - when they are restored). Bug 105162.
+
+
Property changes on: trunk/LayoutTests/inspector-protocol/media-query-listener-exception-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector-protocol/media-query-listener-exception.html (0 => 138003)


--- trunk/LayoutTests/inspector-protocol/media-query-listener-exception.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/media-query-listener-exception.html	2012-12-18 10:47:41 UTC (rev 138003)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+var theMediaQueryList = window.matchMedia("print");
+
+theMediaQueryList.addListener(function(aMediaQueryList) {
+    objectThatDoesNotExist.produceError();
+});
+
+function test()
+{
+    function didSetEmulatedMedia(messageObject)
+    {
+        if (messageObject.error)
+            InspectorTest.log("FAILED: " + messageObject.error.message);
+        InspectorTest.sendCommand("Page.disable", {});
+        InspectorTest.completeTest();
+    }
+
+    InspectorTest.sendCommand("Page.enable", {});
+    InspectorTest.sendCommand("Page.setEmulatedMedia", {
+        "media": "print"
+    }, didSetEmulatedMedia);
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Test that uncaught exception in MediaQueryListListener will be reported to the console. On success you should see two exceptions in the listener logged to the console (first time when the media type is overridden and second - when they are restored). <a href="" 105162.</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector-protocol/media-query-listener-exception.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (138002 => 138003)


--- trunk/Source/WebCore/ChangeLog	2012-12-18 10:40:18 UTC (rev 138002)
+++ trunk/Source/WebCore/ChangeLog	2012-12-18 10:47:41 UTC (rev 138003)
@@ -1,3 +1,24 @@
+2012-12-17  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: MediaQueryList listener silently catches errors
+        https://bugs.webkit.org/show_bug.cgi?id=105162
+
+        Reviewed by Alexander Pavlov.
+
+        Drive-by: removed unused ScriptCallback::call(bool).
+
+        Test: inspector-protocol/media-query-listener-exception.html
+
+        * bindings/js/ScriptFunctionCall.cpp:
+        (WebCore::ScriptCallback::call):
+        * bindings/js/ScriptFunctionCall.h:
+        (ScriptCallback):
+        * bindings/v8/ScriptFunctionCall.cpp: report uncaught exception to the inspector
+        if it was thrown during the function call.
+        (WebCore::ScriptCallback::call):
+        * bindings/v8/ScriptFunctionCall.h:
+        (ScriptCallback):
+
 2012-12-18  Eugene Klyuchnikov  <[email protected]>
 
         Web Inspector: Network: display _javascript_ stack in case of script initiator.

Modified: trunk/Source/WebCore/bindings/js/ScriptFunctionCall.cpp (138002 => 138003)


--- trunk/Source/WebCore/bindings/js/ScriptFunctionCall.cpp	2012-12-18 10:40:18 UTC (rev 138002)
+++ trunk/Source/WebCore/bindings/js/ScriptFunctionCall.cpp	2012-12-18 10:47:41 UTC (rev 138003)
@@ -198,12 +198,6 @@
 
 ScriptValue ScriptCallback::call()
 {
-    bool hadException;
-    return call(hadException);
-}
-
-ScriptValue ScriptCallback::call(bool& hadException)
-{
     JSLockHolder lock(m_exec);
 
     CallData callData;
@@ -212,7 +206,7 @@
         return ScriptValue();
 
     JSValue result = JSC::call(m_exec, m_function.jsValue(), callType, callData, m_function.jsValue(), m_arguments);
-    hadException = m_exec->hadException();
+    bool hadException = m_exec->hadException();
 
     if (hadException) {
         reportException(m_exec, m_exec->exception());

Modified: trunk/Source/WebCore/bindings/js/ScriptFunctionCall.h (138002 => 138003)


--- trunk/Source/WebCore/bindings/js/ScriptFunctionCall.h	2012-12-18 10:40:18 UTC (rev 138002)
+++ trunk/Source/WebCore/bindings/js/ScriptFunctionCall.h	2012-12-18 10:47:41 UTC (rev 138003)
@@ -88,7 +88,6 @@
         ScriptCallback(ScriptState*, const ScriptValue&);
 
         ScriptValue call();
-        ScriptValue call(bool& hadException);
 
     private:
         ScriptValue m_function;

Modified: trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp (138002 => 138003)


--- trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp	2012-12-18 10:40:18 UTC (rev 138002)
+++ trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp	2012-12-18 10:47:41 UTC (rev 138003)
@@ -185,16 +185,11 @@
 
 ScriptValue ScriptCallback::call()
 {
-    bool hadException = false;
-    return call(hadException);
-}
-
-ScriptValue ScriptCallback::call(bool& hadException)
-{
     ASSERT(v8::Context::InContext());
     ASSERT(m_function.v8Value()->IsFunction());
 
     v8::TryCatch exceptionCatcher;
+    exceptionCatcher.SetVerbose(true);
     v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
     v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(m_function.v8Value());
 
@@ -203,13 +198,6 @@
         args[i] = m_arguments[i].v8Value();
 
     v8::Handle<v8::Value> result = ScriptController::callFunctionWithInstrumentation(0, function, object, m_arguments.size(), args.get());
-
-    if (exceptionCatcher.HasCaught()) {
-        hadException = true;
-        m_scriptState->setException(exceptionCatcher.Exception());
-        return ScriptValue();
-    }
-
     return ScriptValue(result);
 }
 

Modified: trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.h (138002 => 138003)


--- trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.h	2012-12-18 10:40:18 UTC (rev 138002)
+++ trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.h	2012-12-18 10:47:41 UTC (rev 138003)
@@ -77,7 +77,6 @@
         ScriptCallback(ScriptState*, const ScriptValue&);
 
         ScriptValue call();
-        ScriptValue call(bool& hadException);
 
     private:
         ScriptValue m_function;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to