Title: [240533] trunk
- Revision
- 240533
- Author
- [email protected]
- Date
- 2019-01-25 17:00:54 -0800 (Fri, 25 Jan 2019)
Log Message
REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL
https://bugs.webkit.org/show_bug.cgi?id=193831
<rdar://problem/47399263>
Reviewed by Chris Dumez.
Source/WebKit:
A System Preview (<a rel="ar">) displays in a modal and doesn't trigger
a navigation. If the link was cross origin, it was causing a process swap,
which meant that the response defaulted back to a navigation.
The fix is to not cause a PSON when the navigation is a system preview.
* UIProcess/API/APINavigation.h:
(API::Navigation::shouldForceDownload const): This is now just tracking
the "download" attribute, and not including System Preview.
(API::Navigation::isSystemPreview const): New method to check for a
navigation triggered as a System Preview.
* UIProcess/WebPageProxy.cpp: Move the code from receivedPolicyDecision to
receivedNavigationPolicyDecision, so that downloads and System Previews are
detected before we decide to change process.
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::receivedPolicyDecision):
Tools:
Two new tests that exercise cross-origin and same-origin System
Previews.
* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (240532 => 240533)
--- trunk/Source/WebKit/ChangeLog 2019-01-26 00:54:08 UTC (rev 240532)
+++ trunk/Source/WebKit/ChangeLog 2019-01-26 01:00:54 UTC (rev 240533)
@@ -1,3 +1,28 @@
+2019-01-25 Dean Jackson <[email protected]>
+
+ REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL
+ https://bugs.webkit.org/show_bug.cgi?id=193831
+ <rdar://problem/47399263>
+
+ Reviewed by Chris Dumez.
+
+ A System Preview (<a rel="ar">) displays in a modal and doesn't trigger
+ a navigation. If the link was cross origin, it was causing a process swap,
+ which meant that the response defaulted back to a navigation.
+
+ The fix is to not cause a PSON when the navigation is a system preview.
+
+ * UIProcess/API/APINavigation.h:
+ (API::Navigation::shouldForceDownload const): This is now just tracking
+ the "download" attribute, and not including System Preview.
+ (API::Navigation::isSystemPreview const): New method to check for a
+ navigation triggered as a System Preview.
+ * UIProcess/WebPageProxy.cpp: Move the code from receivedPolicyDecision to
+ receivedNavigationPolicyDecision, so that downloads and System Previews are
+ detected before we decide to change process.
+ (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
+ (WebKit::WebPageProxy::receivedPolicyDecision):
+
2019-01-25 Tim Horton <[email protected]>
Find-in-page on nyt.com scrolls around without touching the screen when find holes are visible
Modified: trunk/Source/WebKit/UIProcess/API/APINavigation.h (240532 => 240533)
--- trunk/Source/WebKit/UIProcess/API/APINavigation.h 2019-01-26 00:54:08 UTC (rev 240532)
+++ trunk/Source/WebKit/UIProcess/API/APINavigation.h 2019-01-26 01:00:54 UTC (rev 240533)
@@ -106,12 +106,14 @@
bool wasUserInitiated() const { return !!m_lastNavigationAction.userGestureTokenIdentifier; }
- bool shouldForceDownload() const
+ bool shouldForceDownload() const { return !m_lastNavigationAction.downloadAttribute.isNull(); }
+
+ bool isSystemPreview() const
{
#if USE(SYSTEM_PREVIEW)
- return !m_lastNavigationAction.downloadAttribute.isNull() || currentRequest().isSystemPreview();
+ return currentRequest().isSystemPreview();
#else
- return !m_lastNavigationAction.downloadAttribute.isNull();
+ return false;
#endif
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (240532 => 240533)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-01-26 00:54:08 UTC (rev 240532)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-01-26 01:00:54 UTC (rev 240533)
@@ -2687,6 +2687,9 @@
changeWebsiteDataStore(policies->websiteDataStore()->websiteDataStore());
}
+ if (policyAction == PolicyAction::Use && navigation && (navigation->isSystemPreview() || navigation->shouldForceDownload()))
+ policyAction = PolicyAction::Download;
+
if (policyAction != PolicyAction::Use || !frame.isMainFrame() || !navigation) {
receivedPolicyDecision(policyAction, navigation, WTFMove(data), WTFMove(sender));
return;
@@ -2732,9 +2735,6 @@
if (action == PolicyAction::Ignore)
m_pageLoadState.clearPendingAPIRequestURL(transaction);
- if (navigation && navigation->shouldForceDownload() && action == PolicyAction::Use)
- action = ""
-
DownloadID downloadID = { };
if (action == PolicyAction::Download) {
// Create a download proxy.
Modified: trunk/Tools/ChangeLog (240532 => 240533)
--- trunk/Tools/ChangeLog 2019-01-26 00:54:08 UTC (rev 240532)
+++ trunk/Tools/ChangeLog 2019-01-26 01:00:54 UTC (rev 240533)
@@ -1,3 +1,16 @@
+2019-01-25 Dean Jackson <[email protected]>
+
+ REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL
+ https://bugs.webkit.org/show_bug.cgi?id=193831
+ <rdar://problem/47399263>
+
+ Reviewed by Chris Dumez.
+
+ Two new tests that exercise cross-origin and same-origin System
+ Previews.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
2019-01-25 Keith Rollin <[email protected]>
Update Xcode projects with "Check .xcfilelists" build phase
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (240532 => 240533)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-01-26 00:54:08 UTC (rev 240532)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-01-26 01:00:54 UTC (rev 240533)
@@ -1583,6 +1583,100 @@
done = false;
}
+#if USE(SYSTEM_PREVIEW)
+
+static const char* systemPreviewSameOriginTestBytes = R"PSONRESOURCE(
+<body>
+ <a id="testLink" rel="ar" href=""
+ <img src=""
+ </a>
+</body>
+)PSONRESOURCE";
+
+static const char* systemPreviewCrossOriginTestBytes = R"PSONRESOURCE(
+<body>
+ <a id="testLink" rel="ar" href=""
+ <img src=""
+ </a>
+</body>
+)PSONRESOURCE";
+
+TEST(ProcessSwap, SameOriginSystemPreview)
+{
+ auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+ processPoolConfiguration.get().processSwapsOnNavigation = YES;
+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+
+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [webViewConfiguration setProcessPool:processPool.get()];
+ auto handler = adoptNS([[PSONScheme alloc] init]);
+ [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:systemPreviewSameOriginTestBytes];
+ [handler addMappingFromURLString:@"pson://www.webkit.org/whatever" toData:"Fake USDZ data"];
+ [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"pson"];
+
+ [webViewConfiguration _setSystemPreviewEnabled:YES];
+
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+ auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
+ [webView setNavigationDelegate:navigationDelegate.get()];
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&done);
+ done = false;
+ auto pidAfterFirstLoad = [webView _webProcessIdentifier];
+
+ didStartProvisionalLoad = false;
+ [webView evaluateJavaScript:@"testLink.click()" completionHandler:nil];
+
+ TestWebKitAPI::Util::sleep(0.5);
+
+ // We should still be on webkit.org.
+ EXPECT_EQ(pidAfterFirstLoad, [webView _webProcessIdentifier]);
+ EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html", [[webView URL] absoluteString]);
+ EXPECT_FALSE(didStartProvisionalLoad);
+}
+
+TEST(ProcessSwap, CrossOriginSystemPreview)
+{
+ auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+ processPoolConfiguration.get().processSwapsOnNavigation = YES;
+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+
+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [webViewConfiguration setProcessPool:processPool.get()];
+ auto handler = adoptNS([[PSONScheme alloc] init]);
+ [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:systemPreviewCrossOriginTestBytes];
+ [handler addMappingFromURLString:@"pson://www.apple.com/whatever" toData:"Fake USDZ data"];
+ [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"pson"];
+
+ [webViewConfiguration _setSystemPreviewEnabled:YES];
+
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+ auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
+ [webView setNavigationDelegate:navigationDelegate.get()];
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&done);
+ done = false;
+ auto pidAfterFirstLoad = [webView _webProcessIdentifier];
+
+ didStartProvisionalLoad = false;
+ [webView evaluateJavaScript:@"testLink.click()" completionHandler:nil];
+
+ TestWebKitAPI::Util::sleep(0.5);
+
+ // We should still be on webkit.org.
+ EXPECT_EQ(pidAfterFirstLoad, [webView _webProcessIdentifier]);
+ EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html", [[webView URL] absoluteString]);
+ EXPECT_FALSE(didStartProvisionalLoad);
+}
+
+#endif
+
enum class ShouldEnablePSON { No, Yes };
static void runClientSideRedirectTest(ShouldEnablePSON shouldEnablePSON)
{
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes