forked from mirrors/gecko-dev
		
	Automatic update from web-platform-tests WebSocket: stop removing an iframe in onerror from crashing There was an issue that if the iframe owning a WebSocket was synchronously removed in the onerror handler then it would crash the render process. This was caused by unconditionally calling Close() without checking the current state. Fix it. Also add a web platform test. Bug: 974667 Change-Id: Iaeb8f96cf600a2c052f06b5b59f4444b02615e83 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1663681 Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Commit-Queue: Adam Rice <ricea@chromium.org> Cr-Commit-Position: refs/heads/master@{#670061} -- Set a long timeout -- wpt-commits: 433e1f06259a79c6cb8bf695bc03ffdfdfe4e7e7, 28ad65497bccb301707e341a9d36f9d144e2793e wpt-pr: 17380
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			591 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			591 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// META: script=websocket.sub.js
 | 
						|
// META: timeout=long
 | 
						|
 | 
						|
async_test(t => {
 | 
						|
  window.wsurl = 'wss://' + __SERVER__NAME + ':' + __SECURE__PORT +
 | 
						|
      '/does-not-exist';
 | 
						|
  let wsframe;
 | 
						|
  window.wsonerror = () => {
 | 
						|
    wsframe.remove();
 | 
						|
    // If this didn't crash then the test passed.
 | 
						|
    t.done();
 | 
						|
  };
 | 
						|
  wsframe = document.createElement('iframe');
 | 
						|
  wsframe.srcdoc = `<script>
 | 
						|
const ws = new WebSocket(parent.wsurl);
 | 
						|
ws.onerror = parent.wsonerror;
 | 
						|
</script>`;
 | 
						|
  onload = () => document.body.appendChild(wsframe);
 | 
						|
}, 'removing an iframe from within an onerror handler should work');
 | 
						|
 | 
						|
done();
 |