Files
tubestation/testing/web-platform/tests/mixed-content/csp.https.window.js
Blink WPT Bot cb43ae0da7 Bug 1795169 [wpt PR 36445] - [Mixed Content] WPT tests for sandboxed documents., a=testonly
Automatic update from web-platform-tests
[Mixed Content] WPT tests for sandboxed documents. (#36445)

Bug: chromium:956979
Change-Id: I884b1c561d49c859b44e46c99ac9d4a7c7d7b852
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3945033
Commit-Queue: Carlos IL <carlosil@chromium.org>
Auto-Submit: Titouan Rigoudy <titouan@chromium.org>
Reviewed-by: Carlos IL <carlosil@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1057632}

Co-authored-by: Titouan Rigoudy <titouan@chromium.org>
--

wpt-commits: a5b79c3469f743ce880bde06071dc82ac57fe3b5
wpt-pr: 36445
2022-11-07 10:53:26 +00:00

42 lines
1.4 KiB
JavaScript

// META: script=/common/dispatcher/dispatcher.js
// META: script=/common/get-host-info.sub.js
// META: script=/common/utils.js
promise_test((t) => {
const url = `${get_host_info().HTTP_ORIGIN}/common/text-plain.txt`;
const promise = fetch(url, { mode: "no-cors" });
return promise_rejects_js(t, TypeError, promise, "mixed content fetch");
}, "Mixed content checks apply to fetches in sandboxed documents");
promise_test(async (t) => {
const uuid = token();
const context = new RemoteContext(uuid);
const iframe = document.body.appendChild(document.createElement("iframe"));
iframe.src = remoteExecutorUrl(uuid, { protocol: "http:" });
const result = await Promise.race([
context.execute_script(() => "loaded"),
new Promise((resolve) => t.step_timeout(() => {
resolve("timed out");
}, 1000 /* ms */)),
]);
assert_equals(result, "timed out");
}, "Mixed content checks apply to iframes in sandboxed documents");
promise_test(async (t) => {
const uuid = token();
const popup = window.open(remoteExecutorUrl(uuid, { protocol: "http:" }));
const context = new RemoteContext(uuid);
const result = await Promise.race([
context.execute_script(() => "loaded"),
new Promise((resolve) => t.step_timeout(() => {
resolve("timed out");
}, 1000 /* ms */)),
]);
assert_equals(result, "timed out");
}, "Mixed content checks apply to popups in sandboxed documents");