Bug 184763 - Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
Summary: Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-18 16:49 PDT by youenn fablet
Modified: 2018-04-23 20:23 PDT (History)
9 users (show)

See Also:


Attachments
Patch (29.15 KB, patch)
2018-04-18 17:16 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-sierra-wk2 (2.83 MB, application/zip)
2018-04-18 18:33 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews121 for ios-simulator-wk2 (9.17 MB, application/zip)
2018-04-18 18:41 PDT, EWS Watchlist
no flags Details
Patch (28.17 KB, patch)
2018-04-19 08:41 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (28.09 KB, patch)
2018-04-23 17:47 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2018-04-18 16:49:12 PDT
We need to pass preflight policy, CSP response headers, origin and content blockers from DocumentThreadableLoader up to NetworkProcess through WebLoaderStrategy
Comment 1 youenn fablet 2018-04-18 17:16:22 PDT
Created attachment 338287 [details]
Patch
Comment 2 EWS Watchlist 2018-04-18 18:33:31 PDT
Comment on attachment 338287 [details]
Patch

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

New failing tests:
http/tests/inspector/network/fetch-network-data.html
Comment 3 EWS Watchlist 2018-04-18 18:33:32 PDT
Created attachment 338292 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 4 EWS Watchlist 2018-04-18 18:41:31 PDT
Comment on attachment 338287 [details]
Patch

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

New failing tests:
http/wpt/service-workers/header-filtering.https.html
Comment 5 EWS Watchlist 2018-04-18 18:41:33 PDT
Created attachment 338294 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.4
Comment 6 youenn fablet 2018-04-19 08:41:26 PDT
Created attachment 338324 [details]
Patch
Comment 7 youenn fablet 2018-04-19 09:32:28 PDT
gtk-wk2 failure is probably not relevant, log shows "virtual memory exhausted: Cannot allocate memory"
Comment 8 Chris Dumez 2018-04-23 15:56:34 PDT
Comment on attachment 338324 [details]
Patch

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

r=me

> Source/WebCore/ChangeLog:10
> +       Add PreflightPolicy and CSP response headers as ResourceLoaderOptions.

Indentation problem.

> Source/WebCore/ChangeLog:13
> +       Allow getting the original headers from a SubresourceLoader.

ditto.

> Source/WebCore/loader/ResourceLoaderOptions.h:116
> +    ConsiderPreflight,

I think we could even consider dropping the "Preflight" suffix given the enum name.

> Source/WebCore/loader/SubresourceLoader.cpp:787
> +std::optional<HTTPHeaderMap> SubresourceLoader::originalHeaders() const

If we returned a HTTPHeaderMap* instead of an std::optional<>, we could avoid copying the headers.

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:287
> +    if (resourceLoader.isSubresourceLoader()) {

It would be nice to add the template specializations so that is<SubresourceLoader>() / downcast<SubresourceLoader>() works. Would be safer too.

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:289
> +            loadParameters.originalRequestHeaders = WTFMove(headers.value());

I get that we have to copy the headers here anyway, I'd still prefer if the API on SubresourceLoader did not requires the clients to in case they do not need/want copying.

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:295
> +        // FIXME: Instead of passing userContentControllerIdentifier, we should just pass webPageId to NetworkProcess.

I thought we already passed the PageID / FrameID to the network process so I do not understand this comment.

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:296
> +        WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(resourceLoader.frame()->loader().client());

auto*

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:297
> +        WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;

auto*

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:298
> +        WebPage* webPage = webFrame ? webFrame->page() : nullptr;

auto*
Comment 9 youenn fablet 2018-04-23 17:18:47 PDT
Thanks for the review.

> > Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:287
> > +    if (resourceLoader.isSubresourceLoader()) {
> 
> It would be nice to add the template specializations so that
> is<SubresourceLoader>() / downcast<SubresourceLoader>() works. Would be
> safer too.

Agreed, I was tempted to do it in that patch but I resisted it.

> > Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:289
> > +            loadParameters.originalRequestHeaders = WTFMove(headers.value());
> 
> I get that we have to copy the headers here anyway, I'd still prefer if the
> API on SubresourceLoader did not requires the clients to in case they do not
> need/want copying.

OK, will see what I can do.
Note that we would not have to copy it if we were passing it as a direct IPC parameter.
Maybe we should do that instead.

> > Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:295
> > +        // FIXME: Instead of passing userContentControllerIdentifier, we should just pass webPageId to NetworkProcess.
> 
> I thought we already passed the PageID / FrameID to the network process so I
> do not understand this comment.

NetworkProcess has webPageID but no logic yet to compute userContentControllerIdentifier from it.
Comment 10 youenn fablet 2018-04-23 17:47:14 PDT
Created attachment 338624 [details]
Patch
Comment 11 WebKit Commit Bot 2018-04-23 20:22:58 PDT
Comment on attachment 338624 [details]
Patch

Clearing flags on attachment: 338624

Committed r230942: <https://trac.webkit.org/changeset/230942>
Comment 12 WebKit Commit Bot 2018-04-23 20:23:00 PDT
All reviewed patches have been landed.  Closing bug.