mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:22:45 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			866 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			866 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html>
 | |
| <head>
 | |
|   <title>Unhandled Promise rejection with no [[ScriptOrModule]] for the current execution context</title>
 | |
| </head>
 | |
| <body>
 | |
|   <button onclick="
 | |
|     Promise.reject(new Error('Success!'));
 | |
|     window.timer = setTimeout(() => {
 | |
|       const element = document.createElement('p');
 | |
|       element.innerText = 'Did not receive unhandledrejection event in 100ms.';
 | |
|       element.style.color = 'red';
 | |
|       document.body.appendChild(element);
 | |
|     }, 100)
 | |
|   ">
 | |
|     Click me to cause an unhandled promise rejection.
 | |
|   </button>
 | |
| 
 | |
|   <script>
 | |
|     window.onunhandledrejection = (rejectionEvent) => {
 | |
|       clearTimeout(window.timer);
 | |
|       const element = document.createElement("p");
 | |
|       element.innerText = rejectionEvent.reason.message;
 | |
|       element.style.color = "green";
 | |
|       document.body.appendChild(element);
 | |
|     }
 | |
|   </script>
 | |
| </body>
 | |
| </html>
 | 
