Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect-body.html

Issue 1612423002: Don't send the body of the redirected request to the ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated falken's comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect-body.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect-body.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect-body.html
new file mode 100644
index 0000000000000000000000000000000000000000..b06649d6be11afc22b6f8e206557b8400ebd5481
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect-body.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<title>Service Worker: Navigation redirection must clear body</title>
+<script src="../resources/testharness.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>
+promise_test(function(t) {
+ var scope = 'resources/navigation-redirect-body.php';
+ var script = 'resources/navigation-redirect-body-worker.js';
+ var registration;
+ var frame = document.createElement('frame');
+ frame.src = 'about:blank';
+ frame.name = 'target_frame';
+ frame.id = 'frame';
+ document.body.appendChild(frame);
+ var form = document.createElement('form');
+ form.method = 'POST';
+ form.action = scope;
+ form.target = 'target_frame';
+ var hidden_input = document.createElement('input');
+ hidden_input.type = 'hidden';
+ hidden_input.name = 'data';
+ hidden_input.value = 'test data';
+ var submit_button = document.createElement('input');
+ submit_button.type = 'submit';
+ submit_button.value = 'submit';
+ form.appendChild(hidden_input);
+ form.appendChild(submit_button);
+ document.body.appendChild(form);
+ return service_worker_unregister_and_register(t, script, scope)
+ .then(function(r) {
+ registration = r;
+ return wait_for_state(t, registration.installing, 'activated');
+ })
+ .then(function() {
+ var frame_load_promise = new Promise(function(resolve) {
+ frame.addEventListener('load', function() {
+ resolve(frame.contentWindow.document.body.innerText);
+ }, false);
+ });
+ submit_button.click();
+ return frame_load_promise;
+ })
+ .then(function(text) {
+ document.body.removeChild(form);
+ document.body.removeChild(frame);
+ var request_uri = decodeURIComponent(text);
+ assert_equals(
+ request_uri,
+ '/serviceworker/resources/navigation-redirect-body.php?redirect');
+ return registration.unregister();
+ });
+ }, 'Navigation redirection must clear body');
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698