mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:52:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			702 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			702 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <script src="../include.js"></script>
 | |
| <script>
 | |
|     test(() => {
 | |
|         let testCounter = 1;
 | |
|         function testPart(part) {
 | |
|             try {
 | |
|                 println(`${testCounter}. ${JSON.stringify(part())}`);
 | |
|             } catch (e) {
 | |
|                 println(`${testCounter}. Exception: ${e.name}`);
 | |
|             }
 | |
|             testCounter++;
 | |
|         }
 | |
| 
 | |
|         // 1. Send beacon
 | |
|         testPart(() => navigator.sendBeacon('https://example.com/') == true);
 | |
| 
 | |
|         // 2. Send beacon with wrong URL
 | |
|         testPart(() => navigator.sendBeacon('dsfhdsaklfhdasklf'));
 | |
| 
 | |
|         // 3. Send beacon with wrong scheme
 | |
|         testPart(() => navigator.sendBeacon('wss://example.com/'));
 | |
|     });
 | |
| </script>
 | 
