TagSpaces is an offline, open source, document manager with tagging support
removing some js libraries for firefox
Ilian22fc67267cdb
diff --git a/addonlibs/erikvold-menuitems-jplib/docs/menuitems.md b/addonlibs/erikvold-menuitems-jplib/docs/menuitems.mddeleted file mode 100644index ecd162ab5..000000000--- a/addonlibs/erikvold-menuitems-jplib/docs/menuitems.md+++ /dev/null@@ -1,51 +0,0 @@-<!-- contributed by Erik Vold [[email protected]] -->---The `menuitems` API is a simple way to create-[Menuitems](https://developer.mozilla.org/en/XUL/PopupGuide/MenuItems), which-can perform an action when clicked, and display state.--## Example ##-- exports.main = function(options) {- // create menuitem for the File menu,- // and insert it before the 'Quit' menuitem- require("menuitems").Menuitem({- id: "myextprefix-some-mi-id",- menuid: "menu_FilePopup",- insertbefore: "menu_FileQuitItem",- "label": _("label"),- "accesskey": _("label.ak"),- image: self.data.url("icon.png"),- onCommand: function() {- // do something- }- });- };--<api name="Menuitem">-@class--Module exports `Menuitem` constructor allowing users to create a-[`menuitem`](https://developer.mozilla.org/en/XUL/menuitem).--<api name="Menuitem">-@constructor-Creates a `menuitem`.--@param options {Object}- Options for the `menuitem`, with the following parameters:--@prop id {String}-A id for the `menuitem`, this should be namespaced.--@prop label {String}-A label for the `menuitem`.--@prop image {String}-A image url for the `menuitem`.--@prop [onCommand] {Function}- A option function that is invoked when the `menuitem` is executed.-</api>-</api>diff --git a/addonlibs/erikvold-menuitems-jplib/lib/menuitems.js b/addonlibs/erikvold-menuitems-jplib/lib/menuitems.jsdeleted file mode 100644index aab37e955..000000000--- a/addonlibs/erikvold-menuitems-jplib/lib/menuitems.js+++ /dev/null@@ -1,67 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MIT/X11 License- *- * Copyright (c) 2010 Erik Vold- *- * Permission is hereby granted, free of charge, to any person obtaining a copy- * of this software and associated documentation files (the "Software"), to deal- * in the Software without restriction, including without limitation the rights- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell- * copies of the Software, and to permit persons to whom the Software is- * furnished to do so, subject to the following conditions:- *- * The above copyright notice and this permission notice shall be included in- * all copies or substantial portions of the Software.- *- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN- * THE SOFTWARE.- *- * Contributor(s):- * Erik Vold <[email protected]> (Original Author)- *- * ***** END LICENSE BLOCK ***** */--const windowUtils = require("window-utils");-const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";--exports.Menuitem = function Menuitem(options) {- new windowUtils.WindowTracker({- onTrack: function (window) {- if ("chrome://browser/content/browser.xul" != window.location) return;-- var onCmd = function() {- options.onCommand && options.onCommand();- };-- // add the new menuitem to a menu- var menuitem = window.document.createElementNS(NS_XUL, "menuitem");- menuitem.setAttribute("id", options.id);- menuitem.setAttribute("label", options.label);- if (options.accesskey)- menuitem.setAttribute("accesskey", options.accesskey);- if (options.key)- menuitem.setAttribute("key", options.key);- if (options.image) {- menuitem.setAttribute("class", "menuitem-iconic");- menuitem.style.listStyleImage = "url('" + options.image + "')";- }- menuitem.addEventListener("command", onCmd, true);-- if (options.menuid) {- let ($ = function(id) window.document.getElementById(id)) {- $(options.menuid).insertBefore(menuitem, $(options.insertbefore));- }- }-- // add unloader- require("unload+").unload(function() {- menuitem.parentNode.removeChild(menuitem);- }, window);- }- });-};diff --git a/addonlibs/erikvold-menuitems-jplib/package.json b/addonlibs/erikvold-menuitems-jplib/package.jsondeleted file mode 100644index cd1281f9e..000000000--- a/addonlibs/erikvold-menuitems-jplib/package.json+++ /dev/null@@ -1,9 +0,0 @@-{- "name": "menuitems",- "description": "Menuitems for Jetpacks",- "keywords": ["menu", "menuitems", "button", "ui"],- "author": "Erik Vold (http://erikvold.com/) <[email protected]>",- "version": "1.0",- "license": "MIT/X11",- "dependencies": ["api-utils", "vold-utils"]-}diff --git a/addonlibs/erikvold-menuitems-jplib/tests/test-menuitems.js b/addonlibs/erikvold-menuitems-jplib/tests/test-menuitems.jsdeleted file mode 100644index 49aa6ba7d..000000000--- a/addonlibs/erikvold-menuitems-jplib/tests/test-menuitems.js+++ /dev/null@@ -1,55 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MPL 1.1/GPL 2.0/LGPL 2.1- *- * The contents of this file are subject to the Mozilla Public License Version- * 1.1 (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- * http://www.mozilla.org/MPL/- *- * Software distributed under the License is distributed on an "AS IS" basis,- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License- * for the specific language governing rights and limitations under the- * License.- *- * The Initial Developer of the Original Code is Erik Vold- * Portions created by the Initial Developer are Copyright (C) 2011- * the Initial Developer. All Rights Reserved.- *- * Contributor(s):- * Erik Vold <[email protected]> (Original Author)- *- * Alternatively, the contents of this file may be used under the terms of- * either the GNU General Public License Version 2 or later (the "GPL"), or- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),- * in which case the provisions of the GPL or the LGPL are applicable instead- * of those above. If you wish to allow use of your version of this file only- * under the terms of either the GPL or the LGPL, and not to allow others to- * use your version of this file under the terms of the MPL, indicate your- * decision by deleting the provisions above and replace them with the notice- * and other provisions required by the GPL or the LGPL. If you do not delete- * the provisions above, a recipient may use your version of this file under- * the terms of any one of the MPL, the GPL or the LGPL.- *- * ***** END LICENSE BLOCK ***** */--const windowUtils = require("window-utils");-const menuitems = require("menuitems");--let window = windowUtils.activeBrowserWindow;-let document = window.document;-function $(id) document.getElementById(id);--function createMI(options, test) {- test.assertEqual(!$(options.id), true);- var mi = new menuitems.Menuitem(options);- return mi;-}--exports.testMIDoesNotExist = function(test) {- var options = {- id: "test-mi-dne",- label: "test"- };- createMI(options, test);- test.assertEqual(!$(options.id), true);-};diff --git a/addonlibs/toolbarbutton-jplib/.gitignore b/addonlibs/toolbarbutton-jplib/.gitignoredeleted file mode 100644index 057cab783..000000000--- a/addonlibs/toolbarbutton-jplib/.gitignore+++ /dev/null@@ -1,3 +0,0 @@-.DS_Store-.project-.settingsdiff --git a/addonlibs/toolbarbutton-jplib/README.md b/addonlibs/toolbarbutton-jplib/README.mddeleted file mode 100644index 3a15ce114..000000000--- a/addonlibs/toolbarbutton-jplib/README.md+++ /dev/null@@ -1,12 +0,0 @@-# Toolbar Buttons Package for Mozilla's Add-on SDK-by Erik Vold--The toolbarbutton module in this package allows one to easily create toolbar-buttons with Mozilla's Add-on SDK.--## Dependencies--The `toolbarbutton` package depends on the following packages:--* [Vold Utils](https://github.com/erikvold/vold-utils-jplib)-* [API Utils](https://github.com/mozilla/addon-sdk/) *built in to the Add-on SDKdiff --git a/addonlibs/toolbarbutton-jplib/docs/toolbarbutton.md b/addonlibs/toolbarbutton-jplib/docs/toolbarbutton.mddeleted file mode 100644index 87f4cf2fb..000000000--- a/addonlibs/toolbarbutton-jplib/docs/toolbarbutton.md+++ /dev/null@@ -1,84 +0,0 @@-The `toolbarbutton` API provides a simple way to create-[toolbar buttons](https://developer.mozilla.org/en/XUL/toolbarbutton), which-can perform an action when clicked.--## Example ##-- // create toolbarbutton- var tbb = require("toolbarbutton").ToolbarButton({- id: "TBB-TEST",- label: "TBB TEST",- onCommand: function () {- tbb.destroy(); // kills the toolbar button- }- });-- if (require('self').loadReason == "install") {- tbb.moveTo({- toolbarID: "nav-bar",- forceMove: false // only move from palette- });- }--<api name="ToolbarButton">-@class--Module exports `ToolbarButton` constructor allowing users to create a-toolbar button.--<api name="ToolbarButton">-@constructor-Creates a toolbarbutton.--@param options {Object}- Options for the toolbarbutton, with the following parameters:--@prop id {String}-A id for the toolbar button, this should be namespaced.--@prop label {String}-A label for the toolbar button.--@prop image {String}-A image url for the toolbar button.--@prop [onCommand] {Function}- A option function that is invoked when the toolbar button is pressed.--@prop [panel] {Panel}- A optional panel.-</api>--<api name="destroy">-@method-Removes the toolbar button from all open windows and no longer adds the-toolbar button to new windows.-</api>--<api name="moveTo">-@method-Moves the toolbar button on all open windows to the desired location.--@param options {Object}-Options which describe the position to move the toolbar button to, with the-following parameters:--@prop toolbarID {String}-The id of the toolbar which you want to add the toolbar button to.--Example toolbar IDs:--- **toolbar-menubar**: The menu bar.-- **nav-bar**: The navigation bar.-- **TabsToolbar**: The tabs bar.-- **addon-bar**: The addon bar.--@prop insertbefore {String}-The id of the element which the toolbar button should be inserted before.--@prop forceMove {Boolean}-If `forceMove` is `false`, then the move will only occur if the toolbar button-is not already being used. If `true`, then the move will happen no matter where-the toolbar button is.-</api>-</api>diff --git a/addonlibs/toolbarbutton-jplib/lib/toolbarbutton.js b/addonlibs/toolbarbutton-jplib/lib/toolbarbutton.jsdeleted file mode 100644index 5aa2326ee..000000000--- a/addonlibs/toolbarbutton-jplib/lib/toolbarbutton.js+++ /dev/null@@ -1,192 +0,0 @@-'use strict';--const { unload } = require("unload+");-const { listen } = require("listen");-const winUtils = require("window-utils");--const browserURL = "chrome://browser/content/browser.xul";-const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";--exports.ToolbarButton = function ToolbarButton(options) {- var unloaders = [],- toolbarID = "",- insertbefore = "",- destroyed = false,- destoryFuncs = [];-- var delegate = {- onTrack: function (window) {- if (browserURL != window.location || destroyed)- return;-- let doc = window.document;- let $ = function(id) doc.getElementById(id);-- options.tooltiptext = options.tooltiptext || '';-- // create toolbar button- let tbb = doc.createElementNS(NS_XUL, "toolbarbutton");- tbb.setAttribute("id", options.id);- tbb.setAttribute("type", "button");- if (options.image) tbb.setAttribute("image", options.image);- tbb.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");- tbb.setAttribute("label", options.label);- tbb.setAttribute('tooltiptext', options.tooltiptext);- tbb.addEventListener("command", function() {- if (options.onCommand)- options.onCommand({}); // TODO: provide something?-- if (options.panel) {- options.panel.show(tbb);- }- }, true);-- // add toolbarbutton to palette- ($("navigator-toolbox") || $("mail-toolbox")).palette.appendChild(tbb);-- // find a toolbar to insert the toolbarbutton into- if (toolbarID) {- var tb = $(toolbarID);- }- if (!tb) {- var tb = toolbarbuttonExists(doc, options.id);- }-- // found a toolbar to use?- if (tb) {- let b4;-- // find the toolbarbutton to insert before- if (insertbefore) {- b4 = $(insertbefore);- }- if (!b4) {- let currentset = tb.getAttribute("currentset").split(",");- let i = currentset.indexOf(options.id) + 1;-- // was the toolbarbutton id found in the curent set?- if (i > 0) {- let len = currentset.length;- // find a toolbarbutton to the right which actually exists- for (; i < len; i++) {- b4 = $(currentset[i]);- if (b4) break;- }- }- }-- tb.insertItem(options.id, b4, null, false);- }-- var saveTBNodeInfo = function(e) {- toolbarID = tbb.parentNode.getAttribute("id") || "";- insertbefore = (tbb.nextSibling || "")- && tbb.nextSibling.getAttribute("id").replace(/^wrapper-/i, "");- };-- window.addEventListener("aftercustomization", saveTBNodeInfo, false);-- // add unloader to unload+'s queue- var unloadFunc = function() {- tbb.parentNode.removeChild(tbb);- window.removeEventListener("aftercustomization", saveTBNodeInfo, false);- };- var index = destoryFuncs.push(unloadFunc) - 1;- listen(window, window, "unload", function() {- destoryFuncs[index] = null;- }, false);- unloaders.push(unload(unloadFunc, window));- },- onUntrack: function (window) {}- };- var tracker = winUtils.WindowTracker(delegate);-- function setIcon(aOptions) {- options.image = aOptions.image || aOptions.url;- getToolbarButtons(function(tbb) {- tbb.image = options.image;- }, options.id);- return options.image;- }-- return {- destroy: function() {- if (destroyed) return;- destroyed = true;-- if (options.panel)- options.panel.destroy();-- // run unload functions- destoryFuncs.forEach(function(f) f && f());- destoryFuncs.length = 0;-- // remove unload functions from unload+'s queue- unloaders.forEach(function(f) f());- unloaders.length = 0;- },- moveTo: function(pos) {- if (destroyed) return;-- // record the new position for future windows- toolbarID = pos.toolbarID;- insertbefore = pos.insertbefore;-- // change the current position for open windows- for each (var window in winUtils.windowIterator()) {- if (browserURL != window.location) return;-- let doc = window.document;- let $ = function (id) doc.getElementById(id);-- // if the move isn't being forced and it is already in the window, abort- if (!pos.forceMove && $(options.id)) return;-- var tb = $(toolbarID);- var b4 = $(insertbefore);-- // TODO: if b4 dne, but insertbefore is in currentset, then find toolbar to right-- if (tb) tb.insertItem(options.id, b4, null, false);- };- },- get label() options.label,- set label(value) {- options.label = value;- getToolbarButtons(function(tbb) {- tbb.label = value;- }, options.id);- return value;- },- setIcon: setIcon,- get image() options.image,- set image(value) setIcon({image: value}),- get tooltiptext() options.tooltiptext,- set tooltiptext(value) {- options.tooltiptext = value;- getToolbarButtons(function(tbb) {- tbb.setAttribute('tooltiptext', value);- }, options.id);- },- };-};--function getToolbarButtons(callback, id) {- let buttons = [];- for each (var window in winUtils.windowIterator()) {- if (browserURL != window.location) continue;- let tbb = window.document.getElementById(id);- if (tbb) buttons.push(tbb);- }- if (callback) buttons.forEach(callback);- return buttons;-}--function toolbarbuttonExists(doc, id) {- var toolbars = doc.getElementsByTagNameNS(NS_XUL, "toolbar");- for (var i = toolbars.length - 1; ~i; i--) {- if ((new RegExp("(?:^|,)" + id + "(?:,|$)")).test(toolbars[i].getAttribute("currentset")))- return toolbars[i];- }- return false;-}diff --git a/addonlibs/toolbarbutton-jplib/package.json b/addonlibs/toolbarbutton-jplib/package.jsondeleted file mode 100644index 040c540c7..000000000--- a/addonlibs/toolbarbutton-jplib/package.json+++ /dev/null@@ -1,9 +0,0 @@-{- "name": "toolbarbutton",- "description": "Toolbar Buttons for Jetpacks",- "keywords": ["toolbar", "toolbarbutton", "button", "ui"],- "author": "Erik Vold",- "version": "1.1.1",- "license": "MIT/X11",- "dependencies": ["api-utils", "vold-utils"]-}diff --git a/addonlibs/toolbarbutton-jplib/tests/black.png b/addonlibs/toolbarbutton-jplib/tests/black.pngdeleted file mode 100644index ee11b0980..000000000Binary files a/addonlibs/toolbarbutton-jplib/tests/black.png and /dev/null differdiff --git a/addonlibs/toolbarbutton-jplib/tests/test-toolbarbutton.js b/addonlibs/toolbarbutton-jplib/tests/test-toolbarbutton.jsdeleted file mode 100644index 3503493cb..000000000--- a/addonlibs/toolbarbutton-jplib/tests/test-toolbarbutton.js+++ /dev/null@@ -1,111 +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 windowUtils = require("window-utils");-const toolbarbutton = require("toolbarbutton");--const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";--const TEST_ICON_URL = module.uri.replace(/[^\.\\\/]*\.js$/, "test.png");-const TEST_ICON_BLACK_URL = module.uri.replace(/[^\.\\\/]*\.js$/, "black.png");--function $(id) windowUtils.activeBrowserWindow.document.getElementById(id);--function createToolbarButton(options, test) {- test.assertEqual(!$(options.id), true);- var tbb = toolbarbutton.ToolbarButton(options);- test.assertEqual(!$(options.id), true);- tbb.moveTo(options);- return tbb;-}--function buttonExists(button, options, test) {- test.assertEqual(!button, false, 'test button');- test.assertEqual(button.parentNode, $(options.toolbarID), 'test parent');- test.assertEqual(button.id, options.id, 'test id');- if (options.label)- test.assertEqual(button.label, options.label, 'test label');- if (options.image)- test.assertEqual(button.image, options.image);- else- test.assertEqual(button.image, "");-}--exports.testTBBExists = function(test) {- var options = {- id: "test-tbb",- label: "test",- toolbarID: "nav-bar",- forceMove: true- };-- var tbb = createToolbarButton(options, test);- buttonExists($(options.id), options, test);- tbb.destroy();- test.assertEqual(!$(options.id), true);- var tbb = createToolbarButton(options, test);- tbb.destroy();-};--exports.testTBBDoesNotExist = function(test) {- var options = {- id: "test-tbb2",- label: "test"- };- var tbb = createToolbarButton(options, test);- var tbbEle = $(options.id);- test.assertEqual(!tbbEle, true, 'toolbar button dne');- tbb.destroy();-};--exports.testTBBLabelChange = function(test) {- test.waitUntilDone();-- var options = {- id: "test-tbb3",- label: "test",- toolbarID: "nav-bar",- forceMove: true- };-- let tbb = createToolbarButton(options, test);- buttonExists($(options.id), options, test);- tbb.label = 'test change';- test.assertEqual($(options.id).label, 'test change', 'the label is changed');- test.assertEqual(tbb.label, 'test change', 'the label is changed');-- tbb.destroy();- test.done();-};--exports.testTBBPropertyChange = function(test) {- test.waitUntilDone();-- var options = {- id: "test-tbb4",- label: "test",- toolbarID: "nav-bar",- forceMove: true,- image: TEST_ICON_URL,- tooltiptext: 'a'- };-- let tbb = createToolbarButton(options, test);- buttonExists($(options.id), options, test);- test.assertEqual($(options.id).image, TEST_ICON_URL, 'the image is correct');- test.assertEqual(tbb.image, TEST_ICON_URL, 'the image is correct');- test.assertEqual(tbb.tooltiptext, 'a', 'the tooltiptext is correct');- tbb.setIcon({url: TEST_ICON_BLACK_URL});- test.assertEqual($(options.id).image, TEST_ICON_BLACK_URL, 'the image is changed');- test.assertEqual(tbb.image, TEST_ICON_BLACK_URL, 'the image is changed');- tbb.tooltiptext = 'b';- test.assertEqual($(options.id).getAttribute('tooltiptext'), 'b', 'the tooltiptext is changed');- test.assertEqual(tbb.tooltiptext, 'b', 'the tooltiptext is changed');-- tbb.destroy();- test.done();-};--diff --git a/addonlibs/toolbarbutton-jplib/tests/test.png b/addonlibs/toolbarbutton-jplib/tests/test.pngdeleted file mode 100644index 5469a500a..000000000Binary files a/addonlibs/toolbarbutton-jplib/tests/test.png and /dev/null differdiff --git a/addonlibs/voldsoftware-vold-utils-jplib/README.md b/addonlibs/voldsoftware-vold-utils-jplib/README.mddeleted file mode 100644index 41773e3ba..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/README.md+++ /dev/null@@ -1,5 +0,0 @@-# Vold Utils for Mozilla's Add-on SDK--A collection of various modules which help build other apis.--diff --git a/addonlibs/voldsoftware-vold-utils-jplib/docs/listen.md b/addonlibs/voldsoftware-vold-utils-jplib/docs/listen.mddeleted file mode 100644index d19c6c6a5..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/docs/listen.md+++ /dev/null@@ -1,23 +0,0 @@-<!-- contributed by Erik Vold [[email protected]] -->--The `listen` module allows modules to register listeners to elements that are-automatically removed when the module unloads.--<api name="listen">-@function- Add listeners to run when unloading in a unload queue. Optionally scope the- callback to a container, e.g., window. Provide a way to run all the callbacks.--@param container {object}- A container for the node, which a "unload" event will be attached to, this is- used to cancel the unload magic that would occur, to avoid memory leaks.-@param node {object}- The node to listen to.-@param event {string}- The event type, for example: "load", "click", ...-@param callback {function}- A function to be called when the event occurs on the node.-@param [capture] {boolean}- Indicates if the event should be captured. [See the `useCapture`- documentation here](https://developer.mozilla.org/en/DOM/element.addEventListener).-</api>diff --git a/addonlibs/voldsoftware-vold-utils-jplib/docs/unload+.md b/addonlibs/voldsoftware-vold-utils-jplib/docs/unload+.mddeleted file mode 100644index 78693efa3..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/docs/unload+.md+++ /dev/null@@ -1,20 +0,0 @@-<!-- contributed by Erik Vold [[email protected]] -->--The `unload+` module allows modules to register callbacks that are called-when they are unloaded, and associate unload functions to containers to have the-unloader automatically deleted when the container unloads.--<api name="unload">-@function- Save callbacks to run when unloading in a unload queue. Optionally scope the- callback to a container, e.g., window. Provide a way to run all the callbacks.--@param callback {function}- A function to be called when the module unloads.-@param [container] {object}- Optional container object; if the container "unloads" before the module- unloads, then the associated callback is removed from the unload queue.-@returns {function}- Returns a function which will allow one to remove the callback from the unload- queue.-</api>diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/instances.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/instances.jsdeleted file mode 100644index a33ca4028..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/instances.js+++ /dev/null@@ -1,57 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MIT/X11 License- *- * Permission is hereby granted, free of charge, to any person obtaining a copy- * of this software and associated documentation files (the "Software"), to deal- * in the Software without restriction, including without limitation the rights- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell- * copies of the Software, and to permit persons to whom the Software is- * furnished to do so, subject to the following conditions:- *- * The above copyright notice and this permission notice shall be included in- * all copies or substantial portions of the Software.- *- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN- * THE SOFTWARE.- *- * Contributor(s):- * Erik Vold <[email protected]> (Original Author)- *- * ***** END LICENSE BLOCK ***** */--const {Cc, Ci, Cu} = require("chrome");--var Instances = exports.Instances = {- get bis() Cc["@mozilla.org/binaryinputstream;1"]- .createInstance(Ci.nsIBinaryInputStream),- get ch() Cc["@mozilla.org/security/hash;1"]- .createInstance(Ci.nsICryptoHash),- get dp() Cc["@mozilla.org/xmlextras/domparser;1"]- .createInstance(Ci.nsIDOMParser),- get ds() Cc["@mozilla.org/xmlextras/xmlserializer;1"]- .createInstance(Ci.nsIDOMSerializer),- get fos() Cc["@mozilla.org/network/file-output-stream;1"]- .createInstance(Ci.nsIFileOutputStream),- get sfos() Cc["@mozilla.org/network/safe-file-output-stream;1"]- .createInstance(Ci.nsIFileOutputStream)- .QueryInterface(Ci.nsISafeOutputStream),- get fp() Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker),- get lf() Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile),- get process() Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess),- get se() Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError)- .QueryInterface(Ci.nsIScriptError2),- get ss() Cc["@mozilla.org/supports-string;1"]- .createInstance(Ci.nsISupportsString),- get suc() Cc["@mozilla.org/intl/scriptableunicodeconverter"]- .createInstance(Ci.nsIScriptableUnicodeConverter),- get timer() Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),- get wbp() Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]- .createInstance(Ci.nsIWebBrowserPersist),- get xhr() Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]- .createInstance(Ci.nsIXMLHttpRequest)-};diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/listen.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/listen.jsdeleted file mode 100644index e8662a8db..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/listen.js+++ /dev/null@@ -1,61 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MPL 1.1/GPL 2.0/LGPL 2.1- *- * The contents of this file are subject to the Mozilla Public License Version- * 1.1 (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- * http://www.mozilla.org/MPL/- *- * Software distributed under the License is distributed on an "AS IS" basis,- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License- * for the specific language governing rights and limitations under the- * License.- *- * The Original Code is Home Dash Utility.- *- * The Initial Developer of the Original Code is The Mozilla Foundation.- * Portions created by the Initial Developer are Copyright (C) 2011- * the Initial Developer. All Rights Reserved.- *- * Contributor(s):- * Edward Lee <[email protected]>- * Erik Vold <[email protected]>- *- * Alternatively, the contents of this file may be used under the terms of- * either the GNU General Public License Version 2 or later (the "GPL"), or- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),- * in which case the provisions of the GPL or the LGPL are applicable instead- * of those above. If you wish to allow use of your version of this file only- * under the terms of either the GPL or the LGPL, and not to allow others to- * use your version of this file under the terms of the MPL, indicate your- * decision by deleting the provisions above and replace them with the notice- * and other provisions required by the GPL or the LGPL. If you do not delete- * the provisions above, a recipient may use your version of this file under- * the terms of any one of the MPL, the GPL or the LGPL.- *- * ***** END LICENSE BLOCK ***** */--"use strict";--var {unload} = require("unload+");--/**- * Helper that adds event listeners and remembers to remove on unload- */-exports.listen = function listen(window, node, event, func, capture) {- // Default to use capture- if (capture == null)- capture = true;-- node.addEventListener(event, func, capture);- function undoListen() {- node.removeEventListener(event, func, capture);- }-- // Undo the listener on unload and provide a way to undo everything- let undoUnload = unload(undoListen, window);- return function() {- undoListen();- undoUnload();- };-}diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/memoize.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/memoize.jsdeleted file mode 100644index 73bb4fcd5..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/memoize.js+++ /dev/null@@ -1,131 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MIT/X11 License- *- * Permission is hereby granted, free of charge, to any person obtaining a copy- * of this software and associated documentation files (the "Software"), to deal- * in the Software without restriction, including without limitation the rights- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell- * copies of the Software, and to permit persons to whom the Software is- * furnished to do so, subject to the following conditions:- *- * The above copyright notice and this permission notice shall be included in- * all copies or substantial portions of the Software.- *- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN- * THE SOFTWARE.- *- * Contributor(s):- * Nils Maier <[email protected]>- * Erik Vold <[email protected]>- *- * ***** END LICENSE BLOCK ***** */--"use strict";--/**- * Decorate a function with a memoization wrapper, with a limited-size cache- * to reduce peak memory utilization.- *- * The memoized function may have any number of arguments, but they must be- * be serializable. It's safest to use this only on functions that accept- * primitives.- *- * A memoized function is not thread-safe, but so is JS, nor re-entrant-safe!- *- * @usage var foo = Scriptish_memoize(function foo(arg1, arg2) { ... complex operation ... });- * @param {Function} func The function to be memoized- * @param {Number} limit Optional. Cache size (default: 100)- * @param {Number} num_args Options. Number of arguments the function expects (default: func.length)- * @return {Function} Memoized function- */-exports.memoize = function memoize(func, limit, num_args) {- limit = limit || 100;- num_args = num_args || func.length;-- var cache = Object.create(null);- var keylist = [];- var args = [];- var key, result;-- switch (num_args) {- case 0:- throw new Error("memoize does not support functions without arguments");- case 1:- return function memoize_one_arg(a) {- key = a.toString();-- if (key in cache)- return cache[key];-- result = func.call(null, a);- cache[key] = result;- if (keylist.push(key) > limit)- delete cache[keylist.shift()];- return result;- };- case 2:- return function memoize_two_args(a, b) {- args[0] = a; args[1] = b;- key = JSON.stringify(args);- args.length = 0;-- if (key in cache)- return cache[key];-- var result = func.call(null, a, b);- cache[key] = result;- if (keylist.push(key) > limit)- delete cache[keylist.shift()];- return result;- };- case 3:- return function memoize_three_args(a, b, c) {- args[0] = a; args[1] = b; args[2] = c;- key = JSON.stringify(args);- args.length = 0;-- if (key in cache)- return cache[key];-- var result = func.call(null, a, b, c);- cache[key] = result;- if (keylist.push(key) > limit)- delete cache[keylist.shift()];- return result;- };-- case 4:- return function memoize_four_args(a, b, c, d) {- args[0] = a; args[1] = b; args[2] = c; args[3] = d;- key = JSON.stringify(args);- args.length = 0;-- if (key in cache)- return cache[key];-- var result = func.call(null, a, b, c, d);- cache[key] = result;- if (keylist.push(key) > limit)- delete cache[keylist.shift()];- return result;- };-- default:- return function() {- var key = JSON.stringify(arguments);- if (key in cache)- return cache[key];-- var result = func.apply(null, arguments);- cache[key] = result;- if (keylist.push(key) > limit)- delete cache[keylist.shift()];- return result;- };- }-}diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/net-utils.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/net-utils.jsdeleted file mode 100644index df7f30038..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/net-utils.js+++ /dev/null@@ -1,3 +0,0 @@--require("chrome").Cu.import("resource://gre/modules/NetUtil.jsm", this);-exports.NetUtil = NetUtil;diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/services.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/services.jsdeleted file mode 100644index 4854dfae0..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/services.js+++ /dev/null@@ -1,84 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MIT/X11 License- *- * Permission is hereby granted, free of charge, to any person obtaining a copy- * of this software and associated documentation files (the "Software"), to deal- * in the Software without restriction, including without limitation the rights- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell- * copies of the Software, and to permit persons to whom the Software is- * furnished to do so, subject to the following conditions:- *- * The above copyright notice and this permission notice shall be included in- * all copies or substantial portions of the Software.- *- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN- * THE SOFTWARE.- *- * Contributor(s):- * Erik Vold <[email protected]> (Original Author)- *- * ***** END LICENSE BLOCK ***** */--const {Cc, Ci, Cu} = require("chrome");-Cu.import("resource://gre/modules/Services.jsm", this);--const global = this;-var Services = exports.Services = {};-(function(inc, tools){- inc("resource://gre/modules/XPCOMUtils.jsm", global);- inc("resource://gre/modules/Services.jsm", tools);- Services.__proto__ = tools.Services;-})(Cu.import, {});--/*-XPCOMUtils.defineLazyGetter(Services, "scriptish", function() (- Cc["@scriptish.erikvold.com/scriptish-service;1"]- .getService().wrappedJSObject));-*/--XPCOMUtils.defineLazyServiceGetter(- Services, "as", "@mozilla.org/alerts-service;1", "nsIAlertsService");--XPCOMUtils.defineLazyServiceGetter(- Services, "ass", "@mozilla.org/appshell/appShellService;1",- "nsIAppShellService");--XPCOMUtils.defineLazyServiceGetter(- Services, "cb", "@mozilla.org/widget/clipboardhelper;1",- "nsIClipboardHelper");--XPCOMUtils.defineLazyServiceGetter(- Services, "cs", "@mozilla.org/consoleservice;1", "nsIConsoleService");--XPCOMUtils.defineLazyServiceGetter(- Services, "eps", "@mozilla.org/uriloader/external-protocol-service;1",- "nsIExternalProtocolService");--if (Cc["@mozilla.org/privatebrowsing;1"]) {- XPCOMUtils.defineLazyServiceGetter(- Services, "pbs", "@mozilla.org/privatebrowsing;1",- "nsIPrivateBrowsingService");-} else {- Services.pbs = {privateBrowsingEnabled: false};-}--XPCOMUtils.defineLazyServiceGetter(- Services, "sis", "@mozilla.org/scriptableinputstream;1",- "nsIScriptableInputStream");--XPCOMUtils.defineLazyServiceGetter(- Services, "suhtml", "@mozilla.org/feed-unescapehtml;1",- "nsIScriptableUnescapeHTML");--XPCOMUtils.defineLazyServiceGetter(- Services, "tld", "@mozilla.org/network/effective-tld-service;1",- "nsIEffectiveTLDService");--XPCOMUtils.defineLazyServiceGetter(- Services, "uuid", "@mozilla.org/uuid-generator;1",- "nsIUUIDGenerator");diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/unload+.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/unload+.jsdeleted file mode 100644index ce574b169..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/unload+.js+++ /dev/null@@ -1,109 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MPL 1.1/GPL 2.0/LGPL 2.1- *- * The contents of this file are subject to the Mozilla Public License Version- * 1.1 (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- * http://www.mozilla.org/MPL/- *- * Software distributed under the License is distributed on an "AS IS" basis,- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License- * for the specific language governing rights and limitations under the- * License.- *- * The Original Code is Speak Words.- *- * The Initial Developer of the Original Code is The Mozilla Foundation.- * Portions created by the Initial Developer are Copyright (C) 2010- * the Initial Developer. All Rights Reserved.- *- * Contributor(s):- * Edward Lee <[email protected]>- * Erik Vold <[email protected]>- *- * Alternatively, the contents of this file may be used under the terms of- * either the GNU General Public License Version 2 or later (the "GPL"), or- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),- * in which case the provisions of the GPL or the LGPL are applicable instead- * of those above. If you wish to allow use of your version of this file only- * under the terms of either the GPL or the LGPL, and not to allow others to- * use your version of this file under the terms of the MPL, indicate your- * decision by deleting the provisions above and replace them with the notice- * and other provisions required by the GPL or the LGPL. If you do not delete- * the provisions above, a recipient may use your version of this file under- * the terms of any one of the MPL, the GPL or the LGPL.- *- * ***** END LICENSE BLOCK ***** */--"use strict";--var Unloader = exports.Unloader = function Unloader() {- var unloaders = [];-- function unloadersUnlaod() {- unloaders.slice().forEach(function(unloader) unloader());- unloaders.length = 0;- }-- require("unload").when(unloadersUnlaod);-- function removeUnloader(unloader) {- let index = unloaders.indexOf(unloader);- if (index != -1)- unloaders.splice(index, 1);- }-- return {- unload: function unload(callback, container) {- // Calling with no arguments runs all the unloader callbacks- if (callback == null) {- unloadersUnlaod();- return null;- }-- var remover = removeUnloader.bind(null, unloader);-- // The callback is bound to the lifetime of the container if we have one- if (container != null) {- // Remove the unloader when the container unloads- container.addEventListener("unload", remover, false);-- // Wrap the callback to additionally remove the unload listener- let origCallback = callback;- callback = function() {- container.removeEventListener("unload", remover, false);- origCallback();- }- }-- // Wrap the callback in a function that ignores failures- function unloader() {- try {- callback();- }- catch(ex) {}- }- unloaders.push(unloader);-- // Provide a way to remove the unloader- return remover;- }- };-}--/**- * Save callbacks to run when unloading. Optionally scope the callback to a- * container, e.g., window. Provide a way to run all the callbacks.- *- * @usage unload(): Run all callbacks and release them.- *- * @usage unload(callback): Add a callback to run on unload.- * @param [function] callback: 0-parameter function to call on unload.- * @return [function]: A 0-parameter function that undoes adding the callback.- *- * @usage unload(callback, container) Add a scoped callback to run on unload.- * @param [function] callback: 0-parameter function to call on unload.- * @param [node] container: Remove the callback when this container unloads.- * @return [function]: A 0-parameter function that undoes adding the callback.- */-exports.unload = (Unloader()).unload;diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/window-watcher.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/window-watcher.jsdeleted file mode 100644index ab4f4492e..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/window-watcher.js+++ /dev/null@@ -1,91 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MPL 1.1/GPL 2.0/LGPL 2.1- *- * The contents of this file are subject to the Mozilla Public License Version- * 1.1 (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- * http://www.mozilla.org/MPL/- *- * Software distributed under the License is distributed on an "AS IS" basis,- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License- * for the specific language governing rights and limitations under the- * License.- *- * The Original Code is Twitter Address Bar Search.- *- * The Initial Developer of the Original Code is The Mozilla Foundation.- * Portions created by the Initial Developer are Copyright (C) 2011- * the Initial Developer. All Rights Reserved.- *- * Contributor(s):- * Edward Lee <[email protected]>- * Erik Vold <[email protected]>- *- * Alternatively, the contents of this file may be used under the terms of- * either the GNU General Public License Version 2 or later (the "GPL"), or- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),- * in which case the provisions of the GPL or the LGPL are applicable instead- * of those above. If you wish to allow use of your version of this file only- * under the terms of either the GPL or the LGPL, and not to allow others to- * use your version of this file under the terms of the MPL, indicate your- * decision by deleting the provisions above and replace them with the notice- * and other provisions required by the GPL or the LGPL. If you do not delete- * the provisions above, a recipient may use your version of this file under- * the terms of any one of the MPL, the GPL or the LGPL.- *- * ***** END LICENSE BLOCK ***** */--const {Cu} = require("chrome");-Cu.import("resource://gre/modules/Services.jsm", this);--var {unload} = require("unload+");--/**- * Apply a callback to each open and new browser windows.- *- * @usage watchWindows(callback): Apply a callback to each browser window.- * @param [function] callback: 1-parameter function that gets a browser window.- */-exports.watchWindows = function watchWindows(callback) {- // Wrap the callback in a function that ignores failures- function watcher(window) {- try {- // Now that the window has loaded, only handle browser windows- let {documentElement} = window.document;- if (documentElement.getAttribute("windowtype") == "navigator:browser")- callback(window);- }- catch(ex) {}- }-- // Wait for the window to finish loading before running the callback- function runOnLoad(window) {- // Listen for one load event before checking the window type- window.addEventListener("load", function runOnce() {- window.removeEventListener("load", runOnce, false);- watcher(window);- }, false);- }-- // Add functionality to existing windows- let windows = Services.wm.getEnumerator(null);- while (windows.hasMoreElements()) {- // Only run the watcher immediately if the window is completely loaded- let window = windows.getNext();- if (window.document.readyState == "complete")- watcher(window);- // Wait for the window to load before continuing- else- runOnLoad(window);- }-- // Watch for new browser windows opening then wait for it to load- function windowWatcher(subject, topic) {- if (topic == "domwindowopened")- runOnLoad(subject);- }- Services.ww.registerNotification(windowWatcher);-- // Make sure to stop watching for windows if we're unloading- unload(function() Services.ww.unregisterNotification(windowWatcher));-};diff --git a/addonlibs/voldsoftware-vold-utils-jplib/lib/xpcom-utils.js b/addonlibs/voldsoftware-vold-utils-jplib/lib/xpcom-utils.jsdeleted file mode 100644index f453b342d..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/lib/xpcom-utils.js+++ /dev/null@@ -1,3 +0,0 @@--require("chrome").Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);-exports.XPCOMUtils = XPCOMUtils;diff --git a/addonlibs/voldsoftware-vold-utils-jplib/package.json b/addonlibs/voldsoftware-vold-utils-jplib/package.jsondeleted file mode 100644index ad549b7e7..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/package.json+++ /dev/null@@ -1,7 +0,0 @@-{- "name": "vold-utils",- "description": "Utilitys for Jetpacks",- "author": "Erik Vold (http://erikvold.com/) <[email protected]>",- "version": "1.1",- "dependencies": ["api-utils"]-}diff --git a/addonlibs/voldsoftware-vold-utils-jplib/tests/test-unload+.js b/addonlibs/voldsoftware-vold-utils-jplib/tests/test-unload+.jsdeleted file mode 100644index 822ea6105..000000000--- a/addonlibs/voldsoftware-vold-utils-jplib/tests/test-unload+.js+++ /dev/null@@ -1,146 +0,0 @@-/* ***** BEGIN LICENSE BLOCK *****- * Version: MPL 1.1/GPL 2.0/LGPL 2.1- *- * The contents of this file are subject to the Mozilla Public License Version- * 1.1 (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- * http://www.mozilla.org/MPL/- *- * Software distributed under the License is distributed on an "AS IS" basis,- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License- * for the specific language governing rights and limitations under the- * License.- *- * The Initial Developer of the Original Code is Erik Vold- * Portions created by the Initial Developer are Copyright (C) 2011- * the Initial Developer. All Rights Reserved.- *- * Contributor(s):- * Erik Vold <[email protected]> (Original Author)- *- * Alternatively, the contents of this file may be used under the terms of- * either the GNU General Public License Version 2 or later (the "GPL"), or- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),- * in which case the provisions of the GPL or the LGPL are applicable instead- * of those above. If you wish to allow use of your version of this file only- * under the terms of either the GPL or the LGPL, and not to allow others to- * use your version of this file under the terms of the MPL, indicate your- * decision by deleting the provisions above and replace them with the notice- * and other provisions required by the GPL or the LGPL. If you do not delete- * the provisions above, a recipient may use your version of this file under- * the terms of any one of the MPL, the GPL or the LGPL.- *- * ***** END LICENSE BLOCK ***** */--var timer = require("timer");-var {Cc,Ci} = require("chrome");--function makeEmptyWindow() {- var xulNs = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";- var blankXul = ('<?xml version="1.0"?>' +- '<?xml-stylesheet href="chrome://global/skin/" ' +- ' type="text/css"?>' +- '<window xmlns="' + xulNs + '">' +- '</window>');- var url = "data:application/vnd.mozilla.xul+xml," + escape(blankXul);- var features = ["chrome", "width=10", "height=10"];-- var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]- .getService(Ci.nsIWindowWatcher);- return ww.openWindow(null, url, null, features.join(","), null);-}--exports.testUnloading = function(test) {- var loader = test.makeSandboxedLoader();- var {unload} = loader.require("unload+");- var unloadCalled = 0;-- function unloader() {- unloadCalled++;- throw "error";- }- unload(unloader);-- function unloader2() unloadCalled++;- var removeUnloader2 = unload(unloader2);-- function unloader3() unloadCalled++;- unload(unloader3);-- // remove unloader2- removeUnloader2();-- loader.unload();- test.assertEqual(- unloadCalled, 2, "Unloader functions are called on unload.");-};--exports.testUnloadingWindow = function(test) {- var loader = test.makeSandboxedLoader();- var {unload} = loader.require("unload+");- var windowUtils = loader.require("window-utils");- var unloadCalled = 0;- var finished = false;- var myWindow;-- var delegate = {- onTrack: function(window) {- if (window == myWindow) {- test.pass("onTrack() called with our test window");-- function unloader() {- unloadCalled++;- }- unload(unloader, window);- unload(unloader);-- timer.setTimeout(function() {- window.close();-- test.assertEqual(- unloadCalled, 0, "no unloaders called.");-- if (window.closed) {- test.pass("window closed");- } else {- test.fail("window is not closed!");- }-- timer.setTimeout(function() {- test.assertEqual(- unloadCalled, 0, "zero unloaders called.");-- loader.unload();-- test.assertEqual(- unloadCalled, 1, "one unloaders called.");-- if (finished) {- test.pass("finished");- test.done();- } else {- test.fail("not finished!");- }- }, 1);- }, 1);- }- },- onUntrack: function(window) {- if (window == myWindow) {- test.pass("onUntrack() called with our test window");-- if (!finished) {- finished = true;- myWindow = null;- wt.unload();- } else {- test.fail("finishTest() called multiple times.");- }- }- }- };-- var wt = new windowUtils.WindowTracker(delegate);- myWindow = makeEmptyWindow();- test.waitUntilDone(5000);-}