summaryrefslogtreecommitdiffstats
path: root/toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-02-13 19:11:37 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-02-13 19:11:37 +0100
commit43d44975b1f49df640916cca5f6a0b138696da3c (patch)
tree98b95bb1043fc6a599e3c02fbb9b1ee7a363bf89 /toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js
parent6bb02d95f70000b150569089987701c8244d7d5d (diff)
downloadUXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar.gz
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar.lz
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar.xz
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.zip
Remove WebExtension support from the platform.
- Conditional code - WE APIs - WE toolkit theming
Diffstat (limited to 'toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js')
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js55
1 files changed, 0 insertions, 55 deletions
diff --git a/toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js b/toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js
deleted file mode 100644
index 68741a6cc..000000000
--- a/toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js
+++ /dev/null
@@ -1,55 +0,0 @@
-"use strict";
-
-Cu.import("resource://gre/modules/ExtensionManagement.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-function createWindowWithAddonId(addonId) {
- let baseURI = Services.io.newURI("about:blank", null, null);
- let originAttributes = {addonId};
- let principal = Services.scriptSecurityManager
- .createCodebasePrincipal(baseURI, originAttributes);
- let chromeNav = Services.appShell.createWindowlessBrowser(true);
- let interfaceRequestor = chromeNav.QueryInterface(Ci.nsIInterfaceRequestor);
- let docShell = interfaceRequestor.getInterface(Ci.nsIDocShell);
- docShell.createAboutBlankContentViewer(principal);
-
- return {chromeNav, window: docShell.contentViewer.DOMDocument.defaultView};
-}
-
-add_task(function* test_eventpages() {
- const {getAPILevelForWindow, getAddonIdForWindow} = ExtensionManagement;
- const {NO_PRIVILEGES, FULL_PRIVILEGES} = ExtensionManagement.API_LEVELS;
- const FAKE_ADDON_ID = "fakeAddonId";
- const OTHER_ADDON_ID = "otherFakeAddonId";
- const EMPTY_ADDON_ID = "";
-
- let fakeAddonId = createWindowWithAddonId(FAKE_ADDON_ID);
- equal(getAddonIdForWindow(fakeAddonId.window), FAKE_ADDON_ID,
- "the window has the expected addonId");
-
- let apiLevel = getAPILevelForWindow(fakeAddonId.window, FAKE_ADDON_ID);
- equal(apiLevel, FULL_PRIVILEGES,
- "apiLevel for the window with the right addonId should be FULL_PRIVILEGES");
-
- apiLevel = getAPILevelForWindow(fakeAddonId.window, OTHER_ADDON_ID);
- equal(apiLevel, NO_PRIVILEGES,
- "apiLevel for the window with a different addonId should be NO_PRIVILEGES");
-
- fakeAddonId.chromeNav.close();
-
- // NOTE: check that window with an empty addon Id (which are window that are
- // not Extensions pages) always get no WebExtensions APIs.
- let emptyAddonId = createWindowWithAddonId(EMPTY_ADDON_ID);
- equal(getAddonIdForWindow(emptyAddonId.window), EMPTY_ADDON_ID,
- "the window has the expected addonId");
-
- apiLevel = getAPILevelForWindow(emptyAddonId.window, EMPTY_ADDON_ID);
- equal(apiLevel, NO_PRIVILEGES,
- "apiLevel for empty addonId should be NO_PRIVILEGES");
-
- apiLevel = getAPILevelForWindow(emptyAddonId.window, OTHER_ADDON_ID);
- equal(apiLevel, NO_PRIVILEGES,
- "apiLevel for an 'empty addonId' window should be always NO_PRIVILEGES");
-
- emptyAddonId.chromeNav.close();
-});