Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/preload/multiple-meta-csp.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/multiple-meta-csp.html b/third_party/WebKit/LayoutTests/http/tests/preload/multiple-meta-csp.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2ccdb0e807fef5d933c64a476cfc09f2c942d47e |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/preload/multiple-meta-csp.html |
| @@ -0,0 +1,26 @@ |
| +<!DOCTYPE html> |
| +<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; font-src 'none'"> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<link rel=preload href="../resources/Ahem.ttf" as=font crossorigin> |
| + |
| +<meta http-equiv="Content-Security-Policy" content="style-src 'none'"> |
| +<link rel="stylesheet" href="../resources/dummy.css" crossorigin> |
| + |
| +<meta http-equiv="Content-Security-Policy" content="img-src 'none'"> |
| +<img src="../resources/square.png" crossorigin> |
| + |
| +<script> |
| +var t = async_test("Ensure preloads don't bypass CSP policies when multiple meta tags are in the markup"); |
| +window.addEventListener("load", t.step_func(function() { |
| + if (window.internals) { |
| + assert_false(internals.isPreloaded('../resources/Ahem.ttf'), "fonts should not be preloaded"); |
| + assert_false(internals.isPreloaded('../resources/dummy.css'), "css should not be preloaded"); |
| + assert_false(internals.isPreloaded('../resources/square.png'), "imgs should not be preloaded"); |
| + assert_true(internals.isPreloaded('../resources/testharness.js')); |
| + assert_true(internals.isPreloaded('../resources/testharnessreport.js')); |
|
Yoav Weiss
2016/09/02 10:23:53
isPreloaded is not very reliable when used after t
|
| + t.done(); |
| + } |
| +})); |
| +</script> |
| + |