Web Inspector: "Reload Web Inspector" button no longer partially works
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2018 20:51:40 +0000 (20:51 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2018 20:51:40 +0000 (20:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191773
<rdar://problem/46139932>

Reviewed by Devin Rousso.

Source/WebCore:

* inspector/InspectorFrontendClient.h:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::reopen):
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
Provide a host call to reopen an inspector window to reload it.

* testing/Internals.cpp:
Stub implementation, this is not used in tests.

Source/WebInspectorUI:

* UserInterface/Base/Main.js:
* UserInterface/Debug/UncaughtExceptionReporter.js:
(sheetElement.innerHTML):
* UserInterface/Views/SettingsTabContentView.js:

Source/WebKit:

* UIProcess/RemoteWebInspectorProxy.cpp:
(WebKit::RemoteWebInspectorProxy::load):
(WebKit::RemoteWebInspectorProxy::reopen):
* UIProcess/RemoteWebInspectorProxy.h:
* UIProcess/RemoteWebInspectorProxy.messages.in:
* WebProcess/WebPage/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::reopen):
* WebProcess/WebPage/RemoteWebInspectorUI.h:
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::reopen):
* WebProcess/WebPage/WebInspector.h:
* WebProcess/WebPage/WebInspector.messages.in:
* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::reopen):
* WebProcess/WebPage/WebInspectorUI.h:

Source/WebKitLegacy/ios:

* WebCoreSupport/WebInspectorClientIOS.mm:
(WebInspectorFrontendClient::reopen):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::reopen):

Source/WebKitLegacy/win:

* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorFrontendClient::reopen):
* WebCoreSupport/WebInspectorClient.h:

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

30 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendClient.h
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebCore/testing/Internals.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js
Source/WebInspectorUI/UserInterface/Debug/UncaughtExceptionReporter.js
Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp
Source/WebKit/UIProcess/RemoteWebInspectorProxy.h
Source/WebKit/UIProcess/RemoteWebInspectorProxy.messages.in
Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp
Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h
Source/WebKit/WebProcess/WebPage/WebInspector.cpp
Source/WebKit/WebProcess/WebPage/WebInspector.h
Source/WebKit/WebProcess/WebPage/WebInspector.messages.in
Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp
Source/WebKit/WebProcess/WebPage/WebInspectorUI.h
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/WebCoreSupport/WebInspectorClientIOS.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.h

index 91dcd7d..732aadf 100644 (file)
@@ -1,3 +1,21 @@
+2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: "Reload Web Inspector" button no longer partially works
+        https://bugs.webkit.org/show_bug.cgi?id=191773
+        <rdar://problem/46139932>
+
+        Reviewed by Devin Rousso.
+
+        * inspector/InspectorFrontendClient.h:
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::reopen):
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+        Provide a host call to reopen an inspector window to reload it.
+
+        * testing/Internals.cpp:
+        Stub implementation, this is not used in tests.
+
 2018-11-19  Rob Buis  <rbuis@igalia.com>
 
         Setting document.title should have no effect for non SVG/HTML documents
index 7403efb..9fd954b 100644 (file)
@@ -61,6 +61,7 @@ public:
 
     virtual void bringToFront() = 0;
     virtual void closeWindow() = 0;
+    virtual void reopen() = 0;
 
     virtual UserInterfaceLayoutDirection userInterfaceLayoutDirection() const = 0;
 
index b1773aa..9f93294 100644 (file)
@@ -190,6 +190,12 @@ void InspectorFrontendHost::closeWindow()
     }
 }
 
