michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: const app = require("sdk/system/xul-app"); michael@0: michael@0: exports["test addon globa"] = app.is("Firefox") ? testAddonGlobal : unsupported; michael@0: michael@0: function testAddonGlobal (assert, done) { michael@0: const { Panel } = require("sdk/panel") michael@0: const { data } = require("sdk/self") michael@0: michael@0: let panel = Panel({ michael@0: contentURL: //"data:text/html,now?", michael@0: data.url("./index.html"), michael@0: onMessage: function(message) { michael@0: assert.pass("got message from panel script"); michael@0: panel.destroy(); michael@0: done(); michael@0: }, michael@0: onError: function(error) { michael@0: assert.fail(Error("failed to recieve message")); michael@0: done(); michael@0: } michael@0: }); michael@0: }; michael@0: michael@0: function unsupported (assert) { michael@0: assert.pass("privileged-panel unsupported on platform"); michael@0: } michael@0: michael@0: require("sdk/test/runner").runTestsFromModule(module);