forked from mirrors/gecko-dev
		
	Automatic update from web-platform-tests *.any.js: explicitly list defaults, part 1 (#23117) * *.any.js: explicitly list defaults, part 1 Helps with #23111. * add a couple more -- wpt-commits: e1e713c842e54ea0a9410ddc988b63d0e1d31973 wpt-pr: 23117
		
			
				
	
	
		
			18 lines
		
	
	
	
		
			591 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
	
		
			591 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// META: global=window,worker
 | 
						|
// META: script=websocket.sub.js
 | 
						|
 | 
						|
async_test(t => {
 | 
						|
  const isSecure = new URL(location.href).scheme === 'https';
 | 
						|
  const scheme = isSecure ? 'wss' : 'ws';
 | 
						|
  const port = isSecure ? __SECURE__PORT : __PORT;
 | 
						|
  const url = scheme + '://' + 'foo:bar@' + __SERVER__NAME + ':' + port + '/basic_auth';
 | 
						|
  const ws = new WebSocket(url);
 | 
						|
  ws.onopen = () => {
 | 
						|
    ws.onclose = ws.onerror = null;
 | 
						|
    ws.close();
 | 
						|
    t.done();
 | 
						|
  };
 | 
						|
  ws.onerror = ws.onclose = t.unreached_func('open should succeed');
 | 
						|
}, 'HTTP basic authentication should work with WebSockets');
 | 
						|
 | 
						|
done();
 |