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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-frame-errors.html

Issue 1861663002: CREDENTIAL: Block API access from non-top-level Documents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: security_check Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/iframed-credentialscontainer.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-frame-errors.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-frame-errors.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-frame-errors.html
new file mode 100644
index 0000000000000000000000000000000000000000..a18f50f28e58f5806394513450a8f737d858d58f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-frame-errors.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<title>Credential Manager: get() basics.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+function create_iframe_test(origin) {
+ return function (t) {
+ window.addEventListener("load", _ => {
+ var frame_tests = 0;
+ var iframe = document.createElement("iframe");
+ iframe.src = origin + "/credentialmanager/resources/iframed-credentialscontainer.html";
+ window.addEventListener("message", t.step_func(e => {
+ if (e.source == iframe.contentWindow) {
+ assert_equals(e.data.credential, null);
+ assert_equals(e.data.exception, "SecurityError");
+ frame_tests++;
+ if (frame_tests == 3)
+ t.done();
+ }
+ }));
+ document.body.appendChild(iframe);
+ });
+ };
+}
+
+async_test(create_iframe_test("http://127.0.0.1:8000"), "Same-origin IFrame throws.");
+async_test(create_iframe_test("http://example.test:8000"), "Cross-origin IFrame throws.");
+</script>
+
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/iframed-credentialscontainer.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698