Changeset 236987 in webkit
- Timestamp:
- Oct 9, 2018, 4:21:18 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 16 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed-expected.txt (added)
-
LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed.html (added)
-
LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed-expected.txt (added)
-
LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed.html (added)
-
LayoutTests/http/tests/download/anchor-load-after-download.html (modified) (1 diff)
-
LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js (modified) (1 diff)
-
LayoutTests/platform/ios-wk2/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/loader/FrameLoader.cpp (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestInvocation.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/TestInvocation.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r236980 r236987 1 2018-10-09 Chris Dumez <cdumez@apple.com> 2 3 Anchor target should be ignored on activation when the download attribute is set 4 https://bugs.webkit.org/show_bug.cgi?id=190408 5 6 Reviewed by Geoffrey Garen. 7 8 * fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed-expected.txt: Added. 9 * fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed.html: Added. 10 * fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed-expected.txt: Added. 11 * fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed.html: Added. 12 Add layout test coverage. 13 14 * http/tests/download/anchor-load-after-download.html: 15 * http/tests/workers/service/resources/registration-task-queue-scheduling-1.js: 16 Update existing WK2-only layout tests to call testRunner.setCanOpenWindows() since they rely on 17 opening a new window. We failed to notice the issue because these tests are not run on WK1. 18 19 * platform/ios-wk2/TestExpectations: 20 * platform/mac-wk1/TestExpectations: 21 * platform/win/TestExpectations: 22 Skip new tests on WebKit1 since the download attribute is only supported on WebKit2. 23 1 24 2018-10-09 Chris Dumez <cdumez@apple.com> 2 25 -
trunk/LayoutTests/http/tests/download/anchor-load-after-download.html
r223413 r236987 5 5 if (window.testRunner) { 6 6 testRunner.dumpAsText(); 7 testRunner.setCanOpenWindows(); 7 8 testRunner.waitUntilDone(); 8 9 } -
trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js
r226722 r236987 1 1 // This test makes sure that two different windows from two different domains who spam SW registrations get responses intertwined with each other 2 2 // as each registration should operate on its own task queue. 3 4 if (window.testRunner) 5 testRunner.setCanOpenWindows(); 3 6 4 7 if (location.hostname != "127.0.0.1") -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r236980 r236987 1068 1068 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html [ Skip ] 1069 1069 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download.html [ Skip ] 1070 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed.html [ Skip ] 1070 1071 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html [ Skip ] 1072 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed.html [ Skip ] 1071 1073 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Skip ] 1072 1074 webkit.org/b/156067 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Skip ] -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r236970 r236987 308 308 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html [ Skip ] 309 309 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download.html [ Skip ] 310 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed.html [ Skip ] 310 311 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html [ Skip ] 312 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed.html [ Skip ] 311 313 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Skip ] 312 314 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Skip ] -
trunk/LayoutTests/platform/win/TestExpectations
r236970 r236987 456 456 fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html [ Skip ] 457 457 fast/dom/HTMLAnchorElement/anchor-file-blob-download.html [ Skip ] 458 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed.html [ Skip ] 458 459 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html [ Skip ] 460 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed.html [ Skip ] 459 461 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Skip ] 460 462 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r236985 r236987 1 2018-10-09 Chris Dumez <cdumez@apple.com> 2 3 Anchor target should be ignored on activation when the download attribute is set 4 https://bugs.webkit.org/show_bug.cgi?id=190408 5 6 Reviewed by Geoffrey Garen. 7 8 Anchor target should be ignored on activation when the download attribute is set: 9 - https://html.spec.whatwg.org/#the-a-element:downloading-hyperlinks-2 10 11 When the download attribute is set, we should use the "download the hyperlink" algorithm [1] 12 instead of the "follow the hyperlink" [2] algorithm. 13 14 Note that the "download the hyperlink" triggers a download and ignores the target attribute 15 entirely. 16 17 This is important as an anchor element with target=_blank and the download attribute set may 18 fail because of Safari's popup blocker if we do not disregard the anchor target. 19 20 [1] https://html.spec.whatwg.org/#downloading-hyperlinks 21 [2] https://html.spec.whatwg.org/#following-hyperlinks-2 22 23 Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed.html 24 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed.html 25 26 * loader/FrameLoader.cpp: 27 (WebCore::FrameLoader::loadURL): 28 1 29 2018-10-09 Michael Catanzaro <mcatanzaro@igalia.com> 2 30 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r236970 r236987 1323 1323 Ref<Frame> protect(m_frame); 1324 1324 1325 String frameName = frameLoadRequest.frameName(); 1325 // Anchor target is ignored when the download attribute is set since it will download the hyperlink rather than follow it. 1326 String effectiveFrameName = frameLoadRequest.downloadAttribute().isNull() ? frameLoadRequest.frameName() : String(); 1326 1327 AllowNavigationToInvalidURL allowNavigationToInvalidURL = frameLoadRequest.allowNavigationToInvalidURL(); 1327 1328 NewFrameOpenerPolicy openerPolicy = frameLoadRequest.newFrameOpenerPolicy(); … … 1346 1347 1347 1348 // The search for a target frame is done earlier in the case of form submission. 1348 Frame* targetFrame = isFormSubmission ? nullptr : findFrameForNavigation( frameName);1349 Frame* targetFrame = isFormSubmission ? nullptr : findFrameForNavigation(effectiveFrameName); 1349 1350 if (targetFrame && targetFrame != &m_frame) { 1350 1351 frameLoadRequest.setFrameName("_self"); … … 1361 1362 action.setHasOpenedFrames(!m_openedFrames.isEmpty()); 1362 1363 1363 if (!targetFrame && ! frameName.isEmpty()) {1364 if (!targetFrame && !effectiveFrameName.isEmpty()) { 1364 1365 action = action.copyWithShouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicyToApply(m_frame, frameLoadRequest)); 1365 policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(request), WTFMove(formState), frameName, [this, allowNavigationToInvalidURL, openerPolicy, completionHandler = completionHandlerCaller.release()] (const ResourceRequest& request, WeakPtr<FormState>&& formState, const String& frameName, const NavigationAction& action, ShouldContinue shouldContinue) mutable {1366 policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(request), WTFMove(formState), effectiveFrameName, [this, allowNavigationToInvalidURL, openerPolicy, completionHandler = completionHandlerCaller.release()] (const ResourceRequest& request, WeakPtr<FormState>&& formState, const String& frameName, const NavigationAction& action, ShouldContinue shouldContinue) mutable { 1366 1367 continueLoadAfterNewWindowPolicy(request, formState.get(), frameName, action, shouldContinue, allowNavigationToInvalidURL, openerPolicy); 1367 1368 completionHandler(); -
trunk/Tools/ChangeLog
r236984 r236987 1 2018-10-09 Chris Dumez <cdumez@apple.com> 2 3 Anchor target should be ignored on activation when the download attribute is set 4 https://bugs.webkit.org/show_bug.cgi?id=190408 5 6 Reviewed by Geoffrey Garen. 7 8 Update WebKitTestRunner to block popups by default and add support for testRunner.setCanOpenWindows() 9 for tests that need popups. This aligns WebKitTestRunner with DumpRenderTree and allows testing 10 popup blocking. 11 12 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 13 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 14 (WTR::TestRunner::setCanOpenWindows): 15 * WebKitTestRunner/InjectedBundle/TestRunner.h: 16 * WebKitTestRunner/TestController.cpp: 17 (WTR::TestController::createOtherPage): 18 * WebKitTestRunner/TestController.h: 19 * WebKitTestRunner/TestInvocation.cpp: 20 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 21 * WebKitTestRunner/TestInvocation.h: 22 1 23 2018-10-09 Jer Noble <jer.noble@apple.com> 2 24 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r236690 r236987 67 67 void keepWebHistory(); 68 68 void setAcceptsEditing(boolean value); 69 void setCanOpenWindows( boolean value);69 void setCanOpenWindows(); 70 70 void setCloseRemainingWindowsWhenComplete(boolean value); 71 71 void setXSSAuditorEnabled(boolean value); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r236954 r236987 411 411 } 412 412 413 void TestRunner::setCanOpenWindows(bool) 414 { 415 // The test plugins/get-url-with-blank-target.html requires that the embedding client forbid 416 // opening windows (by omitting a call to this function) so as to test that NPN_GetURL() 417 // with a blank target will return an error. 418 // 419 // It is not clear if we should implement this functionality or remove it and plugins/get-url-with-blank-target.html 420 // per the remark in <https://trac.webkit.org/changeset/64504/trunk/LayoutTests/platform/mac-wk2/Skipped>. 421 // For now, just ignore this setting. 413 void TestRunner::setCanOpenWindows() 414 { 415 WKRetainPtr<WKStringRef> messsageName(AdoptWK, WKStringCreateWithUTF8CString("SetCanOpenWindows")); 416 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(true)); 417 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messsageName.get(), messageBody.get(), nullptr); 422 418 } 423 419 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r236954 r236987 100 100 void keepWebHistory(); 101 101 void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; } 102 void setCanOpenWindows( bool);102 void setCanOpenWindows(); 103 103 void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; } 104 104 void setXSSAuditorEnabled(bool); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r236720 r236987 243 243 } 244 244 245 WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)245 WKPageRef TestController::createOtherPage(WKPageRef, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo) 246 246 { 247 247 PlatformWebView* parentView = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo)); 248 return TestController::singleton().createOtherPage(parentView, configuration, navigationAction, windowFeatures); 249 } 250 251 WKPageRef TestController::createOtherPage(PlatformWebView* parentView, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures) 252 { 253 // The test needs to call testRunner.setCanOpenWindows() to open new windows. 254 if (!m_currentInvocation->canOpenWindows()) 255 return nullptr; 248 256 249 257 PlatformWebView* view = platformCreateOtherPage(parentView, configuration, parentView->options()); -
trunk/Tools/WebKitTestRunner/TestController.h
r236690 r236987 401 401 402 402 static WKPageRef createOtherPage(WKPageRef, WKPageConfigurationRef, WKNavigationActionRef, WKWindowFeaturesRef, const void*); 403 WKPageRef createOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, WKNavigationActionRef, WKWindowFeaturesRef); 403 404 404 405 static void runModal(WKPageRef, const void* clientInfo); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r236690 r236987 803 803 return WKRetainPtr<WKTypeRef>(AdoptWK, WKBooleanCreate(m_dumpFrameLoadCallbacks)); 804 804 805 if (WKStringIsEqualToUTF8CString(messageName, "SetCanOpenWindows")) { 806 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 807 m_canOpenWindows = static_cast<unsigned char>(WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody))); 808 return nullptr; 809 } 810 805 811 if (WKStringIsEqualToUTF8CString(messageName, "SetWindowIsKey")) { 806 812 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); -
trunk/Tools/WebKitTestRunner/TestInvocation.h
r235690 r236987 85 85 86 86 void dumpResourceLoadStatistics(); 87 88 bool canOpenWindows() const { return m_canOpenWindows; } 87 89 88 90 private: … … 133 135 bool m_pixelResultIsPending { false }; 134 136 bool m_shouldDumpResourceLoadStatistics { false }; 137 bool m_canOpenWindows { false }; 135 138 WhatToDump m_whatToDump { WhatToDump::RenderTree }; 136 139
Note:
See TracChangeset
for help on using the changeset viewer.