1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/addon-sdk/source/test/test-packaging.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + "use strict"; 1.8 + 1.9 +var options = require("@loader/options"); 1.10 + 1.11 +exports.testPackaging = function(assert) { 1.12 + assert.equal(options.metadata.description, 1.13 + "Add-on development made easy.", 1.14 + "packaging metadata should be available"); 1.15 + try { 1.16 + options.metadata.description = 'new description'; 1.17 + assert.fail('should not have been able to set options.metadata property'); 1.18 + } 1.19 + catch (e) {} 1.20 + 1.21 + assert.equal(options.metadata.description, 1.22 + "Add-on development made easy.", 1.23 + "packaging metadata should be frozen"); 1.24 + 1.25 + assert.equal(options.metadata.permissions['private-browsing'], undefined, 1.26 + "private browsing metadata should be undefined"); 1.27 + assert.equal(options.metadata['private-browsing'], undefined, 1.28 + "private browsing metadata should be be frozen"); 1.29 + assert.equal(options['private-browsing'], undefined, 1.30 + "private browsing metadata should be be frozen"); 1.31 + 1.32 + try { 1.33 + options.metadata['private-browsing'] = true; 1.34 + assert.fail('should not have been able to set options.metadata property'); 1.35 + } 1.36 + catch(e) {} 1.37 + assert.equal(options.metadata['private-browsing'], undefined, 1.38 + "private browsing metadata should be be frozen"); 1.39 + 1.40 + try { 1.41 + options.metadata.permissions['private-browsing'] = true; 1.42 + assert.fail('should not have been able to set options.metadata.permissions property'); 1.43 + } 1.44 + catch (e) {} 1.45 + assert.equal(options.metadata.permissions['private-browsing'], undefined, 1.46 + "private browsing metadata should be be frozen"); 1.47 +}; 1.48 + 1.49 +require('sdk/test').run(exports);