HTML String load cannot be prevented by responding 'Cancel' asynchronously in decideP...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Apr 2018 20:49:57 +0000 (20:49 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Apr 2018 20:49:57 +0000 (20:49 +0000)
commit63a306d899f60b543ef88d0a935e56fb85311a81
tree2bf04852b3ef09f1a176afa7c95c3a0491648c88
parent5ca73a01f5de0a201c74c454480f01b30250c248
HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction
https://bugs.webkit.org/show_bug.cgi?id=184848
<rdar://problem/39145306>

Reviewed by Brady Eidson.

Source/WebCore:

When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank'
with substitute data. In such case, we want to do a regular asynchronous policy
delegate check, there is no reason we need it to be synchronous. Update our check
to make sure we only do a synchronous policy check for initial 'about:blank' loads
that do not have substitute data.

* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm:
(-[DecidePolicyForNavigationActionController webView:decidePolicyForNavigationAction:decisionHandler:]):
(TEST):

LayoutTests:

Update layout tests that wrongly expected 'about:blank' to load synchronously even
when it is not the initial empty document of an iframe. I have checked that our
behavior is now consistent with Chrome.

* fast/events/beforeunload-alert-user-interaction2.html:
* http/tests/security/cross-origin-reified-window-location-setting-expected.txt:
* http/tests/security/cross-origin-reified-window-location-setting.html:
* webarchive/loading/javascript-url-iframe-crash-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/beforeunload-alert-user-interaction2.html
LayoutTests/http/tests/security/cross-origin-reified-window-location-setting-expected.txt
LayoutTests/http/tests/security/cross-origin-reified-window-location-setting.html
LayoutTests/platform/wk2/webarchive/loading/javascript-url-iframe-crash-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/PolicyChecker.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm