summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/websockets/multi-globals/url-parsing/url-parsing.html
blob: 21ef6cd3a95487b99c732f0ff300722ebf3defe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!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.
    // https://github.com/whatwg/websockets/issues/46
    const expectedUrl = new URL('current/foo', location.href);
    expectedUrl.protocol = 'ws:';
    assert_equals(frames[0].ws.url, expectedUrl.href);
  });
});
</script>