Automatic update from web-platform-tests HTML: test <iframe src=javascript:...> Test different return types, whether it is stringified and parsed, how many load events are fired, iframe location.href, lazy loading, embed, object. See https://github.com/whatwg/html/issues/1895 -- wpt-commits: 3c0a541acb3ad08491647a75a0bfa4246bca899f wpt-pr: 50193 Differential Revision: https://phabricator.services.mozilla.com/D249373
45 lines
1.8 KiB
HTML
45 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>object - javascript: URL</title>
|
|
<link rel="help" href="https://html.spec.whatwg.org/#the-object-element">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<div id="log"></div>
|
|
<script>
|
|
// the steps to (re)determine what the object element represents
|
|
// fetches url, which results in a network error
|
|
// and thus "fallback".
|
|
promise_test(async function (t) {
|
|
const object = document.createElement('object');
|
|
object.data = 'javascript:"foo"';
|
|
object.onload = t.unreached_func('No load event expected');
|
|
document.body.append(object);
|
|
t.add_cleanup(() => { object.remove(); });
|
|
await new Promise(resolve => { t.step_timeout(resolve, 100); });
|
|
}, "javascript: in data attribute should do nothing");
|
|
|
|
function insertObjectNavigable(t) {
|
|
const object = document.createElement('object');
|
|
object.data = '/resources/blank.html';
|
|
document.body.append(object);
|
|
t.add_cleanup(() => { object.remove(); });
|
|
return object;
|
|
}
|
|
|
|
promise_test(async function (t) {
|
|
const object = insertObjectNavigable(t);
|
|
await new Promise(resolve => { object.onload = resolve; });
|
|
const loaded = new Promise(resolve => { object.onload = resolve; });
|
|
window[0].location.href = 'javascript:"test"';
|
|
await loaded;
|
|
}, 'location.href = \'javascript:"test"\' should fire a load event');
|
|
|
|
promise_test(async function (t) {
|
|
const object = insertObjectNavigable(t);
|
|
await new Promise(resolve => { object.onload = resolve; });
|
|
object.onload = t.unreached_func('No second load event expected');
|
|
window[0].location.href = 'javascript:1';
|
|
await new Promise(resolve => { t.step_timeout(resolve, 100); });
|
|
}, 'location.href = \'javascript:1\' should not fire a load event');
|
|
</script>
|