Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clicks on Link with download attribute causes all (other) links to tr…
…igger download when clicked https://bugs.webkit.org/show_bug.cgi?id=178267 <rdar://problem/34985016> Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebaseline test which behave differently now in WebKit2 due to WKTR's injected bundle using PassThrough policy for new windows. The new result is identical to what you would get when you open the test in Safari so I think this is a good thing. * web-platform-tests/html/browsers/windows/noreferrer-window-name-expected.txt: Source/WebKit: When clicking on an anchor with the download attribute, the m_syncNavigationActionHasDownloadAttribute flag on WebPageProxy would get set. This flag would not get reset right away and instead, it would get updated during the next call to WebPageProxy::decidePolicyForNavigationAction(). The issue is that if you later click on a link with target="_blank", WebPageProxy::decidePolicyForNewWindowAction() gets called instead of WebPageProxy::decidePolicyForNavigationAction() and we do not reset the m_syncNavigationActionHasDownloadAttribute flag and we force a download. To address the problem, I got rid of this flag on WebPageProxy and it is error-prone and should really not be at page-level. Instead, I added a shouldForceDownload flag on the navigation object. It makes more sense to associate the flag with the navigation and makes it less error-prone. * UIProcess/API/APINavigation.h: (API::Navigation::setShouldForceDownload): (API::Navigation::shouldForceDownload const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebPageProxy.h: Tools: Use PassThrough policy in WKTR's InjectedBundle's decidePolicyForNewWindowAction so that the request is sent to the UIProcess. This gets WKTR's closer to Safari behavior and helps reproduce the bug. Without this change, I would not be able to write a regression test for this bug that is very easily reproducible in Safari. * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::decidePolicyForNewWindowAction): LayoutTests: Add layout test coverage. * http/tests/download/anchor-load-after-download-expected.txt: Added. * http/tests/download/anchor-load-after-download.html: Added. * platform/ios-wk2/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk1/imported/w3c/web-platform-tests/html/browsers/windows/noreferrer-window-name-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/noreferrer-window-name-expected.txt. Canonical link: https://commits.webkit.org/194558@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223413 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing with 131 additions and 18 deletions.
- +16 −0 LayoutTests/ChangeLog
- +5 −0 LayoutTests/http/tests/download/anchor-load-after-download-expected.txt
- +29 −0 LayoutTests/http/tests/download/anchor-load-after-download.html
- +14 −0 LayoutTests/imported/w3c/ChangeLog
- +1 −7 ...utTests/imported/w3c/web-platform-tests/html/browsers/windows/noreferrer-window-name-expected.txt
- +1 −0 LayoutTests/platform/ios-wk2/TestExpectations
- +1 −0 LayoutTests/platform/mac-wk1/TestExpectations
- +13 −0 ...mac-wk1/imported/w3c/web-platform-tests/html/browsers/windows/noreferrer-window-name-expected.txt
- +27 −0 Source/WebKit/ChangeLog
- +4 −0 Source/WebKit/UIProcess/API/APINavigation.h
- +3 −6 Source/WebKit/UIProcess/WebPageProxy.cpp
- +0 −4 Source/WebKit/UIProcess/WebPageProxy.h
- +16 −0 Tools/ChangeLog
- +1 −1 Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp