Index: third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed-after-redirect.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed-after-redirect.html b/third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed-after-redirect.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c1ab0497c8ede6c2d67734fd7a69648a4bd811c |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed-after-redirect.html |
@@ -0,0 +1,39 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+<script type="text/javascript"> |
+if (window.testRunner) { |
+ // Inject a subresource filter to disallow 'beta.js' (but not 'alpha.js'). |
+ testRunner.setDisallowedSubresourcePathSuffixes(["beta.js"]); |
+} |
+ |
+document.scriptsExecuted = []; |
+document.notifyScriptExecuted = function(basename) { |
+ document.scriptsExecuted.push(basename); |
+} |
+ |
+async_test(t => { |
+ var s = document.createElement("script"); |
+ s.onload = t.step_func_done(_ => { |
+ assert_in_array("alpha", document.scriptsExecuted, "Scripts that are not disallowed are still executed."); |
+ }); |
+ s.onerror = t.unreached_func(); |
+ s.src = "http://localhost:8000/resources/redirect.php?url=/subresource_filter/resources/alpha.js"; |
+ document.body.appendChild(s); |
+}, "Resources for which no URLs in the redirect chain are disallowed are still loaded."); |
+ |
+async_test(t => { |
+ var s = document.createElement("script"); |
+ s.onload = t.unreached_func(); |
+ s.onerror = t.step_func_done(); |
+ s.src = "http://localhost:8000/resources/redirect.php?url=/subresource_filter/resources/beta.js"; |
+ document.body.appendChild(s); |
+}, "Resources that redirect to a disallowed URL are not loaded."); |
+ |
+</script> |
+</body> |
+</html> |