RESOLVED FIXED 196725
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
Summary Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentati...
Devin Rousso
Reported 2019-04-08 21:08:19 PDT
`WebCore::InspectorFrontendClientLocal::showMainResourceForFrame` and `WebKit::WebInspector::showMainResourceForFrame` both access `WebCore::InspectorController::pageAgent`, even though the underlying `m_pageAgent` isn't instantiated until the first frontend connects.
Attachments
Patch (8.27 KB, patch)
2019-04-08 21:13 PDT, Devin Rousso
no flags
Patch (8.27 KB, patch)
2019-04-09 12:51 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2019-04-08 21:08:40 PDT
Devin Rousso
Comment 2 2019-04-08 21:13:59 PDT
Devin Rousso
Comment 3 2019-04-09 12:51:04 PDT
Timothy Hatcher
Comment 4 2019-04-10 15:19:49 PDT
Comment on attachment 367064 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367064&action=review > Source/WebCore/inspector/InspectorController.h:110 > - InspectorPageAgent* pageAgent() const { return m_pageAgent; } > + > + InspectorDOMAgent& ensureDOMAgent(); > + WEBCORE_EXPORT InspectorPageAgent& ensurePageAgent(); Why not just have pageAgent() and a domAgent() getter create the agents if needed and drop the need for the ensure functions?
Devin Rousso
Comment 5 2019-04-10 15:34:53 PDT
Comment on attachment 367064 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367064&action=review >> Source/WebCore/inspector/InspectorController.h:110 >> + WEBCORE_EXPORT InspectorPageAgent& ensurePageAgent(); > > Why not just have pageAgent() and a domAgent() getter create the agents if needed and drop the need for the ensure functions? I vaguely remember there being a discussion about this style on one of the webkit-* mailing lists. I prefer the "ensure" as it makes it clearer to callers that this function might create an object, rather than just return whatever currently exists.
WebKit Commit Bot
Comment 6 2019-04-10 16:15:14 PDT
Comment on attachment 367064 [details] Patch Clearing flags on attachment: 367064 Committed r244167: <https://trac.webkit.org/changeset/244167>
WebKit Commit Bot
Comment 7 2019-04-10 16:15:15 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.