Bug 184396 - Web Inspector backend should get headers & cookies from network process separately from resource requests
Summary: Web Inspector backend should get headers & cookies from network process separ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-04-07 23:26 PDT by youenn fablet
Modified: 2018-04-19 14:27 PDT (History)
10 users (show)

See Also:


Attachments
Patch (18.72 KB, patch)
2018-04-07 23:37 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-sierra-wk2 (21.51 MB, application/zip)
2018-04-08 00:49 PDT, EWS Watchlist
no flags Details
Patch (21.18 KB, patch)
2018-04-18 23:38 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (21.43 KB, patch)
2018-04-19 10:24 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Win fix (21.45 KB, patch)
2018-04-19 13:57 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-07 23:26:21 PDT
Web Inspector backend should get headers & cookies from network process separately from resource requests
Comment 1 youenn fablet 2018-04-07 23:26:55 PDT
<rdar://problem/38877384>
Comment 2 youenn fablet 2018-04-07 23:37:56 PDT
Created attachment 337446 [details]
Patch
Comment 3 youenn fablet 2018-04-07 23:39:42 PDT
There is no test, I guess there should be some related to headers and inspector.
Probably when increasing the scope of response filtering, this patch will make sure inspector tests do not fail.
Comment 4 EWS Watchlist 2018-04-08 00:49:20 PDT
Comment on attachment 337446 [details]
Patch

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

New failing tests:
http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html
Comment 5 EWS Watchlist 2018-04-08 00:49:22 PDT
Created attachment 337448 [details]
Archive of layout-test-results from ews107 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 6 BJ Burg 2018-04-08 13:54:51 PDT
Comment on attachment 337446 [details]
Patch

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

> Source/WebCore/loader/LoaderStrategy.h:82
> +    virtual ResourceResponse responseFromResourceLoaIdentifier(uint64_t /* resourceLoadIdentifier */);

There is a typo in these two methods, please fix.

> Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:84
> +    void takeNetworkLoadInformationResponse(ResourceLoadIdentifier identifier, WebCore::ResourceResponse& response)

Is there any particular reason to use an out-parameter?

> Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:184
> +    HashMap<ResourceLoadIdentifier, NetworkLoadInformation> m_networkLoadInformations;

The plural of information is information, so adding 's' doesn't sound good. I would rename the typedef to NetworkLoadData/NetworkLoadResponseData and call this m_responseDataForResourceLoad.
Comment 7 youenn fablet 2018-04-08 22:17:31 PDT
(In reply to Brian Burg from comment #6)
> Comment on attachment 337446 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=337446&action=review
> 
> > Source/WebCore/loader/LoaderStrategy.h:82
> > +    virtual ResourceResponse responseFromResourceLoaIdentifier(uint64_t /* resourceLoadIdentifier */);
> 
> There is a typo in these two methods, please fix.

OK

> > Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:84
> > +    void takeNetworkLoadInformationResponse(ResourceLoadIdentifier identifier, WebCore::ResourceResponse& response)
> 
> Is there any particular reason to use an out-parameter?

Sync IPC, but I think I will update it so that there is no need to create a ResourceResponse and copy it.

> > Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:184
> > +    HashMap<ResourceLoadIdentifier, NetworkLoadInformation> m_networkLoadInformations;
> 
> The plural of information is information, so adding 's' doesn't sound good.
> I would rename the typedef to NetworkLoadData/NetworkLoadResponseData and
> call this m_responseDataForResourceLoad.

OK
Comment 8 youenn fablet 2018-04-18 23:38:05 PDT
Created attachment 338314 [details]
Patch
Comment 9 BJ Burg 2018-04-19 09:48:12 PDT
Comment on attachment 338314 [details]
Patch

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

r=me

> Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp:426
> +    return source != ResourceResponse::Source::MemoryCache && source != ResourceResponse::Source::ServiceWorker && source != ResourceResponse::Source::ApplicationCache && source != ResourceResponse::Source::MemoryCacheAfterValidation;

Nit; a switch would be easier to read & maintain.

> Source/WebCore/loader/LoaderStrategy.h:85
> +    virtual ResourceResponse responseFromResourceLoadIdentifier(uint64_t /* resourceLoadIdentifier */);

Nit: no need to comment out the parameter names in the declaration.

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:279
> +        // FIXME: All loaders should provide their origin if navigation mode is cors/no-cors/same-origin.

I don't quite understand this part. On the assumption it's going to be used for things other than Inspector, I'll let you determine the best way forward to make it more accurate.
Comment 10 youenn fablet 2018-04-19 10:14:24 PDT
Thanks for the review.

(In reply to Brian Burg from comment #9)
> Comment on attachment 338314 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=338314&action=review
> 
> r=me
> 
> > Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp:426
> > +    return source != ResourceResponse::Source::MemoryCache && source != ResourceResponse::Source::ServiceWorker && source != ResourceResponse::Source::ApplicationCache && source != ResourceResponse::Source::MemoryCacheAfterValidation;
> 
> Nit; a switch would be easier to read & maintain.

OK

> > Source/WebCore/loader/LoaderStrategy.h:85
> > +    virtual ResourceResponse responseFromResourceLoadIdentifier(uint64_t /* resourceLoadIdentifier */);
> 
> Nit: no need to comment out the parameter names in the declaration.

OK

> > Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:279
> > +        // FIXME: All loaders should provide their origin if navigation mode is cors/no-cors/same-origin.
> 
> I don't quite understand this part. On the assumption it's going to be used
> for things other than Inspector, I'll let you determine the best way forward
> to make it more accurate.

We are using sourceOrigin to do CORS checks in NetworkProcess.
This is currently limited to sync XHR and beacon API but will be extended to other types of loads.
Comment 11 youenn fablet 2018-04-19 10:24:07 PDT
Created attachment 338338 [details]
Patch for landing
Comment 12 youenn fablet 2018-04-19 13:57:12 PDT
Created attachment 338354 [details]
Win fix
Comment 13 WebKit Commit Bot 2018-04-19 14:27:08 PDT
Comment on attachment 338354 [details]
Win fix

Clearing flags on attachment: 338354

Committed r230820: <https://trac.webkit.org/changeset/230820>
Comment 14 WebKit Commit Bot 2018-04-19 14:27:10 PDT
All reviewed patches have been landed.  Closing bug.