Merge pull request #1020 from lightpanda-io/inline_script_ignore_defer
Some checks failed
e2e-test / zig build release (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled

Inline script tags ignore defer/async
This commit is contained in:
Pierre Tachoire
2025-09-05 17:44:45 +02:00
committed by GitHub
4 changed files with 34 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
<head>
<script>
let dyn1_loaded = 0;
function loadScript(src) {
const script = document.createElement('script');
script.src = src;
document.getElementsByTagName("head")[0].appendChild(script)
}
</script>
</head>
<script src="../../testing.js"></script>
<script defer>
loadScript('inline_defer.js');
</script>
<script async>
loadScript('inline_defer.js');
</script>
<script id=inline_defer>
// inline script should ignore defer and async attributes. If we don't do
// this correctly, we'd end up in an infinite loop
// https://github.com/lightpanda-io/browser/issues/1014
testing.eventually(() => testing.expectEqual(2, dyn1_loaded));
</script>

View File

@@ -0,0 +1 @@
dyn1_loaded += 1;