Changeset 248454 in webkit


Ignore:
Timestamp:
Aug 8, 2019 6:10:41 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Page: don't allow the domain to be disabled
https://bugs.webkit.org/show_bug.cgi?id=200109

Reviewed by Brian Burg.

Source/JavaScriptCore:

The PageAgent is relied on by many of the other agents, so much so that it doesn't make
sense to support the ability to "disable" (as well as "enable") the agent.

When the first frontend connects, we should treat the PageAgent as active and available.

  • inspector/protocol/Page.json:

Remove enable/disable.

Source/WebCore:

The PageAgent is relied on by many of the other agents, so much so that it doesn't make
sense to support the ability to "disable" (as well as "enable") the agent.

When the first frontend connects, we should treat the PageAgent as active and available.

  • inspector/agents/InspectorPageAgent.h:
  • inspector/agents/InspectorPageAgent.cpp:

(WebCore::InspectorPageAgent::didCreateFrontendAndBackend):
(WebCore::InspectorPageAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorPageAgent::timestamp):
(WebCore::InspectorPageAgent::enable): Deleted.
(WebCore::InspectorPageAgent::disable): Deleted.

  • inspector/agents/InspectorApplicationCacheAgent.cpp:

(WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
(WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
(WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):

  • inspector/agents/InspectorCSSAgent.cpp:

(WebCore::InspectorCSSAgent::createStyleSheet):

  • inspector/agents/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::highlightSelector):
(WebCore::InspectorDOMAgent::highlightFrame):
(WebCore::InspectorDOMAgent::buildObjectForNode):

  • inspector/agents/InspectorTimelineAgent.cpp:

(WebCore::InspectorTimelineAgent::setFrameIdentifier):

  • inspector/agents/page/PageNetworkAgent.cpp:

(WebCore::PageNetworkAgent::loaderIdentifier):
(WebCore::PageNetworkAgent::frameIdentifier):
(WebCore::PageNetworkAgent::scriptExecutionContext):

  • inspector/agents/page/PageRuntimeAgent.cpp:

(WebCore::PageRuntimeAgent::didCreateMainWorldContext):
(WebCore::PageRuntimeAgent::reportExecutionContextCreation):

  • testing/Internals.cpp:

(WebCore::InspectorStubFrontend::InspectorStubFrontend):
(WebCore::InspectorStubFrontend::frontendLoaded): Added.
(WebCore::InspectorStubFrontend::closeWindow):
(WebCore::InspectorStubFrontend::sendMessageToFrontend):
(WebCore::InspectorStubFrontend::frontendPage): Deleted.
Ensure that the backend always gets notified via InspectorFrontendHost.loaded so that
messages being sent to the frontend are batched.

Source/WebInspectorUI:

The PageAgent is relied on by many of the other agents, so much so that it doesn't make
sense to support the ability to "disable" (as well as "enable") the agent.

When the first frontend connects, we should treat the PageAgent as active and available.

  • UserInterface/Controllers/NetworkManager.js:

(WI.NetworkManager.prototype.initializeTarget):

  • Test/Test.js:

(WI.loaded):
(WI.initializeBackendTarget):
(WI.contentLoaded):
(WI.targetsAvailable): Added.
(WI.whenTargetsAvailable): Added.

  • Test/TestStub.js:

Ensure that the backend always gets notified via InspectorFrontendHost.loaded so that
messages being sent to the frontend are batched.

LayoutTests:

  • http/tests/inspector/page/loading-iframe-document-node.html:
  • inspector/page/archive.html:
  • inspector/page/frameScheduledNavigation.html:
  • inspector/page/frameScheduledNavigation-async-delegates.html:
  • inspector/page/frameStartedLoading.html:
  • inspector/page/media-query-list-listener-exception.html:
  • inspector/timeline/line-column.html:
Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248448 r248454  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Page: don't allow the domain to be disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=200109
     5
     6        Reviewed by Brian Burg.
     7
     8        * http/tests/inspector/page/loading-iframe-document-node.html:
     9        * inspector/page/archive.html:
     10        * inspector/page/frameScheduledNavigation.html:
     11        * inspector/page/frameScheduledNavigation-async-delegates.html:
     12        * inspector/page/frameStartedLoading.html:
     13        * inspector/page/media-query-list-listener-exception.html:
     14        * inspector/timeline/line-column.html:
     15
    1162019-08-08  Chris Lord  <chrislord.net@gmail.com>
    217
  • trunk/LayoutTests/http/tests/inspector/page/loading-iframe-document-node.html

    r188267 r248454  
    3636    function step1_bootstrap() {
    3737        ProtocolTest.log("step1_bootstrap");
    38         // Enable the frame events.
    39         InspectorProtocol.sendCommand("Page.enable", {}, function() {
    40             // Enable the Runtime.executionContextCreated event.
    41             InspectorProtocol.sendCommand("Runtime.enable", {}, function() {
    42                 // Initialize the DOM agent.
    43                 InspectorProtocol.sendCommand("DOM.getDocument", {}, function() {
    44                     ProtocolTest.log("Main document loaded");
    45                    
    46                     // Add the iframe to the DOM.
    47                     InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "appendIframe()" });
    48                 });
     38        // Enable the Runtime.executionContextCreated event.
     39        InspectorProtocol.sendCommand("Runtime.enable", {}, function() {
     40            // Initialize the DOM agent.
     41            InspectorProtocol.sendCommand("DOM.getDocument", {}, function() {
     42                ProtocolTest.log("Main document loaded");
     43               
     44                // Add the iframe to the DOM.
     45                InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "appendIframe()" });
    4946            });
    5047        });
  • trunk/LayoutTests/inspector/page/archive.html

    r210062 r248454  
    55function test()
    66{
    7     InspectorProtocol.sendCommand("Page.enable", {});
    87    InspectorProtocol.sendCommand("Page.archive", {}, function(event) {
    98        var data = event.result.data;
  • trunk/LayoutTests/inspector/page/frameScheduledNavigation-async-delegates.html

    r229502 r248454  
    1717    InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted;
    1818    InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
    19     InspectorProtocol.sendCommand("Page.enable", {});
    2019
    2120    function onScheduled(msg)
  • trunk/LayoutTests/inspector/page/frameScheduledNavigation.html

    r229502 r248454  
    1414    InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted;
    1515    InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
    16     InspectorProtocol.sendCommand("Page.enable", {});
    1716
    1817    function onScheduled(msg)
  • trunk/LayoutTests/inspector/page/frameStartedLoading.html

    r210062 r248454  
    1515    InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStart;
    1616    InspectorProtocol.eventHandler["Page.frameStoppedLoading"] = onStop;
    17     InspectorProtocol.sendCommand("Page.enable", {});
    1817
    1918    function onStart()
  • trunk/LayoutTests/inspector/page/media-query-list-listener-exception.html

    r208779 r248454  
    1111function test()
    1212{
    13     InspectorProtocol.sendCommand("Page.enable", {});
    1413    InspectorProtocol.sendCommand("Page.setEmulatedMedia", {"media": "print"}, function(messageObject) {
    1514        if (messageObject.error)
  • trunk/LayoutTests/inspector/timeline/line-column.html

    r248286 r248454  
    3838    let suite = ProtocolTest.createAsyncSuite("Timeline.LineColumn");
    3939
    40     InspectorProtocol.sendCommand("Page.enable");
    4140    InspectorProtocol.sendCommand("Timeline.enable");
    4241
  • trunk/Source/JavaScriptCore/ChangeLog

    r248441 r248454  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Page: don't allow the domain to be disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=200109
     5
     6        Reviewed by Brian Burg.
     7
     8        The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
     9        sense to support the ability to "disable" (as well as "enable") the agent.
     10
     11        When the first frontend connects, we should treat the `PageAgent` as active and available.
     12
     13        * inspector/protocol/Page.json:
     14        Remove `enable`/`disable`.
     15
    1162019-08-08  Michael Saboff  <msaboff@apple.com>
    217
  • trunk/Source/JavaScriptCore/inspector/protocol/Page.json

    r248274 r248454  
    112112    "commands": [
    113113        {
    114             "name": "enable",
    115             "description": "Enables page domain notifications."
    116         },
    117         {
    118             "name": "disable",
    119             "description": "Disables page domain notifications."
    120         },
    121         {
    122114            "name": "reload",
    123115            "description": "Reloads the main frame of the inspected page.",
  • trunk/Source/WebCore/ChangeLog

    r248448 r248454  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Page: don't allow the domain to be disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=200109
     5
     6        Reviewed by Brian Burg.
     7
     8        The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
     9        sense to support the ability to "disable" (as well as "enable") the agent.
     10
     11        When the first frontend connects, we should treat the `PageAgent` as active and available.
     12
     13        * inspector/agents/InspectorPageAgent.h:
     14        * inspector/agents/InspectorPageAgent.cpp:
     15        (WebCore::InspectorPageAgent::didCreateFrontendAndBackend):
     16        (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend):
     17        (WebCore::InspectorPageAgent::timestamp):
     18        (WebCore::InspectorPageAgent::enable): Deleted.
     19        (WebCore::InspectorPageAgent::disable): Deleted.
     20
     21        * inspector/agents/InspectorApplicationCacheAgent.cpp:
     22        (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
     23        (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
     24        (WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):
     25        * inspector/agents/InspectorCSSAgent.cpp:
     26        (WebCore::InspectorCSSAgent::createStyleSheet):
     27        * inspector/agents/InspectorDOMAgent.cpp:
     28        (WebCore::InspectorDOMAgent::highlightSelector):
     29        (WebCore::InspectorDOMAgent::highlightFrame):
     30        (WebCore::InspectorDOMAgent::buildObjectForNode):
     31        * inspector/agents/InspectorTimelineAgent.cpp:
     32        (WebCore::InspectorTimelineAgent::setFrameIdentifier):
     33        * inspector/agents/page/PageNetworkAgent.cpp:
     34        (WebCore::PageNetworkAgent::loaderIdentifier):
     35        (WebCore::PageNetworkAgent::frameIdentifier):
     36        (WebCore::PageNetworkAgent::scriptExecutionContext):
     37        * inspector/agents/page/PageRuntimeAgent.cpp:
     38        (WebCore::PageRuntimeAgent::didCreateMainWorldContext):
     39        (WebCore::PageRuntimeAgent::reportExecutionContextCreation):
     40
     41        * testing/Internals.cpp:
     42        (WebCore::InspectorStubFrontend::InspectorStubFrontend):
     43        (WebCore::InspectorStubFrontend::frontendLoaded): Added.
     44        (WebCore::InspectorStubFrontend::closeWindow):
     45        (WebCore::InspectorStubFrontend::sendMessageToFrontend):
     46        (WebCore::InspectorStubFrontend::frontendPage): Deleted.
     47        Ensure that the backend always gets notified via `InspectorFrontendHost.loaded` so that
     48        messages being sent to the frontend are batched.
     49
    1502019-08-08  Chris Lord  <clord@igalia.com>
    251
  • trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp

    r248179 r248454  
    8686void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame)
    8787{
    88     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    89     if (!pageAgent)
    90         return;
    91 
    9288    if (!frame)
    9389        return;
     
    10197    auto manifestURL = host.applicationCacheInfo().manifest.string();
    10298
    103     m_frontendDispatcher->applicationCacheStatusUpdated(pageAgent->frameId(frame), manifestURL, status);
     99    m_frontendDispatcher->applicationCacheStatusUpdated(m_instrumentingAgents.inspectorPageAgent()->frameId(frame), manifestURL, status);
    104100}
    105101
     
    112108{
    113109    result = JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>::create();
    114 
    115     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    116110
    117111    for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
     
    124118        if (!manifestURL.isEmpty()) {
    125119            result->addItem(Inspector::Protocol::ApplicationCache::FrameWithManifest::create()
    126                 .setFrameId(pageAgent->frameId(frame))
     120                .setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(frame))
    127121                .setManifestURL(manifestURL)
    128122                .setStatus(static_cast<int>(host.status()))
     
    134128DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(ErrorString& errorString, const String& frameId)
    135129{
    136     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    137     if (!pageAgent) {
    138         errorString = "Missing Page agent"_s;
    139         return nullptr;
    140     }
    141 
    142     Frame* frame = pageAgent->assertFrame(errorString, frameId);
     130    Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId);
    143131    if (!frame)
    144132        return nullptr;
  • trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp

    r246490 r248454  
    682682void InspectorCSSAgent::createStyleSheet(ErrorString& errorString, const String& frameId, String* styleSheetId)
    683683{
    684     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    685     if (!pageAgent) {
    686         errorString = "Missing Page agent"_s;
    687         return;
    688     }
    689 
    690     Frame* frame = pageAgent->frameForId(frameId);
     684    Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(frameId);
    691685    if (!frame) {
    692686        errorString = "No frame for given id found"_s;
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp

    r248175 r248454  
    12251225
    12261226    if (frameId) {
    1227         auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    1228         if (!pageAgent) {
    1229             errorString = "Missing Page agent"_s;
    1230             return;
    1231         }
    1232 
    1233         Frame* frame = pageAgent->frameForId(*frameId);
     1227        Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(*frameId);
    12341228        if (!frame) {
    12351229            errorString = "No frame for given id found"_s;
     
    13181312void InspectorDOMAgent::highlightFrame(ErrorString& errorString, const String& frameId, const JSON::Object* color, const JSON::Object* outlineColor)
    13191313{
    1320     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    1321     if (!pageAgent) {
    1322         errorString = "Missing Page agent"_s;
    1323         return;
    1324     }
    1325 
    1326     Frame* frame = pageAgent->assertFrame(errorString, frameId);
     1314    Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId);
    13271315    if (!frame)
    13281316        return;
     
    15641552    }
    15651553
    1566     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    1567     if (pageAgent) {
    1568         if (auto* frameView = node->document().view())
    1569             value->setFrameId(pageAgent->frameId(&frameView->frame()));
    1570     }
     1554    if (auto* frameView = node->document().view())
     1555        value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(&frameView->frame()));
    15711556
    15721557    if (is<Element>(*node)) {
     
    16041589    } else if (is<Document>(*node)) {
    16051590        Document& document = downcast<Document>(*node);
    1606         if (pageAgent)
    1607             value->setFrameId(pageAgent->frameId(document.frame()));
     1591        value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(document.frame()));
    16081592        value->setDocumentURL(documentURLString(&document));
    16091593        value->setBaseURL(documentBaseURLString(&document));
  • trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp

    r248274 r248454  
    344344void InspectorPageAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)
    345345{
    346 }
    347 
    348 void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
    349 {
    350     ErrorString unused;
    351     disable(unused);
    352 }
    353 
    354 double InspectorPageAgent::timestamp()
    355 {
    356     return m_environment.executionStopwatch()->elapsedTime().seconds();
    357 }
    358 
    359 void InspectorPageAgent::enable(ErrorString&)
    360 {
    361     if (m_instrumentingAgents.inspectorPageAgent() == this)
    362         return;
    363 
    364346    m_instrumentingAgents.setInspectorPageAgent(this);
    365347
     
    373355}
    374356
    375 void InspectorPageAgent::disable(ErrorString&)
     357void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
    376358{
    377359    ErrorString unused;
     
    392374
    393375    m_instrumentingAgents.setInspectorPageAgent(nullptr);
     376}
     377
     378double InspectorPageAgent::timestamp()
     379{
     380    return m_environment.executionStopwatch()->elapsedTime().seconds();
    394381}
    395382
  • trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h

    r248274 r248454  
    8888    static DocumentLoader* assertDocumentLoader(ErrorString&, Frame*);
    8989
    90     // Page API for InspectorFrontend
    91     void enable(ErrorString&) final;
    92     void disable(ErrorString&) final;
     90    // PageBackendDispatcherHandler
    9391    void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final;
    9492    void navigate(ErrorString&, const String& url) final;
  • trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp

    r248389 r248454  
    741741        return;
    742742
    743     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    744     if (!pageAgent)
    745         return;
    746 
    747     record->setString("frameId"_s, pageAgent->frameId(frame));
     743    record->setString("frameId"_s, m_instrumentingAgents.inspectorPageAgent()->frameId(frame));
    748744}
    749745
  • trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp

    r245508 r248454  
    4949String PageNetworkAgent::loaderIdentifier(DocumentLoader* loader)
    5050{
    51     if (loader) {
    52         if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent())
    53             return pageAgent->loaderId(loader);
    54     }
     51    if (loader)
     52        return m_instrumentingAgents.inspectorPageAgent()->loaderId(loader);
    5553    return { };
    5654}
     
    5856String PageNetworkAgent::frameIdentifier(DocumentLoader* loader)
    5957{
    60     if (loader) {
    61         if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent())
    62             return pageAgent->frameId(loader->frame());
    63     }
     58    if (loader)
     59        return m_instrumentingAgents.inspectorPageAgent()->frameId(loader->frame());
    6460    return { };
    6561}
     
    10197ScriptExecutionContext* PageNetworkAgent::scriptExecutionContext(ErrorString& errorString, const String& frameId)
    10298{
    103     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    104     if (!pageAgent) {
    105         errorString = "Missing Page agent"_s;
    106         return nullptr;
    107     }
    108 
    109     auto* frame = pageAgent->assertFrame(errorString, frameId);
     99    auto* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId);
    110100    if (!frame)
    111101        return nullptr;
  • trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp

    r245366 r248454  
    8686void PageRuntimeAgent::didCreateMainWorldContext(Frame& frame)
    8787{
    88     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    89     if (!pageAgent)
    90         return;
    91 
    92     auto frameId = pageAgent->frameId(&frame);
     88    auto frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(&frame);
    9389    auto* scriptState = mainWorldExecState(&frame);
    9490    notifyContextCreated(frameId, scriptState, nullptr, true);
     
    123119void PageRuntimeAgent::reportExecutionContextCreation()
    124120{
    125     auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
    126     if (!pageAgent)
    127         return;
    128 
    129121    Vector<std::pair<JSC::ExecState*, SecurityOrigin*>> isolatedContexts;
    130122    for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
    131123        if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
    132124            continue;
    133         String frameId = pageAgent->frameId(frame);
     125        String frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(frame);
    134126
    135127        JSC::ExecState* scriptState = mainWorldExecState(frame);
  • trunk/Source/WebCore/testing/Internals.cpp

    r248373 r248454  
    323323
    324324private:
     325    void frontendLoaded() final;
    325326    void attachWindow(DockSide) final { }
    326327    void detachWindow() final { }
     
    338339    ConnectionType connectionType() const final { return ConnectionType::Local; }
    339340
    340     Page* frontendPage() const
    341     {
    342         if (!m_frontendWindow || !m_frontendWindow->document())
    343             return nullptr;
    344 
    345         return m_frontendWindow->document()->page();
    346     }
    347 
    348341    RefPtr<DOMWindow> m_frontendWindow;
    349     InspectorController& m_frontendController;
     342    Vector<String> m_messages;
     343    bool m_loaded { false };
    350344};
    351345
     
    353347    : InspectorFrontendClientLocal(&inspectedPage.inspectorController(), frontendWindow->document()->page(), std::make_unique<InspectorFrontendClientLocal::Settings>())
    354348    , m_frontendWindow(frontendWindow.copyRef())
    355     , m_frontendController(frontendPage()->inspectorController())
    356349{
    357350    ASSERT_ARG(frontendWindow, frontendWindow);
    358351
    359     m_frontendController.setInspectorFrontendClient(this);
     352    frontendPage()->inspectorController().setInspectorFrontendClient(this);
    360353    inspectedPage.inspectorController().connectFrontend(*this);
    361354}
     
    366359}
    367360
     361void InspectorStubFrontend::frontendLoaded()
     362{
     363    m_loaded = true;
     364
     365    for (auto& message : m_messages)
     366        sendMessageToFrontend(message);
     367    m_messages.clear();
     368}
     369
    368370void InspectorStubFrontend::closeWindow()
    369371{
     
    371373        return;
    372374
    373     m_frontendController.setInspectorFrontendClient(nullptr);
     375    frontendPage()->inspectorController().setInspectorFrontendClient(nullptr);
    374376    inspectedPage()->inspectorController().disconnectFrontend(*this);
    375377
     
    381383{
    382384    ASSERT_ARG(message, !message.isEmpty());
     385
     386    if (!m_loaded) {
     387        m_messages.append(message);
     388        return;
     389    }
    383390
    384391    InspectorClient::doDispatchMessageOnFrontendPage(frontendPage(), message);
  • trunk/Source/WebInspectorUI/ChangeLog

    r248434 r248454  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Page: don't allow the domain to be disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=200109
     5
     6        Reviewed by Brian Burg.
     7
     8        The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
     9        sense to support the ability to "disable" (as well as "enable") the agent.
     10
     11        When the first frontend connects, we should treat the `PageAgent` as active and available.
     12
     13        * UserInterface/Controllers/NetworkManager.js:
     14        (WI.NetworkManager.prototype.initializeTarget):
     15
     16        * Test/Test.js:
     17        (WI.loaded):
     18        (WI.initializeBackendTarget):
     19        (WI.contentLoaded):
     20        (WI.targetsAvailable): Added.
     21        (WI.whenTargetsAvailable): Added.
     22        * Test/TestStub.js:
     23        Ensure that the backend always gets notified via `InspectorFrontendHost.loaded` so that
     24        messages being sent to the frontend are batched.
     25
    1262019-08-08  Devin Rousso  <drousso@apple.com>
    227
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js

    r246953 r248454  
    7777    {
    7878        if (target.PageAgent) {
    79             target.PageAgent.enable();
     79            // COMPATIBILITY (iOS 13): Page.enable was removed.
     80            if (target.PageAgent.enable)
     81                target.PageAgent.enable();
     82
    8083            target.PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
    8184        }
  • trunk/Source/WebInspectorUI/UserInterface/Test/Test.js

    r248286 r248454  
    7878    WI.backendTarget = null;
    7979    WI.pageTarget = null;
     80    WI._targetsAvailablePromise = new WI.WrappedPromise;
    8081
    8182    // FIXME: Eliminate `TargetAgent.exists`.
     
    9192
    9293    WI.resetMainExecutionContext();
     94
     95    WI._targetsAvailablePromise.resolve();
    9396};
    9497
     
    143146
    144147    // Signal that the frontend is now ready to receive messages.
    145     InspectorFrontendAPI.loadCompleted();
     148    WI.whenTargetsAvailable().then(() => {
     149        InspectorFrontendAPI.loadCompleted();
     150    });
    146151
    147152    // Tell the InspectorFrontendHost we loaded, which causes the window to display
     
    168173};
    169174
     175WI.targetsAvailable = function()
     176{
     177    return WI._targetsAvailablePromise.settled;
     178};
     179
     180WI.whenTargetsAvailable = function()
     181{
     182    return WI._targetsAvailablePromise.promise;
     183};
     184
    170185Object.defineProperty(WI, "mainTarget",
    171186{
  • trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js

    r188639 r248454  
    3030window.ProtocolTest = new ProtocolTestHarness();
    3131
     32document.addEventListener("DOMContentLoaded", (event) => {
     33    InspectorFrontendHost.loaded();
     34});
     35
    3236window.addEventListener("message", (event) => {
    3337    try {
Note: See TracChangeset for help on using the changeset viewer.