Index: LayoutTests/http/tests/serviceworker/http-to-https-redirect-and-register.html |
diff --git a/LayoutTests/http/tests/serviceworker/http-to-https-redirect-and-register.html b/LayoutTests/http/tests/serviceworker/http-to-https-redirect-and-register.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3e31119bdd869050207d8886c1c2a8b5161f64e9 |
--- /dev/null |
+++ b/LayoutTests/http/tests/serviceworker/http-to-https-redirect-and-register.html |
@@ -0,0 +1,33 @@ |
+<!DOCTYPE html> |
+<title>register on a secure page arrived at via redirect from an non-secure url</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharness-helpers.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="../resources/get-host-info.js?pipe=sub"></script> |
+<script src="resources/test-helpers.js"></script> |
+<body> |
+<script> |
+// Loads a non-secure url in an frame, which redirects to a secure origin page. |
+// That page then registers a service worker, and messages back with the result. |
+// The registration should succeed. |
+promise_test(function(t) { |
+ var script = 'resources/empty-worker.js'; |
Kunihiko Sakamoto
2015/08/24 05:57:39
nit: Unused variable.
falken
2015/08/24 06:09:02
Done.
|
+ var redirect_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] + |
+ '/serviceworker/resources/redirect.php?Redirect='; |
+ var target_url = window.location.origin + '/serviceworker/resources/register.html'; |
+ var frame; |
+ |
+ return with_iframe(redirect_url + encodeURIComponent(target_url)) |
+ .then(function(f) { |
+ frame = f; |
+ return new Promise(resolve => { |
+ window.addEventListener('message', e => {resolve(e.data);}); |
+ }); |
+ }) |
+ .then(function(message) { |
+ frame.remove(); |
+ assert_equals(message, 'PASS'); |
+ }); |
+ }, 'register on a secure page arrived at via redirect from an non-secure url'); |
+</script> |
+</body> |