2011-02-07 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 12:57:37 +0000 (12:57 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 12:57:37 +0000 (12:57 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: ignore cache upon reload via Ctrl(Cmd)+Shift+R.
        https://bugs.webkit.org/show_bug.cgi?id=53914

        * http/tests/inspector/inspector-test2.js:
        (initialize_InspectorTest.InspectorTest.reloadPage):
        * inspector/audits-panel-functional.html:
2011-02-07  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: ignore cache upon reload via Ctrl(Cmd)+Shift+R.
        https://bugs.webkit.org/show_bug.cgi?id=53914

        * inspector/Inspector.idl:
        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::reloadPage):
        * inspector/InspectorAgent.h:
        * inspector/front-end/AuditsPanel.js:
        (WebInspector.AuditsPanel.prototype._reloadResources):
        * inspector/front-end/ExtensionServer.js:
        (WebInspector.ExtensionServer.prototype._onReload):
        * inspector/front-end/inspector.js:
        (WebInspector.documentKeyDown):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77922 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/inspector-test2.js
LayoutTests/inspector/audits-panel-functional-expected.txt
LayoutTests/inspector/audits-panel-functional.html
LayoutTests/inspector/audits-tests.js [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/inspector/Inspector.idl
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorAgent.h
Source/WebCore/inspector/front-end/AuditsPanel.js
Source/WebCore/inspector/front-end/ExtensionServer.js
Source/WebCore/inspector/front-end/inspector.js

index 81a2500..f6f9d6c 100644 (file)
@@ -1,3 +1,14 @@
+2011-02-07  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: ignore cache upon reload via Ctrl(Cmd)+Shift+R.
+        https://bugs.webkit.org/show_bug.cgi?id=53914
+
+        * http/tests/inspector/inspector-test2.js:
+        (initialize_InspectorTest.InspectorTest.reloadPage):
+        * inspector/audits-panel-functional.html:
+
 2011-02-08  Mario Sanchez Prada  <msanchez@igalia.com>
 
         Unreviewed, skipping test timing out on GTK 32-bit debug bot.
index 6196e89..fce492c 100644 (file)
@@ -93,7 +93,7 @@ InspectorTest.reloadPage = function(callback)
 
     if (WebInspector.panels.network)
         WebInspector.panels.network._reset();
-    InspectorBackend.reloadPage();
+    InspectorBackend.reloadPage(false);
 }
 
 InspectorTest.reloadPageIfNeeded = function(callback)
index 57e0450..bfd49d8 100644 (file)
@@ -1,4 +1,5 @@
 Tests audit rules.    
+Page reloaded.
   Network Utilization
     Combine external JavaScript (4)
      There are multiple resources served from same domain. Consider combining them into as few files as possible.
index 17f5c61..807bef6 100644 (file)
@@ -6,67 +6,44 @@
     color: green;
 }
 </style>
-<script src="../http/tests/inspector/inspector-test.js"></script>
-<script src="audits-tests.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
+<script src="audits-tests2.js"></script>
 
 <!-- These scripts are needed to result in a violation of the max JS resource count from the same domain -->
 <script src="resources/audits-script1.js"></script>
 <link rel="stylesheet" href="resources/audits-style1.css" type="text/css">
 <script src="resources/audits-script2.js"></script>
 <script>
-
-function doit()
+var test = function()
 {
-    function callback(result)
-    {
-        if (result === "refreshing")
-            return;
-        var output = document.getElementById("outputPre");
-        output.textContent = result;
-        notifyDone();
-    }
-    evaluateInWebInspector("frontend_runAudits", callback);
-}
+    InspectorTest.reloadPage(step1);
 
