WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
213283
Web Inspector: request / response interception trims resource type
https://bugs.webkit.org/show_bug.cgi?id=213283
Summary
Web Inspector: request / response interception trims resource type
Pavel Feldman
Reported
2020-06-16 22:10:34 PDT
Will add failing test shortly.
Attachments
Patch
(5.27 KB, patch)
2020-06-16 22:12 PDT
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
Patch
(52.80 KB, patch)
2020-06-18 13:29 PDT
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
Patch
(52.83 KB, patch)
2020-06-18 13:50 PDT
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
Patch
(52.93 KB, patch)
2020-06-18 16:22 PDT
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
Patch
(53.23 KB, patch)
2020-06-18 20:32 PDT
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
Patch
(52.93 KB, patch)
2020-06-19 15:44 PDT
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
Patch
(53.20 KB, patch)
2020-06-19 17:31 PDT
,
Pavel Feldman
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Pavel Feldman
Comment 1
2020-06-16 22:12:32 PDT
Created
attachment 402079
[details]
Patch
Pavel Feldman
Comment 2
2020-06-18 13:29:45 PDT
Created
attachment 402232
[details]
Patch
Pavel Feldman
Comment 3
2020-06-18 13:50:38 PDT
Created
attachment 402234
[details]
Patch
Pavel Feldman
Comment 4
2020-06-18 16:22:29 PDT
Created
attachment 402247
[details]
Patch
Pavel Feldman
Comment 5
2020-06-18 20:32:41 PDT
Created
attachment 402265
[details]
Patch
Pavel Feldman
Comment 6
2020-06-19 15:44:22 PDT
Created
attachment 402340
[details]
Patch
Pavel Feldman
Comment 7
2020-06-19 17:31:58 PDT
Created
attachment 402359
[details]
Patch
Devin Rousso
Comment 8
2020-06-22 18:43:16 PDT
Comment on
attachment 402359
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=402359&action=review
What type is shown for cases like `<script src="
https://example.org/definitely-not-a-script.html
">`? I would expect it to still have the requester type (e.g. script), which also matches the current functionality AFAICT. Have you audited all of the places where a `ResourceRequest` is created to see if it should set a `ResourceRequest::Requester`? Perhaps we should also add a `ResourceRequest::Requester` as a constructor parameter so that future manually created requests have to think about that too.
> Source/WebCore/inspector/NetworkResourcesData.h:71 > + ResourceRequest::Requester requester() const { return m_requester; }
we should add `#include "ResourceRequest.h"`
> Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp:-448 > - else if (loader && equalIgnoringFragmentIdentifier(request.url(), loader->url()) && !loader->isCommitted()) > - type = InspectorPageAgent::DocumentResource; > - else if (loader) { > - for (auto& linkIcon : loader->linkIcons()) { > - if (equalIgnoringFragmentIdentifier(request.url(), linkIcon.url)) { > - type = InspectorPageAgent::ImageResource; > - break; > - } > - } > - }
Are these paths also covered by the new logic?
> Source/WebCore/inspector/agents/InspectorPageAgent.cpp:216 > +Inspector::Protocol::Page::ResourceType InspectorPageAgent::resourceTypeJSON(ResourceRequest::Requester requester)
We should rename this to something more explicit/understandable, like `InspectorPageAgent::protocolResourceTypeForResourceRequester`.
> Source/WebCore/loader/PingLoader.cpp:211 > + InspectorInstrumentation::willSendRequest(&frame, identifier, frame.loader().activeDocumentLoader(), request, ResourceResponse());
It seems like not all paths to this function have set a `ResourceRequest::Requester::Ping`. Are we sure that those cases will still be covered after removing this code?
> Source/WebCore/loader/cache/CachedResource.cpp:311 > + InspectorInstrumentation::willSendRequest(&frame, identifier, frameLoader.activeDocumentLoader(), request, ResourceResponse());
Do we know with certainty that `ResourceRequest::Requester::Beacon` has been set by this point?
> Source/WebCore/loader/cache/CachedResourceRequest.cpp:203 > + default: > + // Only cherry-pick the ones below, leave the rest unspecified. > + return;
NIT: personally, I'd rather not use a `default` and instead list the remaining `CachedResource::Type` values so that future changes must also considered for this codepath
> LayoutTests/http/tests/inspector/network/interception-preserves-type.html:31 > + name: "Network.requestIntercepted.resourceType baseline",
NIT: we usually don't use spaces in test case names, preferring camel casing and periods.
> LayoutTests/http/tests/inspector/network/interception-preserves-type.html:37 > + RuntimeAgent.evaluate("loadSubresource('resources/stylesheet.css?baseline')"),
NIT: `InspectorTest.evaluateInPage`?
> LayoutTests/http/tests/inspector/network/interception-preserves-type.html:51 > + RuntimeAgent.evaluate("loadSubresource('resources/stylesheet.css?request')"),
Ditto (:37)
> LayoutTests/http/tests/inspector/network/interception-preserves-type.html:55 > + }
NIT: I don't think it matters, but should we continue the interception so that it's not just left hanging?
> LayoutTests/http/tests/inspector/network/interception-preserves-type.html:59 > + name: "Network.responseIntercepted.resourceType",
NIT: we usually prefix the test case name with the suite name (though I get what you're trying to go for here, so perhaps just change the suite name to be more general instead of specific to "request" such as "Network.InterceptionPreservesType")
> LayoutTests/http/tests/inspector/network/interception-preserves-type.html:65 > + RuntimeAgent.evaluate("loadSubresource('resources/stylesheet.css?response')"),
Ditto (:37)
> LayoutTests/http/tests/inspector/network/interception-preserves-type.html:69 > + }
Ditto (:55)
Blaze Burg
Comment 9
2020-09-09 11:48:08 PDT
Comment on
attachment 402359
[details]
Patch Clearing r? as there is unaddressed review feedback and the patch is now stale.
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