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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed.html

Issue 2022783002: Skeleton of the Safe Browsing Subresource Filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement RenderFrameObserver::OnDestruct introduced by rebase. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed.html b/third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed.html
new file mode 100644
index 0000000000000000000000000000000000000000..3ef6a80b75b137f86dc18504eefe3a1817783dd9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/subresource_filter/resource-disallowed.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 = "resources/alpha.js";
+ document.body.appendChild(s);
+}, "Resources whose URLs are not 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 = "resources/beta.js";
+ document.body.appendChild(s);
+}, "Resources whose initial URL (not after redirects) are disallowed are not loaded.");
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698