+void InspectorFrontendHost::reopen()
+{
+    if (m_client)
+        m_client->reopen();
+}
+
 void InspectorFrontendHost::bringToFront()
 {
     if (m_client)
index 6a0a275..8078f5c 100644 (file)
@@ -57,6 +57,7 @@ public:
     void loaded();
     void requestSetDockSide(const String&);
     void closeWindow();
+    void reopen();
     void bringToFront();
     void inspectedURLChanged(const String&);
 
index 2b9a0d7..163274b 100644 (file)
@@ -36,6 +36,7 @@
 ] interface InspectorFrontendHost {
     void loaded();
     void closeWindow();
+    void reopen();
     void bringToFront();
     void inspectedURLChanged(DOMString newURL);
 
index 6051c2f..1b5db01 100644 (file)
@@ -307,6 +307,7 @@ private:
     void attachWindow(DockSide) final { }
     void detachWindow() final { }
     void closeWindow() final;
+    void reopen() final { }
     void bringToFront() final { }
     String localizedStringsURL() final { return String(); }
     void inspectedURLChanged(const String&) final { }
index abd8ed3..c153786 100644 (file)
@@ -1,3 +1,16 @@
+2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: "Reload Web Inspector" button no longer partially works
+        https://bugs.webkit.org/show_bug.cgi?id=191773
+        <rdar://problem/46139932>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Base/Main.js:
+        * UserInterface/Debug/UncaughtExceptionReporter.js:
+        (sheetElement.innerHTML):
+        * UserInterface/Views/SettingsTabContentView.js:
+
 2018-11-17  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Network: add button to show system certificate dialog
index 392c220..10f9e26 100644 (file)
@@ -1584,8 +1584,7 @@ WI._contextMenuRequested = function(event)
         proposedContextMenu = WI.ContextMenu.createFromEvent(event);
         proposedContextMenu.appendSeparator();
         proposedContextMenu.appendItem(WI.unlocalizedString("Reload Web Inspector"), () => {
-            // FIXME: Reload Web Inspector does not work with MultiplexingBackendTarget.
-            window.location.reload();
+            InspectorFrontendHost.reopen();
         });
 
         let protocolSubMenu = proposedContextMenu.appendSubMenuItem(WI.unlocalizedString("Protocol Debugging"), null, false);
@@ -2253,8 +2252,7 @@ WI.setLayoutDirection = function(value)
     if (WI.resolvedLayoutDirection() === WI.LayoutDirection.LTR && this._dockConfiguration === WI.DockConfiguration.Left)
         this._dockRight();
 
-    // FIXME: Reload Web Inspector does not work with MultiplexingBackendTarget.
-    window.location.reload();
+    InspectorFrontendHost.reopen();
 };
 
 WI._showTabAtIndex = function(i, event)
index 9721412..fd16788 100644 (file)
@@ -36,7 +36,7 @@ WI.runBootstrapOperations = function() {
 
     // Reload the Web Inspector.
     new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "R", () => {
-        window.location.reload();
+        InspectorFrontendHost.reopen();
     });
 
     // Toggle Inspector Messages Filtering.
index 7c61894..5e99a6b 100644 (file)
@@ -257,7 +257,6 @@ Document any additional information that might be useful in resolving the proble
         <dd><a class="bypass-event-blocking" id="dismiss-error-sheet">Click to close this view</a> and return
         to the Web Inspector without reloading. However, some things might not work without reloading if the error corrupted the Inspector's internal state.</dd>`;
 
