summaryrefslogtreecommitdiff
path: root/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@gnu.org>2015-11-28 15:24:36 -0600
committerRuben Rodriguez <ruben@gnu.org>2015-11-28 16:27:06 -0600
commite4a3586a14996bbece3b26c9e3b7704ea6af8615 (patch)
tree499bdd16b3a90c30b01e4b47a5882d13b4800f50 /data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom
parent4dbc2fae927bb02ef243c87938e638af9afee8fa (diff)
LibreJS upgraded to 6.0.10
Diffstat (limited to 'data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom')
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/addon.js80
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/manager.js15
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/provider.js52
3 files changed, 147 insertions, 0 deletions
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/addon.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/addon.js
new file mode 100644
index 0000000..815f8ed
--- /dev/null
+++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/addon.js
@@ -0,0 +1,80 @@
+/* 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 {Cc, Ci, Cu} = require("chrome");
+const {AddonManager, AddonAuthor} = require("../utils/addonmanager");
+const DO_NOTHING = function(){};
+
+// https://developer.mozilla.org/en/Addons/Add-on_Manager/Addon
+function Addon(options) {
+
+ this.appDisabled = !!options.appDisabled || false;
+ this.blocklistState = (options.blocked) ? 2 : 0;
+ if (options.creator) {
+ this.creator = new AddonAuthor(options.creator.name);
+ }
+ this.id = options.id;
+ if (typeof options.isActive != "undefined") this.isActive = !!options.isActive;
+ if (typeof options.isCompatible != "undefined") this.isCompatible = !!options.isCompatible;
+ if (typeof options.isPlatformCompatible != "undefined") this.isPlatformCompatible = !!options.isPlatformCompatible;
+ this.name = options.name || "";
+ //this.pendingOperations =
+ this.description = options.description || "";
+ if (options.iconURL) this.iconURL = options.iconURL;
+
+ // METHODS
+ this.uninstall = function() {
+ options.uninstall && options.uninstall();
+ };
+ this.cancelUninstall = function() {
+ options.cancelUninstall && options.cancelUninstall();
+ };
+
+ if (options.getResourceURI) {
+ this.getResourceURI = function(aPath) {
+ return options.getResourceURI(aPath);
+ };
+ this.getXPI = function() {
+ return options.getResourceURI("").QueryInterface(Ci.nsIFileURL).file;
+ }
+ }
+
+ return this;
+};
+
+Addon.prototype = {
+ // req'd
+ appDisabled: false,
+ blocklistState: 0,
+ creator: null,
+ id: null,
+ isActive: true,
+ isCompatible: true,
+ isPlatformCompatible: true,
+ name: null,
+ pendingOperations: AddonManager.PENDING_NONE,
+ permissions: AddonManager.PERM_CAN_UNINSTALL,
+ providesUpdatesSecurely: false,
+ scope: AddonManager.SCOPE_PROFILE,
+ type: null,
+ userDisabled: false,
+ version: null,
+
+ //not reqd
+ applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE,
+ contributors: [],
+ description: "",
+ translators: [],
+ sourceURI: null,
+
+
+ // METHODS
+ uninstall: DO_NOTHING,
+ findUpdates: DO_NOTHING,
+ cancelUninstall: DO_NOTHING,
+ hasResource: DO_NOTHING
+};
+
+exports.Addon = Addon;
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/manager.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/manager.js
new file mode 100644
index 0000000..cc9388e
--- /dev/null
+++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/manager.js
@@ -0,0 +1,15 @@
+/* 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 {AddonManager, AddonManagerPrivate} = require("../utils/addonmanager");
+const Addon = require("addon").Addon;
+
+exports.getAddonByID = exports.getAddonById = function(aID, aCallback) {
+ // get the addon obj
+ AddonManager.getAddonByID(aID, function (addon) {
+ // return a wrapped addon
+ aCallback(new Addon(addon));
+ });
+};
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/provider.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/provider.js
new file mode 100644
index 0000000..681dcd9
--- /dev/null
+++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/aom/provider.js
@@ -0,0 +1,52 @@
+/* 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 unload = require("sdk/system/unload").when;
+
+const {AddonManager, AddonManagerPrivate, AddonType} = require("../utils/addonmanager");
+
+var defaultUIPriority = 6001; // this increases when it is used
+
+exports.AddonProvider = function(options) {
+ var types = null;
+
+ // AddonManagerPrivate.AddonType DNE in Gecko (FF) < 6
+ if (AddonType) {
+ types = [new AddonType(
+ options.type, // TODO: RANDOMIZE?
+ null,
+ options.localeKey,
+ AddonManager.VIEW_TYPE_LIST,
+ options.uiPriority || defaultUIPriority++)];
+ }
+
+ var provider = {
+ getAddonByID: function(aId, aCallback) {
+ aCallback(options.getAddonByID(aId));
+ },
+
+ getAddonsByTypes: function(aTypes, aCallback) {
+ if (aTypes && aTypes.indexOf(options.type) < 0) {
+ // not the right type, return nothing
+ aCallback([]);
+ }
+ else {
+ // the right type, return all addons
+ aCallback(options.getAddons());
+ }
+ },
+
+ getInstallsByTypes: function(aTypes, aCallback) {
+ aCallback([]);
+ }
+ };
+ AddonManagerPrivate.registerProvider(provider, types);
+
+ unload(function() {
+ AddonManagerPrivate.unregisterProvider(provider);
+ });
+
+ return this;
+};