forked from mirrors/gecko-dev
		
	 0a2c8f9b78
			
		
	
	
		0a2c8f9b78
		
	
	
	
	
		
			
			MozReview-Commit-ID: HBpjT2uHJaZ --HG-- extra : rebase_source : 78fe71a1d673a1c698520a9c82c6f35959614f8f
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			612 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			612 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
 | |
| var carryOn = true;
 | |
| 
 | |
| window.addEventListener("message", e => {
 | |
|   console.log("frame content", "message", e);
 | |
|   if ("title" in e.data) {
 | |
|     document.title = e.data.title;
 | |
|   }
 | |
|   if ("stop" in e.data) {
 | |
|     carryOn = false;
 | |
|   }
 | |
| });
 | |
| 
 | |
| // Use some CPU.
 | |
| var interval = window.setInterval(() => {
 | |
|   if (!carryOn) {
 | |
|     window.clearInterval(interval);
 | |
|     return;
 | |
|   }
 | |
| 
 | |
|   // Compute an arbitrary value, print it out to make sure that the JS
 | |
|   // engine doesn't discard all our computation.
 | |
|   var date = Date.now();
 | |
|   var array = [];
 | |
|   var i = 0;
 | |
|   while (Date.now() - date <= 100) {
 | |
|     array[i % 2] = i++;
 | |
|   }
 | |
| }, 300);
 |