test-module.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. "use strict";
  5. /** Disabled because of Bug 672199
  6. exports["test module exports are frozen"] = function(assert) {
  7. assert.ok(Object.isFrozen(require("sdk/hotkeys")),
  8. "module exports are frozen");
  9. };
  10. exports["test redefine exported property"] = function(assert) {
  11. let hotkeys = require("sdk/hotkeys");
  12. let { Hotkey } = hotkeys;
  13. try { Object.defineProperty(hotkeys, 'Hotkey', { value: {} }); } catch(e) {}
  14. assert.equal(hotkeys.Hotkey, Hotkey, "exports can't be redefined");
  15. };
  16. */
  17. exports["test can't delete exported property"] = function(assert) {
  18. let hotkeys = require("sdk/hotkeys");
  19. let { Hotkey } = hotkeys;
  20. try { delete hotkeys.Hotkey; } catch(e) {}
  21. assert.equal(hotkeys.Hotkey, Hotkey, "exports can't be deleted");
  22. };
  23. exports["test can't override exported property"] = function(assert) {
  24. let hotkeys = require("sdk/hotkeys");
  25. let { Hotkey } = hotkeys;
  26. try { hotkeys.Hotkey = Object } catch(e) {}
  27. assert.equal(hotkeys.Hotkey, Hotkey, "exports can't be overriden");
  28. };
  29. require("test").run(exports);