WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
195637
Drop legacy WebCore::toRegistrableDomain() utility function
https://bugs.webkit.org/show_bug.cgi?id=195637
Summary
Drop legacy WebCore::toRegistrableDomain() utility function
Chris Dumez
Reported
2019-03-12 12:50:35 PDT
Drop legacy WebCore::toRegistrableDomain() utility function. Call sites should be constructing a WebCore::RegistrableDomain instead.
Attachments
Patch
(19.40 KB, patch)
2019-03-12 13:21 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(11.63 KB, patch)
2019-03-12 14:41 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(11.63 KB, patch)
2019-03-13 10:55 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(17.24 KB, patch)
2019-03-13 11:44 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(17.24 KB, patch)
2019-03-13 12:06 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2019-03-12 13:21:44 PDT
Created
attachment 364436
[details]
Patch
Chris Dumez
Comment 2
2019-03-12 13:22:41 PDT
Needs
https://bugs.webkit.org/show_bug.cgi?id=195634
to land first.
John Wilander
Comment 3
2019-03-12 13:47:12 PDT
Comment on
attachment 364436
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364436&action=review
> Source/WebCore/dom/Document.cpp:3453 > + if (targetDocument && (targetDocument->securityOrigin().canAccess(SecurityOrigin::create(destinationURL)) || RegistrableDomain { targetDocument->url() } == RegistrableDomain { destinationURL }))
Is there a reason why you prefer creating two objects over comparing one with the matches() function?
> Source/WebCore/loader/CrossOriginAccessControl.cpp:233 > + if (RegistrableDomain { response.url() } != RegistrableDomain::uncheckedCreateFromHost(origin.host()))
Ditto. You have the response URL.
> Source/WebCore/loader/FrameLoader.cpp:1112 > + if (SecurityPolicy::shouldInheritSecurityOriginFromOwner(frame->document()->url()) || RegistrableDomain { frame->document()->url() } == registrableDomain)
Ditto.
> Source/WebCore/loader/FrameLoader.cpp:2973 > + request.setIsSameSite(RegistrableDomain { initiator->siteForCookies() } == RegistrableDomain { request.url() });
Ditto.
> Source/WebCore/platform/network/ResourceRequestBase.h:-260 > -// FIXME: Find a better place for these functions.
Yay, a FIXME gets fixed.
> Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp:289 > + m_sameSiteDisposition = !siteForCookies ? SameSiteDisposition::Unspecified : (RegistrableDomain { siteForCookies.get() } == RegistrableDomain { m_url }) ? SameSiteDisposition::SameSite : SameSiteDisposition::CrossSite);
Here you could also use the faster matches() function.
> Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:92 > + m_sameSiteDisposition = siteForCookies.isNull() ? SameSiteDisposition::Unspecified : ((RegistrableDomain { siteForCookies } == RegistrableDomain { m_url }) ? SameSiteDisposition::SameSite : SameSiteDisposition::CrossSite);
Ditto.
> Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:148 > + return WebCore::RegistrableDomain { request.url() } != request.firstPartyForCookies();
If request.firstPartyForCookies() returns a RegistrableDomain, you could use matches() here too.
> Source/WebKit/UIProcess/WebProcessPool.cpp:1312 > + updatedRequest.setIsSameSite(RegistrableDomain { initiatingPageURL } == RegistrableDomain { request.url() });
Can use matches().
> Source/WebKit/UIProcess/WebProcessPool.cpp:2299 > + if (!sourceURL.isValid() || !targetURL.isValid() || sourceURL.isEmpty() || sourceURL.protocolIsAbout() || RegistrableDomain { sourceURL } == targetRegistrableDomain)
Ditto.
> Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:398 > + if (m_hasFrameSpecificStorageAccess && RegistrableDomain { currentUrl } != RegistrableDomain { newUrl }) {
Ditto.
Chris Dumez
Comment 4
2019-03-12 13:54:40 PDT
(In reply to John Wilander from
comment #3
)
> Comment on
attachment 364436
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=364436&action=review
> > > Source/WebCore/dom/Document.cpp:3453 > > + if (targetDocument && (targetDocument->securityOrigin().canAccess(SecurityOrigin::create(destinationURL)) || RegistrableDomain { targetDocument->url() } == RegistrableDomain { destinationURL })) > > Is there a reason why you prefer creating two objects over comparing one > with the matches() function?
I merely did not know about it. I'll update the patch, thanks for looking.
Chris Dumez
Comment 5
2019-03-12 14:41:22 PDT
Created
attachment 364447
[details]
Patch
Chris Dumez
Comment 6
2019-03-13 10:55:38 PDT
Created
attachment 364549
[details]
Patch
Geoffrey Garen
Comment 7
2019-03-13 10:57:21 PDT
Comment on
attachment 364549
[details]
Patch r=me
Geoffrey Garen
Comment 8
2019-03-13 10:58:43 PDT
Comment on
attachment 364549
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364549&action=review
> Source/WebCore/platform/RegistrableDomain.h:134 > +inline bool registrableDomainsAreEqual(const URL& a, const URL& b)
Nit: I would name this areRegistrableDomainsEqual. I think seeing is/are as a prefix helps show that what follows is a boolean condition, and I think that's how Apple API is typically written.
Chris Dumez
Comment 9
2019-03-13 11:44:49 PDT
Created
attachment 364554
[details]
Patch
Chris Dumez
Comment 10
2019-03-13 12:06:48 PDT
Created
attachment 364559
[details]
Patch
Chris Dumez
Comment 11
2019-03-13 12:53:55 PDT
Comment on
attachment 364559
[details]
Patch Clearing flags on attachment: 364559 Committed
r242899
: <
https://trac.webkit.org/changeset/242899
>
Chris Dumez
Comment 12
2019-03-13 12:53:57 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13
2019-03-13 12:54:32 PDT
<
rdar://problem/48859177
>
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