File tree Expand file tree Collapse file tree
websockets/multi-globals/url-parsing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < title > Current page used as a test helper</ title >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < title > Incumbent page used as a test helper</ title >
3+
4+ < iframe src ="../current/current.html " id ="current "> </ iframe >
5+
6+ < script >
7+ const current = document . querySelector ( "#current" ) . contentWindow ;
8+
9+ window . hello = ( ) => {
10+ window . ws = new current . WebSocket ( 'foo' ) ;
11+ ws . close ( ) ;
12+ } ;
13+ </ script >
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments