OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Service Worker: Navigation redirection must clear body</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <script src="../resources/get-host-info.js?pipe=sub"></script> | |
6 <script src="resources/test-helpers.js"></script> | |
7 <body> | |
8 <script> | |
9 promise_test(function(t) { | |
10 var scope = 'resources/navigation-redirect-body.php'; | |
11 var script = 'resources/navigation-redirect-body-worker.js'; | |
12 var registration; | |
13 var frame = document.createElement('frame'); | |
14 frame.src = 'about:blank'; | |
15 frame.name = 'target_frame'; | |
16 frame.id = 'frame'; | |
17 document.body.appendChild(frame); | |
18 var form = document.createElement('form'); | |
19 form.method = 'POST'; | |
20 form.action = scope; | |
21 form.target = 'target_frame'; | |
22 var hiddenInput = document.createElement('input'); | |
falken
2016/01/25 04:51:57
nit: snake_case here and throughout
horo
2016/01/25 05:14:51
Done.
| |
23 hiddenInput.type = 'hidden'; | |
24 hiddenInput.name = 'data'; | |
25 hiddenInput.value = 'test data'; | |
26 var submitButton = document.createElement('input'); | |
27 submitButton.type = 'submit'; | |
28 submitButton.value = 'submit'; | |
29 form.appendChild(hiddenInput); | |
30 form.appendChild(submitButton); | |
31 document.body.appendChild(form); | |
32 return service_worker_unregister_and_register(t, script, scope) | |
33 .then(function(r) { | |
34 registration = r; | |
35 return wait_for_state(t, registration.installing, 'activated'); | |
36 }) | |
37 .then(function() { | |
38 var frameLoadPromise = new Promise(function(resolve) { | |
falken
2016/01/25 04:51:57
I think function(resolve)'s body needs an addition
horo
2016/01/25 05:14:51
Done.
| |
39 frame.addEventListener('load', function() { | |
falken
2016/01/25 04:51:57
same with this function()
horo
2016/01/25 05:14:51
Done.
| |
40 resolve(frame.contentWindow.document.body.innerText); | |
41 }, false); | |
42 }); | |
43 submitButton.click(); | |
44 return frameLoadPromise; | |
45 }) | |
46 .then(function(text) { | |
47 document.body.removeChild(form); | |
48 document.body.removeChild(frame); | |
49 var request_uri = decodeURIComponent(text); | |
50 assert_equals( | |
51 request_uri, | |
52 '/serviceworker/resources/navigation-redirect-body.php?redirect'); | |
53 console.log(decodeURIComponent(text)); | |
falken
2016/01/25 04:51:57
debug output?
horo
2016/01/25 05:14:51
Removed
| |
54 return registration.unregister(); | |
55 }); | |
56 }, 'Navigation redirection must clear body'); | |
57 </script> | |
58 </body> | |
OLD | NEW |