Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /workers/constructors/Worker/constructor-utf16-bom.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Worker constructor: UTF-16 BOM should trigger error</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function test_utf16_bom(url, title) {
async_test(t => {
const worker = new Worker(url);
worker.onmessage = t.unreached_func(`${title} should result to a compile error`);
worker.onerror = t.step_func_done(e => {
assert_true(true);
});
}, title);
}
test_utf16_bom("script-utf16be.js", "Worker with UTF-16BE BOM");
test_utf16_bom("script-utf16le.js", "Worker with UTF-16LE BOM");
</script>