Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /websockets/multi-globals/url-parsing/url-parsing.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Multiple globals for base URL in WebSocket constructor</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- This is the entry global -->
<iframe src="incumbent/incumbent.html"></iframe>
<script>
async_test((t) => {
onload = t.step_func_done(() => {
frames[0].hello();
// Inside constructors, "this's relevant settings object" === "current settings object",
// because of how "this" is constructed.
const expectedUrl = new URL('current/foo', location.href);
expectedUrl.protocol = 'ws:';
assert_equals(frames[0].ws.url, expectedUrl.href);
});
});
</script>