url-parsing.html (730B)
1 <!DOCTYPE html> 2 <title>Multiple globals for base URL in WebSocket constructor</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 6 <!-- This is the entry global --> 7 8 <iframe src="incumbent/incumbent.html"></iframe> 9 10 <script> 11 async_test((t) => { 12 onload = t.step_func_done(() => { 13 frames[0].hello(); 14 // Inside constructors, "this's relevant settings object" === "current settings object", 15 // because of how "this" is constructed. 16 // https://github.com/whatwg/websockets/issues/46 17 const expectedUrl = new URL('current/foo', location.href); 18 expectedUrl.protocol = 'ws:'; 19 assert_equals(frames[0].ws.url, expectedUrl.href); 20 }); 21 }); 22 </script>