Title: [99709] trunk
Revision
99709
Author
[email protected]
Date
2011-11-09 07:04:56 -0800 (Wed, 09 Nov 2011)

Log Message

Web Inspector: discard injected scripts upon front-end disconnect.
https://bugs.webkit.org/show_bug.cgi?id=71823

Reviewed by Yury Semikhatsky.

Source/WebCore:

Test: http/tests/inspector-enabled/injected-script-discard.html

* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::clearFrontend):

LayoutTests:

* http/tests/inspector-enabled/injected-script-discard-expected.txt: Added.
* http/tests/inspector-enabled/injected-script-discard.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (99708 => 99709)


--- trunk/LayoutTests/ChangeLog	2011-11-09 15:03:40 UTC (rev 99708)
+++ trunk/LayoutTests/ChangeLog	2011-11-09 15:04:56 UTC (rev 99709)
@@ -1,3 +1,13 @@
+2011-11-09  Pavel Feldman  <[email protected]>
+
+        Web Inspector: discard injected scripts upon front-end disconnect.
+        https://bugs.webkit.org/show_bug.cgi?id=71823
+
+        Reviewed by Yury Semikhatsky.
+
+        * http/tests/inspector-enabled/injected-script-discard-expected.txt: Added.
+        * http/tests/inspector-enabled/injected-script-discard.html: Added.
+
 2011-11-09  Philippe Normand  <[email protected]>
 
         Unreviewed, GTK rebaseline and skip a crashing test.

Added: trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard-expected.txt (0 => 99709)


--- trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard-expected.txt	2011-11-09 15:04:56 UTC (rev 99709)
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: line 1: Opening front-end for the first time
+CONSOLE MESSAGE: line 1: Resolved object successfully
+CONSOLE MESSAGE: line 1: Opening front-end second time
+CONSOLE MESSAGE: line 1: Error resolving object
+Tests that injected script is discarded upon front-end close.
+
+
Property changes on: trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard.html (0 => 99709)


--- trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard.html	2011-11-09 15:04:56 UTC (rev 99709)
@@ -0,0 +1,73 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function openWebInspector()
+{
+    if (window.layoutTestController) {
+        layoutTestController.waitUntilDone();
+        layoutTestController.showWebInspector();
+        runTest();
+    }
+}
+
+function reopenWebInspector(objectId)
+{
+    window.objectId = unescape(objectId);
+    layoutTestController.closeWebInspector();
+    layoutTestController.showWebInspector();
+    runTest();
+}
+
+function test()
+{
+    RuntimeAgent.evaluate("window.objectId", dispatch);
+
+    function dispatch(error, result, wasThrown)
+    {
+        if (result.type !== "string") {
+            InspectorTest.evaluateInPage("console.log('Opening front-end for the first time')");
+            installHandleInInjectedScript();
+        } else {
+            InspectorTest.evaluateInPage("console.log('Opening front-end second time')");
+            checkHandleInInjectedScript(result.value, InspectorTest.completeTest);
+        }
+    }
+
+    function installHandleInInjectedScript()
+    {
+        RuntimeAgent.evaluate("({ handle : \"handle\" })", storeIdInTargetWindow);
+
+        function storeIdInTargetWindow(error, result, wasThrown)
+        {
+            checkHandleInInjectedScript(result.objectId, reopenInspector);
+
+            function reopenInspector()
+            {
+                InspectorTest.evaluateInPage("reopenWebInspector('" + escape(result.objectId) + "')");
+            }
+        }
+    }
+
+    function checkHandleInInjectedScript(objectId, callback)
+    {
+        RuntimeAgent.getProperties(objectId, false, propertiesAvailable);
+
+        function propertiesAvailable(error, properties)
+        {
+            InspectorTest.evaluateInPage(error ? "console.log('Error resolving object')" : "console.log('Resolved object successfully')", callback);
+        }
+    }
+}
+
+</script>
+</head>
+<body _onload_="openWebInspector()">
+<p>
+Tests that injected script is discarded upon front-end close.
+</p>
+<div id="container"/>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector-enabled/injected-script-discard.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (99708 => 99709)


--- trunk/Source/WebCore/ChangeLog	2011-11-09 15:03:40 UTC (rev 99708)
+++ trunk/Source/WebCore/ChangeLog	2011-11-09 15:04:56 UTC (rev 99709)
@@ -1,3 +1,15 @@
+2011-11-09  Pavel Feldman  <[email protected]>
+
+        Web Inspector: discard injected scripts upon front-end disconnect.
+        https://bugs.webkit.org/show_bug.cgi?id=71823
+
+        Reviewed by Yury Semikhatsky.
+
+        Test: http/tests/inspector-enabled/injected-script-discard.html
+
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::clearFrontend):
+
 2011-11-09  Andreas Kling  <[email protected]>
 
         CSS: Remove empty value and rule destructors.

Modified: trunk/Source/WebCore/inspector/InspectorAgent.cpp (99708 => 99709)


--- trunk/Source/WebCore/inspector/InspectorAgent.cpp	2011-11-09 15:03:40 UTC (rev 99708)
+++ trunk/Source/WebCore/inspector/InspectorAgent.cpp	2011-11-09 15:04:56 UTC (rev 99709)
@@ -130,6 +130,7 @@
     m_pendingEvaluateTestCommands.clear();
     m_frontend = 0;
     m_didCommitLoadFired = false;
+    m_injectedScriptManager->discardInjectedScripts();
 }
 
 void InspectorAgent::didCommitLoad()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to