Title: [200276] trunk/Source
Revision
200276
Author
commit-qu...@webkit.org
Date
2016-04-29 18:47:22 -0700 (Fri, 29 Apr 2016)

Log Message

Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
https://bugs.webkit.org/show_bug.cgi?id=157198
<rdar://problem/26011049>

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-04-29
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

* inspector/InspectorBackendDispatcher.cpp:
(Inspector::BackendDispatcher::sendResponse):
While auditing the code, add a WTFMove.

Source/WebCore:

No new tests. This only affects inspecting an inspector.

* inspector/InspectorController.h:
* inspector/InspectorFrontendClient.h:
(WebCore::InspectorFrontendClient::pagePaused):
(WebCore::InspectorFrontendClient::pageUnpaused):
* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::setJavaScriptPaused):
Inform a frontend client if the frontend page itself pauses/unpauses.

Source/WebInspectorUI:

* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackendClass.prototype._sendCommandToBackendWithCallback):
(InspectorBackendClass.prototype._sendCommandToBackendExpectingPromise):
While auditing, use simpler check.

* UserInterface/Proxies/FormatterWorkerProxy.js:
(WebInspector.FormatterWorkerProxy.canFormat): Deleted.
While auditing, remove dead code.

Source/WebKit2:

* WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h:
* WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp:
(WebKit::WebInspectorFrontendAPIDispatcher::reset):
(WebKit::WebInspectorFrontendAPIDispatcher::frontendLoaded):
(WebKit::WebInspectorFrontendAPIDispatcher::suspend):
(WebKit::WebInspectorFrontendAPIDispatcher::unsuspend):
(WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand):
(WebKit::WebInspectorFrontendAPIDispatcher::dispatchMessageAsync):
(WebKit::WebInspectorFrontendAPIDispatcher::evaluateOrQueueExpression):
(WebKit::WebInspectorFrontendAPIDispatcher::evaluateQueuedExpressions):
Avoid evaluating expressions when the page is paused. Generalize the
message queueing and dispatching for pause/suspend that we already
had for waiting for the frontend page to be loaded.

* WebProcess/WebPage/WebInspectorUI.h:
* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::pagePaused):
(WebKit::WebInspectorUI::pageUnpaused):
When the frontend page pauses/unpauses, suspend/resume the dispatcher.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (200275 => 200276)


--- trunk/Source/_javascript_Core/ChangeLog	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-04-30 01:47:22 UTC (rev 200276)
@@ -1,3 +1,15 @@
+2016-04-29  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
+        https://bugs.webkit.org/show_bug.cgi?id=157198
+        <rdar://problem/26011049>
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorBackendDispatcher.cpp:
+        (Inspector::BackendDispatcher::sendResponse):
+        While auditing the code, add a WTFMove.
+
 2016-04-29  Mark Lam  <mark....@apple.com>
 
         Make RegExp.prototype.test spec compliant.

Modified: trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp (200275 => 200276)


--- trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp	2016-04-30 01:47:22 UTC (rev 200276)
@@ -192,7 +192,7 @@
     // The JSON-RPC 2.0 specification requires that the "error" member have the value 'null'
     // if no error occurred during an invocation, but we do not include it at all.
     Ref<InspectorObject> responseMessage = InspectorObject::create();
-    responseMessage->setObject(ASCIILiteral("result"), result);
+    responseMessage->setObject(ASCIILiteral("result"), WTFMove(result));
     responseMessage->setInteger(ASCIILiteral("id"), requestId);
     m_frontendRouter->sendResponse(responseMessage->toJSONString());
 }

Modified: trunk/Source/WebCore/ChangeLog (200275 => 200276)


--- trunk/Source/WebCore/ChangeLog	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebCore/ChangeLog	2016-04-30 01:47:22 UTC (rev 200276)
@@ -1,3 +1,21 @@
+2016-04-29  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
+        https://bugs.webkit.org/show_bug.cgi?id=157198
+        <rdar://problem/26011049>
+
+        Reviewed by Timothy Hatcher.
+
+        No new tests. This only affects inspecting an inspector.
+
+        * inspector/InspectorController.h:
+        * inspector/InspectorFrontendClient.h:
+        (WebCore::InspectorFrontendClient::pagePaused):
+        (WebCore::InspectorFrontendClient::pageUnpaused):
+        * inspector/PageScriptDebugServer.cpp:
+        (WebCore::PageScriptDebugServer::setJavaScriptPaused):
+        Inform a frontend client if the frontend page itself pauses/unpauses.
+
 2016-04-29  Eric Carlson  <eric.carl...@apple.com>
 
         [iOS] do not exit AirPlay when the screen locks

Modified: trunk/Source/WebCore/inspector/InspectorController.h (200275 => 200276)


--- trunk/Source/WebCore/inspector/InspectorController.h	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebCore/inspector/InspectorController.h	2016-04-30 01:47:22 UTC (rev 200276)
@@ -115,6 +115,7 @@
     WEBCORE_EXPORT void setLegacyProfilerEnabled(bool);
 
     InspectorClient* inspectorClient() const { return m_inspectorClient; }
+    InspectorFrontendClient* inspectorFrontendClient() const { return m_inspectorFrontendClient; }
     InspectorPageAgent* pageAgent() const { return m_pageAgent; }
 
     bool developerExtrasEnabled() const override;

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (200275 => 200276)


--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2016-04-30 01:47:22 UTC (rev 200276)
@@ -72,6 +72,9 @@
 
     virtual void inspectedURLChanged(const String&) = 0;
 
+    virtual void pagePaused() { }
+    virtual void pageUnpaused() { }
+
     WEBCORE_EXPORT virtual void sendMessageToBackend(const String&) = 0;
 
     WEBCORE_EXPORT virtual bool isUnderTest() = 0;

Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp (200275 => 200276)


--- trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp	2016-04-30 01:47:22 UTC (rev 200276)
@@ -30,6 +30,8 @@
 #include "Document.h"
 #include "EventLoop.h"
 #include "FrameView.h"
+#include "InspectorController.h"
+#include "InspectorFrontendClient.h"
 #include "JSDOMWindowCustom.h"
 #include "MainFrame.h"
 #include "Page.h"
@@ -142,6 +144,13 @@
 
     for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
         setJavaScriptPaused(frame, paused);
+
+    if (InspectorFrontendClient* frontendClient = page->inspectorController().inspectorFrontendClient()) {
+        if (paused)
+            frontendClient->pagePaused();
+        else
+            frontendClient->pageUnpaused();
+    }
 }
 
 void PageScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused)

Modified: trunk/Source/WebInspectorUI/ChangeLog (200275 => 200276)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-04-30 01:47:22 UTC (rev 200276)
@@ -1,3 +1,20 @@
+2016-04-29  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
+        https://bugs.webkit.org/show_bug.cgi?id=157198
+        <rdar://problem/26011049>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Protocol/InspectorBackend.js:
+        (InspectorBackendClass.prototype._sendCommandToBackendWithCallback):
+        (InspectorBackendClass.prototype._sendCommandToBackendExpectingPromise):
+        While auditing, use simpler check.
+
+        * UserInterface/Proxies/FormatterWorkerProxy.js:
+        (WebInspector.FormatterWorkerProxy.canFormat): Deleted.
+        While auditing, remove dead code.
+
 2016-04-29  Timothy Hatcher  <timo...@apple.com>
 
         Web Inspector: Scrolling in Timelines causes flashing of the DataGrid

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (200275 => 200276)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2016-04-30 01:47:22 UTC (rev 200276)
@@ -200,7 +200,7 @@
             "method": command.qualifiedName,
         };
 
-        if (Object.keys(parameters).length)
+        if (!isEmptyObject(parameters))
             messageObject["params"] = parameters;
 
         let responseData = {command, callback};
@@ -221,7 +221,7 @@
             "method": command.qualifiedName,
         };
 
-        if (Object.keys(parameters).length)
+        if (!isEmptyObject(parameters))
             messageObject["params"] = parameters;
 
         let responseData = {command};

Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js (200275 => 200276)


--- trunk/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js	2016-04-30 01:47:22 UTC (rev 200276)
@@ -45,10 +45,6 @@
         return FormatterWorkerProxy.instance;
     }
 
-    static canFormat(mimeType)
-    {
-    }
-
     // Actions
 
     formatJavaScript(sourceText, indentString, includeSourceMapData)

Modified: trunk/Source/WebKit2/ChangeLog (200275 => 200276)


--- trunk/Source/WebKit2/ChangeLog	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-30 01:47:22 UTC (rev 200276)
@@ -1,3 +1,31 @@
+2016-04-29  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
+        https://bugs.webkit.org/show_bug.cgi?id=157198
+        <rdar://problem/26011049>
+
+        Reviewed by Timothy Hatcher.
+
+        * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h:
+        * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp:
+        (WebKit::WebInspectorFrontendAPIDispatcher::reset):
+        (WebKit::WebInspectorFrontendAPIDispatcher::frontendLoaded):
+        (WebKit::WebInspectorFrontendAPIDispatcher::suspend):
+        (WebKit::WebInspectorFrontendAPIDispatcher::unsuspend):
+        (WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand):
+        (WebKit::WebInspectorFrontendAPIDispatcher::dispatchMessageAsync):
+        (WebKit::WebInspectorFrontendAPIDispatcher::evaluateOrQueueExpression):
+        (WebKit::WebInspectorFrontendAPIDispatcher::evaluateQueuedExpressions):
+        Avoid evaluating expressions when the page is paused. Generalize the
+        message queueing and dispatching for pause/suspend that we already
+        had for waiting for the frontend page to be loaded.
+
+        * WebProcess/WebPage/WebInspectorUI.h:
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::pagePaused):
+        (WebKit::WebInspectorUI::pageUnpaused):
+        When the frontend page pauses/unpauses, suspend/resume the dispatcher.
+
 2016-04-29  Chris Dumez  <cdu...@apple.com>
 
         Remove unnecessary isolated String copying from one of NetworkCache::Key's constructor

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp (200275 => 200276)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp	2016-04-30 01:47:22 UTC (rev 200276)
@@ -27,7 +27,6 @@
 #include "WebInspectorFrontendAPIDispatcher.h"
 
 #include "WebPage.h"
