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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/blink-contrib-2/script-src-wildcards-disallowed.html

Issue 2704543002: Import wpt@3bd204d7e86fd81e98e63f4ce59b95d98bad1c54 (Closed)
Patch Set: Created 3 years, 10 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>script-src disallowed wildcard use</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <!-- enforcing policy:
10 script-src 'nonce-nonce' *; connect-src 'self';
11 -->
12 <script nonce="nonce">
13 var t1 = async_test('data: URIs should not match *');
14 t1.step(function() {
15 var script = document.createElement("script");
16 script.src = 'data:application/javascript,';
17 script.addEventListener('load', t1.step_func(function() {
18 assert_unreached('Should not successfully load data URI.');
19 }));
20 script.addEventListener('error', t1.step_func(function() {
21 t1.done();
22 }));
23 document.head.appendChild(script);
24 });
25
26 var t2 = async_test('blob: URIs should not match *');
27 t2.step(function() {
28 var b = new Blob([''], { type: 'application/javascript' });
29 var script = document.createElement('script');
30 script.addEventListener('load', t2.step_func(function() {
31 assert_unreached('Should not successfully load blob URI.');
32 }));
33 script.addEventListener('error', t2.step_func(function() {
34 t2.done();
35 }));
36
37 script.src = URL.createObjectURL(b);
38 document.head.appendChild(script);
39 });
40
41 var t3 = async_test('filesystem URIs should not match *');
42 if (window.webkitRequestFileSystem) {
43 window.webkitRequestFileSystem(TEMPORARY, 1024*1024 /*1MB*/, functio n(fs) {
44 fs.root.getFile('fail.js', {create: true}, function(fileEntry) {
45 fileEntry.createWriter(function(fileWriter) {
46 var script = document.createElement('script');
47
48 script.addEventListener('load', t3.step_func(function() {
49 assert_unreached('Should not successfully load files ystem URI.');
50 }));
51 script.addEventListener('error', t3.step_func(function() {
52 t3.done();
53 }));
54
55 script.src = fileEntry.toURL('application/javascript');
56 document.body.appendChild(script);
57 });
58 });
59 });
60 } else {
61 t3.done();
62 }
63 </script>
64 </body>
65 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698