Bug 180682 - Storage Access API: Implement frame-specific access in the document.cookie layer
Summary: Storage Access API: Implement frame-specific access in the document.cookie layer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: John Wilander
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-11 16:40 PST by John Wilander
Modified: 2018-04-05 17:33 PDT (History)
16 users (show)

See Also:


Attachments
Patch (43.91 KB, patch)
2017-12-13 12:49 PST, John Wilander
no flags Details | Formatted Diff | Diff
Patch (44.12 KB, patch)
2017-12-13 12:54 PST, John Wilander
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-elcapitan (1.75 MB, application/zip)
2017-12-13 13:41 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews113 for mac-elcapitan (1.08 MB, application/zip)
2017-12-13 13:54 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (2.19 MB, application/zip)
2017-12-13 14:17 PST, EWS Watchlist
no flags Details
Patch (63.73 KB, patch)
2017-12-13 15:30 PST, John Wilander
no flags Details | Formatted Diff | Diff
Patch (64.64 KB, patch)
2017-12-13 16:07 PST, John Wilander
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-elcapitan (1.79 MB, application/zip)
2017-12-13 16:55 PST, EWS Watchlist
no flags Details
Patch (67.97 KB, patch)
2017-12-13 16:59 PST, John Wilander
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-elcapitan (1.82 MB, application/zip)
2017-12-13 17:52 PST, EWS Watchlist
no flags Details
Patch (71.71 KB, patch)
2017-12-13 18:02 PST, John Wilander
no flags Details | Formatted Diff | Diff
Patch (76.55 KB, patch)
2017-12-14 12:14 PST, John Wilander
no flags Details | Formatted Diff | Diff
Patch (78.23 KB, patch)
2017-12-14 13:19 PST, John Wilander
no flags Details | Formatted Diff | Diff
Patch for landing (81.04 KB, patch)
2017-12-14 14:07 PST, John Wilander
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Wilander 2017-12-11 16:40:24 PST
This is part 3 of making Storage Access API frame-specific.
Comment 1 Radar WebKit Bug Importer 2017-12-11 16:41:05 PST
<rdar://problem/35982257>
Comment 2 John Wilander 2017-12-13 12:49:52 PST
Created attachment 329244 [details]
Patch
Comment 3 John Wilander 2017-12-13 12:50:31 PST
Uploading for early patch feedback and EWS results.
Comment 4 John Wilander 2017-12-13 12:54:54 PST
Created attachment 329245 [details]
Patch
Comment 5 Alex Christensen 2017-12-13 13:30:23 PST
Comment on attachment 329245 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329245&action=review

Don't break the linux build.  Otherwise r=me

> Source/WebCore/platform/network/CacheValidation.cpp:351
> +            return cookieRequestHeaderFieldValue(NetworkStorageSession::defaultStorageSession(), request.firstPartyForCookies(), request.url(), std::nullopt, std::nullopt, includeSecureCookies).first;

We should look into passing in real values here.

> Source/WebKit/Shared/mac/CookieStorageShim.mm:64
> +    if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(PAL::SessionID::defaultSessionID(), firstPartyForCookiesURL, inRequestURL, std::nullopt, std::nullopt, includeSecureCookies), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(cookies, secureCookiesAccessed), 0))

This is no big deal.  I filed https://bugs.webkit.org/show_bug.cgi?id=180766 to get rid of this code on all platforms where we have ITP.
Comment 6 EWS Watchlist 2017-12-13 13:41:56 PST
Comment on attachment 329245 [details]
Patch

Attachment 329245 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/5649060

Number of test failures exceeded the failure limit.
Comment 7 EWS Watchlist 2017-12-13 13:41:58 PST
Created attachment 329253 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 8 EWS Watchlist 2017-12-13 13:54:58 PST
Comment on attachment 329245 [details]
Patch

Attachment 329245 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/5649088

Number of test failures exceeded the failure limit.
Comment 9 EWS Watchlist 2017-12-13 13:54:59 PST
Created attachment 329256 [details]
Archive of layout-test-results from ews113 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 10 EWS Watchlist 2017-12-13 14:17:56 PST
Comment on attachment 329245 [details]
Patch

Attachment 329245 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/5649188

New failing tests:
http/tests/websocket/tests/hybi/workers/worker-reload.html
Comment 11 EWS Watchlist 2017-12-13 14:17:57 PST
Created attachment 329258 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.6
Comment 12 John Wilander 2017-12-13 15:30:31 PST
Created attachment 329270 [details]
Patch
Comment 13 John Wilander 2017-12-13 16:07:27 PST
Created attachment 329278 [details]
Patch
Comment 14 John Wilander 2017-12-13 16:09:31 PST
WebSockets may not have a frame so I made CookieJar.cpp check for the existence of a frame and if there is none, call with std::nullopt for frameID and pageID.
Comment 15 EWS Watchlist 2017-12-13 16:55:04 PST
Comment on attachment 329278 [details]
Patch