+    function step1()
+    {
+        WebInspector.AuditRuleResult.resourceDomain = function() {
+            return "[domain]";
+        };
 
-// Frontend functions.
-
-function frontend_runAudits(testController)
-{
-    if (!WebInspector.panels.network._pageWasReloaded) {
-        WebInspector.panels.network._pageWasReloaded = true;
-        WebInspector.panels.network._reset();
-        InspectorBackend.reloadPage();
-        return "refreshing";
-    }
-
-    testController.waitUntilDone();
-    WebInspector.AuditRuleResult.resourceDomain = function() {
-        return "[domain]";
-    };
-    try {
-        const launcherView = WebInspector.panels.audits._launcherView;
+        var launcherView = WebInspector.panels.audits._launcherView;
         launcherView._selectAllClicked(true);
         launcherView._auditPresentStateElement.checked = true;
         launcherView._launchButtonClicked();
 
-        testController.runAfterPendingDispatches(function() {
-            // Audits are done, check results.
-            var output = frontend_collectAuditResults();
-            // Avoid influencing tests that require resource tracking to be disabled.
-            testController.notifyDone(output.join("\n"));
-        });
-    } catch(e) {
-        testController.notifyDone("Exception: " + e.toString());
+        InspectorTest.runAfterPendingDispatches(step2);
+    }    
+
+    function step2()
+    {
+        InspectorTest.collectAuditResults();
+        InspectorTest.completeTest();
     }
 }
-
+</script>
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 Tests audit rules.
-
 <style>
 .violation { color: red; }
 </style>
@@ -75,8 +52,5 @@ Tests audit rules.
 <img src="foo2.jpg" width=100>
 <img src="foo3.jpg" style="position: absolute">
 
-<pre id="outputPre">
-</pre>
-
 </body>
 </html>
diff --git a/LayoutTests/inspector/audits-tests.js b/LayoutTests/inspector/audits-tests.js
deleted file mode 100755 (executable)
index 102c6b4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-function frontend_collectAuditResults()
-{
-    WebInspector.panels.audits.showResults(WebInspector.panels.audits.auditResultsTreeElement.children[0].results);
-    var liElements = WebInspector.panels.audits.visibleView.element.getElementsByTagName("li");
-    for (var j = 0; j < liElements.length; ++j) {
-        if (liElements[j].treeElement)
-            liElements[j].treeElement.expand();
-    }
-    var output = [];
-    frontend_collectTextContent(WebInspector.panels.audits.visibleView.element, 0, output);
-    return output;
-}
-
-function frontend_collectTextContent(element, level, output)
-{
-    var nodeOutput = "";
-    var child = element.firstChild;
-
-    while (child) {
-        if (child.nodeType === Node.TEXT_NODE) {
-            for (var i = 0; i < level; ++i)
-                nodeOutput += " ";
-            nodeOutput += child.nodeValue;
-        } else if (child.nodeType === Node.ELEMENT_NODE) {
-            if (nodeOutput !== "") {
-                output.push(nodeOutput);
-                nodeOutput = "";
-            }
-            frontend_collectTextContent(child, level + 1, output);
-        }
-        child = child.nextSibling;
-    }
-    if (nodeOutput !== "")
-        output.push(nodeOutput);
-}
index d31832e..7916e88 100644 (file)
@@ -1,3 +1,21 @@
+2011-02-07  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: ignore cache upon reload via Ctrl(Cmd)+Shift+R.
+        https://bugs.webkit.org/show_bug.cgi?id=53914
+
+        * inspector/Inspector.idl:
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::reloadPage):
+        * inspector/InspectorAgent.h:
+        * inspector/front-end/AuditsPanel.js:
+        (WebInspector.AuditsPanel.prototype._reloadResources):
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onReload):
+        * inspector/front-end/inspector.js:
+        (WebInspector.documentKeyDown):
+
 2011-02-08  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Cameron Zwarich.
index c242753..966d69b 100644 (file)
@@ -38,7 +38,7 @@ module core {
 
         [domain=Inspector] void addScriptToEvaluateOnLoad(in String scriptSource);
         [domain=Inspector] void removeAllScriptsToEvaluateOnLoad();
-        [domain=Inspector] void reloadPage();
+        [domain=Inspector] void reloadPage(in boolean ignoreCache);
         [domain=Inspector] void populateScriptObjects();
 
         [domain=Inspector] void openInInspectedWindow(in String url);
index daf055d..65dd21a 100644 (file)
@@ -1373,11 +1373,9 @@ KURL InspectorAgent::inspectedURLWithoutFragment() const
     return url;
 }
 
-void InspectorAgent::reloadPage()
+void InspectorAgent::reloadPage(bool ignoreCache)
 {
-    // FIXME: Why do we set the user gesture indicator here?
-    UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
-    m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh();
+    m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
 }
 
 void InspectorAgent::setExtraHeaders(PassRefPtr<InspectorObject> headers)
index 47d0700..987b77c 100644 (file)
@@ -128,7 +128,7 @@ public:
     Page* inspectedPage() const { return m_inspectedPage; }
     KURL inspectedURL() const;
     KURL inspectedURLWithoutFragment() const;
-    void reloadPage();
+    void reloadPage(bool ignoreCache);
 
     void restoreInspectorStateFromCookie(const String& inspectorCookie);
 
index f3cbfa7..47c0b30 100644 (file)
@@ -192,7 +192,7 @@ WebInspector.AuditsPanel.prototype = {
     _reloadResources: function(callback)
     {
         this._pageReloadCallback = callback;
-        InspectorBackend.reloadPage();
+        InspectorBackend.reloadPage(false);
     },
 
     _didMainResourceLoad: function()
index 73c8a89..97e1749 100644 (file)
@@ -257,7 +257,7 @@ WebInspector.ExtensionServer.prototype = {
         if (typeof message.userAgent === "string")
             InspectorBackend.setUserAgentOverride(message.userAgent);
 
-        InspectorBackend.reloadPage();
+        InspectorBackend.reloadPage(false);
         return this._status.OK();
     },
 
index e96d6b2..37a6460 100644 (file)
@@ -875,13 +875,13 @@ WebInspector.documentKeyDown = function(event)
 
         case "U+0052": // R key
             if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) {
-                InspectorBackend.reloadPage();
+                InspectorBackend.reloadPage(event.shiftKey);
                 event.preventDefault();
             }
             break;
         case "F5":
             if (!isMac)
-                InspectorBackend.reloadPage();
+                InspectorBackend.reloadPage(event.ctrlKey || event.shiftKey);
             break;
     }
 }