main.js 971 B

12345678910111213141516171819202122232425262728293031323334
  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. const app = require("sdk/system/xul-app");
  6. exports["test addon globa"] = app.is("Firefox") ? testAddonGlobal : unsupported;
  7. function testAddonGlobal (assert, done) {
  8. const { Panel } = require("sdk/panel")
  9. const { data } = require("sdk/self")
  10. let panel = Panel({
  11. contentURL: //"data:text/html,now?",
  12. data.url("./index.html"),
  13. onMessage: function(message) {
  14. assert.pass("got message from panel script");
  15. panel.destroy();
  16. done();
  17. },
  18. onError: function(error) {
  19. assert.fail(Error("failed to recieve message"));
  20. done();
  21. }
  22. });
  23. };
  24. function unsupported (assert) {
  25. assert.pass("privileged-panel unsupported on platform");
  26. }
  27. require("sdk/test/runner").runTestsFromModule(module);