Web Inspector: Reload actions from second level inspector should properly reload...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2019 04:27:58 +0000 (04:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2019 04:27:58 +0000 (04:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195306

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-03-04
Reviewed by Matt Baker.

* UserInterface/Base/Main.js:
Provide a better reload for a Nth level inspector.

* UserInterface/Debug/Bootstrap.js:
(WI.runBootstrapOperations):
Simplify, should not need to check for InspectorFrontendHost.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js

index 59c6907..5f711a4 100644 (file)
@@ -1,5 +1,19 @@
 2019-03-04  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Reload actions from second level inspector should properly reload the inspected inspector
+        https://bugs.webkit.org/show_bug.cgi?id=195306
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Base/Main.js:
+        Provide a better reload for a Nth level inspector.
+
+        * UserInterface/Debug/Bootstrap.js:
+        (WI.runBootstrapOperations):
+        Simplify, should not need to check for InspectorFrontendHost.
+
+2019-03-04  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: MediaSource logging not initialized properly
         https://bugs.webkit.org/show_bug.cgi?id=195307
 
index b7bc9ed..5cfc367 100644 (file)
@@ -2260,19 +2260,25 @@ WI._downloadWebArchive = function(event)
     this.archiveMainFrame();
 };
 
+WI._reloadInspectedInspector = function()
+{
+    const options = {};
+    WI.runtimeManager.evaluateInInspectedWindow(`InspectorFrontendHost.reopen()`, options, function(){});
+};
+
 WI._reloadPage = function(event)
 {
     if (!window.PageAgent)
         return;
 
-    PageAgent.reload();
     event.preventDefault();
-};
 
-WI._reloadToolbarButtonClicked = function(event)
-{
-    // Reload page from origin if the button is clicked while the shift key is pressed down.
-    PageAgent.reload.invoke({ignoreCache: this.modifierKeys.shiftKey});
+    if (InspectorFrontendHost.inspectionLevel() > 1) {
+        WI._reloadInspectedInspector();
+        return;
+    }
+
+    PageAgent.reload();
 };
 
 WI._reloadPageFromOrigin = function(event)
@@ -2280,8 +2286,25 @@ WI._reloadPageFromOrigin = function(event)
     if (!window.PageAgent)
         return;
 
-    PageAgent.reload.invoke({ignoreCache: true});
     event.preventDefault();
+
+    if (InspectorFrontendHost.inspectionLevel() > 1) {
+        WI._reloadInspectedInspector();
+        return;
+    }
+
+    PageAgent.reload.invoke({ignoreCache: true});
+};
+
+WI._reloadToolbarButtonClicked = function(event)
+{
+    if (InspectorFrontendHost.inspectionLevel() > 1) {
+        WI._reloadInspectedInspector();
+        return;
+    }
+
+    // Reload page from origin if the button is clicked while the shift key is pressed down.
+    PageAgent.reload.invoke({ignoreCache: this.modifierKeys.shiftKey});
 };
 
 WI._updateReloadToolbarButton = function()
index fd16788..0ec34df 100644 (file)
@@ -103,7 +103,7 @@ WI.runBootstrapOperations = function() {
     applyDumpMessagesState(dumpMessagesCurrentState());
 
     // Next Level Inspector.
-    let inspectionLevel = InspectorFrontendHost ? InspectorFrontendHost.inspectionLevel() : 1;
+    let inspectionLevel = InspectorFrontendHost.inspectionLevel();
     const inspectInspectorToolTip = WI.unlocalizedString("Open Web Inspector [%d]").format(inspectionLevel + 1);
     let inspectInspectorToolbarItem = new WI.ButtonToolbarItem("inspect-inspector", inspectInspectorToolTip);
     WI.toolbar.addToolbarItem(inspectInspectorToolbarItem, WI.Toolbar.Section.CenterRight);