summaryrefslogtreecommitdiffstats
path: root/addon-sdk/source/test/test-addon-extras.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-09 06:46:43 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-09 06:46:43 -0500
commitac46df8daea09899ce30dc8fd70986e258c746bf (patch)
tree2750d3125fc253fd5b0671e4bd268eff1fd97296 /addon-sdk/source/test/test-addon-extras.js
parent8cecf8d5208f3945b35f879bba3015bb1a11bec6 (diff)
downloadUXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.gz
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.lz
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.xz
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.zip
Move Add-on SDK source to toolkit/jetpack
Diffstat (limited to 'addon-sdk/source/test/test-addon-extras.js')
-rw-r--r--addon-sdk/source/test/test-addon-extras.js70
1 files changed, 0 insertions, 70 deletions
diff --git a/addon-sdk/source/test/test-addon-extras.js b/addon-sdk/source/test/test-addon-extras.js
deleted file mode 100644
index 1910db05e..000000000
--- a/addon-sdk/source/test/test-addon-extras.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-const { Ci, Cu, Cc, components } = require("chrome");
-const self = require("sdk/self");
-const { before, after } = require("sdk/test/utils");
-const fixtures = require("./fixtures");
-const { Loader } = require("sdk/test/loader");
-const { merge } = require("sdk/util/object");
-
-exports["test changing result from addon extras in panel"] = function(assert, done) {
- let loader = Loader(module, null, null, {
- modules: {
- "sdk/self": merge({}, self, {
- data: merge({}, self.data, {url: fixtures.url})
- })
- }
- });
-
- const { Panel } = loader.require("sdk/panel");
- const { events } = loader.require("sdk/content/sandbox/events");
- const { on } = loader.require("sdk/event/core");
- const { isAddonContent } = loader.require("sdk/content/utils");
-
- var result = 1;
- var extrasVal = {
- test: function() {
- return result;
- }
- };
-
- on(events, "content-script-before-inserted", ({ window, worker }) => {
- assert.pass("content-script-before-inserted");
-
- if (isAddonContent({ contentURL: window.location.href })) {
- let extraStuff = Cu.cloneInto(extrasVal, window, {
- cloneFunctions: true
- });
- getUnsafeWindow(window).extras = extraStuff;
-
- assert.pass("content-script-before-inserted done!");
- }
- });
-
- let panel = Panel({
- contentURL: "./test-addon-extras.html"
- });
-
- panel.port.once("result1", (result) => {
- assert.equal(result, 1, "result is a number");
- result = true;
- panel.port.emit("get-result");
- });
-
- panel.port.once("result2", (result) => {
- assert.equal(result, true, "result is a boolean");
- loader.unload();
- done();
- });
-
- panel.port.emit("get-result");
-}
-
-function getUnsafeWindow (win) {
- return win.wrappedJSObject || win;
-}
-
-require("sdk/test").run(exports);