Title: [265258] trunk
Revision
265258
Author
katherine_che...@apple.com
Date
2020-08-04 13:50:13 -0700 (Tue, 04 Aug 2020)

Log Message

Add test coverage for handling redirects with App-Bound Domains
https://bugs.webkit.org/show_bug.cgi?id=215128
<rdar://problem/66528515>

Reviewed by Brady Eidson.

Tools:

We should always make a new WebView if the test options indicate an
app-bound view, because we need a new configuration.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::ensureViewSupportsOptionsForTest):

LayoutTests:

Add two new tests to confirm that App Bound Domains behaves correctly
for redirect cases: one for top-frame redirects, and one for sub-frame
redirects.

* http/tests/in-app-browser-privacy/resources/redirect.php: Added.
* http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked-expected.txt: Added.
* http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked.html: Added.
* http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked-expected.txt: Added.
* http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265257 => 265258)


--- trunk/LayoutTests/ChangeLog	2020-08-04 20:45:17 UTC (rev 265257)
+++ trunk/LayoutTests/ChangeLog	2020-08-04 20:50:13 UTC (rev 265258)
@@ -1,3 +1,21 @@
+2020-08-04  Kate Cheney  <katherine_che...@apple.com>
+
+        Add test coverage for handling redirects with App-Bound Domains
+        https://bugs.webkit.org/show_bug.cgi?id=215128
+        <rdar://problem/66528515>
+
+        Reviewed by Brady Eidson.
+
+        Add two new tests to confirm that App Bound Domains behaves correctly
+        for redirect cases: one for top-frame redirects, and one for sub-frame
+        redirects.
+
+        * http/tests/in-app-browser-privacy/resources/redirect.php: Added.
+        * http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked-expected.txt: Added.
+        * http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked.html: Added.
+        * http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked-expected.txt: Added.
+        * http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked.html: Added.
+
 2020-08-04  Chris Dumez  <cdu...@apple.com>
 
         Align AudioBufferSourceNode's start() / stop() with the specification

Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/resources/redirect.php (0 => 265258)


--- trunk/LayoutTests/http/tests/in-app-browser-privacy/resources/redirect.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/resources/redirect.php	2020-08-04 20:50:13 UTC (rev 265258)
@@ -0,0 +1,13 @@
+<?php
+if ($_GET['step'] == 1) {
+  header("HTTP/1.0 302 Found");
+  header('Location: http://localhost:8000/in-app-browser-privacy/resources/redirect.php?step=2');
+} else if ($_GET['step'] == 2) {
+    header("HTTP/1.0 302 Found");
+    header('Location: http://localhost:8000/in-app-browser-privacy/resources/redirect.php?step=3');
+} else if ($_GET['step'] == 3) {
+  header("HTTP/1.0 200 OK");
+  echo "FAILED: Should not have loaded\n";
+  echo "<script> if (window.testRunner) testRunner.notifyDone();</script>\n";
+}
+?>

Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked-expected.txt (0 => 265258)


--- trunk/LayoutTests/http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked-expected.txt	2020-08-04 20:50:13 UTC (rev 265258)
@@ -0,0 +1,10 @@
+Test subframe redirects disable app-bound mode
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Subframe does not have app-bound session.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked.html (0 => 265258)


--- trunk/LayoutTests/http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/sub-frame-redirect-to-non-app-bound-domain-blocked.html	2020-08-04 20:50:13 UTC (rev 265258)
@@ -0,0 +1,41 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableInAppBrowserPrivacy=true applicationBundleIdentifier=inAppBrowserPrivacyTestIdentifier isAppBoundWebView=true ] -->
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <script src=""
+    <script src=""
+</head>
+<body>
+<script>
+    description("Test subframe redirects disable app-bound mode");
+    jsTestIsAsync = true;
+
+    function loadFrame() {
+        let iframeElement = document.createElement("iframe");
+        iframeElement.src = ""
+        document.body.appendChild(iframeElement);
+        iframeElement._onload_ = checkForAppBound();
+    }
+
+    // Should be forced into non app-bound mode.
+    function checkForAppBound() {
+        if (testRunner.hasAppBoundSession()) {
+           testFailed("Subframe has app-bound session.");
+           finishJSTest();
+        } else {
+            testPassed("Subframe does not have app-bound session.");
+            finishJSTest();
+        }
+    }
+
+    _onload_ = () => {
+        // Clear the app-bound session to make sure the iframe load creates
+        // a new one.
+        testRunner.clearAppBoundSession();
+        loadFrame();
+    }
+
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked-expected.txt (0 => 265258)


--- trunk/LayoutTests/http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked-expected.txt	2020-08-04 20:50:13 UTC (rev 265258)
@@ -0,0 +1,10 @@
+Test top frame redirects block non-app-bound domains
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Redirect to non app-bound domain failed
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked.html (0 => 265258)


--- trunk/LayoutTests/http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/top-frame-redirect-to-non-app-bound-domain-blocked.html	2020-08-04 20:50:13 UTC (rev 265258)
@@ -0,0 +1,27 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableInAppBrowserPrivacy=true applicationBundleIdentifier=inAppBrowserPrivacyTestIdentifier isAppBoundWebView=true ] -->
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <script src=""
+    <script src=""
+</head>
+<body>
+<script>
+    description("Test top frame redirects block non-app-bound domains");
+    jsTestIsAsync = true;
+    _onload_ = () => {
+        if (document.location.hash == "") {
+            // Load this test again with a random dummy value to avoid caching.
+            document.location.href = "" + Math.random() + "#notempty";
+        } else {
+            document.location.href = ""
+            setTimeout(() => {
+                testPassed("Redirect to non app-bound domain failed");
+                finishJSTest();
+            }, 500);
+        }
+    }
+</script>
+
+</body>
+</html>

Modified: trunk/Tools/ChangeLog (265257 => 265258)


--- trunk/Tools/ChangeLog	2020-08-04 20:45:17 UTC (rev 265257)
+++ trunk/Tools/ChangeLog	2020-08-04 20:50:13 UTC (rev 265258)
@@ -1,3 +1,17 @@
+2020-08-04  Kate Cheney  <katherine_che...@apple.com>
+
+        Add test coverage for handling redirects with App-Bound Domains
+        https://bugs.webkit.org/show_bug.cgi?id=215128
+        <rdar://problem/66528515>
+
+        Reviewed by Brady Eidson.
+
+        We should always make a new WebView if the test options indicate an
+        app-bound view, because we need a new configuration.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::ensureViewSupportsOptionsForTest):
+
 2020-08-04  Jonathan Bedard  <jbed...@apple.com>
 
         [webkitcorepy] Use setup.py for the autoinstaller

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (265257 => 265258)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2020-08-04 20:45:17 UTC (rev 265257)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2020-08-04 20:50:13 UTC (rev 265258)
@@ -809,8 +809,9 @@
 
     if (m_mainWebView) {
         // Having created another page (via window.open()) prevents process swapping on navigation and it may therefore
-        // cause flakiness to reuse the view.
-        if (!m_createdOtherPage && m_mainWebView->viewSupportsOptions(options))
+        // cause flakiness to reuse the view. We should also always make a new view if the test is marked as app-bound, because
+        // the view configuration must change.
+        if (!m_createdOtherPage && m_mainWebView->viewSupportsOptions(options) && !options.isAppBoundWebView)
             return;
 
         willDestroyWebView();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to