summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/webextensions/test/xpcshell/test_permissions.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
committerMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
commiteda567b364a06e9e63efb865a6b1c73f1cb5232e (patch)
tree912ab15d877f733318e2c0394713bca33b830547 /toolkit/mozapps/webextensions/test/xpcshell/test_permissions.js
parent80eb356d57fc310cdf812cae63de30d6e56c1788 (diff)
downloadUXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.gz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.lz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.xz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.zip
[AllAM] Remove Mozilla Tests
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_permissions.js')
-rw-r--r--toolkit/mozapps/webextensions/test/xpcshell/test_permissions.js86
1 files changed, 0 insertions, 86 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_permissions.js b/toolkit/mozapps/webextensions/test/xpcshell/test_permissions.js
deleted file mode 100644
index 48fef406f..000000000
--- a/toolkit/mozapps/webextensions/test/xpcshell/test_permissions.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-Components.utils.import("resource://gre/modules/NetUtil.jsm");
-
-// Checks that permissions set in preferences are correctly imported but can
-// be removed by the user.
-
-const XPI_MIMETYPE = "application/x-xpinstall";
-
-function newPrincipal(uri) {
- return Services.scriptSecurityManager.createCodebasePrincipal(NetUtil.newURI(uri), {});
-}
-
-function run_test() {
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
-
- Services.prefs.setCharPref("xpinstall.whitelist.add", "https://test1.com,https://test2.com");
- Services.prefs.setCharPref("xpinstall.whitelist.add.36", "https://test3.com,https://www.test4.com");
- Services.prefs.setCharPref("xpinstall.whitelist.add.test5", "https://test5.com");
-
- Services.perms.add(NetUtil.newURI("https://www.test9.com"), "install",
- AM_Ci.nsIPermissionManager.ALLOW_ACTION);
-
- startupManager();
-
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("http://test1.com")));
- do_check_true(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test1.com")));
- do_check_true(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test2.com")));
- do_check_true(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test3.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test4.com")));
- do_check_true(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test4.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("http://www.test5.com")));
- do_check_true(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test5.com")));
-
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("http://www.test6.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test6.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test7.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test8.com")));
-
- // This should remain unaffected
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("http://www.test9.com")));
- do_check_true(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test9.com")));
-
- Services.perms.removeAll();
-
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test1.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test2.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test3.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test4.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test5.com")));
-
- // Upgrade the application and verify that the permissions are still not there
- restartManager("2");
-
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test1.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test2.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://test3.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test4.com")));
- do_check_false(AddonManager.isInstallAllowed(XPI_MIMETYPE,
- newPrincipal("https://www.test5.com")));
-}