blob: e774a822526c95cca60257433ba045b5b30f4cc9 [file] [edit]
<!DOCTYPE html>
<title>Location of a page in a Web Bundle</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<body>
<script>
promise_test(async (t) => {
// 'b1' version
assert_equals(
await getLocationPromise("-b1"),
get_host_info().HTTPS_ORIGIN + '/web-bundle/resources/wbn/location.html');
// 'b2' version
assert_equals(
await getLocationPromise(""),
get_host_info().HTTPS_ORIGIN + '/web-bundle/resources/wbn/location.html');
}, 'Location of a page in a Web Bundle');
function getLocationPromise(version_suffix) {
return new Promise((resolve, reject) => {
let win = null;
window.addEventListener(
'message',
(event) => {
win.close();
resolve(event.data.location);
}, false);
win = window.open(
get_host_info().HTTPS_ORIGIN + '/web-bundle/resources/wbn/location' + version_suffix + '.wbn',
'_blank');
if (!win) {
reject('Popup could not be opened');
}
});
}
</script>
</body>