Skip to content

Commit 4e408e1

Browse files
Jenny-233moz-wptsync-bot
authored andcommitted
Bug 1926107 [wpt PR 48741] - WPT for Navigations on Opaque Origins, a=testonly
Automatic update from web-platform-tests WPT for Navigations on Opaque Origins Bug: 361751872 Change-Id: I82408f1a73930807f9a8e8642094b687ce17a480 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5935712 Reviewed-by: Andrew Williams <[email protected]> Commit-Queue: Janice Liu <[email protected]> Reviewed-by: Kyra Seevers <[email protected]> Auto-Submit: Janice Liu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1371585} -- wpt-commits: 754c94f52671d1354ed53c9c74b3aa5705cf982b wpt-pr: 48741
1 parent cc46cf1 commit 4e408e1

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

testing/web-platform/tests/FileAPI/BlobURL/cross-partition-navigation.tentative.https.html

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
reject(`Blob URL wasn't opened in same-top-level-site iframe: ${response_2}`);
115115
}
116116
const noopener_response_2 = await receive(noopener_response_queue);
117-
if (noopener_response_2 !== opener_non_null_response) {
117+
if (noopener_response_2 !== opener_not_null_response) {
118118
reject(`Blob URL page opener was null in same-top-level-site iframe`);
119119
}
120120
resolve();
@@ -124,5 +124,46 @@
124124
});
125125
}, "Blob URL navigation should enforce noopener for a cross-top-level-site navigation");
126126

127+
// Tests navigating to a cross-frame-origin opaque Blob URL where the embedded origin is null.
128+
promise_test(t => {
129+
return new Promise(async (resolve, reject) => {
130+
try {
131+
const noopener_response_queue = token();
132+
const url_queue = token();
133+
134+
const data_frame_html = `
135+
<!doctype html>
136+
<!-- dispatcher.js requires the baseURI to be set in order to compute \
137+
the server path correctly in the data URL page. -->
138+
<base href="${window.location.href}">
139+
<script src="/html/cross-origin-embedder-policy/credentialless/resources/common.js"><\/script>
140+
<script src="/html/anonymous-iframe/resources/common.js"><\/script>
141+
<script src="/common/utils.js"><\/script>
142+
<script src="/common/dispatcher/dispatcher.js"><\/script>
143+
<script>
144+
const frame_html = \`<!doctype html><body>test</body>\`;
145+
const blob = new Blob([frame_html], {type : "text/html"});
146+
const blob_url = URL.createObjectURL(blob);
147+
send("${url_queue}", blob_url);
148+
<\/script>
149+
`;
150+
151+
const iframe = document.body.appendChild(document.createElement("iframe"));
152+
iframe.src = `data:text/html, ${data_frame_html}`;
153+
154+
const blob_url = await receive(url_queue);
155+
const handle = window.open(blob_url);
156+
t.add_cleanup(() => iframe.remove());
157+
if (handle !== null) {
158+
handle.close();
159+
reject(`Cross-origin opaque blob URL navigation succeeded.`);
160+
}
161+
resolve();
162+
} catch (e) {
163+
reject(e);
164+
}
165+
});
166+
}, "Navigation to a cross-origin opaque blob URL is blocked.");
167+
127168
</script>
128169
</body>

0 commit comments

Comments
 (0)