⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285771 in webkit


Ignore:
Timestamp:
Nov 12, 2021, 7:22:14 PM (5 years ago)
Author:
timothy@apple.com
Message:

webView._isBeingInspected does not work with Service Worker pages
https://bugs.webkit.org/show_bug.cgi?id=233062
rdar://problem/85354982

Reviewed by Devin Rousso.

  • inspector/WorkerInspectorController.cpp:

(WebCore::WorkerInspectorController::connectFrontend): Call updateServiceWorkerPageFrontendCount().
(WebCore::WorkerInspectorController::disconnectFrontend): Ditto.
(WebCore::WorkerInspectorController::updateServiceWorkerPageFrontendCount): Added.

  • inspector/WorkerInspectorController.h: Added updateServiceWorkerPageFrontendCount().
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285770 r285771  
     12021-11-12  Timothy Hatcher  <timothy@apple.com>
     2
     3        webView._isBeingInspected does not work with Service Worker pages
     4        https://bugs.webkit.org/show_bug.cgi?id=233062
     5        rdar://problem/85354982
     6
     7        Reviewed by Devin Rousso.
     8
     9        * inspector/WorkerInspectorController.cpp:
     10        (WebCore::WorkerInspectorController::connectFrontend): Call updateServiceWorkerPageFrontendCount().
     11        (WebCore::WorkerInspectorController::disconnectFrontend): Ditto.
     12        (WebCore::WorkerInspectorController::updateServiceWorkerPageFrontendCount): Added.
     13        * inspector/WorkerInspectorController.h: Added updateServiceWorkerPageFrontendCount().
     14
    1152021-11-12  Darin Adler  <darin@apple.com>
    216
  • trunk/Source/WebCore/inspector/WorkerInspectorController.cpp

    r268900 r285771  
    4949
    5050#if ENABLE(SERVICE_WORKER)
     51#include "InspectorClient.h"
     52#include "Page.h"
    5153#include "ServiceWorkerAgent.h"
    5254#include "ServiceWorkerGlobalScope.h"
     
    110112    m_frontendRouter->connectFrontend(*m_forwardingChannel.get());
    111113    m_agents.didCreateFrontendAndBackend(&m_frontendRouter.get(), &m_backendDispatcher.get());
     114
     115#if ENABLE(SERVICE_WORKER)
     116    updateServiceWorkerPageFrontendCount();
     117#endif
    112118}
    113119
     
    126132    m_frontendRouter->disconnectFrontend(*m_forwardingChannel.get());
    127133    m_forwardingChannel = nullptr;
    128 }
     134
     135#if ENABLE(SERVICE_WORKER)
     136    updateServiceWorkerPageFrontendCount();
     137#endif
     138}
     139
     140#if ENABLE(SERVICE_WORKER)
     141void WorkerInspectorController::updateServiceWorkerPageFrontendCount()
     142{
     143    if (!is<ServiceWorkerGlobalScope>(m_globalScope))
     144        return;
     145
     146    auto serviceWorkerPage = downcast<ServiceWorkerGlobalScope>(m_globalScope).serviceWorkerPage();
     147    if (!serviceWorkerPage)
     148        return;
     149
     150    ASSERT(isMainThread());
     151
     152    // When a service worker is loaded in a Page, we need to report its inspector frontend count
     153    // up to the page's inspectorController so the client knows about it.
     154    auto inspectorClient = serviceWorkerPage->inspectorController().inspectorClient();
     155    if (!inspectorClient)
     156        return;
     157
     158    inspectorClient->frontendCountChanged(m_frontendRouter->frontendCount());
     159}
     160#endif
    129161
    130162void WorkerInspectorController::dispatchMessageFromFrontend(const String& message)
  • trunk/Source/WebCore/inspector/WorkerInspectorController.h

    r284857 r285771  
    7575    void createLazyAgents();
    7676
     77#if ENABLE(SERVICE_WORKER)
     78    void updateServiceWorkerPageFrontendCount();
     79#endif
     80
    7781    Ref<InstrumentingAgents> m_instrumentingAgents;
    7882    std::unique_ptr<WebInjectedScriptManager> m_injectedScriptManager;
Note: See TracChangeset for help on using the changeset viewer.