1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug595081.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,27 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.6 + */ 1.7 + 1.8 +// Tests that the AddonManager objects cannot be tampered with 1.9 + 1.10 +function run_test() { 1.11 + // Setup for test 1.12 + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); 1.13 + 1.14 + startupManager(); 1.15 + 1.16 + // Verify that properties cannot be changed 1.17 + let old = AddonManager.STATE_AVAILABLE; 1.18 + AddonManager.STATE_AVAILABLE = 28; 1.19 + do_check_eq(AddonManager.STATE_AVAILABLE, old); 1.20 + 1.21 + // Verify that functions cannot be replaced 1.22 + AddonManager.isInstallEnabled = function() { 1.23 + do_throw("Should not be able to replace a function"); 1.24 + } 1.25 + AddonManager.isInstallEnabled("application/x-xpinstall"); 1.26 + 1.27 + // Verify that properties cannot be added 1.28 + AddonManager.foo = "bar"; 1.29 + do_check_false("foo" in AddonManager); 1.30 +}