forked from mirrors/gecko-dev
		
	 c253e5791b
			
		
	
	
		c253e5791b
		
	
	
	
	
		
			
			Depends on D16575 Differential Revision: https://phabricator.services.mozilla.com/D16576 --HG-- extra : moz-landing-system : lando
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /* Any copyright is dedicated to the Public Domain.
 | |
|    http://creativecommons.org/publicdomain/zero/1.0/ */
 | |
| 
 | |
| "use strict";
 | |
| 
 | |
| /* import-globals-from helper-addons.js */
 | |
| Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this);
 | |
| 
 | |
| // Test that extension warnings are displayed in about:debugging.
 | |
| add_task(async function() {
 | |
|   const EXTENSION_NAME = "Temporary web extension";
 | |
|   const EXTENSION_ID = "test-devtools@mozilla.org";
 | |
| 
 | |
|   const { document, tab } = await openAboutDebugging();
 | |
| 
 | |
|   const manifest = {
 | |
|     "manifest_version": 2,
 | |
|     "name": EXTENSION_NAME,
 | |
|     "version": "1.0",
 | |
|     "applications": {
 | |
|       "gecko": {
 | |
|         "id": EXTENSION_ID,
 | |
|       },
 | |
|     },
 | |
|     // This property is not expected in the manifest and should trigger a warning!
 | |
|     "wrongProperty": {},
 | |
|   };
 | |
| 
 | |
|   const tempExt = new TemporaryExtension(EXTENSION_ID);
 | |
|   tempExt.writeManifest(manifest);
 | |
|   registerCleanupFunction(() => tempExt.remove());
 | |
| 
 | |
|   info("Install a temporary extension");
 | |
|   await AddonManager.installTemporaryAddon(tempExt.sourceDir);
 | |
| 
 | |
|   info("Wait until a debug target item appears");
 | |
|   await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document));
 | |
|   const target = findDebugTargetByText(EXTENSION_NAME, document);
 | |
| 
 | |
|   const warningMessage = target.querySelector(".js-message");
 | |
|   ok(!!warningMessage, "A warning message is displayed for the installed addon");
 | |
| 
 | |
|   const warningText = warningMessage.textContent;
 | |
|   ok(warningText.includes("wrongProperty"), "The warning message mentions wrongProperty");
 | |
| 
 | |
|   await removeTemporaryExtension(EXTENSION_NAME, document);
 | |
|   await removeTab(tab);
 | |
| });
 |