-    // FIXME: Reload Web Inspector does not work with MultiplexingBackendTarget.
     let sheetElement = window.__sheetElement = document.createElement("div");
     sheetElement.classList.add("sheet-container");
     sheetElement.innerHTML = `<div class="uncaught-exception-sheet">
@@ -273,7 +272,7 @@ Document any additional information that might be useful in resolving the proble
         <a href="${prefilledBugReportLink}" target="_blank">click to file a pre-populated
         bug with this information</a>. It is possible that someone else broke it by accident.</dd>
         <dt>Oops, can I try again?</dt>
-        <dd><a href="javascript:window.location.reload()">Click to reload the Inspector</a>
+        <dd><a href="javascript:InspectorFrontendHost.reopen()">Click to reload the Inspector</a>
         again after making local changes.</dd>
         ${dismissOptionHTML}
     </dl>
index 991dd76..84bb248 100644 (file)
@@ -258,10 +258,9 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
         experimentalSettingsView.addSetting(WI.UIString("User Interface:"), WI.settings.experimentalEnableNewTabBar, WI.UIString("Enable New Tab Bar"));
         experimentalSettingsView.addSeparator();
 
-        // FIXME: Reload Web Inspector does not work with MultiplexingBackendTarget.
         let reloadInspectorButton = document.createElement("button");
         reloadInspectorButton.textContent = WI.UIString("Reload Web Inspector");
-        reloadInspectorButton.addEventListener("click", () => { window.location.reload(); });
+        reloadInspectorButton.addEventListener("click", () => { InspectorFrontendHost.reopen(); });
 
         let reloadInspectorContainerElement = experimentalSettingsView.addCenteredContainer(reloadInspectorButton, WI.UIString("for changes to take effect"));
         reloadInspectorContainerElement.classList.add("hidden");
index fde5e5c..f7599fb 100644 (file)
@@ -1,3 +1,27 @@
+2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: "Reload Web Inspector" button no longer partially works
+        https://bugs.webkit.org/show_bug.cgi?id=191773
+        <rdar://problem/46139932>
+
+        Reviewed by Devin Rousso.
+
+        * UIProcess/RemoteWebInspectorProxy.cpp:
+        (WebKit::RemoteWebInspectorProxy::load):
+        (WebKit::RemoteWebInspectorProxy::reopen):
+        * UIProcess/RemoteWebInspectorProxy.h:
+        * UIProcess/RemoteWebInspectorProxy.messages.in:
+        * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
+        (WebKit::RemoteWebInspectorUI::reopen):
+        * WebProcess/WebPage/RemoteWebInspectorUI.h:
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::reopen):
+        * WebProcess/WebPage/WebInspector.h:
+        * WebProcess/WebPage/WebInspector.messages.in:
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::reopen):
+        * WebProcess/WebPage/WebInspectorUI.h:
+
 2018-11-19  Alejandro G. Castro  <alex@igalia.com>
 
         [GTK][WPE] Solve some issues in the enumerateDevices code
index 4bdcf49..927da1b 100644 (file)
@@ -56,6 +56,9 @@ void RemoteWebInspectorProxy::load(const String& debuggableType, const String& b
 {
     createFrontendPageAndWindow();
 
+    m_debuggableType = debuggableType;
+    m_backendCommandsURL = backendCommandsURL;
+
     m_inspectorPage->process().send(Messages::RemoteWebInspectorUI::Initialize(debuggableType, backendCommandsURL), m_inspectorPage->pageID());
     m_inspectorPage->loadRequest(URL(URL(), WebInspectorProxy::inspectorPageURL()));
 }
@@ -91,6 +94,14 @@ void RemoteWebInspectorProxy::frontendDidClose()
     closeFrontendPageAndWindow();
 }
 
+void RemoteWebInspectorProxy::reopen()
+{
+    ASSERT(!m_debuggableType.isEmpty());
+
+    closeFrontendPageAndWindow();
+    load(m_debuggableType, m_backendCommandsURL);
+}
+
 void RemoteWebInspectorProxy::bringToFront()
 {
     platformBringToFront();
index a5db10c..9ecb42b 100644 (file)
@@ -95,6 +95,7 @@ private:
 
     // RemoteWebInspectorProxy messages.
     void frontendDidClose();
+    void reopen();
     void bringToFront();
     void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
     void append(const String& filename, const String& content);
@@ -119,6 +120,9 @@ private:
     RemoteWebInspectorProxyClient* m_client { nullptr };
     WebPageProxy* m_inspectorPage { nullptr };
 
+    String m_debuggableType;
+    String m_backendCommandsURL;
+
 #if PLATFORM(MAC)
     RetainPtr<WKInspectorViewController> m_inspectorView;
     RetainPtr<NSWindow> m_window;
index 83b496e..bc591f4 100644 (file)
@@ -22,6 +22,7 @@
 
 messages -> RemoteWebInspectorProxy {
     FrontendDidClose()
+    Reopen()
     BringToFront()
 
     Save(String filename, String content, bool base64Encoded, bool forceSaveAs)
index 5a9b0fc..f018459 100644 (file)
@@ -128,6 +128,11 @@ void RemoteWebInspectorUI::closeWindow()
     WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::FrontendDidClose(), m_page.pageID());
 }
 
+void RemoteWebInspectorUI::reopen()
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::Reopen(), m_page.pageID());
+}
+
 void RemoteWebInspectorUI::openInNewTab(const String& url)
 {
     WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::OpenInNewTab(url), m_page.pageID());
index 6e0f9b8..f6e17f9 100644 (file)
@@ -66,6 +66,7 @@ public:
 
     void bringToFront() override;
     void closeWindow() override;
+    void reopen() override;
 
     void openInNewTab(const String& url) override;
     void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs) override;
index a6f224b..3751083 100644 (file)
@@ -142,6 +142,12 @@ void WebInspector::close()
     closeFrontendConnection();
 }
 
+void WebInspector::reopen()
+{
+    close();
+    show();
+}
+
 void WebInspector::openInNewTab(const String& urlString)
 {
     UserGestureIndicator indicator { ProcessingUserGesture };
index e50396d..33a11d0 100644 (file)
@@ -52,6 +52,7 @@ public:
 
     void show();
     void close();
+    void reopen();
 
     void openInNewTab(const String& urlString);
 
index bd754c1..bcb3f15 100644 (file)
@@ -23,6 +23,7 @@
 messages -> WebInspector {
     Show()
     Close()
+    Reopen()
 
     SetAttached(bool attached)
 
index 32853ad..dbb372c 100644 (file)
@@ -167,6 +167,12 @@ void WebInspectorUI::closeWindow()
     m_underTest = false;
 }
 
+void WebInspectorUI::reopen()
+{
+    if (m_backendConnection)
+        m_backendConnection->send(Messages::WebInspector::Reopen(), 0);
+}
+
 WebCore::UserInterfaceLayoutDirection WebInspectorUI::userInterfaceLayoutDirection() const
 {
     return m_page.corePage()->userInterfaceLayoutDirection();
index 81e08b1..243d487 100644 (file)
@@ -92,6 +92,7 @@ public:
 
     void bringToFront() override;
     void closeWindow() override;
+    void reopen() override;
 
     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const override;
 
index 75764fa..5b6931a 100644 (file)
@@ -1,3 +1,14 @@
+2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: "Reload Web Inspector" button no longer partially works
+        https://bugs.webkit.org/show_bug.cgi?id=191773
+        <rdar://problem/46139932>
+
+        Reviewed by Devin Rousso.
+
+        * WebCoreSupport/WebInspectorClientIOS.mm:
+        (WebInspectorFrontendClient::reopen):
+
 2018-10-18  Alexey Proskuryakov  <ap@apple.com>
 
         Switch from PLATFORM(IOS) to PLATFORM(IOS_FAMILY)
index d67aa5d..e8c2ee5 100644 (file)
@@ -125,6 +125,7 @@ void WebInspectorFrontendClient::frontendLoaded() { }
 String WebInspectorFrontendClient::localizedStringsURL() { return String(); }
 void WebInspectorFrontendClient::bringToFront() { }
 void WebInspectorFrontendClient::closeWindow() { }
+void WebInspectorFrontendClient::reopen() { }
 void WebInspectorFrontendClient::attachWindow(DockSide) { }
 void WebInspectorFrontendClient::detachWindow() { }
 void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned) { }
index 5a18503..61f00d3 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: "Reload Web Inspector" button no longer partially works
+        https://bugs.webkit.org/show_bug.cgi?id=191773
+        <rdar://problem/46139932>
+
+        Reviewed by Devin Rousso.
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorFrontendClient::reopen):
+
 2018-11-17  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Network: add button to show system certificate dialog
index 03839e7..8ce97b8 100644 (file)
@@ -117,6 +117,7 @@ public:
 
     void bringToFront() override;
     void closeWindow() override;
+    void reopen() override;
 
     void attachWindow(DockSide) override;
     void detachWindow() override;
index 1010c7b..dc6c3b8 100644 (file)
@@ -250,6 +250,13 @@ void WebInspectorFrontendClient::closeWindow()
     [m_frontendWindowController.get() destroyInspectorView];
 }
 
+void WebInspectorFrontendClient::reopen()
+{
+    WebInspector* inspector = [m_inspectedWebView inspector];
+    [inspector close:nil];
+    [inspector show:nil];
+}
+
 void WebInspectorFrontendClient::attachWindow(DockSide)
 {
     if ([m_frontendWindowController.get() attached])
@@ -691,8 +698,7 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String
         return;
     _destroyingInspectorView = YES;
 
-    if (_attachedToInspectedWebView)
-        [self close];
+    [self close];
 
     _visible = NO;
 
index b059834..b1d8b0b 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: "Reload Web Inspector" button no longer partially works
+        https://bugs.webkit.org/show_bug.cgi?id=191773
+        <rdar://problem/46139932>
+
+        Reviewed by Devin Rousso.
+
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorFrontendClient::reopen):
+        * WebCoreSupport/WebInspectorClient.h:
+
 2018-11-17  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Network: add button to show system certificate dialog
index f6b2178..221e22f 100644 (file)
@@ -270,6 +270,14 @@ void WebInspectorFrontendClient::closeWindow()
     destroyInspectorView();
 }
 
+void WebInspectorFrontendClient::reopen()
+{
+    destroyInspectorView();
+
+    if (Page* inspectedPage = m_inspectedWebView->page())
+        inspectedPage->inspectorController().show();
+}
+
 void WebInspectorFrontendClient::attachWindow(DockSide)
 {
     if (m_attached)
index 81d5812..edde6f5 100644 (file)
@@ -103,6 +103,7 @@ public:
 
     void bringToFront() override;
     void closeWindow() override;
+    void reopen() override;
 
     void setAttachedWindowHeight(unsigned) override;
     void setAttachedWindowWidth(unsigned) override;