Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 23:15:08 +0000 (23:15 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 23:15:08 +0000 (23:15 +0000)
commitc4aefa29c0f1835aebc6d046c4f49cadfd4de5cc
treefc03abad9a6a1eaf2d5e50a11f15d007b1d60356
parent08b27b0ecadfc78edf7fb5d997f9eceac788f6ad
Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
https://bugs.webkit.org/show_bug.cgi?id=196725
<rdar://problem/49669810>

Reviewed by Timothy Hatcher.

Source/WebCore:

Move the logic for creating the `InspectorPageAgent` and `InspectorDOMAgent` into separate
functions so that callers into `InspectorController` can be guaranteed to have a valid
instance of the agent.

This doesn't interfere with the `Page.enable` command, as it doesn't clear any saved state.
There is no `DOM.enable` command, so there's no issue there either.

* inspector/InspectorController.h:
(WebCore::InspectorController::pageAgent): Deleted.
* inspector/InspectorController.cpp:
(WebCore::InspectorController::createLazyAgents):
(WebCore::InspectorController::inspect):
(WebCore::InspectorController::hideHighlight):
(WebCore::InspectorController::ensureDOMAgent): Added.
(WebCore::InspectorController::ensurePageAgent): Added.

* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):

Source/WebKit:

* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::showMainResourceForFrame):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebInspector.cpp