forked from mirrors/gecko-dev
		
	# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35951 --HG-- extra : source : 62f3501af4bc1c0bd1ee1977a28aee04706a6663
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			794 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			794 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
"use strict";
 | 
						|
 | 
						|
self.onmessage = function(event) {
 | 
						|
  if (event.data !== "resolve") {
 | 
						|
    return;
 | 
						|
  }
 | 
						|
  // This then-handler should be executed inside the top-level event loop,
 | 
						|
  // within the context of the worker's global.
 | 
						|
  Promise.resolve().then(function() {
 | 
						|
    self.onmessage = function(e) {
 | 
						|
      if (e.data !== "pause") {
 | 
						|
        return;
 | 
						|
      }
 | 
						|
      // This then-handler should be executed inside the top-level event loop,
 | 
						|
      // within the context of the worker's global. Because the debugger
 | 
						|
      // statement here below enters a nested event loop, the then-handler
 | 
						|
      // should not be executed until the debugger statement returns.
 | 
						|
      Promise.resolve().then(function() {
 | 
						|
        postMessage("resumed");
 | 
						|
      });
 | 
						|
      debugger;
 | 
						|
    };
 | 
						|
    postMessage("resolved");
 | 
						|
  });
 | 
						|
};
 |