forked from mirrors/gecko-dev
		
	 2f68e50e6c
			
		
	
	
		2f68e50e6c
		
	
	
	
	
		
			
			MozReview-Commit-ID: DceweCXElI4 --HG-- extra : rebase_source : c900d38b4e6ffb7bf8a6aa16e9f3b6106f63f6c9
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /* Any copyright is dedicated to the Public Domain.
 | |
|    http://creativecommons.org/publicdomain/zero/1.0/ */
 | |
| 
 | |
| "use strict";
 | |
| 
 | |
| /**
 | |
|  * Tests if copying a request's response works.
 | |
|  */
 | |
| 
 | |
| add_task(function* () {
 | |
|   let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
 | |
|   info("Starting test... ");
 | |
| 
 | |
|   const EXPECTED_RESULT = '{ "greeting": "Hello JSON!" }';
 | |
| 
 | |
|   let { document } = monitor.panelWin;
 | |
| 
 | |
|   let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
 | |
|   yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
 | |
|     content.wrappedJSObject.performRequests();
 | |
|   });
 | |
|   yield wait;
 | |
| 
 | |
|   EventUtils.sendMouseEvent({ type: "mousedown" },
 | |
|     document.querySelectorAll(".request-list-item")[3]);
 | |
|   EventUtils.sendMouseEvent({ type: "contextmenu" },
 | |
|     document.querySelectorAll(".request-list-item")[3]);
 | |
| 
 | |
|   yield waitForClipboardPromise(function setup() {
 | |
|     // Context menu is appending in XUL document, we must select it from
 | |
|     // toolbox.doc
 | |
|     monitor.toolbox.doc
 | |
|       .querySelector("#request-list-context-copy-response").click();
 | |
|   }, EXPECTED_RESULT);
 | |
| 
 | |
|   yield teardown(monitor);
 | |
| });
 |