Changeset 287353 in webkit
- Timestamp:
- Dec 22, 2021, 2:13:07 AM (5 years ago)
- Location:
- trunk
- 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
-
trunk/LayoutTests/ChangeLog
r287351 r287353 1 2021-12-22 Youenn Fablet <youenn@apple.com> 2 3 Use requester when calling updateRequestAndAddExtraFields 4 https://bugs.webkit.org/show_bug.cgi?id=234507 5 <rdar://problem/85049490> 6 7 Reviewed by Brent Fulgham. 8 9 * http/wpt/service-workers/navigation-iframe-site-worker.js: Added. 10 * http/wpt/service-workers/navigation-iframe-site.https-expected.txt: Added. 11 * http/wpt/service-workers/navigation-iframe-site.https.html: Added. 12 * http/wpt/service-workers/resources/navigation-iframe-site-frame.html: Added. 13 1 14 2021-12-22 Arcady Goldmints-Orlov <agoldmints@igalia.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r287350 r287353 1 2021-12-22 Youenn Fablet <youenn@apple.com> 2 3 Use requester when calling updateRequestAndAddExtraFields 4 https://bugs.webkit.org/show_bug.cgi?id=234507 5 <rdar://problem/85049490> 6 7 Reviewed by Brent Fulgham. 8 9 In case of navigation loads, the requester is the fetch request client. 10 As such, it should be the one used to determine whether the request is cross-origin is not. 11 Pass the requester to updateRequestAndAddExtraFields to do the correct computation. 12 Validate that some request fields are now correctly observed in service workers. 13 14 Test: http/wpt/service-workers/navigation-iframe-site.https.html 15 16 * loader/FrameLoader.cpp: 17 * loader/FrameLoader.h: 18 * testing/ServiceWorkerInternals.cpp: 19 * testing/ServiceWorkerInternals.h: 20 * testing/ServiceWorkerInternals.idl: 21 1 22 2021-12-22 Philippe Normand <pnormand@igalia.com> 2 23 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r287348 r287353 1343 1343 request.setHTTPReferrer(referrer); 1344 1344 1345 updateRequestAndAddExtraFields(request, IsMainResource::Yes, newLoadType );1345 updateRequestAndAddExtraFields(request, IsMainResource::Yes, newLoadType, ShouldUpdateAppInitiatedValue::Yes, FrameLoader::IsServiceWorkerNavigationLoad::No, &frameLoadRequest.requester()); 1346 1346 1347 1347 ASSERT(newLoadType != FrameLoadType::Same); … … 2904 2904 } 2905 2905 2906 void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate, IsServiceWorkerNavigationLoad isServiceWorkerNavigationLoad )2906 void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate, IsServiceWorkerNavigationLoad isServiceWorkerNavigationLoad, Document* initiator) 2907 2907 { 2908 2908 ASSERT(isServiceWorkerNavigationLoad == IsServiceWorkerNavigationLoad::No || mainResource != IsMainResource::Yes); … … 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); … … 3068 3070 workingResourceRequest.setHTTPBody(inRequest.httpBody()); 3069 3071 workingResourceRequest.setHTTPContentType(contentType); 3070 updateRequestAndAddExtraFields(workingResourceRequest, IsMainResource::Yes, loadType );3072 updateRequestAndAddExtraFields(workingResourceRequest, IsMainResource::Yes, loadType, ShouldUpdateAppInitiatedValue::Yes, FrameLoader::IsServiceWorkerNavigationLoad::No, &request.requester()); 3071 3073 3072 3074 if (Document* document = m_frame.document()) -
trunk/Source/WebCore/loader/FrameLoader.h
r287021 r287353 320 320 enum class IsServiceWorkerNavigationLoad : bool { No, Yes }; 321 321 // For subresource requests the FrameLoadType parameter has no effect and can be skipped. 322 void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes, IsServiceWorkerNavigationLoad = IsServiceWorkerNavigationLoad::No );322 void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes, IsServiceWorkerNavigationLoad = IsServiceWorkerNavigationLoad::No, Document* = nullptr); 323 323 324 324 void scheduleRefreshIfNeeded(Document&, const String& content, IsMetaRefresh); -
trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp
r286044 r287353 189 189 } 190 190 191 bool ServiceWorkerInternals::fetchEventIsSameSite(FetchEvent& event) 192 { 193 return event.request().internalRequest().isSameSite(); 194 } 195 191 196 } // namespace WebCore 192 197 -
trunk/Source/WebCore/testing/ServiceWorkerInternals.h
r286044 r287353 70 70 RefPtr<PushSubscription> createPushSubscription(const String& endpoint, std::optional<EpochTimeStamp> expirationTime, const ArrayBuffer& serverVAPIDPublicKey, const ArrayBuffer& clientECDHPublicKey, const ArrayBuffer& auth); 71 71 72 bool fetchEventIsSameSite(FetchEvent&); 73 72 74 private: 73 75 explicit ServiceWorkerInternals(ServiceWorkerIdentifier); -
trunk/Source/WebCore/testing/ServiceWorkerInternals.idl
r286044 r287353 50 50 51 51 PushSubscription createPushSubscription(USVString endpoint, EpochTimeStamp? expirationTime, ArrayBuffer serverVAPIDPublicKey, ArrayBuffer clientECDHPublicKey, ArrayBuffer auth); 52 53 boolean fetchEventIsSameSite(FetchEvent event); 52 54 };
Note:
See TracChangeset
for help on using the changeset viewer.