Skip to content
Permalink
Browse files
Unreviewed, rolling out r229689.
https://bugs.webkit.org/show_bug.cgi?id=183735

Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
unload-crash.html to fail with async delegates (Requested by
cdumez_ on #webkit).

Reverted changeset:

"WebKit.WebsitePoliciesAutoplayQuirks API test times out with
async policy delegates"
https://bugs.webkit.org/show_bug.cgi?id=183702
https://trac.webkit.org/changeset/229689

Canonical link: https://commits.webkit.org/199371@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229704 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Mar 19, 2018
1 parent ceb1020 commit 4ffa73bf2f71d9e43ba63645e4c3731588ad06e8
Showing with 32 additions and 86 deletions.
  1. +16 −0 Source/WebCore/ChangeLog
  2. +0 −7 Source/WebCore/loader/FrameLoader.cpp
  3. +16 −0 Tools/ChangeLog
  4. +0 −79 Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm
@@ -1,3 +1,19 @@
2018-03-18 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r229689.
https://bugs.webkit.org/show_bug.cgi?id=183735

Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
unload-crash.html to fail with async delegates (Requested by
cdumez_ on #webkit).

Reverted changeset:

"WebKit.WebsitePoliciesAutoplayQuirks API test times out with
async policy delegates"
https://bugs.webkit.org/show_bug.cgi?id=183702
https://trac.webkit.org/changeset/229689

2018-03-17 Tim Horton <timothy_horton@apple.com>

Correct redefined fnfErr type
@@ -1542,13 +1542,6 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t
continueLoadAfterNavigationPolicy(request, formState, shouldContinue, allowNavigationToInvalidURL);
completionHandler();
});

if (policyChecker().delegateIsDecidingNavigationPolicy()) {
if (m_provisionalDocumentLoader) {
m_provisionalDocumentLoader->stopLoading();
setProvisionalDocumentLoader(nullptr);
}
}
}

void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url)
@@ -1,3 +1,19 @@
2018-03-18 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r229689.
https://bugs.webkit.org/show_bug.cgi?id=183735

Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
unload-crash.html to fail with async delegates (Requested by
cdumez_ on #webkit).

Reverted changeset:

"WebKit.WebsitePoliciesAutoplayQuirks API test times out with
async policy delegates"
https://bugs.webkit.org/show_bug.cgi?id=183702
https://trac.webkit.org/changeset/229689

2018-03-18 Zalan Bujtas <zalan@apple.com>

[LayoutReloaded] Remove left/right width/height getters from Layout.Box
@@ -200,42 +200,6 @@ - (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)even

@end

@interface AsyncAutoplayPoliciesDelegate : NSObject <WKNavigationDelegate, WKUIDelegatePrivate>
@property (nonatomic, copy) _WKWebsiteAutoplayPolicy(^autoplayPolicyForURL)(NSURL *);
@property (nonatomic, copy) _WKWebsiteAutoplayQuirk(^allowedAutoplayQuirksForURL)(NSURL *);
@end

@implementation AsyncAutoplayPoliciesDelegate

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
// _webView:decidePolicyForNavigationAction:decisionHandler: should be called instead if it is implemented.
EXPECT_TRUE(false);
decisionHandler(WKNavigationActionPolicyAllow);
}

- (void)_webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy, _WKWebsitePolicies *))decisionHandler
{
dispatch_async(dispatch_get_main_queue(), ^{
_WKWebsitePolicies *websitePolicies = [[[_WKWebsitePolicies alloc] init] autorelease];
if (_allowedAutoplayQuirksForURL)
websitePolicies.allowedAutoplayQuirks = _allowedAutoplayQuirksForURL(navigationAction.request.URL);
if (_autoplayPolicyForURL)
websitePolicies.autoplayPolicy = _autoplayPolicyForURL(navigationAction.request.URL);
decisionHandler(WKNavigationActionPolicyAllow, websitePolicies);
});
}

#if PLATFORM(MAC)
- (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags
{
receivedAutoplayEventFlags = flags;
receivedAutoplayEvent = event;
}
#endif

@end

TEST(WebKit, WebsitePoliciesAutoplayEnabled)
{
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
@@ -694,49 +658,6 @@ - (void)webView:(WKWebView *)webView stopURLSchemeTask:(id <WKURLSchemeTask>)tas
[webView stringByEvaluatingJavaScript:@"play()"];
[webView waitForMessage:@"playing"];
}

TEST(WebKit, WebsitePoliciesAutoplayQuirksAsyncPolicyDelegate)
{
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);

auto delegate = adoptNS([[AsyncAutoplayPoliciesDelegate alloc] init]);
[webView setNavigationDelegate:delegate.get()];

WKRetainPtr<WKPreferencesRef> preferences(AdoptWK, WKPreferencesCreate());
WKPreferencesSetNeedsSiteSpecificQuirks(preferences.get(), true);
WKPageGroupSetPreferences(WKPageGetPageGroup([webView _pageForTesting]), preferences.get());

NSURLRequest *requestWithAudio = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"autoplay-check" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];

[delegate setAllowedAutoplayQuirksForURL:^_WKWebsiteAutoplayQuirk(NSURL *url) {
return _WKWebsiteAutoplayQuirkSynthesizedPauseEvents;
}];
[delegate setAutoplayPolicyForURL:^(NSURL *) {
return _WKWebsiteAutoplayPolicyDeny;
}];
[webView loadRequest:requestWithAudio];
[webView waitForMessage:@"did-not-play"];
[webView waitForMessage:@"on-pause"];

receivedAutoplayEvent = std::nullopt;
[webView loadHTMLString:@"" baseURL:nil];

NSURLRequest *requestWithAudioInFrame = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"autoplay-check-in-iframe" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];

[delegate setAllowedAutoplayQuirksForURL:^_WKWebsiteAutoplayQuirk(NSURL *url) {
if ([url.lastPathComponent isEqualToString:@"autoplay-check-frame.html"])
return _WKWebsiteAutoplayQuirkInheritedUserGestures;

return _WKWebsiteAutoplayQuirkSynthesizedPauseEvents | _WKWebsiteAutoplayQuirkInheritedUserGestures;
}];
[delegate setAutoplayPolicyForURL:^(NSURL *) {
return _WKWebsiteAutoplayPolicyDeny;
}];
[webView loadRequest:requestWithAudioInFrame];
[webView waitForMessage:@"did-not-play"];
[webView waitForMessage:@"on-pause"];
}
#endif // PLATFORM(MAC)

TEST(WebKit, InvalidCustomHeaders)

0 comments on commit 4ffa73b

Please sign in to comment.