Changeset 200276 in webkit


Ignore:
Timestamp:
Apr 29, 2016 6:47:22 PM (8 years ago)
Author:
commit-queue@webkit.org
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 <Joseph Pecoraro> on 2016-04-29
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • 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.

Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r200272 r200276  
     12016-04-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
     4        https://bugs.webkit.org/show_bug.cgi?id=157198
     5        <rdar://problem/26011049>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/InspectorBackendDispatcher.cpp:
     10        (Inspector::BackendDispatcher::sendResponse):
     11        While auditing the code, add a WTFMove.
     12
    1132016-04-29  Mark Lam  <mark.lam@apple.com>
    214
  • trunk/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp

    r194496 r200276  
    193193    // if no error occurred during an invocation, but we do not include it at all.
    194194    Ref<InspectorObject> responseMessage = InspectorObject::create();
    195     responseMessage->setObject(ASCIILiteral("result"), result);
     195    responseMessage->setObject(ASCIILiteral("result"), WTFMove(result));
    196196    responseMessage->setInteger(ASCIILiteral("id"), requestId);
    197197    m_frontendRouter->sendResponse(responseMessage->toJSONString());
  • trunk/Source/WebCore/ChangeLog

    r200273 r200276  
     12016-04-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
     4        https://bugs.webkit.org/show_bug.cgi?id=157198
     5        <rdar://problem/26011049>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        No new tests. This only affects inspecting an inspector.
     10
     11        * inspector/InspectorController.h:
     12        * inspector/InspectorFrontendClient.h:
     13        (WebCore::InspectorFrontendClient::pagePaused):
     14        (WebCore::InspectorFrontendClient::pageUnpaused):
     15        * inspector/PageScriptDebugServer.cpp:
     16        (WebCore::PageScriptDebugServer::setJavaScriptPaused):
     17        Inform a frontend client if the frontend page itself pauses/unpauses.
     18
    1192016-04-29  Eric Carlson  <eric.carlson@apple.com>
    220
  • trunk/Source/WebCore/inspector/InspectorController.h

    r197563 r200276  
    116116
    117117    InspectorClient* inspectorClient() const { return m_inspectorClient; }
     118    InspectorFrontendClient* inspectorFrontendClient() const { return m_inspectorFrontendClient; }
    118119    InspectorPageAgent* pageAgent() const { return m_pageAgent; }
    119120
  • trunk/Source/WebCore/inspector/InspectorFrontendClient.h

    r194322 r200276  
    7373    virtual void inspectedURLChanged(const String&) = 0;
    7474
     75    virtual void pagePaused() { }
     76    virtual void pageUnpaused() { }
     77
    7578    WEBCORE_EXPORT virtual void sendMessageToBackend(const String&) = 0;
    7679
  • trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp

    r198648 r200276  
    3131#include "EventLoop.h"
    3232#include "FrameView.h"
     33#include "InspectorController.h"
     34#include "InspectorFrontendClient.h"
    3335#include "JSDOMWindowCustom.h"
    3436#include "MainFrame.h"
     
    143145    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
    144146        setJavaScriptPaused(frame, paused);
     147
     148    if (InspectorFrontendClient* frontendClient = page->inspectorController().inspectorFrontendClient()) {
     149        if (paused)
     150            frontendClient->pagePaused();
     151        else
     152            frontendClient->pageUnpaused();
     153    }
    145154}
    146155
  • trunk/Source/WebInspectorUI/ChangeLog

    r200270 r200276  
     12016-04-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
     4        https://bugs.webkit.org/show_bug.cgi?id=157198
     5        <rdar://problem/26011049>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Protocol/InspectorBackend.js:
     10        (InspectorBackendClass.prototype._sendCommandToBackendWithCallback):
     11        (InspectorBackendClass.prototype._sendCommandToBackendExpectingPromise):
     12        While auditing, use simpler check.
     13
     14        * UserInterface/Proxies/FormatterWorkerProxy.js:
     15        (WebInspector.FormatterWorkerProxy.canFormat): Deleted.
     16        While auditing, remove dead code.
     17
    1182016-04-29  Timothy Hatcher  <timothy@apple.com>
    219
  • trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js

    r199602 r200276  
    201201        };
    202202
    203         if (Object.keys(parameters).length)
     203        if (!isEmptyObject(parameters))
    204204            messageObject["params"] = parameters;
    205205
     
    222222        };
    223223
    224         if (Object.keys(parameters).length)
     224        if (!isEmptyObject(parameters))
    225225            messageObject["params"] = parameters;
    226226
  • trunk/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js

    r199168 r200276  
    4646    }
    4747
    48     static canFormat(mimeType)
    49     {
    50     }
    51 
    5248    // Actions
    5349
  • trunk/Source/WebKit2/ChangeLog

    r200275 r200276  
     12016-04-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
     4        https://bugs.webkit.org/show_bug.cgi?id=157198
     5        <rdar://problem/26011049>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h:
     10        * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp:
     11        (WebKit::WebInspectorFrontendAPIDispatcher::reset):
     12        (WebKit::WebInspectorFrontendAPIDispatcher::frontendLoaded):
     13        (WebKit::WebInspectorFrontendAPIDispatcher::suspend):
     14        (WebKit::WebInspectorFrontendAPIDispatcher::unsuspend):
     15        (WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand):
     16        (WebKit::WebInspectorFrontendAPIDispatcher::dispatchMessageAsync):
     17        (WebKit::WebInspectorFrontendAPIDispatcher::evaluateOrQueueExpression):
     18        (WebKit::WebInspectorFrontendAPIDispatcher::evaluateQueuedExpressions):
     19        Avoid evaluating expressions when the page is paused. Generalize the
     20        message queueing and dispatching for pause/suspend that we already
     21        had for waiting for the frontend page to be loaded.
     22
     23        * WebProcess/WebPage/WebInspectorUI.h:
     24        * WebProcess/WebPage/WebInspectorUI.cpp:
     25        (WebKit::WebInspectorUI::pagePaused):
     26        (WebKit::WebInspectorUI::pageUnpaused):
     27        When the frontend page pauses/unpauses, suspend/resume the dispatcher.
     28
    1292016-04-29  Chris Dumez  <cdumez@apple.com>
    230
  • trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp

    r189657 r200276  
    2828
    2929#include "WebPage.h"
    30 #include <JavaScriptCore/ScriptValue.h>
    3130#include <WebCore/MainFrame.h>
    3231#include <WebCore/ScriptController.h>
     
    4342{
    4443    m_frontendLoaded = false;
    45 
     44    m_suspended = false;
    4645    m_queue.clear();
    4746}
     
    5150    m_frontendLoaded = true;
    5251
    53     for (const String& expression : m_queue)
     52    evaluateQueuedExpressions();
     53}
     54
     55void WebInspectorFrontendAPIDispatcher::suspend()
     56{
     57    ASSERT(m_frontendLoaded);
     58    ASSERT(!m_suspended);
     59    ASSERT(m_queue.isEmpty());
     60
     61    m_suspended = true;
     62}
     63
     64void WebInspectorFrontendAPIDispatcher::unsuspend()
     65{
     66    ASSERT(m_suspended);
     67
     68    m_suspended = false;
     69
     70    evaluateQueuedExpressions();
     71}
     72
     73void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command)
     74{
     75    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatch([\"", command, "\"])"));
     76}
     77
     78void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command, const String& argument)
     79{
     80    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", \"", argument, "\"])"));
     81}
     82
     83void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command, bool argument)
     84{
     85    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", ", argument ? "true" : "false", "])"));
     86}
     87
     88void WebInspectorFrontendAPIDispatcher::dispatchMessageAsync(const String& message)
     89{
     90    evaluateOrQueueExpression(makeString("InspectorFrontendAPI.dispatchMessageAsync(", message, ")"));
     91}
     92
     93void WebInspectorFrontendAPIDispatcher::evaluateOrQueueExpression(const String& expression)
     94{
     95    if (!m_frontendLoaded || m_suspended) {
     96        m_queue.append(expression);
     97        return;
     98    }
     99
     100    ASSERT(m_queue.isEmpty());
     101    ASSERT(!m_page.corePage()->mainFrame().script().isPaused());
     102    m_page.corePage()->mainFrame().script().executeScript(expression);
     103}
     104
     105void WebInspectorFrontendAPIDispatcher::evaluateQueuedExpressions()
     106{
     107    if (m_queue.isEmpty())
     108        return;
     109
     110    for (const String& expression : m_queue) {
     111        ASSERT(!m_page.corePage()->mainFrame().script().isPaused());
    54112        m_page.corePage()->mainFrame().script().executeScript(expression);
     113    }
    55114
    56115    m_queue.clear();
    57116}
    58117
    59 void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command)
    60 {
    61     evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatch([\"", command, "\"])"));
    62 }
    63 
    64 void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command, const String& argument)
    65 {
    66     evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", \"", argument, "\"])"));
    67 }
    68 
    69 void WebInspectorFrontendAPIDispatcher::dispatchCommand(const String& command, bool argument)
    70 {
    71     evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatch([\"", command, "\", ", argument ? "true" : "false", "])"));
    72 }
    73 
    74 void WebInspectorFrontendAPIDispatcher::dispatchMessageAsync(const String& message)
    75 {
    76     evaluateExpressionOnLoad(makeString("InspectorFrontendAPI.dispatchMessageAsync(", message, ")"));
    77 }
    78 
    79 void WebInspectorFrontendAPIDispatcher::evaluateExpressionOnLoad(const String& expression)
    80 {
    81     if (m_frontendLoaded) {
    82         ASSERT(m_queue.isEmpty());
    83         m_page.corePage()->mainFrame().script().executeScript(expression);
    84         return;
    85     }
    86 
    87     m_queue.append(expression);
    88 }
    89 
    90118} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h

    r189657 r200276  
    3636class WebInspectorFrontendAPIDispatcher {
    3737public:
    38     WebInspectorFrontendAPIDispatcher(WebPage& page);
     38    WebInspectorFrontendAPIDispatcher(WebPage&);
    3939
    4040    void reset();
    4141    void frontendLoaded();
     42
     43    void suspend();
     44    void unsuspend();
    4245
    4346    void dispatchCommand(const String& command);
     
    4750
    4851private:
    49     void evaluateExpressionOnLoad(const String& expression);
     52    void evaluateOrQueueExpression(const String&);
     53    void evaluateQueuedExpressions();
    5054
    5155    WebPage& m_page;
    5256    Deque<String> m_queue;
    5357    bool m_frontendLoaded { false };
     58    bool m_suspended { false };
    5459};
    5560
  • trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp

    r199619 r200276  
    259259}
    260260
     261void WebInspectorUI::pagePaused()
     262{
     263    m_frontendAPIDispatcher.suspend();
     264}
     265
     266void WebInspectorUI::pageUnpaused()
     267{
     268    m_frontendAPIDispatcher.unsuspend();
     269}
     270
    261271void WebInspectorUI::sendMessageToBackend(const String& message)
    262272{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h

    r199380 r200276  
    105105    void sendMessageToBackend(const String&) override;
    106106
     107    void pagePaused() override;
     108    void pageUnpaused() override;
     109
    107110    bool isUnderTest() override { return m_underTest; }
    108111    unsigned inspectionLevel() const override { return m_inspectionLevel; }
Note: See TracChangeset for help on using the changeset viewer.