Changeset 287633 in webkit
- Timestamp:
- Jan 5, 2022, 10:21:25 AM (5 years ago)
- Location:
- branches/safari-612-branch
- Files:
-
- 4 added
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/service-workers/navigation-iframe-site-worker.js (added)
-
LayoutTests/http/wpt/service-workers/navigation-iframe-site.https-expected.txt (added)
-
LayoutTests/http/wpt/service-workers/navigation-iframe-site.https.html (added)
-
LayoutTests/http/wpt/service-workers/resources/navigation-iframe-site-frame.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/loader/FrameLoader.cpp (modified) (4 diffs)
-
Source/WebCore/loader/FrameLoader.h (modified) (1 diff)
-
Source/WebCore/testing/ServiceWorkerInternals.cpp (modified) (1 diff)
-
Source/WebCore/testing/ServiceWorkerInternals.h (modified) (1 diff)
-
Source/WebCore/testing/ServiceWorkerInternals.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612-branch/LayoutTests/ChangeLog
r287620 r287633 1 2022-01-05 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r287353. rdar://problem/87125345 4 5 Use requester when calling updateRequestAndAddExtraFields 6 https://bugs.webkit.org/show_bug.cgi?id=234507 7 <rdar://problem/85049490> 8 9 Reviewed by Brent Fulgham. 10 11 Source/WebCore: 12 13 In case of navigation loads, the requester is the fetch request client. 14 As such, it should be the one used to determine whether the request is cross-origin is not. 15 Pass the requester to updateRequestAndAddExtraFields to do the correct computation. 16 Validate that some request fields are now correctly observed in service workers. 17 18 Test: http/wpt/service-workers/navigation-iframe-site.https.html 19 20 * loader/FrameLoader.cpp: 21 * loader/FrameLoader.h: 22 * testing/ServiceWorkerInternals.cpp: 23 * testing/ServiceWorkerInternals.h: 24 * testing/ServiceWorkerInternals.idl: 25 26 LayoutTests: 27 28 * http/wpt/service-workers/navigation-iframe-site-worker.js: Added. 29 * http/wpt/service-workers/navigation-iframe-site.https-expected.txt: Added. 30 * http/wpt/service-workers/navigation-iframe-site.https.html: Added. 31 * http/wpt/service-workers/resources/navigation-iframe-site-frame.html: Added. 32 33 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287353 268f45cc-cd09-0410-ab3c-d52691b4dbfc 34 35 2021-12-22 Youenn Fablet <youenn@apple.com> 36 37 Use requester when calling updateRequestAndAddExtraFields 38 https://bugs.webkit.org/show_bug.cgi?id=234507 39 <rdar://problem/85049490> 40 41 Reviewed by Brent Fulgham. 42 43 * http/wpt/service-workers/navigation-iframe-site-worker.js: Added. 44 * http/wpt/service-workers/navigation-iframe-site.https-expected.txt: Added. 45 * http/wpt/service-workers/navigation-iframe-site.https.html: Added. 46 * http/wpt/service-workers/resources/navigation-iframe-site-frame.html: Added. 47 1 48 2022-01-05 Russell Epstein <repstein@apple.com> 2 49 -
branches/safari-612-branch/Source/WebCore/ChangeLog
r287631 r287633 1 2022-01-05 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r287353. rdar://problem/87125345 4 5 Use requester when calling updateRequestAndAddExtraFields 6 https://bugs.webkit.org/show_bug.cgi?id=234507 7 <rdar://problem/85049490> 8 9 Reviewed by Brent Fulgham. 10 11 Source/WebCore: 12 13 In case of navigation loads, the requester is the fetch request client. 14 As such, it should be the one used to determine whether the request is cross-origin is not. 15 Pass the requester to updateRequestAndAddExtraFields to do the correct computation. 16 Validate that some request fields are now correctly observed in service workers. 17 18 Test: http/wpt/service-workers/navigation-iframe-site.https.html 19 20 * loader/FrameLoader.cpp: 21 * loader/FrameLoader.h: 22 * testing/ServiceWorkerInternals.cpp: 23 * testing/ServiceWorkerInternals.h: 24 * testing/ServiceWorkerInternals.idl: 25 26 LayoutTests: 27 28 * http/wpt/service-workers/navigation-iframe-site-worker.js: Added. 29 * http/wpt/service-workers/navigation-iframe-site.https-expected.txt: Added. 30 * http/wpt/service-workers/navigation-iframe-site.https.html: Added. 31 * http/wpt/service-workers/resources/navigation-iframe-site-frame.html: Added. 32 33 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287353 268f45cc-cd09-0410-ab3c-d52691b4dbfc 34 35 2021-12-22 Youenn Fablet <youenn@apple.com> 36 37 Use requester when calling updateRequestAndAddExtraFields 38 https://bugs.webkit.org/show_bug.cgi?id=234507 39 <rdar://problem/85049490> 40 41 Reviewed by Brent Fulgham. 42 43 In case of navigation loads, the requester is the fetch request client. 44 As such, it should be the one used to determine whether the request is cross-origin is not. 45 Pass the requester to updateRequestAndAddExtraFields to do the correct computation. 46 Validate that some request fields are now correctly observed in service workers. 47 48 Test: http/wpt/service-workers/navigation-iframe-site.https.html 49 50 * loader/FrameLoader.cpp: 51 * loader/FrameLoader.h: 52 * testing/ServiceWorkerInternals.cpp: 53 * testing/ServiceWorkerInternals.h: 54 * testing/ServiceWorkerInternals.idl: 55 1 56 2022-01-05 Russell Epstein <repstein@apple.com> 2 57 -
branches/safari-612-branch/Source/WebCore/loader/FrameLoader.cpp
r286401 r287633 1357 1357 request.setHTTPReferrer(referrer); 1358 1358 1359 updateRequestAndAddExtraFields(request, IsMainResource::Yes, newLoadType );1359 updateRequestAndAddExtraFields(request, IsMainResource::Yes, newLoadType, ShouldUpdateAppInitiatedValue::Yes, FrameLoader::IsServiceWorkerNavigationLoad::No, &frameLoadRequest.requester()); 1360 1360 1361 1361 ASSERT(newLoadType != FrameLoadType::Same); … … 2906 2906 } 2907 2907 2908 void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate )2908 void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate, Document* initiator) 2909 2909 { 2910 2910 // If the request came from a previous process due to process-swap-on-navigation then we should not modify the request. … … 2924 2924 2925 2925 if (request.isSameSiteUnspecified()) { 2926 auto* initiator = m_frame.document(); 2927 if (isMainResource) { 2928 auto* ownerFrame = m_frame.tree().parent(); 2929 if (!ownerFrame && m_stateMachine.isDisplayingInitialEmptyDocument()) 2930 ownerFrame = m_opener.get(); 2931 if (ownerFrame) 2932 initiator = ownerFrame->document(); 2933 ASSERT(ownerFrame || m_frame.isMainFrame()); 2926 if (!initiator) { 2927 initiator = m_frame.document(); 2928 if (isMainResource) { 2929 auto* ownerFrame = m_frame.tree().parent(); 2930 if (!ownerFrame && m_stateMachine.isDisplayingInitialEmptyDocument()) 2931 ownerFrame = m_opener.get(); 2932 if (ownerFrame) 2933 initiator = ownerFrame->document(); 2934 ASSERT(ownerFrame || m_frame.isMainFrame()); 2935 } 2934 2936 } 2935 2937 addSameSiteInfoToRequestIfNeeded(request, initiator); … … 3065 3067 workingResourceRequest.setHTTPBody(inRequest.httpBody()); 3066 3068 workingResourceRequest.setHTTPContentType(contentType); 3067 updateRequestAndAddExtraFields(workingResourceRequest, IsMainResource::Yes, loadType );3069 updateRequestAndAddExtraFields(workingResourceRequest, IsMainResource::Yes, loadType, ShouldUpdateAppInitiatedValue::Yes, FrameLoader::IsServiceWorkerNavigationLoad::No, &request.requester()); 3068 3070 3069 3071 if (Document* document = m_frame.document()) -
branches/safari-612-branch/Source/WebCore/loader/FrameLoader.h
r286401 r287633 319 319 320 320 // For subresource requests the FrameLoadType parameter has no effect and can be skipped. 321 void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes );321 void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes, Document* = nullptr); 322 322 323 323 void scheduleRefreshIfNeeded(Document&, const String& content, IsMetaRefresh); -
branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.cpp
r279750 r287633 137 137 } 138 138 139 bool ServiceWorkerInternals::fetchEventIsSameSite(FetchEvent& event) 140 { 141 return event.request().internalRequest().isSameSite(); 142 } 143 139 144 } // namespace WebCore 140 145 -
branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.h
r279750 r287633 63 63 void lastNavigationWasAppInitiated(Ref<DeferredPromise>&&); 64 64 65 bool fetchEventIsSameSite(FetchEvent&); 66 65 67 private: 66 68 explicit ServiceWorkerInternals(ServiceWorkerIdentifier); -
branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.idl
r279750 r287633 45 45 46 46 Promise<boolean> lastNavigationWasAppInitiated(); 47 48 boolean fetchEventIsSameSite(FetchEvent event); 47 49 };
Note:
See TracChangeset
for help on using the changeset viewer.