| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
| 3 <title>Service Worker: Registration for iframe</title> | 3 <title>Service Worker: Registration for iframe</title> |
| 4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script src="resources/test-helpers.js"></script> | 6 <script src="resources/test-helpers.js"></script> |
| 7 <script> | 7 <script> |
| 8 // Set script url and scope url relative to the calling frame's document's url. | 8 // Set script url and scope url relative to the calling frame's document's url. |
| 9 // Assert the implementation parses the urls against the calling frame's | 9 // Assert the implementation parses the urls against the calling frame's |
| 10 // document's url. | 10 // document's url. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 'document\'s url'); | 40 'document\'s url'); |
| 41 frame.remove(); | 41 frame.remove(); |
| 42 return service_worker_unregister_and_done(t, scope); | 42 return service_worker_unregister_and_done(t, scope); |
| 43 }) | 43 }) |
| 44 .catch(unreached_rejection(t)); | 44 .catch(unreached_rejection(t)); |
| 45 }, 'Subframe\'s container\'s register method should use calling frame\'s ' + | 45 }, 'Subframe\'s container\'s register method should use calling frame\'s ' + |
| 46 'document\'s url as a base url for parsing its script url and scope url ' + | 46 'document\'s url as a base url for parsing its script url and scope url ' + |
| 47 '- normal case'); | 47 '- normal case'); |
| 48 | 48 |
| 49 // Set script url and scope url relative to the iframe's document's url. | 49 // Set script url and scope url relative to the iframe's document's url. |
| 50 // Assert the implementation throws a NetworkError exception. | 50 // Assert the implementation throws a TypeError exception. |
| 51 async_test(function(t) { | 51 async_test(function(t) { |
| 52 var url = 'resources/blank.html'; | 52 var url = 'resources/blank.html'; |
| 53 var scope = 'registration-for-iframe-from-calling-frame'; | 53 var scope = 'registration-for-iframe-from-calling-frame'; |
| 54 var script = 'empty-worker.js'; | 54 var script = 'empty-worker.js'; |
| 55 var frame; | 55 var frame; |
| 56 var registration; | 56 var registration; |
| 57 | 57 |
| 58 service_worker_unregister(t, scope) | 58 service_worker_unregister(t, scope) |
| 59 .then(function() { return with_iframe(url); }) | 59 .then(function() { return with_iframe(url); }) |
| 60 .then(function(f) { | 60 .then(function(f) { |
| 61 frame = f; | 61 frame = f; |
| 62 return frame.contentWindow.navigator.serviceWorker.register( | 62 return frame.contentWindow.navigator.serviceWorker.register( |
| 63 script, | 63 script, |
| 64 { scope: scope }); | 64 { scope: scope }); |
| 65 }) | 65 }) |
| 66 .then( | 66 .then( |
| 67 function() { | 67 function() { |
| 68 assert_unreached('register() should reject'); | 68 assert_unreached('register() should reject'); |
| 69 }, | 69 }, |
| 70 function(e) { | 70 function(e) { |
| 71 assert_equals(e.name, 'NetworkError'); | 71 assert_equals(e.name, 'TypeError'); |
| 72 frame.remove(); | 72 frame.remove(); |
| 73 return service_worker_unregister_and_done(t, scope); | 73 return service_worker_unregister_and_done(t, scope); |
| 74 }) | 74 }) |
| 75 .catch(unreached_rejection(t)); | 75 .catch(unreached_rejection(t)); |
| 76 }, 'Subframe\'s container\'s register method should use calling frame\'s ' + | 76 }, 'Subframe\'s container\'s register method should use calling frame\'s ' + |
| 77 'document\'s url as a base url for parsing its script url and scope url ' + | 77 'document\'s url as a base url for parsing its script url and scope url ' + |
| 78 '- error case'); | 78 '- error case'); |
| 79 | 79 |
| 80 // Set the scope url to a non-subdirectory of the script url. | 80 // Set the scope url to a non-subdirectory of the script url. |
| 81 // Assert the implementation throws a SecurityError exception. | 81 // Assert the implementation throws a SecurityError exception. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 99 assert_unreached('register() should reject'); | 99 assert_unreached('register() should reject'); |
| 100 }, | 100 }, |
| 101 function(e) { | 101 function(e) { |
| 102 assert_equals(e.name, 'SecurityError'); | 102 assert_equals(e.name, 'SecurityError'); |
| 103 frame.remove(); | 103 frame.remove(); |
| 104 return service_worker_unregister_and_done(t, scope); | 104 return service_worker_unregister_and_done(t, scope); |
| 105 }) | 105 }) |
| 106 .catch(unreached_rejection(t)); | 106 .catch(unreached_rejection(t)); |
| 107 }, 'A scope url should start with the given script url'); | 107 }, 'A scope url should start with the given script url'); |
| 108 </script> | 108 </script> |
| OLD | NEW |