Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-in line'; font-src 'none'"> | |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <link rel=preload href="../resources/Ahem.ttf" as=font crossorigin> | |
| 6 | |
| 7 <meta http-equiv="Content-Security-Policy" content="style-src 'none'"> | |
| 8 <link rel="stylesheet" href="../resources/dummy.css" crossorigin> | |
| 9 | |
| 10 <meta http-equiv="Content-Security-Policy" content="img-src 'none'"> | |
| 11 <img src="../resources/square.png" crossorigin> | |
| 12 | |
| 13 <script> | |
| 14 var t = async_test("Ensure preloads don't bypass CSP policies when multiple meta tags are in the markup"); | |
| 15 window.addEventListener("load", t.step_func(function() { | |
| 16 if (window.internals) { | |
| 17 assert_false(internals.isPreloaded('../resources/Ahem.ttf'), "fonts shou ld not be preloaded"); | |
| 18 assert_false(internals.isPreloaded('../resources/dummy.css'), "css shoul d not be preloaded"); | |
| 19 assert_false(internals.isPreloaded('../resources/square.png'), "imgs sho uld not be preloaded"); | |
| 20 assert_true(internals.isPreloaded('../resources/testharness.js')); | |
| 21 assert_true(internals.isPreloaded('../resources/testharnessreport.js')); | |
|
Yoav Weiss
2016/09/02 10:23:53
isPreloaded is not very reliable when used after t
| |
| 22 t.done(); | |
| 23 } | |
| 24 })); | |
| 25 </script> | |
| 26 | |
| OLD | NEW |