-#include <_javascript_Core/ScriptValue.h>
 #include <WebCore/MainFrame.h>
 #include <WebCore/ScriptController.h>
 #include <WebCore/ScriptState.h>
@@ -42,7 +41,7 @@
 void WebInspectorFrontendAPIDispatcher::reset()
 {
     m_frontendLoaded = false;
-
+    m_suspended = false;
     m_queue.clear();
 }
 
@@ -50,41 +49,70 @@
 {
     m_frontendLoaded = true;
 
-    for (const String& _expression_ : m_queue)
-        m_page.corePage()->mainFrame().script().executeScript(_expression_);
+    evaluateQueuedExpressions();
+}
 
-    m_queue.clear();
+void WebInspectorFrontendAPIDispatcher::suspend()
+{
+    ASSERT(m_frontendLoaded);
+    ASSERT(!m_suspended);
+    ASSERT(m_queue.isEmpty());
+
+    m_suspended = true;
 }
 
+void WebInspectorFrontendAPIDispatcher::unsuspend()
+{
+    ASSERT(m_suspended);
+
+    m_suspended = false;
+
+    evaluateQueuedExpressions();
+}
+
 void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command)
 {
-    evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatch([\"", command, "\"])"));
+    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatch([\"", command, "\"])"));
 }
 
 void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command, const String& argument)
 {
-    evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", \"", argument, "\"])"));
+    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", \"", argument, "\"])"));
 }
 
 void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command, bool argument)
 {
-    evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", ", argument ? "true" : "false", "])"));
+    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", ", argument ? "true" : "false", "])"));
 }
 
 void WebInspectorFrontendAPIDispatcher::dispatchMessageAsync(const String& message)
 {
-    evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatchMessageAsync(", message, ")"));
+    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatchMessageAsync(", message, ")"));
 }
 
-void WebInspectorFrontendAPIDispatcher::evaluateExpressionOnLoad(const String& _expression_)
+void WebInspectorFrontendAPIDispatcher::evaluateOrQueueExpression(const String& _expression_)
 {
-    if (m_frontendLoaded) {
-        ASSERT(m_queue.isEmpty());
-        m_page.corePage()->mainFrame().script().executeScript(_expression_);
+    if (!m_frontendLoaded || m_suspended) {
+        m_queue.append(_expression_);
         return;
     }
 
-    m_queue.append(_expression_);
+    ASSERT(m_queue.isEmpty());
+    ASSERT(!m_page.corePage()->mainFrame().script().isPaused());
+    m_page.corePage()->mainFrame().script().executeScript(_expression_);
 }
 
+void WebInspectorFrontendAPIDispatcher::evaluateQueuedExpressions()
+{
+    if (m_queue.isEmpty())
+        return;
+
+    for (const String& _expression_ : m_queue) {
+        ASSERT(!m_page.corePage()->mainFrame().script().isPaused());
+        m_page.corePage()->mainFrame().script().executeScript(_expression_);
+    }
+
+    m_queue.clear();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h (200275 => 200276)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h	2016-04-30 01:47:22 UTC (rev 200276)
@@ -35,22 +35,27 @@
 
 class WebInspectorFrontendAPIDispatcher {
 public:
-    WebInspectorFrontendAPIDispatcher(WebPage& page);
+    WebInspectorFrontendAPIDispatcher(WebPage&);
 
     void reset();
     void frontendLoaded();
 
+    void suspend();
+    void unsuspend();
+
     void dispatchCommand(const String& command);
     void dispatchCommand(const String& command, const String& argument);
     void dispatchCommand(const String& command, bool argument);
     void dispatchMessageAsync(const String& message);
 
 private:
-    void evaluateExpressionOnLoad(const String& _expression_);
+    void evaluateOrQueueExpression(const String&);
+    void evaluateQueuedExpressions();
 
     WebPage& m_page;
     Deque<String> m_queue;
     bool m_frontendLoaded { false };
+    bool m_suspended { false };
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp (200275 => 200276)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp	2016-04-30 01:47:22 UTC (rev 200276)
@@ -258,6 +258,16 @@
     m_frontendAPIDispatcher.dispatchMessageAsync(message);
 }
 
+void WebInspectorUI::pagePaused()
+{
+    m_frontendAPIDispatcher.suspend();
+}
+
+void WebInspectorUI::pageUnpaused()
+{
+    m_frontendAPIDispatcher.unsuspend();
+}
+
 void WebInspectorUI::sendMessageToBackend(const String& message)
 {
     if (m_backendConnection)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h (200275 => 200276)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h	2016-04-30 01:28:22 UTC (rev 200275)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h	2016-04-30 01:47:22 UTC (rev 200276)
@@ -104,6 +104,9 @@
 
     void sendMessageToBackend(const String&) override;
 
+    void pagePaused() override;
+    void pageUnpaused() override;
+
     bool isUnderTest() override { return m_underTest; }
     unsigned inspectionLevel() const override { return m_inspectionLevel; }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to