Skip to content

Commit c5fa272

Browse files
committed
Add WKTR support for "should open external URLs".
https://bugs.webkit.org/show_bug.cgi?id=145505 Reviewed by Darin Adler. Source/WebKit2: Expose C-spi to allow WKTR to set this bit on new loads: * UIProcess/API/C/WKPage.cpp: (WKPageLoadURLWithShouldOpenExternalURLsPolicy): * UIProcess/API/C/WKPagePrivate.h: Expose the bit on NavigationAction for the policy delegate: * WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp: (WKBundleNavigationActionGetShouldOpenExternalURLs): * WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h: Copied from Tools/WebKitTestRunner/WorkQueueManager.h. * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp: (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction): * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h: (WebKit::InjectedBundleNavigationAction::shouldOpenExternalURLs): * WebKit2.xcodeproj/project.pbxproj: Tools: - Add a new option to "queueLoad" to allow javascript to queue a load that has the "should open external URLs" bit set. - Add a new "dumpPolicyDelegateCallbacks" call to dump the NavigationAction in the policy delegate, including whether or not the bit was set. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::queueLoad): * WebKitTestRunner/InjectedBundle/TestRunner.h: (WTR::TestRunner::dumpPolicyDelegateCallbacks): (WTR::TestRunner::shouldDumpPolicyCallbacks): * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::queueLoad): * WebKitTestRunner/InjectedBundle/InjectedBundle.h: * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::decidePolicyForNavigationAction): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): * WebKitTestRunner/WorkQueueManager.cpp: (WTR::WorkQueueManager::queueLoad): * WebKitTestRunner/WorkQueueManager.h: LayoutTests: * loader/navigation-policy/resources/notify-done.html: Added. * loader/navigation-policy/should-load-external-urls-set-by-api-basic-expected.txt: Added. * loader/navigation-policy/should-load-external-urls-set-by-api-basic.html: Added. * loader/navigation-policy/should-not-load-external-urls-set-by-api-basic-expected.txt: Added. * loader/navigation-policy/should-not-load-external-urls-set-by-api-basic.html: Added. * platform/ios-simulator-wk1/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/163561@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3637a3e commit c5fa272

27 files changed

Lines changed: 214 additions & 12 deletions

LayoutTests/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2015-06-01 Brady Eidson <beidson@apple.com>
2+
3+
Add WKTR support for "should open external URLs".
4+
https://bugs.webkit.org/show_bug.cgi?id=145505
5+
6+
Reviewed by Darin Adler.
7+
8+
* loader/navigation-policy/resources/notify-done.html: Added.
9+
* loader/navigation-policy/should-load-external-urls-set-by-api-basic-expected.txt: Added.
10+
* loader/navigation-policy/should-load-external-urls-set-by-api-basic.html: Added.
11+
* loader/navigation-policy/should-not-load-external-urls-set-by-api-basic-expected.txt: Added.
12+
* loader/navigation-policy/should-not-load-external-urls-set-by-api-basic.html: Added.
13+
14+
* platform/ios-simulator-wk1/TestExpectations:
15+
* platform/mac-wk1/TestExpectations:
16+
* platform/win/TestExpectations:
17+
118
2015-06-01 Chris Dumez <cdumez@apple.com>
219

320
ASSERT(revalidatingResource.inCache()) in MemoryCache when reloading tumblr.com
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- decidePolicyForNavigationAction
2+
<NSURLRequest URL resources/notify-done.html, main document URL resources/notify-done.html, http method GET> is main frame - yes should open URLs externally - no
3+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
if (window.testRunner) {
3+
testRunner.dumpAsText();
4+
testRunner.dumpPolicyDelegateCallbacks();
5+
testRunner.queueLoad("resources/notify-done.html");
6+
}
7+
</script>
8+
This test dumps the NavigationPolicy passed to the decidePolicyForNavigationAction delegate call.<br>
9+
It only makes sense to run this in WebKitTestRunner.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- decidePolicyForNavigationAction
2+
<NSURLRequest URL resources/notify-done.html, main document URL resources/notify-done.html, http method GET> is main frame - yes should open URLs externally - yes
3+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
if (window.testRunner) {
3+
testRunner.dumpAsText();
4+
testRunner.dumpPolicyDelegateCallbacks();
5+
testRunner.queueLoad("resources/notify-done.html", "", true);
6+
}
7+
</script>
8+
This test dumps the NavigationPolicy passed to the decidePolicyForNavigationAction delegate call.<br>
9+
It only makes sense to run this in WebKitTestRunner.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<script>
2+
if (window.testRunner)
3+
testRunner.notifyDone();
4+
</script>

LayoutTests/platform/ios-simulator-wk1/TestExpectations

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,3 +1446,6 @@ crypto/subtle/rsa-indexeddb-non-exportable.html
14461446
crypto/subtle/rsa-indexeddb.html
14471447
fast/history/page-cache-indexed-closed-db.html
14481448
fast/history/page-cache-indexed-opened-db.html
1449+
1450+
# ShouldOpenExternalURLs not yet supported in WK1
1451+
loader/navigation-policy [ Skip ]

LayoutTests/platform/mac-wk1/TestExpectations

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,8 @@ fast/events/mouse-force-up.html [ Skip ]
102102

103103
[ Yosemite+ ] platform/mac/fast/ruby/ruby-expansion-cjk-2.html [ ImageOnlyFailure ]
104104

105+
# ShouldOpenExternalURLs not yet supported in WK1
106+
loader/navigation-policy [ Skip ]
107+
105108
### END OF (2) Failures without bug reports
106109
########################################

LayoutTests/platform/win/TestExpectations

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,3 +3101,6 @@ webkit.org/b/143420 fast/fixed-layout/fixed-layout.html [ Skip ]
31013101

31023102
# Seems to be font metrics dependent.
31033103
fast/text/simple-line-layout-text-stroke-width.html [ Failure ]
3104+
3105+
# ShouldOpenExternalURLs not yet supported in WK1
3106+
loader/navigation-policy [ Skip ]

Source/WebKit2/ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2015-06-01 Brady Eidson <beidson@apple.com>
2+
3+
Add WKTR support for "should open external URLs".
4+
https://bugs.webkit.org/show_bug.cgi?id=145505
5+
6+
Reviewed by Darin Adler.
7+
8+
Expose C-spi to allow WKTR to set this bit on new loads:
9+
* UIProcess/API/C/WKPage.cpp:
10+
(WKPageLoadURLWithShouldOpenExternalURLsPolicy):
11+
* UIProcess/API/C/WKPagePrivate.h:
12+
13+
Expose the bit on NavigationAction for the policy delegate:
14+
* WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp:
15+
(WKBundleNavigationActionGetShouldOpenExternalURLs):
16+
* WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h: Copied from Tools/WebKitTestRunner/WorkQueueManager.h.
17+
18+
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
19+
(WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
20+
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
21+
(WebKit::InjectedBundleNavigationAction::shouldOpenExternalURLs):
22+
23+
* WebKit2.xcodeproj/project.pbxproj:
24+
125
2015-06-01 Gavin Barraclough <barraclough@apple.com>
226

327
PDFs always think they're visible on iOS.

0 commit comments

Comments
 (0)