Summary: | Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Devin Rousso <hi> | ||||||
Component: | Web Inspector | Assignee: | Devin Rousso <hi> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, ews-watchlist, hi, inspector-bugzilla-changes, joepeck, timothy, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 195971 | ||||||||
Attachments: |
|
Description
Devin Rousso
2019-04-08 21:08:19 PDT
Created attachment 367025 [details]
Patch
Created attachment 367064 [details]
Patch
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? 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. Comment on attachment 367064 [details] Patch Clearing flags on attachment: 367064 Committed r244167: <https://trac.webkit.org/changeset/244167> All reviewed patches have been landed. Closing bug. |