Changeset 280870 in webkit
- Timestamp:
- Aug 10, 2021 4:19:03 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 15 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (2 diffs)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/html/HTMLMetaElement.cpp (modified) (1 diff)
-
Source/WebCore/loader/DocumentLoader.cpp (modified) (1 diff)
-
Source/WebCore/loader/FrameLoader.cpp (modified) (3 diffs)
-
Source/WebCore/loader/FrameLoader.h (modified) (1 diff)
-
Source/WebCore/loader/FrameLoaderTypes.h (modified) (1 diff)
-
Source/WebCore/loader/NavigationScheduler.cpp (modified) (5 diffs)
-
Source/WebCore/loader/NavigationScheduler.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r280862 r280870 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Meta HTTP refresh should not navigate if document has sandboxed automatic features browsing context flag set 4 https://bugs.webkit.org/show_bug.cgi?id=228965 5 6 Reviewed by Darin Adler. 7 8 Unskip tests that should no longer be flaky now that they are passing. 9 10 * TestExpectations: 11 1 12 2021-08-10 Ayumi Kojima <ayumi_kojima@apple.com> 2 13 -
trunk/LayoutTests/TestExpectations
r280827 r280870 1505 1505 # Flaky tests at import time 1506 1506 imported/w3c/web-platform-tests/css/css-scoping/css-scoping-shadow-host-namespace.html [ ImageOnlyFailure ] 1507 1508 # Those WPT tests are flaky when failing.1509 imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1.html [ Pass Failure ]1510 imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2.html [ Pass Failure ]1511 1507 1512 1508 # WPT tests for custom elements -
trunk/LayoutTests/imported/w3c/ChangeLog
r280855 r280870 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Meta HTTP refresh should not navigate if document has sandboxed automatic features browsing context flag set 4 https://bugs.webkit.org/show_bug.cgi?id=228965 5 6 Reviewed by Darin Adler. 7 8 Rebaseline WPT tests that are now passing. 9 10 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt: 11 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt: 12 1 13 2021-08-10 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt
r259900 r280870 1 CONSOLE MESSAGE: TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node1 CONSOLE MESSAGE: Unable to do meta refresh due to sandboxing 2 2 3 FAIL Meta refresh is blocked by the allow-scripts sandbox flag at its creation time, not when refresh comes due TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node3 PASS Meta refresh is blocked by the allow-scripts sandbox flag at its creation time, not when refresh comes due 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt
r259900 r280870 1 CONSOLE MESSAGE: TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node1 CONSOLE MESSAGE: Unable to do meta refresh due to sandboxing 2 2 3 FAIL Meta refresh of the original iframe is not blocked if moved into a sandboxed iframe TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node3 PASS Meta refresh of the original iframe is not blocked if moved into a sandboxed iframe 4 4 -
trunk/Source/WebCore/ChangeLog
r280861 r280870 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Meta HTTP refresh should not navigate if document has sandboxed automatic features browsing context flag set 4 https://bugs.webkit.org/show_bug.cgi?id=228965 5 6 Reviewed by Darin Adler. 7 8 Meta HTTP refresh should not navigate if document has sandboxed automatic features browsing context flag set: 9 - https://html.spec.whatwg.org/multipage/semantics.html#shared-declarative-refresh-steps (Step 13) 10 11 Firefox and Chrome already behave this way. 12 13 No new tests, rebaselined existing tests. 14 15 * dom/Document.cpp: 16 (WebCore::Document::processMetaHttpEquiv): 17 * dom/Document.h: 18 * html/HTMLMetaElement.cpp: 19 (WebCore::HTMLMetaElement::process): 20 * loader/DocumentLoader.cpp: 21 (WebCore::DocumentLoader::responseReceived): 22 * loader/FrameLoader.cpp: 23 (WebCore::FrameLoader::receivedFirstData): 24 (WebCore::FrameLoader::scheduleRefreshIfNeeded): 25 * loader/FrameLoader.h: 26 * loader/FrameLoaderTypes.h: 27 * loader/NavigationScheduler.cpp: 28 (WebCore::ScheduledRedirect::ScheduledRedirect): 29 (WebCore::NavigationScheduler::scheduleRedirect): 30 * loader/NavigationScheduler.h: 31 1 32 2021-08-10 Ryosuke Niwa <rniwa@webkit.org> 2 33 -
trunk/Source/WebCore/dom/Document.cpp
r280855 r280870 3737 3737 } 3738 3738 3739 void Document::process HttpEquiv(const String& equiv, const String& content, bool isInDocumentHead)3739 void Document::processMetaHttpEquiv(const String& equiv, const String& content, bool isInDocumentHead) 3740 3740 { 3741 3741 ASSERT(!equiv.isNull()); … … 3782 3782 case HTTPHeaderName::Refresh: 3783 3783 if (frame) 3784 frame->loader().scheduleRefreshIfNeeded(*this, content );3784 frame->loader().scheduleRefreshIfNeeded(*this, content, IsMetaRefresh::Yes); 3785 3785 break; 3786 3786 -
trunk/Source/WebCore/dom/Document.h
r280855 r280870 893 893 // tag. This enables scripts to use meta tags to perform refreshes and set expiry dates in addition to them being 894 894 // specified in an HTML file. 895 void process HttpEquiv(const String& equiv, const String& content, bool isInDocumentHead);895 void processMetaHttpEquiv(const String& equiv, const String& content, bool isInDocumentHead); 896 896 897 897 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebCore/html/HTMLMetaElement.cpp
r278340 r280870 182 182 const AtomString& httpEquivValue = attributeWithoutSynchronization(http_equivAttr); 183 183 if (!httpEquivValue.isNull()) 184 document().process HttpEquiv(httpEquivValue, contentValue, isDescendantOf(document().head()));184 document().processMetaHttpEquiv(httpEquivValue, contentValue, isDescendantOf(document().head())); 185 185 } 186 186 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r280504 r280870 928 928 if (auto loginDomains = NetworkStorageSession::subResourceDomainsInNeedOfStorageAccessForFirstParty(firstPartyDomain)) { 929 929 if (!Quirks::hasStorageAccessForAllLoginDomains(*loginDomains, firstPartyDomain)) { 930 m_frame->navigationScheduler().scheduleRedirect(document, 0, microsoftTeamsRedirectURL() );930 m_frame->navigationScheduler().scheduleRedirect(document, 0, microsoftTeamsRedirectURL(), IsMetaRefresh::No); 931 931 return; 932 932 } -
trunk/Source/WebCore/loader/FrameLoader.cpp
r280859 r280870 714 714 LinkLoader::loadLinksFromHeader(documentLoader.response().httpHeaderField(HTTPHeaderName::Link), document.url(), document, LinkLoader::MediaAttributeCheck::MediaAttributeEmpty); 715 715 716 scheduleRefreshIfNeeded(document, documentLoader.response().httpHeaderField(HTTPHeaderName::Refresh) );716 scheduleRefreshIfNeeded(document, documentLoader.response().httpHeaderField(HTTPHeaderName::Refresh), IsMetaRefresh::No); 717 717 } 718 718 … … 2969 2969 } 2970 2970 2971 void FrameLoader::scheduleRefreshIfNeeded(Document& document, const String& content )2971 void FrameLoader::scheduleRefreshIfNeeded(Document& document, const String& content, IsMetaRefresh isMetaRefresh) 2972 2972 { 2973 2973 double delay = 0; … … 2976 2976 auto completedURL = urlString.isEmpty() ? document.url() : document.completeURL(urlString); 2977 2977 if (!completedURL.protocolIsJavaScript()) 2978 m_frame.navigationScheduler().scheduleRedirect(document, delay, completedURL );2978 m_frame.navigationScheduler().scheduleRedirect(document, delay, completedURL, isMetaRefresh); 2979 2979 else { 2980 2980 String message = "Refused to refresh " + document.url().stringCenterEllipsizedToLength() + " to a javascript: URL"; -
trunk/Source/WebCore/loader/FrameLoader.h
r280504 r280870 320 320 void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes); 321 321 322 void scheduleRefreshIfNeeded(Document&, const String& content );322 void scheduleRefreshIfNeeded(Document&, const String& content, IsMetaRefresh); 323 323 324 324 void switchBrowsingContextsGroup(); -
trunk/Source/WebCore/loader/FrameLoaderTypes.h
r278253 r280870 70 70 }; 71 71 72 enum class IsMetaRefresh : bool { No, Yes }; 72 73 enum class WillContinueLoading : bool { No, Yes }; 73 74 -
trunk/Source/WebCore/loader/NavigationScheduler.cpp
r271124 r280870 168 168 class ScheduledRedirect : public ScheduledURLNavigation { 169 169 public: 170 ScheduledRedirect(Document& initiatingDocument, double delay, SecurityOrigin* securityOrigin, const URL& url, LockHistory lockHistory, LockBackForwardList lockBackForwardList )170 ScheduledRedirect(Document& initiatingDocument, double delay, SecurityOrigin* securityOrigin, const URL& url, LockHistory lockHistory, LockBackForwardList lockBackForwardList, IsMetaRefresh isMetaRefresh) 171 171 : ScheduledURLNavigation(initiatingDocument, delay, securityOrigin, url, String(), lockHistory, lockBackForwardList, false, false) 172 , m_isMetaRefresh(isMetaRefresh) 172 173 { 173 174 clearUserGesture(); … … 181 182 void fire(Frame& frame) override 182 183 { 184 if (m_isMetaRefresh == IsMetaRefresh::Yes) { 185 if (auto document = frame.document(); document && document->isSandboxed(SandboxAutomaticFeatures)) { 186 document->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Unable to do meta refresh due to sandboxing"_s); 187 return; 188 } 189 } 190 183 191 UserGestureIndicator gestureIndicator { userGestureToForward() }; 184 192 … … 195 203 frame.loader().changeLocation(WTFMove(frameLoadRequest)); 196 204 } 205 206 private: 207 IsMetaRefresh m_isMetaRefresh; 197 208 }; 198 209 … … 408 419 } 409 420 410 void NavigationScheduler::scheduleRedirect(Document& initiatingDocument, double delay, const URL& url )421 void NavigationScheduler::scheduleRedirect(Document& initiatingDocument, double delay, const URL& url, IsMetaRefresh isMetaRefresh) 411 422 { 412 423 if (!shouldScheduleNavigation(url)) … … 420 431 if (!m_redirect || delay <= m_redirect->delay()) { 421 432 auto lockBackForwardList = delay <= 1 ? LockBackForwardList::Yes : LockBackForwardList::No; 422 schedule(makeUnique<ScheduledRedirect>(initiatingDocument, delay, &m_frame.document()->securityOrigin(), url, LockHistory::Yes, lockBackForwardList ));433 schedule(makeUnique<ScheduledRedirect>(initiatingDocument, delay, &m_frame.document()->securityOrigin(), url, LockHistory::Yes, lockBackForwardList, isMetaRefresh)); 423 434 } 424 435 } -
trunk/Source/WebCore/loader/NavigationScheduler.h
r248762 r280870 55 55 bool locationChangePending(); 56 56 57 void scheduleRedirect(Document& initiatingDocument, double delay, const URL& );57 void scheduleRedirect(Document& initiatingDocument, double delay, const URL&, IsMetaRefresh); 58 58 void scheduleLocationChange(Document& initiatingDocument, SecurityOrigin&, const URL&, const String& referrer, LockHistory = LockHistory::Yes, LockBackForwardList = LockBackForwardList::Yes, CompletionHandler<void()>&& = [] { }); 59 59 void scheduleFormSubmission(Ref<FormSubmission>&&);
Note: See TracChangeset
for help on using the changeset viewer.