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

Unified Diff: LayoutTests/http/tests/serviceworker/registration.html

Issue 697833004: ServiceWorker: Registering a malformed script should fail [3/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@install_malformed_script
Patch Set: add more tests Created 6 years, 1 month 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/malformed-worker.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/registration.html
diff --git a/LayoutTests/http/tests/serviceworker/registration.html b/LayoutTests/http/tests/serviceworker/registration.html
index 7219e79c3af8faa72d0e956fb8d4a2ca11fd2b27..42289fa80e6d74ca844b9c7651c4bbd43baff5ba 100644
--- a/LayoutTests/http/tests/serviceworker/registration.html
+++ b/LayoutTests/http/tests/serviceworker/registration.html
@@ -121,11 +121,67 @@ promise_test(function(t) {
promise_test(function(t) {
var script = 'resources/redirect.php?Redirect=' +
encodeURIComponent('/resources/registration-worker.js');
- var scope = 'resources/sope/redirect/';
+ var scope = 'resources/scope/redirect/';
return assert_promise_rejects(
navigator.serviceWorker.register(script, {scope: scope}),
'SecurityError',
'Registration of redirected script should fail.');
}, 'Registering redirected script');
+promise_test(function(t) {
+ var script = 'resources/malformed-worker.php?parse-error';
+ var scope = 'resources/scope/parse-error';
+ return assert_promise_rejects(
+ navigator.serviceWorker.register(script, {scope: scope}),
+ 'AbortError',
+ 'Registration of script including parse error should fail.');
+ }, 'Registering script including parse error');
+
+promise_test(function(t) {
+ var script = 'resources/malformed-worker.php?undefined-error';
+ var scope = 'resources/scope/undefined-error';
+ return assert_promise_rejects(
+ navigator.serviceWorker.register(script, {scope: scope}),
+ 'AbortError',
+ 'Registration of script including undefined error should fail.');
+ }, 'Registering script including undefined error');
+
+promise_test(function(t) {
+ var script = 'resources/malformed-worker.php?uncaught-exception';
+ var scope = 'resources/scope/uncaught-exception';
+ return assert_promise_rejects(
+ navigator.serviceWorker.register(script, {scope: scope}),
+ 'AbortError',
+ 'Registration of script including uncaught exception should fail.');
+ }, 'Registering script including uncaught exception');
+
+promise_test(function(t) {
+ var script = 'resources/malformed-worker.php?caught-exception';
+ var scope = 'resources/scope/caught-exception';
+ return navigator.serviceWorker.register(script, {scope: scope})
+ .then(function(registration) {
+ assert_true(registration instanceof ServiceWorkerRegistration,
+ 'Successfully registered.');
+ service_worker_unregister_and_done(t, scope);
+ })
+ }, 'Registering script including caught exception');
+
+promise_test(function(t) {
+ var script = 'resources/malformed-worker.php?import-malformed-script';
+ var scope = 'resources/scope/import-malformed-script';
+ return assert_promise_rejects(
+ navigator.serviceWorker.register(script, {scope: scope}),
+ 'AbortError',
+ 'Registration of script importing malformed script should fail.');
+ }, 'Registering script importing malformed script');
+
+promise_test(function(t) {
+ var script = 'resources/malformed-worker.php?import-no-such-script';
+ var scope = 'resources/scope/import-no-such-script';
+ return assert_promise_rejects(
+ navigator.serviceWorker.register(script, {scope: scope}),
+ 'AbortError',
+ 'Registration of script importing non-existent script should fail.');
+ }, 'Registering script importing non-existent script');
+
</script>
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/malformed-worker.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698