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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-iframe.html

Issue 2059953003: service worker: Fix the type of a register promise reject value (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Use ServiceWorkerErrorForUpdate directly Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/registration-tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/registration-tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698