Add pop-up policy support in website policies.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Jan 2018 19:12:43 +0000 (19:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Jan 2018 19:12:43 +0000 (19:12 +0000)
commit8d3d48830df01d0dda62a8214e473beaa618b7f1
treeaa9d8c68ec88e1aa43f07e49d0ce5c300a111389
parente9f0d3e5d59f19e819d298f3a27fc47bef0644ee
Add pop-up policy support in website policies.
https://bugs.webkit.org/show_bug.cgi?id=181544.
rdar://problem/30521400.

Patch by Zach Li <zachli@apple.com> on 2018-01-16
Reviewed by Alex Christensen.

Source/WebCore:

* loader/DocumentLoader.h:
Introduce pop-up policy getter and setter. Initialize
the policy as Default.
(WebCore::DocumentLoader::popUpPolicy const):
(WebCore::DocumentLoader::setPopUpPolicy):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::allowPopUp):
Pop-up policy specified on a per-page basis holds
precedence over the global policy. If no pop-up policy
is specified during navigation, global policy is used.

Source/WebKit:

* Shared/WebsitePoliciesData.cpp: Encode and decode
pop-up policy.
(WebKit::WebsitePoliciesData::encode const):
(WebKit::WebsitePoliciesData::decode):
(WebKit::WebsitePoliciesData::applyToDocumentLoader):
Apply the pop-up policy from website policies to the
document loader.

* Shared/WebsitePoliciesData.h:

* Shared/WebsitePopUpPolicy.h:
Added for declaring enum WebsitePopUpPolicy.

* UIProcess/API/APIWforebsitePolicies.cpp:
Include pop-up policy in website policies.
(API::WebsitePolicies::WebsitePolicies):
(API::WebsitePolicies::data):
* UIProcess/API/APIWebsitePolicies.h:

* UIProcess/API/C/WKWebsitePolicies.cpp:
Added C API to get and set pop-up policy on
website policies.
(WKWebsitePoliciesGetPopUpPolicy):
(WKWebsitePoliciesSetPopUpPolicy):
* UIProcess/API/C/WKWebsitePolicies.h:

* UIProcess/API/Cocoa/_WKWebsitePolicies.h:
Added Obj-C API to get and set pop-up policy
on website policies.
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
(-[_WKWebsitePolicies setPopUpPolicy:]):
(-[_WKWebsitePolicies popUpPolicy]):

* WebKit.xcodeproj/project.pbxproj:
Added WebsitePopUpPolicy.h.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Added pop-up-check.html.

* TestWebKitAPI/Tests/WebKit/pop-up-check.html: Added.

* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(-[PopUpPoliciesDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[PopUpPoliciesDelegate _webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[PopUpPoliciesDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/page/DOMWindow.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebsitePoliciesData.cpp
Source/WebKit/Shared/WebsitePoliciesData.h
Source/WebKit/Shared/WebsitePopUpPolicy.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
Source/WebKit/UIProcess/API/APIWebsitePolicies.h
Source/WebKit/UIProcess/API/C/WKWebsitePolicies.cpp
Source/WebKit/UIProcess/API/C/WKWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit/pop-up-check.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm