test-packaging.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. var options = require("@loader/options");
  6. exports.testPackaging = function(assert) {
  7. assert.equal(options.metadata.description,
  8. "Add-on development made easy.",
  9. "packaging metadata should be available");
  10. try {
  11. options.metadata.description = 'new description';
  12. assert.fail('should not have been able to set options.metadata property');
  13. }
  14. catch (e) {}
  15. assert.equal(options.metadata.description,
  16. "Add-on development made easy.",
  17. "packaging metadata should be frozen");
  18. assert.equal(options.metadata.permissions['private-browsing'], undefined,
  19. "private browsing metadata should be undefined");
  20. assert.equal(options.metadata['private-browsing'], undefined,
  21. "private browsing metadata should be be frozen");
  22. assert.equal(options['private-browsing'], undefined,
  23. "private browsing metadata should be be frozen");
  24. try {
  25. options.metadata['private-browsing'] = true;
  26. assert.fail('should not have been able to set options.metadata property');
  27. }
  28. catch(e) {}
  29. assert.equal(options.metadata['private-browsing'], undefined,
  30. "private browsing metadata should be be frozen");
  31. try {
  32. options.metadata.permissions['private-browsing'] = true;
  33. assert.fail('should not have been able to set options.metadata.permissions property');
  34. }
  35. catch (e) {}
  36. assert.equal(options.metadata.permissions['private-browsing'], undefined,
  37. "private browsing metadata should be be frozen");
  38. };
  39. require('sdk/test').run(exports);