Attachment 329278 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/5651778

Number of test failures exceeded the failure limit.
Comment 16 EWS Watchlist 2017-12-13 16:55:05 PST
Created attachment 329290 [details]
Archive of layout-test-results from ews103 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 17 John Wilander 2017-12-13 16:59:15 PST
Created attachment 329291 [details]
Patch
Comment 18 EWS Watchlist 2017-12-13 17:52:05 PST
Comment on attachment 329291 [details]
Patch

Attachment 329291 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/5652637

Number of test failures exceeded the failure limit.
Comment 19 EWS Watchlist 2017-12-13 17:52:07 PST
Created attachment 329299 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 20 John Wilander 2017-12-13 18:02:17 PST
Created attachment 329302 [details]
Patch
Comment 21 John Wilander 2017-12-13 18:04:18 PST
Introduced FrameLoaderClient::hasIDs() to be able to check whether the client has IDs available or not. Otherwise I hit RELEASE_ASSERT_NOT_REACHED() calls in WebKitLegacy.
Comment 22 Alex Christensen 2017-12-13 18:16:31 PST
Comment on attachment 329302 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329302&action=review

I think it's time to introduce a new structure that contains two std::optional<uint64_t>, and maybe some URLs, too.

> Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:204
> +bool WebFrameLoaderClient::hasIDs() const

I think returning std::nullopt from WebFrameLoaderClient::pageID is cleaner than this.  I don't think we have a good reason to RELEASE_ASSERT_NOT_REACHED when they're called other than that we had no legitimate use of pageID in WebCore before this, and now we do.  Returning std::nullopt is the correct WebKitLegacy behavior for this.  I'd be open if someone feels differently.
Comment 23 John Wilander 2017-12-14 12:14:17 PST
Created attachment 329379 [details]
Patch
Comment 24 John Wilander 2017-12-14 12:15:47 PST
(In reply to Alex Christensen from comment #22)
> Comment on attachment 329302 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=329302&action=review
> 
> I think it's time to introduce a new structure that contains two
> std::optional<uint64_t>, and maybe some URLs, too.

I will first see if I can get this working. Then either update this patch to do it in a follow-up patch.

> > Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:204
> > +bool WebFrameLoaderClient::hasIDs() const
> 
> I think returning std::nullopt from WebFrameLoaderClient::pageID is cleaner
> than this.  I don't think we have a good reason to
> RELEASE_ASSERT_NOT_REACHED when they're called other than that we had no
> legitimate use of pageID in WebCore before this, and now we do.  Returning
> std::nullopt is the correct WebKitLegacy behavior for this.  I'd be open if
> someone feels differently.

OK. This is what Tim Horton suggested too. The new patch does this. Thanks!
Comment 25 John Wilander 2017-12-14 13:19:41 PST
Created attachment 329391 [details]
Patch
Comment 26 John Wilander 2017-12-14 13:21:49 PST
Fix for the Windows ports.
Comment 27 Alex Christensen 2017-12-14 13:25:17 PST
Comment on attachment 329391 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329391&action=review

> Source/WebCore/loader/EmptyFrameLoaderClient.h:36
> +    std::optional<uint64_t> frameID() const override { return 0; }
> +    std::optional<uint64_t> pageID() const override { return 0; }

These should probably return nullopt
Comment 28 John Wilander 2017-12-14 14:02:29 PST
(In reply to Alex Christensen from comment #27)
> Comment on attachment 329391 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=329391&action=review
> 
> > Source/WebCore/loader/EmptyFrameLoaderClient.h:36
> > +    std::optional<uint64_t> frameID() const override { return 0; }
> > +    std::optional<uint64_t> pageID() const override { return 0; }
> 
> These should probably return nullopt

Thanks, Alex! Will fix.
Comment 29 John Wilander 2017-12-14 14:07:15 PST
Created attachment 329402 [details]
Patch for landing
Comment 30 WebKit Commit Bot 2017-12-14 14:39:52 PST
Comment on attachment 329402 [details]
Patch for landing

Clearing flags on attachment: 329402

Committed r225934: <https://trac.webkit.org/changeset/225934>
Comment 31 WebKit Commit Bot 2017-12-14 14:39:54 PST
All reviewed patches have been landed.  Closing bug.
Comment 32 Fujii Hironori 2017-12-18 01:22:08 PST
A lot of crashed on AppleWin LayoutTests. I'm going to fix it in Bug 180926.