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

Side by Side Diff: LayoutTests/http/tests/serviceworker/registration.html

Issue 1260003003: Move Service Worker %2f validation logic from browser into Blink (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: Registration</title> 2 <title>Service Worker: Registration</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharness-helpers.js"></script> 4 <script src="../resources/testharness-helpers.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 8
9 promise_test(function(t) { 9 promise_test(function(t) {
10 var script = 'resources/registration-worker.js'; 10 var script = 'resources/registration-worker.js';
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 'Non-URL-encoded multibyte characters should be available.'); 221 'Non-URL-encoded multibyte characters should be available.');
222 service_worker_unregister_and_done(t, scope); 222 service_worker_unregister_and_done(t, scope);
223 }); 223 });
224 }, 'Scope including non-escaped multibyte characters'); 224 }, 'Scope including non-escaped multibyte characters');
225 225
226 promise_test(function(t) { 226 promise_test(function(t) {
227 var script = 'resources%2fempty-worker.js'; 227 var script = 'resources%2fempty-worker.js';
228 var scope = 'resources/scope/encoded-slash-in-script-url'; 228 var scope = 'resources/scope/encoded-slash-in-script-url';
229 return assert_promise_rejects( 229 return assert_promise_rejects(
230 navigator.serviceWorker.register(script, {scope: scope}), 230 navigator.serviceWorker.register(script, {scope: scope}),
231 'SecurityError', 231 new TypeError,
232 'URL-encoded slash in the script URL should be rejected.'); 232 'URL-encoded slash in the script URL should be rejected.');
233 }, 'Script URL including URL-encoded slash'); 233 }, 'Script URL including URL-encoded slash');
234 234
235 promise_test(function(t) { 235 promise_test(function(t) {
236 var script = 'resources/empty-worker.js'; 236 var script = 'resources/empty-worker.js';
237 var scope = 'resources/scope%2fencoded-slash-in-scope'; 237 var scope = 'resources/scope%2fencoded-slash-in-scope';
238 return assert_promise_rejects( 238 return assert_promise_rejects(
239 navigator.serviceWorker.register(script, {scope: scope}), 239 navigator.serviceWorker.register(script, {scope: scope}),
240 'SecurityError', 240 new TypeError,
241 'URL-encoded slash in the scope should be rejected.'); 241 'URL-encoded slash in the scope should be rejected.');
242 }, 'Scope including URL-encoded slash'); 242 }, 'Scope including URL-encoded slash');
243 243
244 promise_test(function(t) { 244 promise_test(function(t) {
245 var script = 'resources%5cempty-worker.js'; 245 var script = 'resources%5cempty-worker.js';
246 var scope = 'resources/scope/encoded-slash-in-script-url'; 246 var scope = 'resources/scope/encoded-slash-in-script-url';
247 return assert_promise_rejects( 247 return assert_promise_rejects(
248 navigator.serviceWorker.register(script, {scope: scope}), 248 navigator.serviceWorker.register(script, {scope: scope}),
249 'SecurityError', 249 new TypeError,
250 'URL-encoded backslash in the script URL should be rejected.'); 250 'URL-encoded backslash in the script URL should be rejected.');
251 }, 'Script URL including URL-encoded backslash'); 251 }, 'Script URL including URL-encoded backslash');
252 252
253 promise_test(function(t) { 253 promise_test(function(t) {
254 var script = 'resources/empty-worker.js'; 254 var script = 'resources/empty-worker.js';
255 var scope = 'resources/scope%5cencoded-slash-in-scope'; 255 var scope = 'resources/scope%5cencoded-slash-in-scope';
256 return assert_promise_rejects( 256 return assert_promise_rejects(
257 navigator.serviceWorker.register(script, {scope: scope}), 257 navigator.serviceWorker.register(script, {scope: scope}),
258 'SecurityError', 258 new TypeError,
259 'URL-encoded backslash in the scope should be rejected.'); 259 'URL-encoded backslash in the scope should be rejected.');
260 }, 'Scope including URL-encoded backslash'); 260 }, 'Scope including URL-encoded backslash');
261 261
nhiroki 2015/07/28 07:04:36 It'd be good to have tests for capital letter case
262 promise_test(function(t) { 262 promise_test(function(t) {
263 var script = 'resources/././empty-worker.js'; 263 var script = 'resources/././empty-worker.js';
264 var scope = 'resources/scope/parent-reference-in-script-url'; 264 var scope = 'resources/scope/parent-reference-in-script-url';
265 return navigator.serviceWorker.register(script, {scope: scope}) 265 return navigator.serviceWorker.register(script, {scope: scope})
266 .then(function(registration) { 266 .then(function(registration) {
267 assert_equals( 267 assert_equals(
268 registration.installing.scriptURL, 268 registration.installing.scriptURL,
269 normalizeURL('resources/empty-worker.js'), 269 normalizeURL('resources/empty-worker.js'),
270 'Script URL including self-reference should be normalized.'); 270 'Script URL including self-reference should be normalized.');
271 service_worker_unregister_and_done(t, scope); 271 service_worker_unregister_and_done(t, scope);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 var script = 'resources/empty-worker.js'; 359 var script = 'resources/empty-worker.js';
360 var scope = 'filesystem:' + normalizeURL('resources/scope/filesystem-scope-u rl'); 360 var scope = 'filesystem:' + normalizeURL('resources/scope/filesystem-scope-u rl');
361 return assert_promise_rejects( 361 return assert_promise_rejects(
362 navigator.serviceWorker.register(script, {scope: scope}), 362 navigator.serviceWorker.register(script, {scope: scope}),
363 'SecurityError', 363 'SecurityError',
364 'Registering with the scope that has same-origin filesystem: URL ' + 364 'Registering with the scope that has same-origin filesystem: URL ' +
365 'should fail with SecurityError.'); 365 'should fail with SecurityError.');
366 }, 'Scope URL is same-origin filesystem: URL'); 366 }, 'Scope URL is same-origin filesystem: URL');
367 367
368 </script> 368 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698