michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Tests that the AddonManager objects cannot be tampered with michael@0: michael@0: function run_test() { michael@0: // Setup for test michael@0: createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); michael@0: michael@0: startupManager(); michael@0: michael@0: // Verify that properties cannot be changed michael@0: let old = AddonManager.STATE_AVAILABLE; michael@0: AddonManager.STATE_AVAILABLE = 28; michael@0: do_check_eq(AddonManager.STATE_AVAILABLE, old); michael@0: michael@0: // Verify that functions cannot be replaced michael@0: AddonManager.isInstallEnabled = function() { michael@0: do_throw("Should not be able to replace a function"); michael@0: } michael@0: AddonManager.isInstallEnabled("application/x-xpinstall"); michael@0: michael@0: // Verify that properties cannot be added michael@0: AddonManager.foo = "bar"; michael@0: do_check_false("foo" in AddonManager); michael@0: }