WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
210036
Use GlobalFrameIdentifier in NavigationAction
https://bugs.webkit.org/show_bug.cgi?id=210036
Summary
Use GlobalFrameIdentifier in NavigationAction
Rob Buis
Reported
2020-04-05 13:35:30 PDT
Use GlobalFrameIdentifier in NavigationAction rather adding yet another custom data type.
Attachments
Patch
(4.08 KB, patch)
2020-04-05 13:37 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(3.64 KB, patch)
2020-04-05 14:17 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(7.01 KB, patch)
2020-04-06 11:09 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(5.99 KB, patch)
2020-04-06 13:15 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(5.99 KB, patch)
2020-04-07 00:20 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Rob Buis
Comment 1
2020-04-05 13:37:55 PDT
Created
attachment 395523
[details]
Patch
Rob Buis
Comment 2
2020-04-05 14:17:16 PDT
Created
attachment 395527
[details]
Patch
Darin Adler
Comment 3
2020-04-05 15:06:57 PDT
Comment on
attachment 395527
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=395527&action=review
Some comments, not things you really must do, but all a good idea.
> Source/WebCore/loader/NavigationAction.cpp:48 > - , m_pageIDAndFrameIDPair { document.frame() ? std::make_pair(document.frame()->loader().client().pageID().valueOr(PageIdentifier { }), document.frame()->loader().client().frameID().valueOr(FrameIdentifier { })) : std::make_pair<PageIdentifier, FrameIdentifier>({ }, { }) } > { > + if (document.frame()) { > + m_globalFrameIdentifier.pageID = document.frame()->loader().client().pageID().valueOr(PageIdentifier { }); > + m_globalFrameIdentifier.frameID = document.frame()->loader().client().frameID().valueOr(FrameIdentifier { }); > + }
Would be nice to do this with construction, not assignment. Could make a helper function or use a lambda. Would also be nice to refactor not to repeat document.frame() and document.frame()->loader().client(). Should also investigate if we can just pass { } to valueOr without repeating the type.
> Source/WebCore/loader/NavigationAction.h:67 > class Requester {
For future refinement: This seems much more like a struct than a class to me. As long as we pass a const Requester around, that protects us against things being changed. And then there’s no need to have both function and data members for each thing.
> Source/WebCore/loader/NavigationAction.h:74 > + PageIdentifier pageID() const { return m_globalFrameIdentifier.pageID; } > + FrameIdentifier frameID() const { return m_globalFrameIdentifier.frameID; }
Consider eliminating these getters and having a GlobalFrameIdentifier getter instead. Unless it makes the code significantly uglier at the call sites.
> Source/WebCore/loader/NavigationAction.h:77 > RefPtr<SecurityOrigin> m_origin;
This should probably be Ref<> instead of RefPtr<>.
Rob Buis
Comment 4
2020-04-06 11:09:34 PDT
Created
attachment 395589
[details]
Patch
Darin Adler
Comment 5
2020-04-06 11:15:45 PDT
Comment on
attachment 395589
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=395589&action=review
> Source/WebCore/loader/NavigationAction.h:71 > + WEBCORE_EXPORT Requester(const Requester&); > + Requester& operator=(const Requester&);
Would also be nice to add the move constructor and assignment operator for efficiency, otherwise we will copy even when in move contexts. Requester(Requester&&) = default; Requester& operator=(Requester&&) = default;
> Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:948 > + if (const auto& pageID = requester.globalFrameIdentifier().pageID) {
I wouldn’t have bothered with the const here.
Darin Adler
Comment 6
2020-04-06 11:16:25 PDT
Comment on
attachment 395589
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=395589&action=review
> Source/WebCore/loader/NavigationAction.cpp:68 > +NavigationAction::Requester::Requester(const Requester& other) > + : m_url(other.m_url) > + , m_origin(other.m_origin.copyRef()) > + , m_globalFrameIdentifier(other.m_globalFrameIdentifier) > +{ > +} > + > +NavigationAction::Requester& NavigationAction::Requester::operator=(const Requester& other) > { > + m_url = other.m_url; > + m_origin = other.m_origin.copyRef(); > + m_globalFrameIdentifier = other.m_globalFrameIdentifier; > + return *this; > }
Looks like making this use Ref ruined everything! The fact that you can’t copy a Ref is starting to be more annoying than helpful.
Rob Buis
Comment 7
2020-04-06 11:18:04 PDT
Should I go back to RefPtr? It does seem to add a lot of complexity when adding Ref here.
Darin Adler
Comment 8
2020-04-06 11:28:37 PDT
(In reply to Rob Buis from
comment #7
)
> Should I go back to RefPtr? It does seem to add a lot of complexity when > adding Ref here.
I think so.
Rob Buis
Comment 9
2020-04-06 13:15:14 PDT
Created
attachment 395608
[details]
Patch
EWS
Comment 10
2020-04-06 23:59:09 PDT
ChangeLog entry in Source/WebKit/ChangeLog contains OOPS!.
Rob Buis
Comment 11
2020-04-07 00:20:53 PDT
Created
attachment 395656
[details]
Patch
EWS
Comment 12
2020-04-07 00:56:02 PDT
Committed
r259629
: <
https://trac.webkit.org/changeset/259629
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 395656
[details]
.
Radar WebKit Bug Importer
Comment 13
2020-04-07 00:57:14 PDT
<
rdar://problem/61381656
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug