Skip to content

Refactor Request creation to enable its call from NetworkProcess - #74672

Open
yoavweiss wants to merge 1 commit into
WebKit:mainfrom
yoavweiss:subresource_request_construction
Open

yoavweiss wants to merge 1 commit into
WebKit:mainfrom
yoavweiss:subresource_request_construction

Conversation

@yoavweiss

@yoavweiss yoavweiss commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

e38fdb5

Refactor Request creation to enable its call from NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=324958

The current request creation logic depends on WebProcess objects
(e.g. Document). This PR refactors out that dependency, to ensure
that this logic is callable from the NetworkProcess.

This is a requirement for supporting Early Hints preloads.

No new tests, as this is a pure refactor.

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::applyUserAgentIfNeeded):
* Source/WebCore/loader/LinkLoader.cpp:
(WebCore::LinkLoader::resourceTypeFromAsAttribute):
* Source/WebCore/loader/LinkLoader.h:
* Source/WebCore/loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
* Source/WebCore/loader/cache/CachedResourceRequest.cpp:
(WebCore::setRequestAcceptHeaderIfNone):
(WebCore::CachedResourceRequest::setAcceptHeaderIfNone):
(WebCore::updateRequestAccordingCacheMode):
(WebCore::CachedResourceRequest::updateAccordingCacheMode):
(WebCore::updateRequestAcceptEncodingHeader):
(WebCore::CachedResourceRequest::updateAcceptEncodingHeader):
(WebCore::updateRequestReferrerAndOrigin):
(WebCore::CachedResourceRequest::updateReferrerAndOriginHeaders):
(WebCore::updateRequestUserAgent):
(WebCore::isRequestCrossOrigin):
* Source/WebCore/loader/cache/CachedResourceRequest.h:

e38fdb5

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ❌ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
loading 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-AS-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@yoavweiss
yoavweiss requested a review from cdumez as a code owner September 23, 2026 10:32
@yoavweiss yoavweiss self-assigned this Sep 23, 2026
@yoavweiss yoavweiss added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Sep 23, 2026
@weinig

weinig commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

You've got "Explanation of why this fixes the bug (OOPS!)." still in the commit message. And are missing the reviewed by (OOPS!) line.

https://bugs.webkit.org/show_bug.cgi?id=324958

The current request creation logic depends on WebProcess objects
(e.g. Document). This PR refactors out that dependency, to ensure
that this logic is callable from the NetworkProcess.

This is a requirement for supporting Early Hints preloads.

No new tests, as this is a pure refactor.

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::applyUserAgentIfNeeded):
* Source/WebCore/loader/LinkLoader.cpp:
(WebCore::LinkLoader::resourceTypeFromAsAttribute):
* Source/WebCore/loader/LinkLoader.h:
* Source/WebCore/loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
* Source/WebCore/loader/cache/CachedResourceRequest.cpp:
(WebCore::setRequestAcceptHeaderIfNone):
(WebCore::CachedResourceRequest::setAcceptHeaderIfNone):
(WebCore::updateRequestAccordingCacheMode):
(WebCore::CachedResourceRequest::updateAccordingCacheMode):
(WebCore::updateRequestAcceptEncodingHeader):
(WebCore::CachedResourceRequest::updateAcceptEncodingHeader):
(WebCore::updateRequestReferrerAndOrigin):
(WebCore::CachedResourceRequest::updateReferrerAndOriginHeaders):
(WebCore::updateRequestUserAgent):
(WebCore::isRequestCrossOrigin):
* Source/WebCore/loader/cache/CachedResourceRequest.h:
@yoavweiss
yoavweiss force-pushed the subresource_request_construction branch from 89d5cb5 to e38fdb5 Compare September 23, 2026 17:27
@yoavweiss

Copy link
Copy Markdown
Contributor Author

You've got "Explanation of why this fixes the bug (OOPS!)." still in the commit message. And are missing the reviewed by (OOPS!) line.

OOPS indeed. Removed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants