summaryrefslogtreecommitdiffstats
path: root/application/basilisk/components/extensions
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-02 05:06:10 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-02 05:06:10 -0500
commit6d614170cbfa958564eb5f824234ad5a9e484344 (patch)
tree3e1eb384382f30987cb2e64bd654afa8b74fd06b /application/basilisk/components/extensions
parent2a6b605d64b19411a300efdbbd7f78c349f90206 (diff)
downloadUXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.gz
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.lz
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.xz
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.zip
Revert "Add Basilisk"
This reverts commit e72ef92b5bdc43cd2584198e2e54e951b70299e8.
Diffstat (limited to 'application/basilisk/components/extensions')
-rw-r--r--application/basilisk/components/extensions/.eslintrc.js23
-rw-r--r--application/basilisk/components/extensions/ext-bookmarks.js374
-rw-r--r--application/basilisk/components/extensions/ext-browserAction.js545
-rw-r--r--application/basilisk/components/extensions/ext-browsingData.js237
-rw-r--r--application/basilisk/components/extensions/ext-c-contextMenus.js158
-rw-r--r--application/basilisk/components/extensions/ext-c-devtools-inspectedWindow.js22
-rw-r--r--application/basilisk/components/extensions/ext-c-omnibox.js32
-rw-r--r--application/basilisk/components/extensions/ext-c-tabs.js35
-rw-r--r--application/basilisk/components/extensions/ext-commands.js264
-rw-r--r--application/basilisk/components/extensions/ext-contextMenus.js640
-rw-r--r--application/basilisk/components/extensions/ext-desktop-runtime.js26
-rw-r--r--application/basilisk/components/extensions/ext-devtools.js312
-rw-r--r--application/basilisk/components/extensions/ext-history.js246
-rw-r--r--application/basilisk/components/extensions/ext-omnibox.js104
-rw-r--r--application/basilisk/components/extensions/ext-pageAction.js310
-rw-r--r--application/basilisk/components/extensions/ext-sessions.js107
-rw-r--r--application/basilisk/components/extensions/ext-tabs.js1105
-rw-r--r--application/basilisk/components/extensions/ext-theme.js19
-rw-r--r--application/basilisk/components/extensions/ext-utils.js1296
-rw-r--r--application/basilisk/components/extensions/ext-windows.js232
-rw-r--r--application/basilisk/components/extensions/extension-mac-panel.css3
-rw-r--r--application/basilisk/components/extensions/extension-mac.css11
-rw-r--r--application/basilisk/components/extensions/extension-win-panel.css7
-rw-r--r--application/basilisk/components/extensions/extension.css572
-rw-r--r--application/basilisk/components/extensions/extension.svg19
-rw-r--r--application/basilisk/components/extensions/extensions-browser.manifest41
-rw-r--r--application/basilisk/components/extensions/jar.mn33
-rw-r--r--application/basilisk/components/extensions/moz.build13
-rw-r--r--application/basilisk/components/extensions/schemas/LICENSE27
-rw-r--r--application/basilisk/components/extensions/schemas/bookmarks.json568
-rw-r--r--application/basilisk/components/extensions/schemas/browser_action.json430
-rw-r--r--application/basilisk/components/extensions/schemas/browsing_data.json413
-rw-r--r--application/basilisk/components/extensions/schemas/commands.json152
-rw-r--r--application/basilisk/components/extensions/schemas/context_menus.json424
-rw-r--r--application/basilisk/components/extensions/schemas/context_menus_internal.json78
-rw-r--r--application/basilisk/components/extensions/schemas/devtools.json16
-rw-r--r--application/basilisk/components/extensions/schemas/devtools_inspected_window.json273
-rw-r--r--application/basilisk/components/extensions/schemas/history.json316
-rw-r--r--application/basilisk/components/extensions/schemas/jar.mn20
-rw-r--r--application/basilisk/components/extensions/schemas/moz.build7
-rw-r--r--application/basilisk/components/extensions/schemas/omnibox.json248
-rw-r--r--application/basilisk/components/extensions/schemas/page_action.json234
-rw-r--r--application/basilisk/components/extensions/schemas/sessions.json145
-rw-r--r--application/basilisk/components/extensions/schemas/tabs.json1295
-rw-r--r--application/basilisk/components/extensions/schemas/theme.json24
-rw-r--r--application/basilisk/components/extensions/schemas/windows.json506
46 files changed, 0 insertions, 11962 deletions
diff --git a/application/basilisk/components/extensions/.eslintrc.js b/application/basilisk/components/extensions/.eslintrc.js
deleted file mode 100644
index d6dc0a489..000000000
--- a/application/basilisk/components/extensions/.eslintrc.js
+++ /dev/null
@@ -1,23 +0,0 @@
-"use strict";
-
-module.exports = { // eslint-disable-line no-undef
- "extends": "../../../toolkit/components/extensions/.eslintrc.js",
-
- "globals": {
- "AllWindowEvents": true,
- "browserActionFor": true,
- "currentWindow": true,
- "EventEmitter": true,
- "getBrowserInfo": true,
- "getCookieStoreIdForTab": true,
- "IconDetails": true,
- "makeWidgetId": true,
- "pageActionFor": true,
- "PanelPopup": true,
- "TabContext": true,
- "ViewPopup": true,
- "WindowEventManager": true,
- "WindowListManager": true,
- "WindowManager": true,
- },
-};
diff --git a/application/basilisk/components/extensions/ext-bookmarks.js b/application/basilisk/components/extensions/ext-bookmarks.js
deleted file mode 100644
index 399f6212d..000000000
--- a/application/basilisk/components/extensions/ext-bookmarks.js
+++ /dev/null
@@ -1,374 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-const {
- SingletonEventManager,
-} = ExtensionUtils;
-
-XPCOMUtils.defineLazyModuleGetter(this, "EventEmitter",
- "resource://devtools/shared/event-emitter.js");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-
-let listenerCount = 0;
-
-function getTree(rootGuid, onlyChildren) {
- function convert(node, parent) {
- let treenode = {
- id: node.guid,
- title: node.title || "",
- index: node.index,
- dateAdded: node.dateAdded / 1000,
- };
-
- if (parent && node.guid != PlacesUtils.bookmarks.rootGuid) {
- treenode.parentId = parent.guid;
- }
-
- if (node.type == PlacesUtils.TYPE_X_MOZ_PLACE) {
- // This isn't quite correct. Recently Bookmarked ends up here ...
- treenode.url = node.uri;
- } else {
- treenode.dateGroupModified = node.lastModified / 1000;
-
- if (node.children && !onlyChildren) {
- treenode.children = node.children.map(child => convert(child, node));
- }
- }
-
- return treenode;
- }
-
- return PlacesUtils.promiseBookmarksTree(rootGuid, {
- excludeItemsCallback: item => {
- if (item.type == PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR) {
- return true;
- }
- return item.annos &&
- item.annos.find(a => a.name == PlacesUtils.EXCLUDE_FROM_BACKUP_ANNO);
- },
- }).then(root => {
- if (onlyChildren) {
- let children = root.children || [];
- return children.map(child => convert(child, root));
- }
- // It seems like the array always just contains the root node.
- return [convert(root, null)];
- }).catch(e => Promise.reject({message: e.message}));
-}
-
-function convert(result) {
- let node = {
- id: result.guid,
- title: result.title || "",
- index: result.index,
- dateAdded: result.dateAdded.getTime(),
- };
-
- if (result.guid != PlacesUtils.bookmarks.rootGuid) {
- node.parentId = result.parentGuid;
- }
-
- if (result.type == PlacesUtils.bookmarks.TYPE_BOOKMARK) {
- node.url = result.url.href; // Output is always URL object.
- } else {
- node.dateGroupModified = result.lastModified.getTime();
- }
-
- return node;
-}
-
-let observer = {
- skipTags: true,
- skipDescendantsOnItemRemoval: true,
-
- onBeginUpdateBatch() {},
- onEndUpdateBatch() {},
-
- onItemAdded(id, parentId, index, itemType, uri, title, dateAdded, guid, parentGuid, source) {
- if (itemType == PlacesUtils.bookmarks.TYPE_SEPARATOR) {
- return;
- }
-
- let bookmark = {
- id: guid,
- parentId: parentGuid,
- index,
- title,
- dateAdded: dateAdded / 1000,
- };
-
- if (itemType == PlacesUtils.bookmarks.TYPE_BOOKMARK) {
- bookmark.url = uri.spec;
- } else {
- bookmark.dateGroupModified = bookmark.dateAdded;
- }
-
- this.emit("created", bookmark);
- },
-
- onItemVisited() {},
-
- onItemMoved(id, oldParentId, oldIndex, newParentId, newIndex, itemType, guid, oldParentGuid, newParentGuid, source) {
- if (itemType == PlacesUtils.bookmarks.TYPE_SEPARATOR) {
- return;
- }
-
- let info = {
- parentId: newParentGuid,
- index: newIndex,
- oldParentId: oldParentGuid,
- oldIndex,
- };
- this.emit("moved", {guid, info});
- },
-
- onItemRemoved(id, parentId, index, itemType, uri, guid, parentGuid, source) {
- if (itemType == PlacesUtils.bookmarks.TYPE_SEPARATOR) {
- return;
- }
-
- let node = {
- id: guid,
- parentId: parentGuid,
- index,
- };
-
- if (itemType == PlacesUtils.bookmarks.TYPE_BOOKMARK) {
- node.url = uri.spec;
- }
-
- this.emit("removed", {guid, info: {parentId: parentGuid, index, node}});
- },
-
- onItemChanged(id, prop, isAnno, val, lastMod, itemType, parentId, guid, parentGuid, oldVal, source) {
- if (itemType == PlacesUtils.bookmarks.TYPE_SEPARATOR) {
- return;
- }
-
- let info = {};
- if (prop == "title") {
- info.title = val;
- } else if (prop == "uri") {
- info.url = val;
- } else {
- // Not defined yet.
- return;
- }
-
- this.emit("changed", {guid, info});
- },
-};
-EventEmitter.decorate(observer);
-
-function decrementListeners() {
- listenerCount -= 1;
- if (!listenerCount) {
- PlacesUtils.bookmarks.removeObserver(observer);
- }
-}
-
-function incrementListeners() {
- listenerCount++;
- if (listenerCount == 1) {
- PlacesUtils.bookmarks.addObserver(observer, false);
- }
-}
-
-extensions.registerSchemaAPI("bookmarks", "addon_parent", context => {
- return {
- bookmarks: {
- get: function(idOrIdList) {
- let list = Array.isArray(idOrIdList) ? idOrIdList : [idOrIdList];
-
- return Task.spawn(function* () {
- let bookmarks = [];
- for (let id of list) {
- let bookmark = yield PlacesUtils.bookmarks.fetch({guid: id});
- if (!bookmark) {
- throw new Error("Bookmark not found");
- }
- bookmarks.push(convert(bookmark));
- }
- return bookmarks;
- }).catch(error => Promise.reject({message: error.message}));
- },
-
- getChildren: function(id) {
- // TODO: We should optimize this.
- return getTree(id, true);
- },
-
- getTree: function() {
- return getTree(PlacesUtils.bookmarks.rootGuid, false);
- },
-
- getSubTree: function(id) {
- return getTree(id, false);
- },
-
- search: function(query) {
- return PlacesUtils.bookmarks.search(query).then(result => result.map(convert));
- },
-
- getRecent: function(numberOfItems) {
- return PlacesUtils.bookmarks.getRecent(numberOfItems).then(result => result.map(convert));
- },
-
- create: function(bookmark) {
- let info = {
- title: bookmark.title || "",
- };
-
- // If url is NULL or missing, it will be a folder.
- if (bookmark.url !== null) {
- info.type = PlacesUtils.bookmarks.TYPE_BOOKMARK;
- info.url = bookmark.url || "";
- } else {
- info.type = PlacesUtils.bookmarks.TYPE_FOLDER;
- }
-
- if (bookmark.index !== null) {
- info.index = bookmark.index;
- }
-
- if (bookmark.parentId !== null) {
- info.parentGuid = bookmark.parentId;
- } else {
- info.parentGuid = PlacesUtils.bookmarks.unfiledGuid;
- }
-
- try {
- return PlacesUtils.bookmarks.insert(info).then(convert)
- .catch(error => Promise.reject({message: error.message}));
- } catch (e) {
- return Promise.reject({message: `Invalid bookmark: ${JSON.stringify(info)}`});
- }
- },
-
- move: function(id, destination) {
- let info = {
- guid: id,
- };
-
- if (destination.parentId !== null) {
- info.parentGuid = destination.parentId;
- }
- info.index = (destination.index === null) ?
- PlacesUtils.bookmarks.DEFAULT_INDEX : destination.index;
-
- try {
- return PlacesUtils.bookmarks.update(info).then(convert)
- .catch(error => Promise.reject({message: error.message}));
- } catch (e) {
- return Promise.reject({message: `Invalid bookmark: ${JSON.stringify(info)}`});
- }
- },
-
- update: function(id, changes) {
- let info = {
- guid: id,
- };
-
- if (changes.title !== null) {
- info.title = changes.title;
- }
- if (changes.url !== null) {
- info.url = changes.url;
- }
-
- try {
- return PlacesUtils.bookmarks.update(info).then(convert)
- .catch(error => Promise.reject({message: error.message}));
- } catch (e) {
- return Promise.reject({message: `Invalid bookmark: ${JSON.stringify(info)}`});
- }
- },
-
- remove: function(id) {
- let info = {
- guid: id,
- };
-
- // The API doesn't give you the old bookmark at the moment
- try {
- return PlacesUtils.bookmarks.remove(info, {preventRemovalOfNonEmptyFolders: true}).then(result => {})
- .catch(error => Promise.reject({message: error.message}));
- } catch (e) {
- return Promise.reject({message: `Invalid bookmark: ${JSON.stringify(info)}`});
- }
- },
-
- removeTree: function(id) {
- let info = {
- guid: id,
- };
-
- try {
- return PlacesUtils.bookmarks.remove(info).then(result => {})
- .catch(error => Promise.reject({message: error.message}));
- } catch (e) {
- return Promise.reject({message: `Invalid bookmark: ${JSON.stringify(info)}`});
- }
- },
-
- onCreated: new SingletonEventManager(context, "bookmarks.onCreated", fire => {
- let listener = (event, bookmark) => {
- context.runSafe(fire, bookmark.id, bookmark);
- };
-
- observer.on("created", listener);
- incrementListeners();
- return () => {
- observer.off("created", listener);
- decrementListeners();
- };
- }).api(),
-
- onRemoved: new SingletonEventManager(context, "bookmarks.onRemoved", fire => {
- let listener = (event, data) => {
- context.runSafe(fire, data.guid, data.info);
- };
-
- observer.on("removed", listener);
- incrementListeners();
- return () => {
- observer.off("removed", listener);
- decrementListeners();
- };
- }).api(),
-
- onChanged: new SingletonEventManager(context, "bookmarks.onChanged", fire => {
- let listener = (event, data) => {
- context.runSafe(fire, data.guid, data.info);
- };
-
- observer.on("changed", listener);
- incrementListeners();
- return () => {
- observer.off("changed", listener);
- decrementListeners();
- };
- }).api(),
-
- onMoved: new SingletonEventManager(context, "bookmarks.onMoved", fire => {
- let listener = (event, data) => {
- context.runSafe(fire, data.guid, data.info);
- };
-
- observer.on("moved", listener);
- incrementListeners();
- return () => {
- observer.off("moved", listener);
- decrementListeners();
- };
- }).api(),
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-browserAction.js b/application/basilisk/components/extensions/ext-browserAction.js
deleted file mode 100644
index b24678830..000000000
--- a/application/basilisk/components/extensions/ext-browserAction.js
+++ /dev/null
@@ -1,545 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
- "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "clearTimeout",
- "resource://gre/modules/Timer.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
- "resource://gre/modules/Timer.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "DOMUtils",
- "@mozilla.org/inspector/dom-utils;1",
- "inIDOMUtils");
-
-Cu.import("resource://devtools/shared/event-emitter.js");
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
-
-var {
- EventManager,
- IconDetails,
-} = ExtensionUtils;
-
-const POPUP_PRELOAD_TIMEOUT_MS = 200;
-
-const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-
-function isAncestorOrSelf(target, node) {
- for (; node; node = node.parentNode) {
- if (node === target) {
- return true;
- }
- }
- return false;
-}
-
-// WeakMap[Extension -> BrowserAction]
-var browserActionMap = new WeakMap();
-
-// Responsible for the browser_action section of the manifest as well
-// as the associated popup.
-function BrowserAction(options, extension) {
- this.extension = extension;
-
- let widgetId = makeWidgetId(extension.id);
- this.id = `${widgetId}-browser-action`;
- this.viewId = `PanelUI-webext-${widgetId}-browser-action-view`;
- this.widget = null;
-
- this.pendingPopup = null;
- this.pendingPopupTimeout = null;
-
- this.tabManager = TabManager.for(extension);
-
- this.defaults = {
- enabled: true,
- title: options.default_title || extension.name,
- badgeText: "",
- badgeBackgroundColor: null,
- icon: IconDetails.normalize({path: options.default_icon}, extension),
- popup: options.default_popup || "",
- };
-
- this.browserStyle = options.browser_style || false;
- if (options.browser_style === null) {
- this.extension.logger.warn("Please specify whether you want browser_style " +
- "or not in your browser_action options.");
- }
-
- this.tabContext = new TabContext(tab => Object.create(this.defaults),
- extension);
-
- EventEmitter.decorate(this);
-}
-
-BrowserAction.prototype = {
- build() {
- let widget = CustomizableUI.createWidget({
- id: this.id,
- viewId: this.viewId,
- type: "view",
- removable: true,
- label: this.defaults.title || this.extension.name,
- tooltiptext: this.defaults.title || "",
- defaultArea: CustomizableUI.AREA_NAVBAR,
-
- onBeforeCreated: document => {
- let view = document.createElementNS(XUL_NS, "panelview");
- view.id = this.viewId;
- view.setAttribute("flex", "1");
-
- document.getElementById("PanelUI-multiView").appendChild(view);
- document.addEventListener("popupshowing", this);
- },
-
- onDestroyed: document => {
- let view = document.getElementById(this.viewId);
- if (view) {
- this.clearPopup();
- CustomizableUI.hidePanelForNode(view);
- view.remove();
- }
- document.removeEventListener("popupshowing", this);
- },
-
- onCreated: node => {
- node.classList.add("badged-button");
- node.classList.add("webextension-browser-action");
- node.setAttribute("constrain-size", "true");
-
- node.onmousedown = event => this.handleEvent(event);
-
- this.updateButton(node, this.defaults);
- },
-
- onViewShowing: event => {
- let document = event.target.ownerDocument;
- let tabbrowser = document.defaultView.gBrowser;
-
- let tab = tabbrowser.selectedTab;
- let popupURL = this.getProperty(tab, "popup");
- this.tabManager.addActiveTabPermission(tab);
-
- // Popups are shown only if a popup URL is defined; otherwise
- // a "click" event is dispatched. This is done for compatibility with the
- // Google Chrome onClicked extension API.
- if (popupURL) {
- try {
- let popup = this.getPopup(document.defaultView, popupURL);
- event.detail.addBlocker(popup.attach(event.target));
- } catch (e) {
- Cu.reportError(e);
- event.preventDefault();
- }
- } else {
- // This isn't not a hack, but it seems to provide the correct behavior
- // with the fewest complications.
- event.preventDefault();
- this.emit("click");
- }
- },
- });
-
- this.tabContext.on("tab-select", // eslint-disable-line mozilla/balanced-listeners
- (evt, tab) => { this.updateWindow(tab.ownerGlobal); });
-
- this.widget = widget;
- },
-
- /**
- * Triggers this browser action for the given window, with the same effects as
- * if it were clicked by a user.
- *
- * This has no effect if the browser action is disabled for, or not
- * present in, the given window.
- */
- triggerAction: Task.async(function* (window) {
- let popup = ViewPopup.for(this.extension, window);
- if (popup) {
- popup.closePopup();
- return;
- }
-
- let widget = this.widget.forWindow(window);
- let tab = window.gBrowser.selectedTab;
-
- if (!widget || !this.getProperty(tab, "enabled")) {
- return;
- }
-
- // Popups are shown only if a popup URL is defined; otherwise
- // a "click" event is dispatched. This is done for compatibility with the
- // Google Chrome onClicked extension API.
- if (this.getProperty(tab, "popup")) {
- if (this.widget.areaType == CustomizableUI.TYPE_MENU_PANEL) {
- yield window.PanelUI.show();
- }
-
- let event = new window.CustomEvent("command", {bubbles: true, cancelable: true});
- widget.node.dispatchEvent(event);
- } else {
- this.emit("click");
- }
- }),
-
- handleEvent(event) {
- let button = event.target;
- let window = button.ownerDocument.defaultView;
-
- switch (event.type) {
- case "mousedown":
- if (event.button == 0) {
- // Begin pre-loading the browser for the popup, so it's more likely to
- // be ready by the time we get a complete click.
- let tab = window.gBrowser.selectedTab;
- let popupURL = this.getProperty(tab, "popup");
- let enabled = this.getProperty(tab, "enabled");
-
- if (popupURL && enabled) {
- // Add permission for the active tab so it will exist for the popup.
- // Store the tab to revoke the permission during clearPopup.
- if (!this.pendingPopup && !this.tabManager.hasActiveTabPermission(tab)) {
- this.tabManager.addActiveTabPermission(tab);
- this.tabToRevokeDuringClearPopup = tab;
- }
-
- this.pendingPopup = this.getPopup(window, popupURL);
- window.addEventListener("mouseup", this, true);
- } else {
- this.clearPopup();
- }
- }
- break;
-
- case "mouseup":
- if (event.button == 0) {
- this.clearPopupTimeout();
- // If we have a pending pre-loaded popup, cancel it after we've waited
- // long enough that we can be relatively certain it won't be opening.
- if (this.pendingPopup) {
- let {node} = this.widget.forWindow(window);
- if (isAncestorOrSelf(node, event.originalTarget)) {
- this.pendingPopupTimeout = setTimeout(() => this.clearPopup(),
- POPUP_PRELOAD_TIMEOUT_MS);
- } else {
- this.clearPopup();
- }
- }
- }
- break;
-
- case "popupshowing":
- const menu = event.target;
- const trigger = menu.triggerNode;
- const node = window.document.getElementById(this.id);
- const contexts = ["toolbar-context-menu", "customizationPanelItemContextMenu"];
-
- if (contexts.includes(menu.id) && node && isAncestorOrSelf(node, trigger)) {
- global.actionContextMenu({
- extension: this.extension,
- onBrowserAction: true,
- menu: menu,
- });
- }
- break;
- }
- },
-
- /**
- * Returns a potentially pre-loaded popup for the given URL in the given
- * window. If a matching pre-load popup already exists, returns that.
- * Otherwise, initializes a new one.
- *
- * If a pre-load popup exists which does not match, it is destroyed before a
- * new one is created.
- *
- * @param {Window} window
- * The browser window in which to create the popup.
- * @param {string} popupURL
- * The URL to load into the popup.
- * @returns {ViewPopup}
- */
- getPopup(window, popupURL) {
- this.clearPopupTimeout();
- let {pendingPopup} = this;
- this.pendingPopup = null;
-
- if (pendingPopup) {
- if (pendingPopup.window === window && pendingPopup.popupURL === popupURL) {
- return pendingPopup;
- }
- pendingPopup.destroy();
- }
-
- let fixedWidth = this.widget.areaType == CustomizableUI.TYPE_MENU_PANEL;
- return new ViewPopup(this.extension, window, popupURL, this.browserStyle, fixedWidth);
- },
-
- /**
- * Clears any pending pre-loaded popup and related timeouts.
- */
- clearPopup() {
- this.clearPopupTimeout();
- if (this.pendingPopup) {
- if (this.tabToRevokeDuringClearPopup) {
- this.tabManager.revokeActiveTabPermission(this.tabToRevokeDuringClearPopup);
- this.tabToRevokeDuringClearPopup = null;
- }
- this.pendingPopup.destroy();
- this.pendingPopup = null;
- }
- },
-
- /**
- * Clears any pending timeouts to clear stale, pre-loaded popups.
- */
- clearPopupTimeout() {
- if (this.pendingPopup) {
- this.pendingPopup.window.removeEventListener("mouseup", this, true);
- }
-
- if (this.pendingPopupTimeout) {
- clearTimeout(this.pendingPopupTimeout);
- this.pendingPopupTimeout = null;
- }
- },
-
- // Update the toolbar button |node| with the tab context data
- // in |tabData|.
- updateButton(node, tabData) {
- let title = tabData.title || this.extension.name;
- node.setAttribute("tooltiptext", title);
- node.setAttribute("label", title);
-
- if (tabData.badgeText) {
- node.setAttribute("badge", tabData.badgeText);
- } else {
- node.removeAttribute("badge");
- }
-
- if (tabData.enabled) {
- node.removeAttribute("disabled");
- } else {
- node.setAttribute("disabled", "true");
- }
-
- let badgeNode = node.ownerDocument.getAnonymousElementByAttribute(node,
- "class", "toolbarbutton-badge");
- if (badgeNode) {
- let color = tabData.badgeBackgroundColor;
- if (color) {
- color = `rgba(${color[0]}, ${color[1]}, ${color[2]}, ${color[3] / 255})`;
- }
- badgeNode.style.backgroundColor = color || "";
- }
-
- const LEGACY_CLASS = "toolbarbutton-legacy-addon";
- node.classList.remove(LEGACY_CLASS);
-
- let baseSize = 16;
- let {icon, size} = IconDetails.getPreferredIcon(tabData.icon, this.extension, baseSize);
-
- // If the best available icon size is not divisible by 16, check if we have
- // an 18px icon to fall back to, and trim off the padding instead.
- if (size % 16 && !icon.endsWith(".svg")) {
- let result = IconDetails.getPreferredIcon(tabData.icon, this.extension, 18);
-
- if (result.size % 18 == 0) {
- baseSize = 18;
- icon = result.icon;
- node.classList.add(LEGACY_CLASS);
- }
- }
-
- // These URLs should already be properly escaped, but make doubly sure CSS
- // string escape characters are escaped here, since they could lead to a
- // sandbox break.
- let escape = str => str.replace(/[\\\s"]/g, encodeURIComponent);
-
- let getIcon = size => escape(IconDetails.getPreferredIcon(tabData.icon, this.extension, size).icon);
-
- node.setAttribute("style", `
- --webextension-menupanel-image: url("${getIcon(32)}");
- --webextension-menupanel-image-2x: url("${getIcon(64)}");
- --webextension-toolbar-image: url("${escape(icon)}");
- --webextension-toolbar-image-2x: url("${getIcon(baseSize * 2)}");
- `);
- },
-
- // Update the toolbar button for a given window.
- updateWindow(window) {
- let widget = this.widget.forWindow(window);
- if (widget) {
- let tab = window.gBrowser.selectedTab;
- this.updateButton(widget.node, this.tabContext.get(tab));
- }
- },
-
- // Update the toolbar button when the extension changes the icon,
- // title, badge, etc. If it only changes a parameter for a single
- // tab, |tab| will be that tab. Otherwise it will be null.
- updateOnChange(tab) {
- if (tab) {
- if (tab.selected) {
- this.updateWindow(tab.ownerGlobal);
- }
- } else {
- for (let window of WindowListManager.browserWindows()) {
- this.updateWindow(window);
- }
- }
- },
-
- // tab is allowed to be null.
- // prop should be one of "icon", "title", "badgeText", "popup", or "badgeBackgroundColor".
- setProperty(tab, prop, value) {
- if (tab == null) {
- this.defaults[prop] = value;
- } else if (value != null) {
- this.tabContext.get(tab)[prop] = value;
- } else {
- delete this.tabContext.get(tab)[prop];
- }
-
- this.updateOnChange(tab);
- },
-
- // tab is allowed to be null.
- // prop should be one of "title", "badgeText", "popup", or "badgeBackgroundColor".
- getProperty(tab, prop) {
- if (tab == null) {
- return this.defaults[prop];
- }
- return this.tabContext.get(tab)[prop];
- },
-
- shutdown() {
- this.tabContext.shutdown();
- CustomizableUI.destroyWidget(this.id);
- },
-};
-
-BrowserAction.for = (extension) => {
- return browserActionMap.get(extension);
-};
-
-global.browserActionFor = BrowserAction.for;
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("manifest_browser_action", (type, directive, extension, manifest) => {
- let browserAction = new BrowserAction(manifest.browser_action, extension);
- browserAction.build();
- browserActionMap.set(extension, browserAction);
-});
-
-extensions.on("shutdown", (type, extension) => {
- if (browserActionMap.has(extension)) {
- browserActionMap.get(extension).shutdown();
- browserActionMap.delete(extension);
- }
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-extensions.registerSchemaAPI("browserAction", "addon_parent", context => {
- let {extension} = context;
- return {
- browserAction: {
- onClicked: new EventManager(context, "browserAction.onClicked", fire => {
- let listener = () => {
- let tab = TabManager.activeTab;
- fire(TabManager.convert(extension, tab));
- };
- BrowserAction.for(extension).on("click", listener);
- return () => {
- BrowserAction.for(extension).off("click", listener);
- };
- }).api(),
-
- enable: function(tabId) {
- let tab = tabId !== null ? TabManager.getTab(tabId, context) : null;
- BrowserAction.for(extension).setProperty(tab, "enabled", true);
- },
-
- disable: function(tabId) {
- let tab = tabId !== null ? TabManager.getTab(tabId, context) : null;
- BrowserAction.for(extension).setProperty(tab, "enabled", false);
- },
-
- setTitle: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- let title = details.title;
- // Clear the tab-specific title when given a null string.
- if (tab && title == "") {
- title = null;
- }
- BrowserAction.for(extension).setProperty(tab, "title", title);
- },
-
- getTitle: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- let title = BrowserAction.for(extension).getProperty(tab, "title");
- return Promise.resolve(title);
- },
-
- setIcon: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- let icon = IconDetails.normalize(details, extension, context);
- BrowserAction.for(extension).setProperty(tab, "icon", icon);
- },
-
- setBadgeText: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- BrowserAction.for(extension).setProperty(tab, "badgeText", details.text);
- },
-
- getBadgeText: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- let text = BrowserAction.for(extension).getProperty(tab, "badgeText");
- return Promise.resolve(text);
- },
-
- setPopup: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- // Note: Chrome resolves arguments to setIcon relative to the calling
- // context, but resolves arguments to setPopup relative to the extension
- // root.
- // For internal consistency, we currently resolve both relative to the
- // calling context.
- let url = details.popup && context.uri.resolve(details.popup);
- BrowserAction.for(extension).setProperty(tab, "popup", url);
- },
-
- getPopup: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- let popup = BrowserAction.for(extension).getProperty(tab, "popup");
- return Promise.resolve(popup);
- },
-
- setBadgeBackgroundColor: function(details) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
- let color = details.color;
- if (!Array.isArray(color)) {
- let col = DOMUtils.colorToRGBA(color);
- color = col && [col.r, col.g, col.b, Math.round(col.a * 255)];
- }
- BrowserAction.for(extension).setProperty(tab, "badgeBackgroundColor", color);
- },
-
- getBadgeBackgroundColor: function(details, callback) {
- let tab = details.tabId !== null ? TabManager.getTab(details.tabId, context) : null;
-
- let color = BrowserAction.for(extension).getProperty(tab, "badgeBackgroundColor");
- return Promise.resolve(color || [0xd9, 0, 0, 255]);
- },
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-browsingData.js b/application/basilisk/components/extensions/ext-browsingData.js
deleted file mode 100644
index a927b4268..000000000
--- a/application/basilisk/components/extensions/ext-browsingData.js
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/Task.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
- "resource://gre/modules/Preferences.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Sanitizer",
- "resource:///modules/Sanitizer.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Services",
- "resource://gre/modules/Services.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
- "resource://gre/modules/Timer.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "serviceWorkerManager",
- "@mozilla.org/serviceworkers/manager;1",
- "nsIServiceWorkerManager");
-
-/**
-* A number of iterations after which to yield time back
-* to the system.
-*/
-const YIELD_PERIOD = 10;
-
-const PREF_DOMAIN = "privacy.cpd.";
-
-XPCOMUtils.defineLazyGetter(this, "sanitizer", () => {
- let sanitizer = new Sanitizer();
- sanitizer.prefDomain = PREF_DOMAIN;
- return sanitizer;
-});
-
-function makeRange(options) {
- return (options.since == null) ?
- null :
- [PlacesUtils.toPRTime(options.since), PlacesUtils.toPRTime(Date.now())];
-}
-
-function clearCache() {
- // Clearing the cache does not support timestamps.
- return sanitizer.items.cache.clear();
-}
-
-let clearCookies = Task.async(function* (options) {
- let cookieMgr = Services.cookies;
- // This code has been borrowed from sanitize.js.
- let yieldCounter = 0;
-
- if (options.since) {
- // Iterate through the cookies and delete any created after our cutoff.
- let cookiesEnum = cookieMgr.enumerator;
- while (cookiesEnum.hasMoreElements()) {
- let cookie = cookiesEnum.getNext().QueryInterface(Ci.nsICookie2);
-
- if (cookie.creationTime >= PlacesUtils.toPRTime(options.since)) {
- // This cookie was created after our cutoff, clear it.
- cookieMgr.remove(cookie.host, cookie.name, cookie.path,
- false, cookie.originAttributes);
-
- if (++yieldCounter % YIELD_PERIOD == 0) {
- yield new Promise(resolve => setTimeout(resolve, 0)); // Don't block the main thread too long.
- }
- }
- }
- } else {
- // Remove everything.
- cookieMgr.removeAll();
- }
-});
-
-function clearDownloads(options) {
- return sanitizer.items.downloads.clear(makeRange(options));
-}
-
-function clearFormData(options) {
- return sanitizer.items.formdata.clear(makeRange(options));
-}
-
-function clearHistory(options) {
- return sanitizer.items.history.clear(makeRange(options));
-}
-
-let clearPasswords = Task.async(function* (options) {
- let loginManager = Services.logins;
- let yieldCounter = 0;
-
- if (options.since) {
- // Iterate through the logins and delete any updated after our cutoff.
- let logins = loginManager.getAllLogins();
- for (let login of logins) {
- login.QueryInterface(Ci.nsILoginMetaInfo);
- if (login.timePasswordChanged >= options.since) {
- loginManager.removeLogin(login);
- if (++yieldCounter % YIELD_PERIOD == 0) {
- yield new Promise(resolve => setTimeout(resolve, 0)); // Don't block the main thread too long.
- }
- }
- }
- } else {
- // Remove everything.
- loginManager.removeAllLogins();
- }
-});
-
-function clearPluginData(options) {
- return sanitizer.items.pluginData.clear(makeRange(options));
-}
-
-let clearServiceWorkers = Task.async(function* () {
- // Clearing service workers does not support timestamps.
- let yieldCounter = 0;
-
- // Iterate through the service workers and remove them.
- let serviceWorkers = serviceWorkerManager.getAllRegistrations();
- for (let i = 0; i < serviceWorkers.length; i++) {
- let sw = serviceWorkers.queryElementAt(i, Ci.nsIServiceWorkerRegistrationInfo);
- let host = sw.principal.URI.host;
- serviceWorkerManager.removeAndPropagate(host);
- if (++yieldCounter % YIELD_PERIOD == 0) {
- yield new Promise(resolve => setTimeout(resolve, 0)); // Don't block the main thread too long.
- }
- }
-});
-
-function doRemoval(options, dataToRemove, extension) {
- if (options.originTypes &&
- (options.originTypes.protectedWeb || options.originTypes.extension)) {
- return Promise.reject(
- {message: "Firefox does not support protectedWeb or extension as originTypes."});
- }
-
- let removalPromises = [];
- let invalidDataTypes = [];
- for (let dataType in dataToRemove) {
- if (dataToRemove[dataType]) {
- switch (dataType) {
- case "cache":
- removalPromises.push(clearCache());
- break;
- case "cookies":
- removalPromises.push(clearCookies(options));
- break;
- case "downloads":
- removalPromises.push(clearDownloads(options));
- break;
- case "formData":
- removalPromises.push(clearFormData(options));
- break;
- case "history":
- removalPromises.push(clearHistory(options));
- break;
- case "passwords":
- removalPromises.push(clearPasswords(options));
- break;
- case "pluginData":
- removalPromises.push(clearPluginData(options));
- break;
- case "serviceWorkers":
- removalPromises.push(clearServiceWorkers());
- break;
- default:
- invalidDataTypes.push(dataType);
- }
- }
- }
- if (extension && invalidDataTypes.length) {
- extension.logger.warn(
- `Firefox does not support dataTypes: ${invalidDataTypes.toString()}.`);
- }
- return Promise.all(removalPromises);
-}
-
-extensions.registerSchemaAPI("browsingData", "addon_parent", context => {
- let {extension} = context;
- return {
- browsingData: {
- settings() {
- const PREF_DOMAIN = "privacy.cpd.";
- // The following prefs are the only ones in Firefox that match corresponding
- // values used by Chrome when rerturning settings.
- const PREF_LIST = ["cache", "cookies", "history", "formdata", "downloads"];
-
- // since will be the start of what is returned by Sanitizer.getClearRange
- // divided by 1000 to convert to ms.
- // If Sanitizer.getClearRange returns undefined that means the range is
- // currently "Everything", so we should set since to 0.
- let clearRange = Sanitizer.getClearRange();
- let since = clearRange ? clearRange[0] / 1000 : 0;
- let options = {since};
-
- let dataToRemove = {};
- let dataRemovalPermitted = {};
-
- for (let item of PREF_LIST) {
- // The property formData needs a different case than the
- // formdata preference.
- const name = item === "formdata" ? "formData" : item;
- dataToRemove[name] = Preferences.get(`${PREF_DOMAIN}${item}`);
- // Firefox doesn't have the same concept of dataRemovalPermitted
- // as Chrome, so it will always be true.
- dataRemovalPermitted[name] = true;
- }
-
- return Promise.resolve({options, dataToRemove, dataRemovalPermitted});
- },
- remove(options, dataToRemove) {
- return doRemoval(options, dataToRemove, extension);
- },
- removeCache(options) {
- return doRemoval(options, {cache: true});
- },
- removeCookies(options) {
- return doRemoval(options, {cookies: true});
- },
- removeDownloads(options) {
- return doRemoval(options, {downloads: true});
- },
- removeFormData(options) {
- return doRemoval(options, {formData: true});
- },
- removeHistory(options) {
- return doRemoval(options, {history: true});
- },
- removePasswords(options) {
- return doRemoval(options, {passwords: true});
- },
- removePluginData(options) {
- return doRemoval(options, {pluginData: true});
- },
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-c-contextMenus.js b/application/basilisk/components/extensions/ext-c-contextMenus.js
deleted file mode 100644
index 9fde90808..000000000
--- a/application/basilisk/components/extensions/ext-c-contextMenus.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-// If id is not specified for an item we use an integer.
-// This ID need only be unique within a single addon. Since all addon code that
-// can use this API runs in the same process, this local variable suffices.
-var gNextMenuItemID = 0;
-
-// Map[Extension -> Map[string or id, ContextMenusClickPropHandler]]
-var gPropHandlers = new Map();
-
-// The contextMenus API supports an "onclick" attribute in the create/update
-// methods to register a callback. This class manages these onclick properties.
-class ContextMenusClickPropHandler {
- constructor(context) {
- this.context = context;
- // Map[string or integer -> callback]
- this.onclickMap = new Map();
- this.dispatchEvent = this.dispatchEvent.bind(this);
- }
-
- // A listener on contextMenus.onClicked that forwards the event to the only
- // listener, if any.
- dispatchEvent(info, tab) {
- let onclick = this.onclickMap.get(info.menuItemId);
- if (onclick) {
- // No need for runSafe or anything because we are already being run inside
- // an event handler -- the event is just being forwarded to the actual
- // handler.
- onclick(info, tab);
- }
- }
-
- // Sets the `onclick` handler for the given menu item.
- // The `onclick` function MUST be owned by `this.context`.
- setListener(id, onclick) {
- if (this.onclickMap.size === 0) {
- this.context.childManager.getParentEvent("contextMenus.onClicked").addListener(this.dispatchEvent);
- this.context.callOnClose(this);
- }
- this.onclickMap.set(id, onclick);
-
- let propHandlerMap = gPropHandlers.get(this.context.extension);
- if (!propHandlerMap) {
- propHandlerMap = new Map();
- } else {
- // If the current callback was created in a different context, remove it
- // from the other context.
- let propHandler = propHandlerMap.get(id);
- if (propHandler && propHandler !== this) {
- propHandler.unsetListener(id);
- }
- }
- propHandlerMap.set(id, this);
- gPropHandlers.set(this.context.extension, propHandlerMap);
- }
-
- // Deletes the `onclick` handler for the given menu item.
- // The `onclick` function MUST be owned by `this.context`.
- unsetListener(id) {
- if (!this.onclickMap.delete(id)) {
- return;
- }
- if (this.onclickMap.size === 0) {
- this.context.childManager.getParentEvent("contextMenus.onClicked").removeListener(this.dispatchEvent);
- this.context.forgetOnClose(this);
- }
- let propHandlerMap = gPropHandlers.get(this.context.extension);
- propHandlerMap.delete(id);
- if (propHandlerMap.size === 0) {
- gPropHandlers.delete(this.context.extension);
- }
- }
-
- // Deletes the `onclick` handler for the given menu item, if any, regardless
- // of the context where it was created.
- unsetListenerFromAnyContext(id) {
- let propHandlerMap = gPropHandlers.get(this.context.extension);
- let propHandler = propHandlerMap && propHandlerMap.get(id);
- if (propHandler) {
- propHandler.unsetListener(id);
- }
- }
-
- // Remove all `onclick` handlers of the extension.
- deleteAllListenersFromExtension() {
- let propHandlerMap = gPropHandlers.get(this.context.extension);
- if (propHandlerMap) {
- for (let [id, propHandler] of propHandlerMap) {
- propHandler.unsetListener(id);
- }
- }
- }
-
- // Removes all `onclick` handlers from this context.
- close() {
- for (let id of this.onclickMap.keys()) {
- this.unsetListener(id);
- }
- }
-}
-
-extensions.registerSchemaAPI("contextMenus", "addon_child", context => {
- let onClickedProp = new ContextMenusClickPropHandler(context);
-
- return {
- contextMenus: {
- create(createProperties, callback) {
- if (createProperties.id === null) {
- createProperties.id = ++gNextMenuItemID;
- }
- let {onclick} = createProperties;
- delete createProperties.onclick;
- context.childManager.callParentAsyncFunction("contextMenus.createInternal", [
- createProperties,
- ]).then(() => {
- if (onclick) {
- onClickedProp.setListener(createProperties.id, onclick);
- }
- if (callback) {
- callback();
- }
- });
- return createProperties.id;
- },
-
- update(id, updateProperties) {
- let {onclick} = updateProperties;
- delete updateProperties.onclick;
- return context.childManager.callParentAsyncFunction("contextMenus.update", [
- id,
- updateProperties,
- ]).then(() => {
- if (onclick) {
- onClickedProp.setListener(id, onclick);
- } else if (onclick === null) {
- onClickedProp.unsetListenerFromAnyContext(id);
- }
- // else onclick is not set so it should not be changed.
- });
- },
-
- remove(id) {
- onClickedProp.unsetListenerFromAnyContext(id);
- return context.childManager.callParentAsyncFunction("contextMenus.remove", [
- id,
- ]);
- },
-
- removeAll() {
- onClickedProp.deleteAllListenersFromExtension();
-
- return context.childManager.callParentAsyncFunction("contextMenus.removeAll", []);
- },
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-c-devtools-inspectedWindow.js b/application/basilisk/components/extensions/ext-c-devtools-inspectedWindow.js
deleted file mode 100644
index f50b7d80e..000000000
--- a/application/basilisk/components/extensions/ext-c-devtools-inspectedWindow.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-extensions.registerSchemaAPI("devtools.inspectedWindow", "devtools_child", context => {
- // `devtoolsToolboxInfo` is received from the child process when the root devtools view
- // has been created, and every sub-frame of that top level devtools frame will
- // receive the same information when the context has been created from the
- // `ExtensionChild.createExtensionContext` method.
- let tabId = (context.devtoolsToolboxInfo &&
- context.devtoolsToolboxInfo.inspectedWindowTabId);
-
- return {
- devtools: {
- inspectedWindow: {
- get tabId() {
- return tabId;
- },
- },
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-c-omnibox.js b/application/basilisk/components/extensions/ext-c-omnibox.js
deleted file mode 100644
index 3b9b6e2f7..000000000
--- a/application/basilisk/components/extensions/ext-c-omnibox.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-var {
- runSafeSyncWithoutClone,
- SingletonEventManager,
-} = ExtensionUtils;
-
-extensions.registerSchemaAPI("omnibox", "addon_child", context => {
- return {
- omnibox: {
- onInputChanged: new SingletonEventManager(context, "omnibox.onInputChanged", fire => {
- let listener = (text, id) => {
- runSafeSyncWithoutClone(fire, text, suggestions => {
- // TODO: Switch to using callParentFunctionNoReturn once bug 1314903 is fixed.
- context.childManager.callParentAsyncFunction("omnibox_internal.addSuggestions", [
- id,
- suggestions,
- ]);
- });
- };
- context.childManager.getParentEvent("omnibox_internal.onInputChanged").addListener(listener);
- return () => {
- context.childManager.getParentEvent("omnibox_internal.onInputChanged").removeListener(listener);
- };
- }).api(),
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-c-tabs.js b/application/basilisk/components/extensions/ext-c-tabs.js
deleted file mode 100644
index d5ce9fbf9..000000000
--- a/application/basilisk/components/extensions/ext-c-tabs.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-extensions.registerSchemaAPI("tabs", "addon_child", context => {
- return {
- tabs: {
- connect: function(tabId, connectInfo) {
- let name = "";
- if (connectInfo && connectInfo.name !== null) {
- name = connectInfo.name;
- }
- let recipient = {
- extensionId: context.extension.id,
- tabId,
- };
- if (connectInfo && connectInfo.frameId !== null) {
- recipient.frameId = connectInfo.frameId;
- }
- return context.messenger.connect(context.messageManager, name, recipient);
- },
-
- sendMessage: function(tabId, message, options, responseCallback) {
- let recipient = {
- extensionId: context.extension.id,
- tabId: tabId,
- };
- if (options && options.frameId !== null) {
- recipient.frameId = options.frameId;
- }
- return context.messenger.sendMessage(context.messageManager, message, recipient, responseCallback);
- },
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-commands.js b/application/basilisk/components/extensions/ext-commands.js
deleted file mode 100644
index b6e7ab3d1..000000000
--- a/application/basilisk/components/extensions/ext-commands.js
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-Cu.import("resource://devtools/shared/event-emitter.js");
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-var {
- EventManager,
- PlatformInfo,
-} = ExtensionUtils;
-
-const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-
-// WeakMap[Extension -> CommandList]
-var commandsMap = new WeakMap();
-
-function CommandList(manifest, extension) {
- this.extension = extension;
- this.id = makeWidgetId(extension.id);
- this.windowOpenListener = null;
-
- // Map[{String} commandName -> {Object} commandProperties]
- this.commands = this.loadCommandsFromManifest(manifest);
-
- // WeakMap[Window -> <xul:keyset>]
- this.keysetsMap = new WeakMap();
-
- this.register();
- EventEmitter.decorate(this);
-}
-
-CommandList.prototype = {
- /**
- * Registers the commands to all open windows and to any which
- * are later created.
- */
- register() {
- for (let window of WindowListManager.browserWindows()) {
- this.registerKeysToDocument(window);
- }
-
- this.windowOpenListener = (window) => {
- if (!this.keysetsMap.has(window)) {
- this.registerKeysToDocument(window);
- }
- };
-
- WindowListManager.addOpenListener(this.windowOpenListener);
- },
-
- /**
- * Unregisters the commands from all open windows and stops commands
- * from being registered to windows which are later created.
- */
- unregister() {
- for (let window of WindowListManager.browserWindows()) {
- if (this.keysetsMap.has(window)) {
- this.keysetsMap.get(window).remove();
- }
- }
-
- WindowListManager.removeOpenListener(this.windowOpenListener);
- },
-
- /**
- * Creates a Map from commands for each command in the manifest.commands object.
- *
- * @param {Object} manifest The manifest JSON object.
- * @returns {Map<string, object>}
- */
- loadCommandsFromManifest(manifest) {
- let commands = new Map();
- // For Windows, chrome.runtime expects 'win' while chrome.commands
- // expects 'windows'. We can special case this for now.
- let os = PlatformInfo.os == "win" ? "windows" : PlatformInfo.os;
- for (let [name, command] of Object.entries(manifest.commands)) {
- let suggested_key = command.suggested_key || {};
- let shortcut = suggested_key[os] || suggested_key.default;
- shortcut = shortcut ? shortcut.replace(/\s+/g, "") : null;
- commands.set(name, {
- description: command.description,
- shortcut,
- });
- }
- return commands;
- },
-
- /**
- * Registers the commands to a document.
- * @param {ChromeWindow} window The XUL window to insert the Keyset.
- */
- registerKeysToDocument(window) {
- let doc = window.document;
- let keyset = doc.createElementNS(XUL_NS, "keyset");
- keyset.id = `ext-keyset-id-${this.id}`;
- this.commands.forEach((command, name) => {
- if (command.shortcut) {
- let keyElement = this.buildKey(doc, name, command.shortcut);
- keyset.appendChild(keyElement);
- }
- });
- doc.documentElement.appendChild(keyset);
- this.keysetsMap.set(window, keyset);
- },
-
- /**
- * Builds a XUL Key element and attaches an onCommand listener which
- * emits a command event with the provided name when fired.
- *
- * @param {Document} doc The XUL document.
- * @param {string} name The name of the command.
- * @param {string} shortcut The shortcut provided in the manifest.
- * @see https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/key
- *
- * @returns {Document} The newly created Key element.
- */
- buildKey(doc, name, shortcut) {
- let keyElement = this.buildKeyFromShortcut(doc, shortcut);
-
- // We need to have the attribute "oncommand" for the "command" listener to fire,
- // and it is currently ignored when set to the empty string.
- keyElement.setAttribute("oncommand", "//");
-
- /* eslint-disable mozilla/balanced-listeners */
- // We remove all references to the key elements when the extension is shutdown,
- // therefore the listeners for these elements will be garbage collected.
- keyElement.addEventListener("command", (event) => {
- if (name == "_execute_page_action") {
- let win = event.target.ownerDocument.defaultView;
- pageActionFor(this.extension).triggerAction(win);
- } else if (name == "_execute_browser_action") {
- let win = event.target.ownerDocument.defaultView;
- browserActionFor(this.extension).triggerAction(win);
- } else {
- TabManager.for(this.extension)
- .addActiveTabPermission(TabManager.activeTab);
- this.emit("command", name);
- }
- });
- /* eslint-enable mozilla/balanced-listeners */
-
- return keyElement;
- },
-
- /**
- * Builds a XUL Key element from the provided shortcut.
- *
- * @param {Document} doc The XUL document.
- * @param {string} shortcut The shortcut provided in the manifest.
- *
- * @see https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/key
- * @returns {Document} The newly created Key element.
- */
- buildKeyFromShortcut(doc, shortcut) {
- let keyElement = doc.createElementNS(XUL_NS, "key");
-
- let parts = shortcut.split("+");
-
- // The key is always the last element.
- let chromeKey = parts.pop();
-
- // The modifiers are the remaining elements.
- keyElement.setAttribute("modifiers", this.getModifiersAttribute(parts));
-
- if (/^[A-Z]$/.test(chromeKey)) {
- // We use the key attribute for all single digits and characters.
- keyElement.setAttribute("key", chromeKey);
- } else {
- keyElement.setAttribute("keycode", this.getKeycodeAttribute(chromeKey));
- keyElement.setAttribute("event", "keydown");
- }
-
- return keyElement;
- },
-
- /**
- * Determines the corresponding XUL keycode from the given chrome key.
- *
- * For example:
- *
- * input | output
- * ---------------------------------------
- * "PageUP" | "VK_PAGE_UP"
- * "Delete" | "VK_DELETE"
- *
- * @param {string} chromeKey The chrome key (e.g. "PageUp", "Space", ...)
- * @returns {string} The constructed value for the Key's 'keycode' attribute.
- */
- getKeycodeAttribute(chromeKey) {
- if (/[0-9]/.test(chromeKey)) {
- return `VK_${chromeKey}`;
- }
- return `VK${chromeKey.replace(/([A-Z])/g, "_$&").toUpperCase()}`;
- },
-
- /**
- * Determines the corresponding XUL modifiers from the chrome modifiers.
- *
- * For example:
- *
- * input | output
- * ---------------------------------------
- * ["Ctrl", "Shift"] | "accel shift"
- * ["MacCtrl"] | "control"
- *
- * @param {Array} chromeModifiers The array of chrome modifiers.
- * @returns {string} The constructed value for the Key's 'modifiers' attribute.
- */
- getModifiersAttribute(chromeModifiers) {
- let modifiersMap = {
- "Alt": "alt",
- "Command": "accel",
- "Ctrl": "accel",
- "MacCtrl": "control",
- "Shift": "shift",
- };
- return Array.from(chromeModifiers, modifier => {
- return modifiersMap[modifier];
- }).join(" ");
- },
-};
-
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("manifest_commands", (type, directive, extension, manifest) => {
- commandsMap.set(extension, new CommandList(manifest, extension));
-});
-
-extensions.on("shutdown", (type, extension) => {
- let commandsList = commandsMap.get(extension);
- if (commandsList) {
- commandsList.unregister();
- commandsMap.delete(extension);
- }
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-extensions.registerSchemaAPI("commands", "addon_parent", context => {
- let {extension} = context;
- return {
- commands: {
- getAll() {
- let commands = commandsMap.get(extension).commands;
- return Promise.resolve(Array.from(commands, ([name, command]) => {
- return ({
- name,
- description: command.description,
- shortcut: command.shortcut,
- });
- }));
- },
- onCommand: new EventManager(context, "commands.onCommand", fire => {
- let listener = (eventName, commandName) => {
- fire(commandName);
- };
- commandsMap.get(extension).on("command", listener);
- return () => {
- commandsMap.get(extension).off("command", listener);
- };
- }).api(),
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-contextMenus.js b/application/basilisk/components/extensions/ext-contextMenus.js
deleted file mode 100644
index 34a828f13..000000000
--- a/application/basilisk/components/extensions/ext-contextMenus.js
+++ /dev/null
@@ -1,640 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-Cu.import("resource://gre/modules/MatchPattern.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-var {
- EventManager,
- ExtensionError,
- IconDetails,
-} = ExtensionUtils;
-
-const ACTION_MENU_TOP_LEVEL_LIMIT = 6;
-
-// Map[Extension -> Map[ID -> MenuItem]]
-// Note: we want to enumerate all the menu items so
-// this cannot be a weak map.
-var gContextMenuMap = new Map();
-
-// Map[Extension -> MenuItem]
-var gRootItems = new Map();
-
-// If id is not specified for an item we use an integer.
-var gNextMenuItemID = 0;
-
-// Used to assign unique names to radio groups.
-var gNextRadioGroupID = 0;
-
-// The max length of a menu item's label.
-var gMaxLabelLength = 64;
-
-var gMenuBuilder = {
- // When a new contextMenu is opened, this function is called and
- // we populate the |xulMenu| with all the items from extensions
- // to be displayed. We always clear all the items again when
- // popuphidden fires.
- build(contextData) {
- let firstItem = true;
- let xulMenu = contextData.menu;
- xulMenu.addEventListener("popuphidden", this);
- this.xulMenu = xulMenu;
- for (let [, root] of gRootItems) {
- let rootElement = this.buildElementWithChildren(root, contextData);
- if (!rootElement.firstChild || !rootElement.firstChild.childNodes.length) {
- // If the root has no visible children, there is no reason to show
- // the root menu item itself either.
- continue;
- }
- rootElement.setAttribute("ext-type", "top-level-menu");
- rootElement = this.removeTopLevelMenuIfNeeded(rootElement);
-
- // Display the extension icon on the root element.
- if (root.extension.manifest.icons) {
- let parentWindow = contextData.menu.ownerGlobal;
- let extension = root.extension;
-
- let {icon} = IconDetails.getPreferredIcon(extension.manifest.icons, extension,
- 16 * parentWindow.devicePixelRatio);
-
- // The extension icons in the manifest are not pre-resolved, since
- // they're sometimes used by the add-on manager when the extension is
- // not enabled, and its URLs are not resolvable.
- let resolvedURL = root.extension.baseURI.resolve(icon);
-
- if (rootElement.localName == "menu") {
- rootElement.setAttribute("class", "menu-iconic");
- } else if (rootElement.localName == "menuitem") {
- rootElement.setAttribute("class", "menuitem-iconic");
- }
- rootElement.setAttribute("image", resolvedURL);
- }
-
- if (firstItem) {
- firstItem = false;
- const separator = xulMenu.ownerDocument.createElement("menuseparator");
- this.itemsToCleanUp.add(separator);
- xulMenu.append(separator);
- }
-
- xulMenu.appendChild(rootElement);
- this.itemsToCleanUp.add(rootElement);
- }
- },
-
- // Builds a context menu for browserAction and pageAction buttons.
- buildActionContextMenu(contextData) {
- const {menu} = contextData;
-
- contextData.tab = TabManager.activeTab;
- contextData.pageUrl = contextData.tab.linkedBrowser.currentURI.spec;
-
- const root = gRootItems.get(contextData.extension);
- const children = this.buildChildren(root, contextData);
- const visible = children.slice(0, ACTION_MENU_TOP_LEVEL_LIMIT);
-
- if (visible.length) {
- this.xulMenu = menu;
- menu.addEventListener("popuphidden", this);
-
- const separator = menu.ownerDocument.createElement("menuseparator");
- menu.insertBefore(separator, menu.firstChild);
- this.itemsToCleanUp.add(separator);
-
- for (const child of visible) {
- this.itemsToCleanUp.add(child);
- menu.insertBefore(child, separator);
- }
- }
- },
-
- buildElementWithChildren(item, contextData) {
- const element = this.buildSingleElement(item, contextData);
- const children = this.buildChildren(item, contextData);
- if (children.length) {
- element.firstChild.append(...children);
- }
- return element;
- },
-
- buildChildren(item, contextData) {
- let groupName;
- let children = [];
- for (let child of item.children) {
- if (child.type == "radio" && !child.groupName) {
- if (!groupName) {
- groupName = `webext-radio-group-${gNextRadioGroupID++}`;
- }
- child.groupName = groupName;
- } else {
- groupName = null;
- }
-
- if (child.enabledForContext(contextData)) {
- children.push(this.buildElementWithChildren(child, contextData));
- }
- }
- return children;
- },
-
- removeTopLevelMenuIfNeeded(element) {
- // If there is only one visible top level element we don't need the
- // root menu element for the extension.
- let menuPopup = element.firstChild;
- if (menuPopup && menuPopup.childNodes.length == 1) {
- let onlyChild = menuPopup.firstChild;
- onlyChild.remove();
- return onlyChild;
- }
-
- return element;
- },
-
- buildSingleElement(item, contextData) {
- let doc = contextData.menu.ownerDocument;
- let element;
- if (item.children.length > 0) {
- element = this.createMenuElement(doc, item);
- } else if (item.type == "separator") {
- element = doc.createElement("menuseparator");
- } else {
- element = doc.createElement("menuitem");
- }
-
- return this.customizeElement(element, item, contextData);
- },
-
- createMenuElement(doc, item) {
- let element = doc.createElement("menu");
- // Menu elements need to have a menupopup child for its menu items.
- let menupopup = doc.createElement("menupopup");
- element.appendChild(menupopup);
- return element;
- },
-
- customizeElement(element, item, contextData) {
- let label = item.title;
- if (label) {
- if (contextData.isTextSelected && label.indexOf("%s") > -1) {
- let selection = contextData.selectionText;
- // The rendering engine will truncate the title if it's longer than 64 characters.
- // But if it makes sense let's try truncate selection text only, to handle cases like
- // 'look up "%s" in MyDictionary' more elegantly.
- let maxSelectionLength = gMaxLabelLength - label.length + 2;
- if (maxSelectionLength > 4) {
- selection = selection.substring(0, maxSelectionLength - 3) + "...";
- }
- label = label.replace(/%s/g, selection);
- }
-
- element.setAttribute("label", label);
- }
-
- if (item.type == "checkbox") {
- element.setAttribute("type", "checkbox");
- if (item.checked) {
- element.setAttribute("checked", "true");
- }
- } else if (item.type == "radio") {
- element.setAttribute("type", "radio");
- element.setAttribute("name", item.groupName);
- if (item.checked) {
- element.setAttribute("checked", "true");
- }
- }
-
- if (!item.enabled) {
- element.setAttribute("disabled", "true");
- }
-
- element.addEventListener("command", event => { // eslint-disable-line mozilla/balanced-listeners
- if (event.target !== event.currentTarget) {
- return;
- }
- const wasChecked = item.checked;
- if (item.type == "checkbox") {
- item.checked = !item.checked;
- } else if (item.type == "radio") {
- // Deselect all radio items in the current radio group.
- for (let child of item.parent.children) {
- if (child.type == "radio" && child.groupName == item.groupName) {
- child.checked = false;
- }
- }
- // Select the clicked radio item.
- item.checked = true;
- }
-
- item.tabManager.addActiveTabPermission();
-
- let tab = item.tabManager.convert(contextData.tab);
- let info = item.getClickInfo(contextData, wasChecked);
- item.extension.emit("webext-contextmenu-menuitem-click", info, tab);
- });
-
- return element;
- },
-
- handleEvent(event) {
- if (this.xulMenu != event.target || event.type != "popuphidden") {
- return;
- }
-
- delete this.xulMenu;
- let target = event.target;
- target.removeEventListener("popuphidden", this);
- for (let item of this.itemsToCleanUp) {
- item.remove();
- }
- this.itemsToCleanUp.clear();
- },
-
- itemsToCleanUp: new Set(),
-};
-
-// Called from pageAction or browserAction popup.
-global.actionContextMenu = function(contextData) {
- gMenuBuilder.buildActionContextMenu(contextData);
-};
-
-function getContexts(contextData) {
- let contexts = new Set();
-
- if (contextData.inFrame) {
- contexts.add("frame");
- }
-
- if (contextData.isTextSelected) {
- contexts.add("selection");
- }
-
- if (contextData.onLink) {
- contexts.add("link");
- }
-
- if (contextData.onEditableArea) {
- contexts.add("editable");
- }
-
- if (contextData.onPassword) {
- contexts.add("password");
- }
-
- if (contextData.onImage) {
- contexts.add("image");
- }
-
- if (contextData.onVideo) {
- contexts.add("video");
- }
-
- if (contextData.onAudio) {
- contexts.add("audio");
- }
-
- if (contextData.onPageAction) {
- contexts.add("page_action");
- }
-
- if (contextData.onBrowserAction) {
- contexts.add("browser_action");
- }
-
- if (contexts.size === 0) {
- contexts.add("page");
- }
-
- if (contextData.onTab) {
- contexts.add("tab");
- } else {
- contexts.add("all");
- }
-
- return contexts;
-}
-
-function MenuItem(extension, createProperties, isRoot = false) {
- this.extension = extension;
- this.children = [];
- this.parent = null;
- this.tabManager = TabManager.for(extension);
-
- this.setDefaults();
- this.setProps(createProperties);
-
- if (!this.hasOwnProperty("_id")) {
- this.id = gNextMenuItemID++;
- }
- // If the item is not the root and has no parent
- // it must be a child of the root.
- if (!isRoot && !this.parent) {
- this.root.addChild(this);
- }
-}
-
-MenuItem.prototype = {
- setProps(createProperties) {
- for (let propName in createProperties) {
- if (createProperties[propName] === null) {
- // Omitted optional argument.
- continue;
- }
- this[propName] = createProperties[propName];
- }
-
- if (createProperties.documentUrlPatterns != null) {
- this.documentUrlMatchPattern = new MatchPattern(this.documentUrlPatterns);
- }
-
- if (createProperties.targetUrlPatterns != null) {
- this.targetUrlMatchPattern = new MatchPattern(this.targetUrlPatterns);
- }
-
- // If a child MenuItem does not specify any contexts, then it should
- // inherit the contexts specified from its parent.
- if (createProperties.parentId && !createProperties.contexts) {
- this.contexts = this.parent.contexts;
- }
- },
-
- setDefaults() {
- this.setProps({
- type: "normal",
- checked: false,
- contexts: ["all"],
- enabled: true,
- });
- },
-
- set id(id) {
- if (this.hasOwnProperty("_id")) {
- throw new Error("Id of a MenuItem cannot be changed");
- }
- let isIdUsed = gContextMenuMap.get(this.extension).has(id);
- if (isIdUsed) {
- throw new Error("Id already exists");
- }
- this._id = id;
- },
-
- get id() {
- return this._id;
- },
-
- ensureValidParentId(parentId) {
- if (parentId === undefined) {
- return;
- }
- let menuMap = gContextMenuMap.get(this.extension);
- if (!menuMap.has(parentId)) {
- throw new Error("Could not find any MenuItem with id: " + parentId);
- }
- for (let item = menuMap.get(parentId); item; item = item.parent) {
- if (item === this) {
- throw new ExtensionError("MenuItem cannot be an ancestor (or self) of its new parent.");
- }
- }
- },
-
- set parentId(parentId) {
- this.ensureValidParentId(parentId);
-
- if (this.parent) {
- this.parent.detachChild(this);
- }
-
- if (parentId === undefined) {
- this.root.addChild(this);
- } else {
- let menuMap = gContextMenuMap.get(this.extension);
- menuMap.get(parentId).addChild(this);
- }
- },
-
- get parentId() {
- return this.parent ? this.parent.id : undefined;
- },
-
- addChild(child) {
- if (child.parent) {
- throw new Error("Child MenuItem already has a parent.");
- }
- this.children.push(child);
- child.parent = this;
- },
-
- detachChild(child) {
- let idx = this.children.indexOf(child);
- if (idx < 0) {
- throw new Error("Child MenuItem not found, it cannot be removed.");
- }
- this.children.splice(idx, 1);
- child.parent = null;
- },
-
- get root() {
- let extension = this.extension;
- if (!gRootItems.has(extension)) {
- let root = new MenuItem(extension,
- {title: extension.name},
- /* isRoot = */ true);
- gRootItems.set(extension, root);
- }
-
- return gRootItems.get(extension);
- },
-
- remove() {
- if (this.parent) {
- this.parent.detachChild(this);
- }
- let children = this.children.slice(0);
- for (let child of children) {
- child.remove();
- }
-
- let menuMap = gContextMenuMap.get(this.extension);
- menuMap.delete(this.id);
- if (this.root == this) {
- gRootItems.delete(this.extension);
- }
- },
-
- getClickInfo(contextData, wasChecked) {
- let mediaType;
- if (contextData.onVideo) {
- mediaType = "video";
- }
- if (contextData.onAudio) {
- mediaType = "audio";
- }
- if (contextData.onImage) {
- mediaType = "image";
- }
-
- let info = {
- menuItemId: this.id,
- editable: contextData.onEditableArea || contextData.onPassword,
- };
-
- function setIfDefined(argName, value) {
- if (value !== undefined) {
- info[argName] = value;
- }
- }
-
- setIfDefined("parentMenuItemId", this.parentId);
- setIfDefined("mediaType", mediaType);
- setIfDefined("linkUrl", contextData.linkUrl);
- setIfDefined("srcUrl", contextData.srcUrl);
- setIfDefined("pageUrl", contextData.pageUrl);
- setIfDefined("frameUrl", contextData.frameUrl);
- setIfDefined("selectionText", contextData.selectionText);
-
- if ((this.type === "checkbox") || (this.type === "radio")) {
- info.checked = this.checked;
- info.wasChecked = wasChecked;
- }
-
- return info;
- },
-
- enabledForContext(contextData) {
- let contexts = getContexts(contextData);
- if (!this.contexts.some(n => contexts.has(n))) {
- return false;
- }
-
- let docPattern = this.documentUrlMatchPattern;
- let pageURI = Services.io.newURI(contextData.pageUrl);
- if (docPattern && !docPattern.matches(pageURI)) {
- return false;
- }
-
- let targetPattern = this.targetUrlMatchPattern;
- if (targetPattern) {
- let targetUrls = [];
- if (contextData.onImage || contextData.onAudio || contextData.onVideo) {
- // TODO: double check if srcUrl is always set when we need it
- targetUrls.push(contextData.srcUrl);
- }
- if (contextData.onLink) {
- targetUrls.push(contextData.linkUrl);
- }
- if (!targetUrls.some(targetUrl => targetPattern.matches(NetUtil.newURI(targetUrl)))) {
- return false;
- }
- }
-
- return true;
- },
-};
-
-// While any extensions are active, this Tracker registers to observe/listen
-// for contex-menu events from both content and chrome.
-const contextMenuTracker = {
- register() {
- Services.obs.addObserver(this, "on-build-contextmenu", false);
- for (const window of WindowListManager.browserWindows()) {
- this.onWindowOpen(window);
- }
- WindowListManager.addOpenListener(this.onWindowOpen);
- },
-
- unregister() {
- Services.obs.removeObserver(this, "on-build-contextmenu");
- for (const window of WindowListManager.browserWindows()) {
- const menu = window.document.getElementById("tabContextMenu");
- menu.removeEventListener("popupshowing", this);
- }
- WindowListManager.removeOpenListener(this.onWindowOpen);
- },
-
- observe(subject, topic, data) {
- subject = subject.wrappedJSObject;
- gMenuBuilder.build(subject);
- },
-
- onWindowOpen(window) {
- const menu = window.document.getElementById("tabContextMenu");
- menu.addEventListener("popupshowing", contextMenuTracker);
- },
-
- handleEvent(event) {
- const menu = event.target;
- if (menu.id === "tabContextMenu") {
- const trigger = menu.triggerNode;
- const tab = trigger.localName === "tab" ? trigger : TabManager.activeTab;
- const pageUrl = tab.linkedBrowser.currentURI.spec;
- gMenuBuilder.build({menu, tab, pageUrl, onTab: true});
- }
- },
-};
-
-var gExtensionCount = 0;
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("startup", (type, extension) => {
- gContextMenuMap.set(extension, new Map());
- if (++gExtensionCount == 1) {
- contextMenuTracker.register();
- }
-});
-
-extensions.on("shutdown", (type, extension) => {
- gContextMenuMap.delete(extension);
- gRootItems.delete(extension);
- if (--gExtensionCount == 0) {
- contextMenuTracker.unregister();
- }
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-extensions.registerSchemaAPI("contextMenus", "addon_parent", context => {
- let {extension} = context;
- return {
- contextMenus: {
- createInternal: function(createProperties) {
- // Note that the id is required by the schema. If the addon did not set
- // it, the implementation of contextMenus.create in the child should
- // have added it.
- let menuItem = new MenuItem(extension, createProperties);
- gContextMenuMap.get(extension).set(menuItem.id, menuItem);
- },
-
- update: function(id, updateProperties) {
- let menuItem = gContextMenuMap.get(extension).get(id);
- if (menuItem) {
- menuItem.setProps(updateProperties);
- }
- },
-
- remove: function(id) {
- let menuItem = gContextMenuMap.get(extension).get(id);
- if (menuItem) {
- menuItem.remove();
- }
- },
-
- removeAll: function() {
- let root = gRootItems.get(extension);
- if (root) {
- root.remove();
- }
- },
-
- onClicked: new EventManager(context, "contextMenus.onClicked", fire => {
- let listener = (event, info, tab) => {
- fire(info, tab);
- };
-
- extension.on("webext-contextmenu-menuitem-click", listener);
- return () => {
- extension.off("webext-contextmenu-menuitem-click", listener);
- };
- }).api(),
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-desktop-runtime.js b/application/basilisk/components/extensions/ext-desktop-runtime.js
deleted file mode 100644
index 0fdb45562..000000000
--- a/application/basilisk/components/extensions/ext-desktop-runtime.js
+++ /dev/null
@@ -1,26 +0,0 @@
-"use strict";
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("uninstall", (msg, extension) => {
- if (extension.uninstallURL) {
- let browser = WindowManager.topWindow.gBrowser;
- browser.addTab(extension.uninstallURL, {relatedToCurrent: true});
- }
-});
-
-global.openOptionsPage = (extension) => {
- let window = WindowManager.topWindow;
- if (!window) {
- return Promise.reject({message: "No browser window available"});
- }
-
- if (extension.manifest.options_ui.open_in_tab) {
- window.switchToTabHavingURI(extension.manifest.options_ui.page, true);
- return Promise.resolve();
- }
-
- let viewId = `addons://detail/${encodeURIComponent(extension.id)}/preferences`;
-
- return window.BrowserOpenAddonsMgr(viewId);
-};
-
diff --git a/application/basilisk/components/extensions/ext-devtools.js b/application/basilisk/components/extensions/ext-devtools.js
deleted file mode 100644
index 6ba9e507a..000000000
--- a/application/basilisk/components/extensions/ext-devtools.js
+++ /dev/null
@@ -1,312 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-/* global getTargetTabIdForToolbox */
-
-/**
- * This module provides helpers used by the other specialized `ext-devtools-*.js` modules
- * and the implementation of the `devtools_page`.
- */
-
-XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
- "resource://devtools/client/framework/gDevTools.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-
-Cu.import("resource://gre/modules/ExtensionParent.jsm");
-
-const {
- HiddenExtensionPage,
- watchExtensionProxyContextLoad,
-} = ExtensionParent;
-
-// Map[extension -> DevToolsPageDefinition]
-let devtoolsPageDefinitionMap = new Map();
-
-let initDevTools;
-
-/**
- * Retrieve the devtools target for the devtools extension proxy context
- * (lazily cloned from the target of the toolbox associated to the context
- * the first time that it is accessed).
- *
- * @param {DevToolsExtensionPageContextParent} context
- * A devtools extension proxy context.
- *
- * @returns {Promise<TabTarget>}
- * The cloned devtools target associated to the context.
- */
-global.getDevToolsTargetForContext = (context) => {
- return Task.spawn(function* asyncGetTabTarget() {
- if (context.devToolsTarget) {
- return context.devToolsTarget;
- }
-
- if (!context.devToolsToolbox || !context.devToolsToolbox.target) {
- throw new Error("Unable to get a TabTarget for a context not associated to any toolbox");
- }
-
- if (!context.devToolsToolbox.target.isLocalTab) {
- throw new Error("Unexpected target type: only local tabs are currently supported.");
- }
-
- const {TabTarget} = require("devtools/client/framework/target");
-
- context.devToolsTarget = new TabTarget(context.devToolsToolbox.target.tab);
- yield context.devToolsTarget.makeRemote();
-
- return context.devToolsTarget;
- });
-};
-
-/**
- * Retrieve the devtools target for the devtools extension proxy context
- * (lazily cloned from the target of the toolbox associated to the context
- * the first time that it is accessed).
- *
- * @param {Toolbox} toolbox
- * A devtools toolbox instance.
- *
- * @returns {number}
- * The corresponding WebExtensions tabId.
- */
-global.getTargetTabIdForToolbox = (toolbox) => {
- let {target} = toolbox;
-
- if (!target.isLocalTab) {
- throw new Error("Unexpected target type: only local tabs are currently supported.");
- }
-
- let parentWindow = target.tab.linkedBrowser.ownerDocument.defaultView;
- let tab = parentWindow.gBrowser.getTabForBrowser(target.tab.linkedBrowser);
-
- return TabManager.getId(tab);
-};
-
-/**
- * The DevToolsPage represents the "devtools_page" related to a particular
- * Toolbox and WebExtension.
- *
- * The devtools_page contexts are invisible WebExtensions contexts, similar to the
- * background page, associated to a single developer toolbox (e.g. If an add-on
- * registers a devtools_page and the user opens 3 developer toolbox in 3 webpages,
- * 3 devtools_page contexts will be created for that add-on).
- *
- * @param {Extension} extension
- * The extension that owns the devtools_page.
- * @param {Object} options
- * @param {Toolbox} options.toolbox
- * The developer toolbox instance related to this devtools_page.
- * @param {string} options.url
- * The path to the devtools page html page relative to the extension base URL.
- * @param {DevToolsPageDefinition} options.devToolsPageDefinition
- * The instance of the devToolsPageDefinition class related to this DevToolsPage.
- */
-class DevToolsPage extends HiddenExtensionPage {
- constructor(extension, options) {
- super(extension, "devtools_page");
-
- this.url = extension.baseURI.resolve(options.url);
- this.toolbox = options.toolbox;
- this.devToolsPageDefinition = options.devToolsPageDefinition;
-
- this.unwatchExtensionProxyContextLoad = null;
-
- this.waitForTopLevelContext = new Promise(resolve => {
- this.resolveTopLevelContext = resolve;
- });
- }
-
- build() {
- return Task.spawn(function* () {
- yield this.createBrowserElement();
-
- // Listening to new proxy contexts.
- this.unwatchExtensionProxyContextLoad = watchExtensionProxyContextLoad(this, context => {
- // Keep track of the toolbox and target associated to the context, which is
- // needed by the API methods implementation.
- context.devToolsToolbox = this.toolbox;
-
- if (!this.topLevelContext) {
- this.topLevelContext = context;
-
- // Ensure this devtools page is destroyed, when the top level context proxy is
- // closed.
- this.topLevelContext.callOnClose(this);
-
- this.resolveTopLevelContext(context);
- }
- });
-
- extensions.emit("extension-browser-inserted", this.browser, {
- devtoolsToolboxInfo: {
- inspectedWindowTabId: getTargetTabIdForToolbox(this.toolbox),
- },
- });
-
- this.browser.loadURI(this.url);
-
- yield this.waitForTopLevelContext;
- }.bind(this));
- }
-
- close() {
- if (this.closed) {
- throw new Error("Unable to shutdown a closed DevToolsPage instance");
- }
-
- this.closed = true;
-
- // Unregister the devtools page instance from the devtools page definition.
- this.devToolsPageDefinition.forgetForTarget(this.toolbox.target);
-
- // Unregister it from the resources to cleanup when the context has been closed.
- if (this.topLevelContext) {
- this.topLevelContext.forgetOnClose(this);
- }
-
- // Stop watching for any new proxy contexts from the devtools page.
- if (this.unwatchExtensionProxyContextLoad) {
- this.unwatchExtensionProxyContextLoad();
- this.unwatchExtensionProxyContextLoad = null;
- }
-
- super.shutdown();
- }
-}
-
-/**
- * The DevToolsPageDefinitions class represents the "devtools_page" manifest property
- * of a WebExtension.
- *
- * A DevToolsPageDefinition instance is created automatically when a WebExtension
- * which contains the "devtools_page" manifest property has been loaded, and it is
- * automatically destroyed when the related WebExtension has been unloaded,
- * and so there will be at most one DevtoolsPageDefinition per add-on.
- *
- * Every time a developer tools toolbox is opened, the DevToolsPageDefinition creates
- * and keep track of a DevToolsPage instance (which represents the actual devtools_page
- * instance related to that particular toolbox).
- *
- * @param {Extension} extension
- * The extension that owns the devtools_page.
- * @param {string} url
- * The path to the devtools page html page relative to the extension base URL.
- */
-class DevToolsPageDefinition {
- constructor(extension, url) {
- initDevTools();
-
- this.url = url;
- this.extension = extension;
-
- // Map[TabTarget -> DevToolsPage]
- this.devtoolsPageForTarget = new Map();
- }
-
- buildForToolbox(toolbox) {
- if (this.devtoolsPageForTarget.has(toolbox.target)) {
- return Promise.reject(new Error("DevtoolsPage has been already created for this toolbox"));
- }
-
- const devtoolsPage = new DevToolsPage(this.extension, {
- toolbox, url: this.url, devToolsPageDefinition: this,
- });
- this.devtoolsPageForTarget.set(toolbox.target, devtoolsPage);
-
- return devtoolsPage.build();
- }
-
- shutdownForTarget(target) {
- if (this.devtoolsPageForTarget.has(target)) {
- const devtoolsPage = this.devtoolsPageForTarget.get(target);
- devtoolsPage.close();
-
- // `devtoolsPage.close()` should remove the instance from the map,
- // raise an exception if it is still there.
- if (this.devtoolsPageForTarget.has(target)) {
- throw new Error(`Leaked DevToolsPage instance for target "${target.toString()}"`);
- }
- }
- }
-
- forgetForTarget(target) {
- this.devtoolsPageForTarget.delete(target);
- }
-
- shutdown() {
- for (let target of this.devtoolsPageForTarget.keys()) {
- this.shutdownForTarget(target);
- }
-
- if (this.devtoolsPageForTarget.size > 0) {
- throw new Error(
- `Leaked ${this.devtoolsPageForTarget.size} DevToolsPage instances in devtoolsPageForTarget Map`
- );
- }
- }
-}
-
-/* eslint-disable mozilla/balanced-listeners */
-
-let devToolsInitialized = false;
-initDevTools = function() {
- if (devToolsInitialized) {
- return;
- }
-
- // Create a devtools page context for a new opened toolbox,
- // based on the registered devtools_page definitions.
- gDevTools.on("toolbox-created", (evt, toolbox) => {
- if (!toolbox.target.isLocalTab) {
- // Only local tabs are currently supported (See Bug 1304378 for additional details
- // related to remote targets support).
- let msg = `Ignoring DevTools Toolbox for target "${toolbox.target.toString()}": ` +
- `"${toolbox.target.name}" ("${toolbox.target.url}"). ` +
- "Only local tab are currently supported by the WebExtensions DevTools API.";
- let scriptError = Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError);
- scriptError.init(msg, null, null, null, null, Ci.nsIScriptError.warningFlag, "content javascript");
- let consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
- consoleService.logMessage(scriptError);
-
- return;
- }
-
- for (let devtoolsPage of devtoolsPageDefinitionMap.values()) {
- devtoolsPage.buildForToolbox(toolbox);
- }
- });
-
- // Destroy a devtools page context for a destroyed toolbox,
- // based on the registered devtools_page definitions.
- gDevTools.on("toolbox-destroy", (evt, target) => {
- if (!target.isLocalTab) {
- // Only local tabs are currently supported (See Bug 1304378 for additional details
- // related to remote targets support).
- return;
- }
-
- for (let devtoolsPageDefinition of devtoolsPageDefinitionMap.values()) {
- devtoolsPageDefinition.shutdownForTarget(target);
- }
- });
-
- devToolsInitialized = true;
-};
-
-// Create and register a new devtools_page definition as specified in the
-// "devtools_page" property in the extension manifest.
-extensions.on("manifest_devtools_page", (type, directive, extension, manifest) => {
- let devtoolsPageDefinition = new DevToolsPageDefinition(extension, manifest[directive]);
- devtoolsPageDefinitionMap.set(extension, devtoolsPageDefinition);
-});
-
-// Destroy the registered devtools_page definition on extension shutdown.
-extensions.on("shutdown", (type, extension) => {
- if (devtoolsPageDefinitionMap.has(extension)) {
- devtoolsPageDefinitionMap.get(extension).shutdown();
- devtoolsPageDefinitionMap.delete(extension);
- }
-});
-/* eslint-enable mozilla/balanced-listeners */
diff --git a/application/basilisk/components/extensions/ext-history.js b/application/basilisk/components/extensions/ext-history.js
deleted file mode 100644
index a47df1621..000000000
--- a/application/basilisk/components/extensions/ext-history.js
+++ /dev/null
@@ -1,246 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "EventEmitter",
- "resource://devtools/shared/event-emitter.js");
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
- "resource://gre/modules/NetUtil.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-
-const {
- normalizeTime,
- SingletonEventManager,
-} = ExtensionUtils;
-
-let nsINavHistoryService = Ci.nsINavHistoryService;
-const TRANSITION_TO_TRANSITION_TYPES_MAP = new Map([
- ["link", nsINavHistoryService.TRANSITION_LINK],
- ["typed", nsINavHistoryService.TRANSITION_TYPED],
- ["auto_bookmark", nsINavHistoryService.TRANSITION_BOOKMARK],
- ["auto_subframe", nsINavHistoryService.TRANSITION_EMBED],
- ["manual_subframe", nsINavHistoryService.TRANSITION_FRAMED_LINK],
-]);
-
-let TRANSITION_TYPE_TO_TRANSITIONS_MAP = new Map();
-for (let [transition, transitionType] of TRANSITION_TO_TRANSITION_TYPES_MAP) {
- TRANSITION_TYPE_TO_TRANSITIONS_MAP.set(transitionType, transition);
-}
-
-function getTransitionType(transition) {
- // cannot set a default value for the transition argument as the framework sets it to null
- transition = transition || "link";
- let transitionType = TRANSITION_TO_TRANSITION_TYPES_MAP.get(transition);
- if (!transitionType) {
- throw new Error(`|${transition}| is not a supported transition for history`);
- }
- return transitionType;
-}
-
-function getTransition(transitionType) {
- return TRANSITION_TYPE_TO_TRANSITIONS_MAP.get(transitionType) || "link";
-}
-
-/*
- * Converts a nsINavHistoryResultNode into a HistoryItem
- *
- * https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsINavHistoryResultNode
- */
-function convertNodeToHistoryItem(node) {
- return {
- id: node.pageGuid,
- url: node.uri,
- title: node.title,
- lastVisitTime: PlacesUtils.toDate(node.time).getTime(),
- visitCount: node.accessCount,
- };
-}
-
-/*
- * Converts a nsINavHistoryResultNode into a VisitItem
- *
- * https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsINavHistoryResultNode
- */
-function convertNodeToVisitItem(node) {
- return {
- id: node.pageGuid,
- visitId: node.visitId,
- visitTime: PlacesUtils.toDate(node.time).getTime(),
- referringVisitId: node.fromVisitId,
- transition: getTransition(node.visitType),
- };
-}
-
-/*
- * Converts a nsINavHistoryContainerResultNode into an array of objects
- *
- * https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsINavHistoryContainerResultNode
- */
-function convertNavHistoryContainerResultNode(container, converter) {
- let results = [];
- container.containerOpen = true;
- for (let i = 0; i < container.childCount; i++) {
- let node = container.getChild(i);
- results.push(converter(node));
- }
- container.containerOpen = false;
- return results;
-}
-
-var _observer;
-
-function getObserver() {
- if (!_observer) {
- _observer = {
- onDeleteURI: function(uri, guid, reason) {
- this.emit("visitRemoved", {allHistory: false, urls: [uri.spec]});
- },
- onVisit: function(uri, visitId, time, sessionId, referringId, transitionType, guid, hidden, visitCount, typed) {
- let data = {
- id: guid,
- url: uri.spec,
- title: "",
- lastVisitTime: time / 1000, // time from Places is microseconds,
- visitCount,
- typedCount: typed,
- };
- this.emit("visited", data);
- },
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onTitleChanged: function() {},
- onClearHistory: function() {
- this.emit("visitRemoved", {allHistory: true, urls: []});
- },
- onPageChanged: function() {},
- onFrecencyChanged: function() {},
- onManyFrecenciesChanged: function() {},
- onDeleteVisits: function(uri, time, guid, reason) {
- this.emit("visitRemoved", {allHistory: false, urls: [uri.spec]});
- },
- };
- EventEmitter.decorate(_observer);
- PlacesUtils.history.addObserver(_observer, false);
- }
- return _observer;
-}
-
-extensions.registerSchemaAPI("history", "addon_parent", context => {
- return {
- history: {
- addUrl: function(details) {
- let transition, date;
- try {
- transition = getTransitionType(details.transition);
- } catch (error) {
- return Promise.reject({message: error.message});
- }
- if (details.visitTime) {
- date = normalizeTime(details.visitTime);
- }
- let pageInfo = {
- title: details.title,
- url: details.url,
- visits: [
- {
- transition,
- date,
- },
- ],
- };
- try {
- return PlacesUtils.history.insert(pageInfo).then(() => undefined);
- } catch (error) {
- return Promise.reject({message: error.message});
- }
- },
-
- deleteAll: function() {
- return PlacesUtils.history.clear();
- },
-
- deleteRange: function(filter) {
- let newFilter = {
- beginDate: normalizeTime(filter.startTime),
- endDate: normalizeTime(filter.endTime),
- };
- // History.removeVisitsByFilter returns a boolean, but our API should return nothing
- return PlacesUtils.history.removeVisitsByFilter(newFilter).then(() => undefined);
- },
-
- deleteUrl: function(details) {
- let url = details.url;
- // History.remove returns a boolean, but our API should return nothing
- return PlacesUtils.history.remove(url).then(() => undefined);
- },
-
- search: function(query) {
- let beginTime = (query.startTime == null) ?
- PlacesUtils.toPRTime(Date.now() - 24 * 60 * 60 * 1000) :
- PlacesUtils.toPRTime(normalizeTime(query.startTime));
- let endTime = (query.endTime == null) ?
- Number.MAX_VALUE :
- PlacesUtils.toPRTime(normalizeTime(query.endTime));
- if (beginTime > endTime) {
- return Promise.reject({message: "The startTime cannot be after the endTime"});
- }
-
- let options = PlacesUtils.history.getNewQueryOptions();
- options.sortingMode = options.SORT_BY_DATE_DESCENDING;
- options.maxResults = query.maxResults || 100;
-
- let historyQuery = PlacesUtils.history.getNewQuery();
- historyQuery.searchTerms = query.text;
- historyQuery.beginTime = beginTime;
- historyQuery.endTime = endTime;
- let queryResult = PlacesUtils.history.executeQuery(historyQuery, options).root;
- let results = convertNavHistoryContainerResultNode(queryResult, convertNodeToHistoryItem);
- return Promise.resolve(results);
- },
-
- getVisits: function(details) {
- let url = details.url;
- if (!url) {
- return Promise.reject({message: "A URL must be provided for getVisits"});
- }
-
- let options = PlacesUtils.history.getNewQueryOptions();
- options.sortingMode = options.SORT_BY_DATE_DESCENDING;
- options.resultType = options.RESULTS_AS_VISIT;
-
- let historyQuery = PlacesUtils.history.getNewQuery();
- historyQuery.uri = NetUtil.newURI(url);
- let queryResult = PlacesUtils.history.executeQuery(historyQuery, options).root;
- let results = convertNavHistoryContainerResultNode(queryResult, convertNodeToVisitItem);
- return Promise.resolve(results);
- },
-
- onVisited: new SingletonEventManager(context, "history.onVisited", fire => {
- let listener = (event, data) => {
- context.runSafe(fire, data);
- };
-
- getObserver().on("visited", listener);
- return () => {
- getObserver().off("visited", listener);
- };
- }).api(),
-
- onVisitRemoved: new SingletonEventManager(context, "history.onVisitRemoved", fire => {
- let listener = (event, data) => {
- context.runSafe(fire, data);
- };
-
- getObserver().on("visitRemoved", listener);
- return () => {
- getObserver().off("visitRemoved", listener);
- };
- }).api(),
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-omnibox.js b/application/basilisk/components/extensions/ext-omnibox.js
deleted file mode 100644
index 9b2f60ca4..000000000
--- a/application/basilisk/components/extensions/ext-omnibox.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "ExtensionSearchHandler",
- "resource://gre/modules/ExtensionSearchHandler.jsm");
-var {
- SingletonEventManager,
-} = ExtensionUtils;
-
-// WeakMap[extension -> keyword]
-let gKeywordMap = new WeakMap();
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("manifest_omnibox", (type, directive, extension, manifest) => {
- let keyword = manifest.omnibox.keyword;
- try {
- // This will throw if the keyword is already registered.
- ExtensionSearchHandler.registerKeyword(keyword, extension);
- gKeywordMap.set(extension, keyword);
- } catch (e) {
- extension.manifestError(e.message);
- }
-});
-
-extensions.on("shutdown", (type, extension) => {
- let keyword = gKeywordMap.get(extension);
- if (keyword) {
- ExtensionSearchHandler.unregisterKeyword(keyword);
- gKeywordMap.delete(extension);
- }
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-extensions.registerSchemaAPI("omnibox", "addon_parent", context => {
- let {extension} = context;
- return {
- omnibox: {
- setDefaultSuggestion(suggestion) {
- let keyword = gKeywordMap.get(extension);
- try {
- // This will throw if the keyword failed to register.
- ExtensionSearchHandler.setDefaultSuggestion(keyword, suggestion);
- } catch (e) {
- return Promise.reject(e.message);
- }
- },
-
- onInputStarted: new SingletonEventManager(context, "omnibox.onInputStarted", fire => {
- let listener = (eventName) => {
- fire();
- };
- extension.on(ExtensionSearchHandler.MSG_INPUT_STARTED, listener);
- return () => {
- extension.off(ExtensionSearchHandler.MSG_INPUT_STARTED, listener);
- };
- }).api(),
-
- onInputCancelled: new SingletonEventManager(context, "omnibox.onInputCancelled", fire => {
- let listener = (eventName) => {
- fire();
- };
- extension.on(ExtensionSearchHandler.MSG_INPUT_CANCELLED, listener);
- return () => {
- extension.off(ExtensionSearchHandler.MSG_INPUT_CANCELLED, listener);
- };
- }).api(),
-
- onInputEntered: new SingletonEventManager(context, "omnibox.onInputEntered", fire => {
- let listener = (eventName, text, disposition) => {
- fire(text, disposition);
- };
- extension.on(ExtensionSearchHandler.MSG_INPUT_ENTERED, listener);
- return () => {
- extension.off(ExtensionSearchHandler.MSG_INPUT_ENTERED, listener);
- };
- }).api(),
- },
-
- omnibox_internal: {
- addSuggestions(id, suggestions) {
- let keyword = gKeywordMap.get(extension);
- try {
- ExtensionSearchHandler.addSuggestions(keyword, id, suggestions);
- } catch (e) {
- // Silently fail because the extension developer can not know for sure if the user
- // has already invalidated the callback when asynchronously providing suggestions.
- }
- },
-
- onInputChanged: new SingletonEventManager(context, "omnibox_internal.onInputChanged", fire => {
- let listener = (eventName, text, id) => {
- fire(text, id);
- };
- extension.on(ExtensionSearchHandler.MSG_INPUT_CHANGED, listener);
- return () => {
- extension.off(ExtensionSearchHandler.MSG_INPUT_CHANGED, listener);
- };
- }).api(),
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-pageAction.js b/application/basilisk/components/extensions/ext-pageAction.js
deleted file mode 100644
index 4e3299690..000000000
--- a/application/basilisk/components/extensions/ext-pageAction.js
+++ /dev/null
@@ -1,310 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-Cu.import("resource://gre/modules/Task.jsm");
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-var {
- EventManager,
- IconDetails,
-} = ExtensionUtils;
-
-// WeakMap[Extension -> PageAction]
-var pageActionMap = new WeakMap();
-
-// Handles URL bar icons, including the |page_action| manifest entry
-// and associated API.
-function PageAction(options, extension) {
- this.extension = extension;
- this.id = makeWidgetId(extension.id) + "-page-action";
-
- this.tabManager = TabManager.for(extension);
-
- this.defaults = {
- show: false,
- title: options.default_title || extension.name,
- icon: IconDetails.normalize({path: options.default_icon}, extension),
- popup: options.default_popup || "",
- };
-
- this.browserStyle = options.browser_style || false;
- if (options.browser_style === null) {
- this.extension.logger.warn("Please specify whether you want browser_style " +
- "or not in your page_action options.");
- }
-
- this.tabContext = new TabContext(tab => Object.create(this.defaults),
- extension);
-
- this.tabContext.on("location-change", this.handleLocationChange.bind(this)); // eslint-disable-line mozilla/balanced-listeners
-
- // WeakMap[ChromeWindow -> <xul:image>]
- this.buttons = new WeakMap();
-
- EventEmitter.decorate(this);
-}
-
-PageAction.prototype = {
- // Returns the value of the property |prop| for the given tab, where
- // |prop| is one of "show", "title", "icon", "popup".
- getProperty(tab, prop) {
- return this.tabContext.get(tab)[prop];
- },
-
- // Sets the value of the property |prop| for the given tab to the
- // given value, symmetrically to |getProperty|.
- //
- // If |tab| is currently selected, updates the page action button to
- // reflect the new value.
- setProperty(tab, prop, value) {
- if (value != null) {
- this.tabContext.get(tab)[prop] = value;
- } else {
- delete this.tabContext.get(tab)[prop];
- }
-
- if (tab.selected) {
- this.updateButton(tab.ownerGlobal);
- }
- },
-
- // Updates the page action button in the given window to reflect the
- // properties of the currently selected tab:
- //
- // Updates "tooltiptext" and "aria-label" to match "title" property.
- // Updates "image" to match the "icon" property.
- // Shows or hides the icon, based on the "show" property.
- updateButton(window) {
- let tabData = this.tabContext.get(window.gBrowser.selectedTab);
-
- if (!(tabData.show || this.buttons.has(window))) {
- // Don't bother creating a button for a window until it actually
- // needs to be shown.
- return;
- }
-
- let button = this.getButton(window);
-
- if (tabData.show) {
- // Update the title and icon only if the button is visible.
-
- let title = tabData.title || this.extension.name;
- button.setAttribute("tooltiptext", title);
- button.setAttribute("aria-label", title);
-
- // These URLs should already be properly escaped, but make doubly sure CSS
- // string escape characters are escaped here, since they could lead to a
- // sandbox break.
- let escape = str => str.replace(/[\\\s"]/g, encodeURIComponent);
-
- let getIcon = size => escape(IconDetails.getPreferredIcon(tabData.icon, this.extension, size).icon);
-
- button.setAttribute("style", `
- --webextension-urlbar-image: url("${getIcon(16)}");
- --webextension-urlbar-image-2x: url("${getIcon(32)}");
- `);
-
- button.classList.add("webextension-page-action");
- }
-
- button.hidden = !tabData.show;
- },
-
- // Create an |image| node and add it to the |urlbar-icons|
- // container in the given window.
- addButton(window) {
- let document = window.document;
-
- let button = document.createElement("image");
- button.id = this.id;
- button.setAttribute("class", "urlbar-icon");
-
- button.addEventListener("click", this); // eslint-disable-line mozilla/balanced-listeners
- document.addEventListener("popupshowing", this);
-
- document.getElementById("urlbar-icons").appendChild(button);
-
- return button;
- },
-
- // Returns the page action button for the given window, creating it if
- // it doesn't already exist.
- getButton(window) {
- if (!this.buttons.has(window)) {
- let button = this.addButton(window);
- this.buttons.set(window, button);
- }
-
- return this.buttons.get(window);
- },
-
- /**
- * Triggers this page action for the given window, with the same effects as
- * if it were clicked by a user.
- *
- * This has no effect if the page action is hidden for the selected tab.
- *
- * @param {Window} window
- */
- triggerAction(window) {
- let pageAction = pageActionMap.get(this.extension);
- if (pageAction.getProperty(window.gBrowser.selectedTab, "show")) {
- pageAction.handleClick(window);
- }
- },
-
- handleEvent(event) {
- const window = event.target.ownerDocument.defaultView;
-
- switch (event.type) {
- case "click":
- if (event.button === 0) {
- this.handleClick(window);
- }
- break;
-
- case "popupshowing":
- const menu = event.target;
- const trigger = menu.triggerNode;
-
- if (menu.id === "toolbar-context-menu" && trigger && trigger.id === this.id) {
- global.actionContextMenu({
- extension: this.extension,
- onPageAction: true,
- menu: menu,
- });
- }
- break;
- }
- },
-
- // Handles a click event on the page action button for the given
- // window.
- // If the page action has a |popup| property, a panel is opened to
- // that URL. Otherwise, a "click" event is emitted, and dispatched to
- // the any click listeners in the add-on.
- handleClick(window) {
- let tab = window.gBrowser.selectedTab;
- let popupURL = this.tabContext.get(tab).popup;
-
- this.tabManager.addActiveTabPermission(tab);
-
- // If the widget has a popup URL defined, we open a popup, but do not
- // dispatch a click event to the extension.
- // If it has no popup URL defined, we dispatch a click event, but do not
- // open a popup.
- if (popupURL) {
- new PanelPopup(this.extension, this.getButton(window), popupURL,
- this.browserStyle);
- } else {
- this.emit("click", tab);
- }
- },
-
- handleLocationChange(eventType, tab, fromBrowse) {
- if (fromBrowse) {
- this.tabContext.clear(tab);
- }
- this.updateButton(tab.ownerGlobal);
- },
-
- shutdown() {
- this.tabContext.shutdown();
-
- for (let window of WindowListManager.browserWindows()) {
- if (this.buttons.has(window)) {
- this.buttons.get(window).remove();
- window.removeEventListener("popupshowing", this);
- }
- }
- },
-};
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("manifest_page_action", (type, directive, extension, manifest) => {
- let pageAction = new PageAction(manifest.page_action, extension);
- pageActionMap.set(extension, pageAction);
-});
-
-extensions.on("shutdown", (type, extension) => {
- if (pageActionMap.has(extension)) {
- pageActionMap.get(extension).shutdown();
- pageActionMap.delete(extension);
- }
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-PageAction.for = extension => {
- return pageActionMap.get(extension);
-};
-
-global.pageActionFor = PageAction.for;
-
-extensions.registerSchemaAPI("pageAction", "addon_parent", context => {
- let {extension} = context;
- return {
- pageAction: {
- onClicked: new EventManager(context, "pageAction.onClicked", fire => {
- let listener = (evt, tab) => {
- fire(TabManager.convert(extension, tab));
- };
- let pageAction = PageAction.for(extension);
-
- pageAction.on("click", listener);
- return () => {
- pageAction.off("click", listener);
- };
- }).api(),
-
- show(tabId) {
- let tab = TabManager.getTab(tabId, context);
- PageAction.for(extension).setProperty(tab, "show", true);
- },
-
- hide(tabId) {
- let tab = TabManager.getTab(tabId, context);
- PageAction.for(extension).setProperty(tab, "show", false);
- },
-
- setTitle(details) {
- let tab = TabManager.getTab(details.tabId, context);
-
- // Clear the tab-specific title when given a null string.
- PageAction.for(extension).setProperty(tab, "title", details.title || null);
- },
-
- getTitle(details) {
- let tab = TabManager.getTab(details.tabId, context);
-
- let title = PageAction.for(extension).getProperty(tab, "title");
- return Promise.resolve(title);
- },
-
- setIcon(details) {
- let tab = TabManager.getTab(details.tabId, context);
-
- let icon = IconDetails.normalize(details, extension, context);
- PageAction.for(extension).setProperty(tab, "icon", icon);
- },
-
- setPopup(details) {
- let tab = TabManager.getTab(details.tabId, context);
-
- // Note: Chrome resolves arguments to setIcon relative to the calling
- // context, but resolves arguments to setPopup relative to the extension
- // root.
- // For internal consistency, we currently resolve both relative to the
- // calling context.
- let url = details.popup && context.uri.resolve(details.popup);
- PageAction.for(extension).setProperty(tab, "popup", url);
- },
-
- getPopup(details) {
- let tab = TabManager.getTab(details.tabId, context);
-
- let popup = PageAction.for(extension).getProperty(tab, "popup");
- return Promise.resolve(popup);
- },
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-sessions.js b/application/basilisk/components/extensions/ext-sessions.js
deleted file mode 100644
index 3052957d6..000000000
--- a/application/basilisk/components/extensions/ext-sessions.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-var {
- promiseObserved,
- SingletonEventManager,
-} = ExtensionUtils;
-
-XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
- "resource:///modules/sessionstore/SessionStore.jsm");
-
-const SS_ON_CLOSED_OBJECTS_CHANGED = "sessionstore-closed-objects-changed";
-
-function getRecentlyClosed(maxResults, extension) {
- let recentlyClosed = [];
-
- // Get closed windows
- let closedWindowData = SessionStore.getClosedWindowData(false);
- for (let window of closedWindowData) {
- recentlyClosed.push({
- lastModified: window.closedAt,
- window: WindowManager.convertFromSessionStoreClosedData(window, extension)});
- }
-
- // Get closed tabs
- for (let window of WindowListManager.browserWindows()) {
- let closedTabData = SessionStore.getClosedTabData(window, false);
- for (let tab of closedTabData) {
- recentlyClosed.push({
- lastModified: tab.closedAt,
- tab: TabManager.for(extension).convertFromSessionStoreClosedData(tab, window)});
- }
- }
-
- // Sort windows and tabs
- recentlyClosed.sort((a, b) => b.lastModified - a.lastModified);
- return recentlyClosed.slice(0, maxResults);
-}
-
-function createSession(restored, extension, sessionId) {
- if (!restored) {
- return Promise.reject({message: `Could not restore object using sessionId ${sessionId}.`});
- }
- let sessionObj = {lastModified: Date.now()};
- if (restored instanceof Ci.nsIDOMChromeWindow) {
- return promiseObserved("sessionstore-single-window-restored", subject => subject == restored).then(() => {
- sessionObj.window = WindowManager.convert(extension, restored, {populate: true});
- return Promise.resolve([sessionObj]);
- });
- }
- sessionObj.tab = TabManager.for(extension).convert(restored);
- return Promise.resolve([sessionObj]);
-}
-
-extensions.registerSchemaAPI("sessions", "addon_parent", context => {
- let {extension} = context;
- return {
- sessions: {
- getRecentlyClosed: function(filter) {
- let maxResults = filter.maxResults == undefined ? this.MAX_SESSION_RESULTS : filter.maxResults;
- return Promise.resolve(getRecentlyClosed(maxResults, extension));
- },
-
- restore: function(sessionId) {
- let session, closedId;
- if (sessionId) {
- closedId = sessionId;
- session = SessionStore.undoCloseById(closedId);
- } else if (SessionStore.lastClosedObjectType == "window") {
- // If the most recently closed object is a window, just undo closing the most recent window.
- session = SessionStore.undoCloseWindow(0);
- } else {
- // It is a tab, and we cannot call SessionStore.undoCloseTab without a window,
- // so we must find the tab in which case we can just use its closedId.
- let recentlyClosedTabs = [];
- for (let window of WindowListManager.browserWindows()) {
- let closedTabData = SessionStore.getClosedTabData(window, false);
- for (let tab of closedTabData) {
- recentlyClosedTabs.push(tab);
- }
- }
-
- // Sort the tabs.
- recentlyClosedTabs.sort((a, b) => b.closedAt - a.closedAt);
-
- // Use the closedId of the most recently closed tab to restore it.
- closedId = recentlyClosedTabs[0].closedId;
- session = SessionStore.undoCloseById(closedId);
- }
- return createSession(session, extension, closedId);
- },
-
- onChanged: new SingletonEventManager(context, "sessions.onChanged", fire => {
- let observer = () => {
- context.runSafe(fire);
- };
-
- Services.obs.addObserver(observer, SS_ON_CLOSED_OBJECTS_CHANGED, false);
- return () => {
- Services.obs.removeObserver(observer, SS_ON_CLOSED_OBJECTS_CHANGED);
- };
- }).api(),
- },
- };
-});
diff --git a/application/basilisk/components/extensions/ext-tabs.js b/application/basilisk/components/extensions/ext-tabs.js
deleted file mode 100644
index f7b9b3468..000000000
--- a/application/basilisk/components/extensions/ext-tabs.js
+++ /dev/null
@@ -1,1105 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
- "@mozilla.org/browser/aboutnewtab-service;1",
- "nsIAboutNewTabService");
-
-XPCOMUtils.defineLazyModuleGetter(this, "MatchPattern",
- "resource://gre/modules/MatchPattern.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
- "resource://gre/modules/PrivateBrowsingUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
- "resource://gre/modules/PromiseUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Services",
- "resource://gre/modules/Services.jsm");
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-var {
- EventManager,
- ignoreEvent,
-} = ExtensionUtils;
-
-// This function is pretty tightly tied to Extension.jsm.
-// Its job is to fill in the |tab| property of the sender.
-function getSender(extension, target, sender) {
- let tabId;
- if ("tabId" in sender) {
- // The message came from a privileged extension page running in a tab. In
- // that case, it should include a tabId property (which is filled in by the
- // page-open listener below).
- tabId = sender.tabId;
- delete sender.tabId;
- } else if (target instanceof Ci.nsIDOMXULElement) {
- tabId = getBrowserInfo(target).tabId;
- }
-
- if (tabId) {
- let tab = TabManager.getTab(tabId, null, null);
- if (tab) {
- sender.tab = TabManager.convert(extension, tab);
- }
- }
-}
-
-// Used by Extension.jsm
-global.tabGetSender = getSender;
-
-/* eslint-disable mozilla/balanced-listeners */
-
-extensions.on("page-shutdown", (type, context) => {
- if (context.viewType == "tab") {
- if (context.extension.id !== context.xulBrowser.contentPrincipal.addonId) {
- // Only close extension tabs.
- // This check prevents about:addons from closing when it contains a
- // WebExtension as an embedded inline options page.
- return;
- }
- let {gBrowser} = context.xulBrowser.ownerGlobal;
- if (gBrowser) {
- let tab = gBrowser.getTabForBrowser(context.xulBrowser);
- if (tab) {
- gBrowser.removeTab(tab);
- }
- }
- }
-});
-
-extensions.on("fill-browser-data", (type, browser, data) => {
- let tabId, windowId;
- if (browser) {
- ({tabId, windowId} = getBrowserInfo(browser));
- }
-
- data.tabId = tabId || -1;
- data.windowId = windowId || -1;
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-global.currentWindow = function(context) {
- let {xulWindow} = context;
- if (xulWindow && context.viewType != "background") {
- return xulWindow;
- }
- return WindowManager.topWindow;
-};
-
-let tabListener = {
- init() {
- if (this.initialized) {
- return;
- }
-
- this.adoptedTabs = new WeakMap();
-
- this.handleWindowOpen = this.handleWindowOpen.bind(this);
- this.handleWindowClose = this.handleWindowClose.bind(this);
-
- AllWindowEvents.addListener("TabClose", this);
- AllWindowEvents.addListener("TabOpen", this);
- WindowListManager.addOpenListener(this.handleWindowOpen);
- WindowListManager.addCloseListener(this.handleWindowClose);
-
- EventEmitter.decorate(this);
-
- this.initialized = true;
- },
-
- handleEvent(event) {
- switch (event.type) {
- case "TabOpen":
- if (event.detail.adoptedTab) {
- this.adoptedTabs.set(event.detail.adoptedTab, event.target);
- }
-
- // We need to delay sending this event until the next tick, since the
- // tab does not have its final index when the TabOpen event is dispatched.
- Promise.resolve().then(() => {
- if (event.detail.adoptedTab) {
- this.emitAttached(event.originalTarget);
- } else {
- this.emitCreated(event.originalTarget);
- }
- });
- break;
-
- case "TabClose":
- let tab = event.originalTarget;
-
- if (event.detail.adoptedBy) {
- this.emitDetached(tab, event.detail.adoptedBy);
- } else {
- this.emitRemoved(tab, false);
- }
- break;
- }
- },
-
- handleWindowOpen(window) {
- if (window.arguments && window.arguments[0] instanceof window.XULElement) {
- // If the first window argument is a XUL element, it means the
- // window is about to adopt a tab from another window to replace its
- // initial tab.
- //
- // Note that this event handler depends on running before the
- // delayed startup code in browser.js, which is currently triggered
- // by the first MozAfterPaint event. That code handles finally
- // adopting the tab, and clears it from the arguments list in the
- // process, so if we run later than it, we're too late.
- let tab = window.arguments[0];
- this.adoptedTabs.set(tab, window.gBrowser.tabs[0]);
-
- // We need to be sure to fire this event after the onDetached event
- // for the original tab.
- let listener = (event, details) => {
- if (details.tab == tab) {
- this.off("tab-detached", listener);
-
- Promise.resolve().then(() => {
- this.emitAttached(details.adoptedBy);
- });
- }
- };
-
- this.on("tab-detached", listener);
- } else {
- for (let tab of window.gBrowser.tabs) {
- this.emitCreated(tab);
- }
- }
- },
-
- handleWindowClose(window) {
- for (let tab of window.gBrowser.tabs) {
- if (this.adoptedTabs.has(tab)) {
- this.emitDetached(tab, this.adoptedTabs.get(tab));
- } else {
- this.emitRemoved(tab, true);
- }
- }
- },
-
- emitAttached(tab) {
- let newWindowId = WindowManager.getId(tab.ownerGlobal);
- let tabId = TabManager.getId(tab);
-
- this.emit("tab-attached", {tab, tabId, newWindowId, newPosition: tab._tPos});
- },
-
- emitDetached(tab, adoptedBy) {
- let oldWindowId = WindowManager.getId(tab.ownerGlobal);
- let tabId = TabManager.getId(tab);
-
- this.emit("tab-detached", {tab, adoptedBy, tabId, oldWindowId, oldPosition: tab._tPos});
- },
-
- emitCreated(tab) {
- this.emit("tab-created", {tab});
- },
-
- emitRemoved(tab, isWindowClosing) {
- let windowId = WindowManager.getId(tab.ownerGlobal);
- let tabId = TabManager.getId(tab);
-
- // When addons run in-process, `window.close()` is synchronous. Most other
- // addon-invoked calls are asynchronous since they go through a proxy
- // context via the message manager. This includes event registrations such
- // as `tabs.onRemoved.addListener`.
- // So, even if `window.close()` were to be called (in-process) after calling
- // `tabs.onRemoved.addListener`, then the tab would be closed before the
- // event listener is registered. To make sure that the event listener is
- // notified, we dispatch `tabs.onRemoved` asynchronously.
- Services.tm.mainThread.dispatch(() => {
- this.emit("tab-removed", {tab, tabId, windowId, isWindowClosing});
- }, Ci.nsIThread.DISPATCH_NORMAL);
- },
-
- tabReadyInitialized: false,
- tabReadyPromises: new WeakMap(),
- initializingTabs: new WeakSet(),
-
- initTabReady() {
- if (!this.tabReadyInitialized) {
- AllWindowEvents.addListener("progress", this);
-
- this.tabReadyInitialized = true;
- }
- },
-
- onLocationChange(browser, webProgress, request, locationURI, flags) {
- if (webProgress.isTopLevel) {
- let gBrowser = browser.ownerGlobal.gBrowser;
- let tab = gBrowser.getTabForBrowser(browser);
-
- // Now we are certain that the first page in the tab was loaded.
- this.initializingTabs.delete(tab);
-
- // browser.innerWindowID is now set, resolve the promises if any.
- let deferred = this.tabReadyPromises.get(tab);
- if (deferred) {
- deferred.resolve(tab);
- this.tabReadyPromises.delete(tab);
- }
- }
- },
-
- /**
- * Returns a promise that resolves when the tab is ready.
- * Tabs created via the `tabs.create` method are "ready" once the location
- * changes to the requested URL. Other tabs are assumed to be ready once their
- * inner window ID is known.
- *
- * @param {XULElement} tab The <tab> element.
- * @returns {Promise} Resolves with the given tab once ready.
- */
- awaitTabReady(tab) {
- let deferred = this.tabReadyPromises.get(tab);
- if (!deferred) {
- deferred = PromiseUtils.defer();
- if (!this.initializingTabs.has(tab) && tab.linkedBrowser.innerWindowID) {
- deferred.resolve(tab);
- } else {
- this.initTabReady();
- this.tabReadyPromises.set(tab, deferred);
- }
- }
- return deferred.promise;
- },
-};
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("startup", () => {
- tabListener.init();
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-extensions.registerSchemaAPI("tabs", "addon_parent", context => {
- let {extension} = context;
- let self = {
- tabs: {
- onActivated: new WindowEventManager(context, "tabs.onActivated", "TabSelect", (fire, event) => {
- let tab = event.originalTarget;
- let tabId = TabManager.getId(tab);
- let windowId = WindowManager.getId(tab.ownerGlobal);
- fire({tabId, windowId});
- }).api(),
-
- onCreated: new EventManager(context, "tabs.onCreated", fire => {
- let listener = (eventName, event) => {
- fire(TabManager.convert(extension, event.tab));
- };
-
- tabListener.on("tab-created", listener);
- return () => {
- tabListener.off("tab-created", listener);
- };
- }).api(),
-
- /**
- * Since multiple tabs currently can't be highlighted, onHighlighted
- * essentially acts an alias for self.tabs.onActivated but returns
- * the tabId in an array to match the API.
- * @see https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/Tabs/onHighlighted
- */
- onHighlighted: new WindowEventManager(context, "tabs.onHighlighted", "TabSelect", (fire, event) => {
- let tab = event.originalTarget;
- let tabIds = [TabManager.getId(tab)];
- let windowId = WindowManager.getId(tab.ownerGlobal);
- fire({tabIds, windowId});
- }).api(),
-
- onAttached: new EventManager(context, "tabs.onAttached", fire => {
- let listener = (eventName, event) => {
- fire(event.tabId, {newWindowId: event.newWindowId, newPosition: event.newPosition});
- };
-
- tabListener.on("tab-attached", listener);
- return () => {
- tabListener.off("tab-attached", listener);
- };
- }).api(),
-
- onDetached: new EventManager(context, "tabs.onDetached", fire => {
- let listener = (eventName, event) => {
- fire(event.tabId, {oldWindowId: event.oldWindowId, oldPosition: event.oldPosition});
- };
-
- tabListener.on("tab-detached", listener);
- return () => {
- tabListener.off("tab-detached", listener);
- };
- }).api(),
-
- onRemoved: new EventManager(context, "tabs.onRemoved", fire => {
- let listener = (eventName, event) => {
- fire(event.tabId, {windowId: event.windowId, isWindowClosing: event.isWindowClosing});
- };
-
- tabListener.on("tab-removed", listener);
- return () => {
- tabListener.off("tab-removed", listener);
- };
- }).api(),
-
- onReplaced: ignoreEvent(context, "tabs.onReplaced"),
-
- onMoved: new EventManager(context, "tabs.onMoved", fire => {
- // There are certain circumstances where we need to ignore a move event.
- //
- // Namely, the first time the tab is moved after it's created, we need
- // to report the final position as the initial position in the tab's
- // onAttached or onCreated event. This is because most tabs are inserted
- // in a temporary location and then moved after the TabOpen event fires,
- // which generates a TabOpen event followed by a TabMove event, which
- // does not match the contract of our API.
- let ignoreNextMove = new WeakSet();
-
- let openListener = event => {
- ignoreNextMove.add(event.target);
- // Remove the tab from the set on the next tick, since it will already
- // have been moved by then.
- Promise.resolve().then(() => {
- ignoreNextMove.delete(event.target);
- });
- };
-
- let moveListener = event => {
- let tab = event.originalTarget;
-
- if (ignoreNextMove.has(tab)) {
- ignoreNextMove.delete(tab);
- return;
- }
-
- fire(TabManager.getId(tab), {
- windowId: WindowManager.getId(tab.ownerGlobal),
- fromIndex: event.detail,
- toIndex: tab._tPos,
- });
- };
-
- AllWindowEvents.addListener("TabMove", moveListener);
- AllWindowEvents.addListener("TabOpen", openListener);
- return () => {
- AllWindowEvents.removeListener("TabMove", moveListener);
- AllWindowEvents.removeListener("TabOpen", openListener);
- };
- }).api(),
-
- onUpdated: new EventManager(context, "tabs.onUpdated", fire => {
- const restricted = ["url", "favIconUrl", "title"];
-
- function sanitize(extension, changeInfo) {
- let result = {};
- let nonempty = false;
- for (let prop in changeInfo) {
- if (extension.hasPermission("tabs") || !restricted.includes(prop)) {
- nonempty = true;
- result[prop] = changeInfo[prop];
- }
- }
- return [nonempty, result];
- }
-
- let fireForBrowser = (browser, changed) => {
- let [needed, changeInfo] = sanitize(extension, changed);
- if (needed) {
- let gBrowser = browser.ownerGlobal.gBrowser;
- let tabElem = gBrowser.getTabForBrowser(browser);
-
- let tab = TabManager.convert(extension, tabElem);
- fire(tab.id, changeInfo, tab);
- }
- };
-
- let listener = event => {
- let needed = [];
- if (event.type == "TabAttrModified") {
- let changed = event.detail.changed;
- if (changed.includes("image")) {
- needed.push("favIconUrl");
- }
- if (changed.includes("muted")) {
- needed.push("mutedInfo");
- }
- if (changed.includes("soundplaying")) {
- needed.push("audible");
- }
- if (changed.includes("label")) {
- needed.push("title");
- }
- } else if (event.type == "TabPinned") {
- needed.push("pinned");
- } else if (event.type == "TabUnpinned") {
- needed.push("pinned");
- }
-
- if (needed.length && !extension.hasPermission("tabs")) {
- needed = needed.filter(attr => !restricted.includes(attr));
- }
-
- if (needed.length) {
- let tab = TabManager.convert(extension, event.originalTarget);
-
- let changeInfo = {};
- for (let prop of needed) {
- changeInfo[prop] = tab[prop];
- }
- fire(tab.id, changeInfo, tab);
- }
- };
- let progressListener = {
- onStateChange(browser, webProgress, request, stateFlags, statusCode) {
- if (!webProgress.isTopLevel) {
- return;
- }
-
- let status;
- if (stateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {
- if (stateFlags & Ci.nsIWebProgressListener.STATE_START) {
- status = "loading";
- } else if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
- status = "complete";
- }
- } else if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
- statusCode == Cr.NS_BINDING_ABORTED) {
- status = "complete";
- }
-
- fireForBrowser(browser, {status});
- },
-
- onLocationChange(browser, webProgress, request, locationURI, flags) {
- if (!webProgress.isTopLevel) {
- return;
- }
-
- fireForBrowser(browser, {
- status: webProgress.isLoadingDocument ? "loading" : "complete",
- url: locationURI.spec,
- });
- },
- };
-
- AllWindowEvents.addListener("progress", progressListener);
- AllWindowEvents.addListener("TabAttrModified", listener);
- AllWindowEvents.addListener("TabPinned", listener);
- AllWindowEvents.addListener("TabUnpinned", listener);
-
- return () => {
- AllWindowEvents.removeListener("progress", progressListener);
- AllWindowEvents.removeListener("TabAttrModified", listener);
- AllWindowEvents.removeListener("TabPinned", listener);
- AllWindowEvents.removeListener("TabUnpinned", listener);
- };
- }).api(),
-
- create: function(createProperties) {
- return new Promise((resolve, reject) => {
- let window = createProperties.windowId !== null ?
- WindowManager.getWindow(createProperties.windowId, context) :
- WindowManager.topWindow;
- if (!window.gBrowser) {
- let obs = (finishedWindow, topic, data) => {
- if (finishedWindow != window) {
- return;
- }
- Services.obs.removeObserver(obs, "browser-delayed-startup-finished");
- resolve(window);
- };
- Services.obs.addObserver(obs, "browser-delayed-startup-finished", false);
- } else {
- resolve(window);
- }
- }).then(window => {
- let url;
-
- if (createProperties.url !== null) {
- url = context.uri.resolve(createProperties.url);
-
- if (!context.checkLoadURL(url, {dontReportErrors: true})) {
- return Promise.reject({message: `Illegal URL: ${url}`});
- }
- }
-
- if (createProperties.cookieStoreId && !extension.hasPermission("cookies")) {
- return Promise.reject({message: `No permission for cookieStoreId: ${createProperties.cookieStoreId}`});
- }
-
- let options = {};
- if (createProperties.cookieStoreId) {
- if (!global.isValidCookieStoreId(createProperties.cookieStoreId)) {
- return Promise.reject({message: `Illegal cookieStoreId: ${createProperties.cookieStoreId}`});
- }
-
- let privateWindow = PrivateBrowsingUtils.isBrowserPrivate(window.gBrowser);
- if (privateWindow && !global.isPrivateCookieStoreId(createProperties.cookieStoreId)) {
- return Promise.reject({message: `Illegal to set non-private cookieStorageId in a private window`});
- }
-
- if (!privateWindow && global.isPrivateCookieStoreId(createProperties.cookieStoreId)) {
- return Promise.reject({message: `Illegal to set private cookieStorageId in a non-private window`});
- }
-
- if (global.isContainerCookieStoreId(createProperties.cookieStoreId)) {
- let containerId = global.getContainerForCookieStoreId(createProperties.cookieStoreId);
- if (!containerId) {
- return Promise.reject({message: `No cookie store exists with ID ${createProperties.cookieStoreId}`});
- }
-
- options.userContextId = containerId;
- }
- }
-
- // Make sure things like about:blank and data: URIs never inherit,
- // and instead always get a NullPrincipal.
- options.disallowInheritPrincipal = true;
-
- tabListener.initTabReady();
- let tab = window.gBrowser.addTab(url || window.BROWSER_NEW_TAB_URL, options);
-
- let active = true;
- if (createProperties.active !== null) {
- active = createProperties.active;
- }
- if (active) {
- window.gBrowser.selectedTab = tab;
- }
-
- if (createProperties.index !== null) {
- window.gBrowser.moveTabTo(tab, createProperties.index);
- }
-
- if (createProperties.pinned) {
- window.gBrowser.pinTab(tab);
- }
-
- if (createProperties.url && !createProperties.url.startsWith("about:")) {
- // We can't wait for a location change event for about:newtab,
- // since it may be pre-rendered, in which case its initial
- // location change event has already fired.
-
- // Mark the tab as initializing, so that operations like
- // `executeScript` wait until the requested URL is loaded in
- // the tab before dispatching messages to the inner window
- // that contains the URL we're attempting to load.
- tabListener.initializingTabs.add(tab);
- }
-
- return TabManager.convert(extension, tab);
- });
- },
-
- remove: function(tabs) {
- if (!Array.isArray(tabs)) {
- tabs = [tabs];
- }
-
- for (let tabId of tabs) {
- let tab = TabManager.getTab(tabId, context);
- tab.ownerGlobal.gBrowser.removeTab(tab);
- }
-
- return Promise.resolve();
- },
-
- update: function(tabId, updateProperties) {
- let tab = tabId !== null ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- let tabbrowser = tab.ownerGlobal.gBrowser;
-
- if (updateProperties.url !== null) {
- let url = context.uri.resolve(updateProperties.url);
-
- if (!context.checkLoadURL(url, {dontReportErrors: true})) {
- return Promise.reject({message: `Illegal URL: ${url}`});
- }
-
- tab.linkedBrowser.loadURI(url);
- }
-
- if (updateProperties.active !== null) {
- if (updateProperties.active) {
- tabbrowser.selectedTab = tab;
- } else {
- // Not sure what to do here? Which tab should we select?
- }
- }
- if (updateProperties.muted !== null) {
- if (tab.muted != updateProperties.muted) {
- tab.toggleMuteAudio(extension.uuid);
- }
- }
- if (updateProperties.pinned !== null) {
- if (updateProperties.pinned) {
- tabbrowser.pinTab(tab);
- } else {
- tabbrowser.unpinTab(tab);
- }
- }
- // FIXME: highlighted/selected, openerTabId
-
- return Promise.resolve(TabManager.convert(extension, tab));
- },
-
- reload: function(tabId, reloadProperties) {
- let tab = tabId !== null ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
- if (reloadProperties && reloadProperties.bypassCache) {
- flags |= Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
- }
- tab.linkedBrowser.reloadWithFlags(flags);
-
- return Promise.resolve();
- },
-
- get: function(tabId) {
- let tab = TabManager.getTab(tabId, context);
-
- return Promise.resolve(TabManager.convert(extension, tab));
- },
-
- getCurrent() {
- let tab;
- if (context.tabId) {
- tab = TabManager.convert(extension, TabManager.getTab(context.tabId, context));
- }
- return Promise.resolve(tab);
- },
-
- query: function(queryInfo) {
- let pattern = null;
- if (queryInfo.url !== null) {
- if (!extension.hasPermission("tabs")) {
- return Promise.reject({message: 'The "tabs" permission is required to use the query API with the "url" parameter'});
- }
-
- pattern = new MatchPattern(queryInfo.url);
- }
-
- function matches(tab) {
- let props = ["active", "pinned", "highlighted", "status", "title", "index"];
- for (let prop of props) {
- if (queryInfo[prop] !== null && queryInfo[prop] != tab[prop]) {
- return false;
- }
- }
-
- if (queryInfo.audible !== null) {
- if (queryInfo.audible != tab.audible) {
- return false;
- }
- }
-
- if (queryInfo.muted !== null) {
- if (queryInfo.muted != tab.mutedInfo.muted) {
- return false;
- }
- }
-
- if (queryInfo.cookieStoreId !== null &&
- tab.cookieStoreId != queryInfo.cookieStoreId) {
- return false;
- }
-
- if (pattern && !pattern.matches(Services.io.newURI(tab.url))) {
- return false;
- }
-
- return true;
- }
-
- let result = [];
- for (let window of WindowListManager.browserWindows()) {
- let lastFocused = window === WindowManager.topWindow;
- if (queryInfo.lastFocusedWindow !== null && queryInfo.lastFocusedWindow !== lastFocused) {
- continue;
- }
-
- let windowType = WindowManager.windowType(window);
- if (queryInfo.windowType !== null && queryInfo.windowType !== windowType) {
- continue;
- }
-
- if (queryInfo.windowId !== null) {
- if (queryInfo.windowId === WindowManager.WINDOW_ID_CURRENT) {
- if (currentWindow(context) !== window) {
- continue;
- }
- } else if (queryInfo.windowId !== WindowManager.getId(window)) {
- continue;
- }
- }
-
- if (queryInfo.currentWindow !== null) {
- let eq = window === currentWindow(context);
- if (queryInfo.currentWindow != eq) {
- continue;
- }
- }
-
- let tabs = TabManager.for(extension).getTabs(window);
- for (let tab of tabs) {
- if (matches(tab)) {
- result.push(tab);
- }
- }
- }
- return Promise.resolve(result);
- },
-
- captureVisibleTab: function(windowId, options) {
- if (!extension.hasPermission("<all_urls>")) {
- return Promise.reject({message: "The <all_urls> permission is required to use the captureVisibleTab API"});
- }
-
- let window = windowId == null ?
- WindowManager.topWindow :
- WindowManager.getWindow(windowId, context);
-
- let tab = window.gBrowser.selectedTab;
- return tabListener.awaitTabReady(tab).then(() => {
- let browser = tab.linkedBrowser;
- let recipient = {
- innerWindowID: browser.innerWindowID,
- };
-
- if (!options) {
- options = {};
- }
- if (options.format == null) {
- options.format = "png";
- }
- if (options.quality == null) {
- options.quality = 92;
- }
-
- let message = {
- options,
- width: browser.clientWidth,
- height: browser.clientHeight,
- };
-
- return context.sendMessage(browser.messageManager, "Extension:Capture",
- message, {recipient});
- });
- },
-
- detectLanguage: function(tabId) {
- let tab = tabId !== null ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- return tabListener.awaitTabReady(tab).then(() => {
- let browser = tab.linkedBrowser;
- let recipient = {innerWindowID: browser.innerWindowID};
-
- return context.sendMessage(browser.messageManager, "Extension:DetectLanguage",
- {}, {recipient});
- });
- },
-
- // Used to executeScript, insertCSS and removeCSS.
- _execute: function(tabId, details, kind, method) {
- let tab = tabId !== null ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- let options = {
- js: [],
- css: [],
- remove_css: method == "removeCSS",
- };
-
- // We require a `code` or a `file` property, but we can't accept both.
- if ((details.code === null) == (details.file === null)) {
- return Promise.reject({message: `${method} requires either a 'code' or a 'file' property, but not both`});
- }
-
- if (details.frameId !== null && details.allFrames) {
- return Promise.reject({message: `'frameId' and 'allFrames' are mutually exclusive`});
- }
-
- if (TabManager.for(extension).hasActiveTabPermission(tab)) {
- // If we have the "activeTab" permission for this tab, ignore
- // the host whitelist.
- options.matchesHost = ["<all_urls>"];
- } else {
- options.matchesHost = extension.whiteListedHosts.serialize();
- }
-
- if (details.code !== null) {
- options[kind + "Code"] = details.code;
- }
- if (details.file !== null) {
- let url = context.uri.resolve(details.file);
- if (!extension.isExtensionURL(url)) {
- return Promise.reject({message: "Files to be injected must be within the extension"});
- }
- options[kind].push(url);
- }
- if (details.allFrames) {
- options.all_frames = details.allFrames;
- }
- if (details.frameId !== null) {
- options.frame_id = details.frameId;
- }
- if (details.matchAboutBlank) {
- options.match_about_blank = details.matchAboutBlank;
- }
- if (details.runAt !== null) {
- options.run_at = details.runAt;
- } else {
- options.run_at = "document_idle";
- }
- if (details.cssOrigin !== null) {
- options.css_origin = details.cssOrigin;
- } else {
- options.css_origin = "author";
- }
-
- return tabListener.awaitTabReady(tab).then(() => {
- let browser = tab.linkedBrowser;
- let recipient = {
- innerWindowID: browser.innerWindowID,
- };
-
- return context.sendMessage(browser.messageManager, "Extension:Execute", {options}, {recipient});
- });
- },
-
- executeScript: function(tabId, details) {
- return self.tabs._execute(tabId, details, "js", "executeScript");
- },
-
- insertCSS: function(tabId, details) {
- return self.tabs._execute(tabId, details, "css", "insertCSS").then(() => {});
- },
-
- removeCSS: function(tabId, details) {
- return self.tabs._execute(tabId, details, "css", "removeCSS").then(() => {});
- },
-
- move: function(tabIds, moveProperties) {
- let index = moveProperties.index;
- let tabsMoved = [];
- if (!Array.isArray(tabIds)) {
- tabIds = [tabIds];
- }
-
- let destinationWindow = null;
- if (moveProperties.windowId !== null) {
- destinationWindow = WindowManager.getWindow(moveProperties.windowId, context);
- // Fail on an invalid window.
- if (!destinationWindow) {
- return Promise.reject({message: `Invalid window ID: ${moveProperties.windowId}`});
- }
- }
-
- /*
- Indexes are maintained on a per window basis so that a call to
- move([tabA, tabB], {index: 0})
- -> tabA to 0, tabB to 1 if tabA and tabB are in the same window
- move([tabA, tabB], {index: 0})
- -> tabA to 0, tabB to 0 if tabA and tabB are in different windows
- */
- let indexMap = new Map();
-
- let tabs = tabIds.map(tabId => TabManager.getTab(tabId, context));
- for (let tab of tabs) {
- // If the window is not specified, use the window from the tab.
- let window = destinationWindow || tab.ownerGlobal;
- let gBrowser = window.gBrowser;
-
- let insertionPoint = indexMap.get(window) || index;
- // If the index is -1 it should go to the end of the tabs.
- if (insertionPoint == -1) {
- insertionPoint = gBrowser.tabs.length;
- }
-
- // We can only move pinned tabs to a point within, or just after,
- // the current set of pinned tabs. Unpinned tabs, likewise, can only
- // be moved to a position after the current set of pinned tabs.
- // Attempts to move a tab to an illegal position are ignored.
- let numPinned = gBrowser._numPinnedTabs;
- let ok = tab.pinned ? insertionPoint <= numPinned : insertionPoint >= numPinned;
- if (!ok) {
- continue;
- }
-
- indexMap.set(window, insertionPoint + 1);
-
- if (tab.ownerGlobal != window) {
- // If the window we are moving the tab in is different, then move the tab
- // to the new window.
- tab = gBrowser.adoptTab(tab, insertionPoint, false);
- } else {
- // If the window we are moving is the same, just move the tab.
- gBrowser.moveTabTo(tab, insertionPoint);
- }
- tabsMoved.push(tab);
- }
-
- return Promise.resolve(tabsMoved.map(tab => TabManager.convert(extension, tab)));
- },
-
- duplicate: function(tabId) {
- let tab = TabManager.getTab(tabId, context);
-
- let gBrowser = tab.ownerGlobal.gBrowser;
- let newTab = gBrowser.duplicateTab(tab);
-
- return new Promise(resolve => {
- // We need to use SSTabRestoring because any attributes set before
- // are ignored. SSTabRestored is too late and results in a jump in
- // the UI. See http://bit.ly/session-store-api for more information.
- newTab.addEventListener("SSTabRestoring", function listener() {
- // As the tab is restoring, move it to the correct position.
- newTab.removeEventListener("SSTabRestoring", listener);
- // Pinned tabs that are duplicated are inserted
- // after the existing pinned tab and pinned.
- if (tab.pinned) {
- gBrowser.pinTab(newTab);
- }
- gBrowser.moveTabTo(newTab, tab._tPos + 1);
- });
-
- newTab.addEventListener("SSTabRestored", function listener() {
- // Once it has been restored, select it and return the promise.
- newTab.removeEventListener("SSTabRestored", listener);
- gBrowser.selectedTab = newTab;
- return resolve(TabManager.convert(extension, newTab));
- });
- });
- },
-
- getZoom(tabId) {
- let tab = tabId ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- let {ZoomManager} = tab.ownerGlobal;
- let zoom = ZoomManager.getZoomForBrowser(tab.linkedBrowser);
-
- return Promise.resolve(zoom);
- },
-
- setZoom(tabId, zoom) {
- let tab = tabId ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- let {FullZoom, ZoomManager} = tab.ownerGlobal;
-
- if (zoom === 0) {
- // A value of zero means use the default zoom factor.
- return FullZoom.reset(tab.linkedBrowser);
- } else if (zoom >= ZoomManager.MIN && zoom <= ZoomManager.MAX) {
- FullZoom.setZoom(zoom, tab.linkedBrowser);
- } else {
- return Promise.reject({
- message: `Zoom value ${zoom} out of range (must be between ${ZoomManager.MIN} and ${ZoomManager.MAX})`,
- });
- }
-
- return Promise.resolve();
- },
-
- _getZoomSettings(tabId) {
- let tab = tabId ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- let {FullZoom} = tab.ownerGlobal;
-
- return {
- mode: "automatic",
- scope: FullZoom.siteSpecific ? "per-origin" : "per-tab",
- defaultZoomFactor: 1,
- };
- },
-
- getZoomSettings(tabId) {
- return Promise.resolve(this._getZoomSettings(tabId));
- },
-
- setZoomSettings(tabId, settings) {
- let tab = tabId ? TabManager.getTab(tabId, context) : TabManager.activeTab;
-
- let currentSettings = this._getZoomSettings(tab.id);
-
- if (!Object.keys(settings).every(key => settings[key] === currentSettings[key])) {
- return Promise.reject(`Unsupported zoom settings: ${JSON.stringify(settings)}`);
- }
- return Promise.resolve();
- },
-
- onZoomChange: new EventManager(context, "tabs.onZoomChange", fire => {
- let getZoomLevel = browser => {
- let {ZoomManager} = browser.ownerGlobal;
-
- return ZoomManager.getZoomForBrowser(browser);
- };
-
- // Stores the last known zoom level for each tab's browser.
- // WeakMap[<browser> -> number]
- let zoomLevels = new WeakMap();
-
- // Store the zoom level for all existing tabs.
- for (let window of WindowListManager.browserWindows()) {
- for (let tab of window.gBrowser.tabs) {
- let browser = tab.linkedBrowser;
- zoomLevels.set(browser, getZoomLevel(browser));
- }
- }
-
- let tabCreated = (eventName, event) => {
- let browser = event.tab.linkedBrowser;
- zoomLevels.set(browser, getZoomLevel(browser));
- };
-
-
- let zoomListener = event => {
- let browser = event.originalTarget;
-
- // For non-remote browsers, this event is dispatched on the document
- // rather than on the <browser>.
- if (browser instanceof Ci.nsIDOMDocument) {
- browser = browser.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDocShell)
- .chromeEventHandler;
- }
-
- let {gBrowser} = browser.ownerGlobal;
- let tab = gBrowser.getTabForBrowser(browser);
- if (!tab) {
- // We only care about zoom events in the top-level browser of a tab.
- return;
- }
-
- let oldZoomFactor = zoomLevels.get(browser);
- let newZoomFactor = getZoomLevel(browser);
-
- if (oldZoomFactor != newZoomFactor) {
- zoomLevels.set(browser, newZoomFactor);
-
- let tabId = TabManager.getId(tab);
- fire({
- tabId,
- oldZoomFactor,
- newZoomFactor,
- zoomSettings: self.tabs._getZoomSettings(tabId),
- });
- }
- };
-
- tabListener.on("tab-attached", tabCreated);
- tabListener.on("tab-created", tabCreated);
-
- AllWindowEvents.addListener("FullZoomChange", zoomListener);
- AllWindowEvents.addListener("TextZoomChange", zoomListener);
- return () => {
- tabListener.off("tab-attached", tabCreated);
- tabListener.off("tab-created", tabCreated);
-
- AllWindowEvents.removeListener("FullZoomChange", zoomListener);
- AllWindowEvents.removeListener("TextZoomChange", zoomListener);
- };
- }).api(),
- },
- };
- return self;
-});
diff --git a/application/basilisk/components/extensions/ext-theme.js b/application/basilisk/components/extensions/ext-theme.js
deleted file mode 100644
index 5ff39b79c..000000000
--- a/application/basilisk/components/extensions/ext-theme.js
+++ /dev/null
@@ -1,19 +0,0 @@
-"use strict";
-
-XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
- "resource://gre/modules/Preferences.jsm");
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("manifest_theme", (type, directive, extension, manifest) => {
- let enabled = Preferences.get("extensions.webextensions.themes.enabled");
- extension.emit("test-message", "themes-enabled", enabled);
-
- if (enabled) {
- // Apply theme only if themes are enabled.
- }
-});
-
-extensions.on("shutdown", (type, extension) => {
- // Remove theme only if it has been applied.
-});
-/* eslint-enable mozilla/balanced-listeners */
diff --git a/application/basilisk/components/extensions/ext-utils.js b/application/basilisk/components/extensions/ext-utils.js
deleted file mode 100644
index 14de1ae7d..000000000
--- a/application/basilisk/components/extensions/ext-utils.js
+++ /dev/null
@@ -1,1296 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
- "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
- "resource:///modules/E10SUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
- "resource://gre/modules/NetUtil.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
- "resource://gre/modules/PrivateBrowsingUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
- "resource://gre/modules/Timer.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "styleSheetService",
- "@mozilla.org/content/style-sheet-service;1",
- "nsIStyleSheetService");
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-const POPUP_LOAD_TIMEOUT_MS = 200;
-
-const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-
-var {
- DefaultWeakMap,
- EventManager,
- promiseEvent,
-} = ExtensionUtils;
-
-// This file provides some useful code for the |tabs| and |windows|
-// modules. All of the code is installed on |global|, which is a scope
-// shared among the different ext-*.js scripts.
-
-global.makeWidgetId = id => {
- id = id.toLowerCase();
- // FIXME: This allows for collisions.
- return id.replace(/[^a-z0-9_-]/g, "_");
-};
-
-function promisePopupShown(popup) {
- return new Promise(resolve => {
- if (popup.state == "open") {
- resolve();
- } else {
- popup.addEventListener("popupshown", function onPopupShown(event) {
- popup.removeEventListener("popupshown", onPopupShown);
- resolve();
- });
- }
- });
-}
-
-XPCOMUtils.defineLazyGetter(this, "popupStylesheets", () => {
- let stylesheets = ["chrome://browser/content/extension.css"];
-
-#ifdef XP_MACOSX
- stylesheets.push("chrome://browser/content/extension-mac.css");
-#endif
- return stylesheets;
-});
-
-XPCOMUtils.defineLazyGetter(this, "standaloneStylesheets", () => {
- let stylesheets = [];
-
-#ifdef XP_MACOSX
- stylesheets.push("chrome://browser/content/extension-mac-panel.css");
-#elif XP_WIN
- stylesheets.push("chrome://browser/content/extension-win-panel.css");
-#endif
- return stylesheets;
-});
-
-class BasePopup {
- constructor(extension, viewNode, popupURL, browserStyle, fixedWidth = false) {
- this.extension = extension;
- this.popupURL = popupURL;
- this.viewNode = viewNode;
- this.browserStyle = browserStyle;
- this.window = viewNode.ownerGlobal;
- this.destroyed = false;
- this.fixedWidth = fixedWidth;
-
- extension.callOnClose(this);
-
- this.contentReady = new Promise(resolve => {
- this._resolveContentReady = resolve;
- });
-
- this.viewNode.addEventListener(this.DESTROY_EVENT, this);
-
- let doc = viewNode.ownerDocument;
- let arrowContent = doc.getAnonymousElementByAttribute(this.panel, "class", "panel-arrowcontent");
- this.borderColor = doc.defaultView.getComputedStyle(arrowContent).borderTopColor;
-
- this.browser = null;
- this.browserLoaded = new Promise((resolve, reject) => {
- this.browserLoadedDeferred = {resolve, reject};
- });
- this.browserReady = this.createBrowser(viewNode, popupURL);
-
- BasePopup.instances.get(this.window).set(extension, this);
- }
-
- static for(extension, window) {
- return BasePopup.instances.get(window).get(extension);
- }
-
- close() {
- this.closePopup();
- }
-
- destroy() {
- this.extension.forgetOnClose(this);
-
- this.destroyed = true;
- this.browserLoadedDeferred.reject(new Error("Popup destroyed"));
- return this.browserReady.then(() => {
- this.destroyBrowser(this.browser, true);
- this.browser.remove();
-
- if (this.viewNode) {
- this.viewNode.removeEventListener(this.DESTROY_EVENT, this);
- this.viewNode.style.maxHeight = "";
- }
-
- if (this.panel) {
- this.panel.style.removeProperty("--arrowpanel-background");
- this.panel.style.removeProperty("--panel-arrow-image-vertical");
- }
-
- BasePopup.instances.get(this.window).delete(this.extension);
-
- this.browser = null;
- this.viewNode = null;
- });
- }
-
- destroyBrowser(browser, finalize = false) {
- let mm = browser.messageManager;
- // If the browser has already been removed from the document, because the
- // popup was closed externally, there will be no message manager here, so
- // just replace our receiveMessage method with a stub.
- if (mm) {
- mm.removeMessageListener("DOMTitleChanged", this);
- mm.removeMessageListener("Extension:BrowserBackgroundChanged", this);
- mm.removeMessageListener("Extension:BrowserContentLoaded", this);
- mm.removeMessageListener("Extension:BrowserResized", this);
- mm.removeMessageListener("Extension:DOMWindowClose", this);
- } else if (finalize) {
- this.receiveMessage = () => {};
- }
- }
-
- // Returns the name of the event fired on `viewNode` when the popup is being
- // destroyed. This must be implemented by every subclass.
- get DESTROY_EVENT() {
- throw new Error("Not implemented");
- }
-
- get STYLESHEETS() {
- let sheets = [];
-
- if (this.browserStyle) {
- sheets.push(...popupStylesheets);
- }
- if (!this.fixedWidth) {
- sheets.push(...standaloneStylesheets);
- }
-
- return sheets;
- }
-
- get panel() {
- let panel = this.viewNode;
- while (panel && panel.localName != "panel") {
- panel = panel.parentNode;
- }
- return panel;
- }
-
- receiveMessage({name, data}) {
- switch (name) {
- case "DOMTitleChanged":
- this.viewNode.setAttribute("aria-label", this.browser.contentTitle);
- break;
-
- case "Extension:BrowserBackgroundChanged":
- this.setBackground(data.background);
- break;
-
- case "Extension:BrowserContentLoaded":
- this.browserLoadedDeferred.resolve();
- break;
-
- case "Extension:BrowserResized":
- this._resolveContentReady();
- if (this.ignoreResizes) {
- this.dimensions = data;
- } else {
- this.resizeBrowser(data);
- }
- break;
-
- case "Extension:DOMWindowClose":
- this.closePopup();
- break;
- }
- }
-
- handleEvent(event) {
- switch (event.type) {
- case this.DESTROY_EVENT:
- if (!this.destroyed) {
- this.destroy();
- }
- break;
- }
- }
-
- createBrowser(viewNode, popupURL = null) {
- let document = viewNode.ownerDocument;
- let browser = document.createElementNS(XUL_NS, "browser");
- browser.setAttribute("type", "content");
- browser.setAttribute("disableglobalhistory", "true");
- browser.setAttribute("transparent", "true");
- browser.setAttribute("class", "webextension-popup-browser");
- browser.setAttribute("webextension-view-type", "popup");
- browser.setAttribute("tooltip", "aHTMLTooltip");
-
- if (this.extension.remote) {
- browser.setAttribute("remote", "true");
- browser.setAttribute("remoteType", E10SUtils.EXTENSION_REMOTE_TYPE);
- }
-
- // We only need flex sizing for the sake of the slide-in sub-views of the
- // main menu panel, so that the browser occupies the full width of the view,
- // and also takes up any extra height that's available to it.
- browser.setAttribute("flex", "1");
-
- // Note: When using noautohide panels, the popup manager will add width and
- // height attributes to the panel, breaking our resize code, if the browser
- // starts out smaller than 30px by 10px. This isn't an issue now, but it
- // will be if and when we popup debugging.
-
- this.browser = browser;
-
- let readyPromise;
- if (this.extension.remote) {
- readyPromise = promiseEvent(browser, "XULFrameLoaderCreated");
- } else {
- readyPromise = promiseEvent(browser, "load");
- }
-
- viewNode.appendChild(browser);
-
- extensions.emit("extension-browser-inserted", browser);
-
- let setupBrowser = browser => {
- let mm = browser.messageManager;
- mm.addMessageListener("DOMTitleChanged", this);
- mm.addMessageListener("Extension:BrowserBackgroundChanged", this);
- mm.addMessageListener("Extension:BrowserContentLoaded", this);
- mm.addMessageListener("Extension:BrowserResized", this);
- mm.addMessageListener("Extension:DOMWindowClose", this, true);
- return browser;
- };
-
- if (!popupURL) {
- // For remote browsers, we can't do any setup until the frame loader is
- // created. Non-remote browsers get a message manager immediately, so
- // there's no need to wait for the load event.
- if (this.extension.remote) {
- return readyPromise.then(() => setupBrowser(browser));
- }
- return setupBrowser(browser);
- }
-
- return readyPromise.then(() => {
- setupBrowser(browser);
- let mm = browser.messageManager;
-
- mm.loadFrameScript(
- "chrome://extensions/content/ext-browser-content.js", false);
-
- mm.sendAsyncMessage("Extension:InitBrowser", {
- allowScriptsToClose: true,
- fixedWidth: this.fixedWidth,
- maxWidth: 800,
- maxHeight: 600,
- stylesheets: this.STYLESHEETS,
- });
-
- browser.loadURI(popupURL);
- });
- }
-
- resizeBrowser({width, height, detail}) {
- if (this.fixedWidth) {
- // Figure out how much extra space we have on the side of the panel
- // opposite the arrow.
- let side = this.panel.getAttribute("side") == "top" ? "bottom" : "top";
- let maxHeight = this.viewHeight + this.extraHeight[side];
-
- height = Math.min(height, maxHeight);
- this.browser.style.height = `${height}px`;
-
- // Set a maximum height on the <panelview> element to our preferred
- // maximum height, so that the PanelUI resizing code can make an accurate
- // calculation. If we don't do this, the flex sizing logic will prevent us
- // from ever reporting a preferred size smaller than the height currently
- // available to us in the panel.
- height = Math.max(height, this.viewHeight);
- this.viewNode.style.maxHeight = `${height}px`;
- } else {
- this.browser.style.width = `${width}px`;
- this.browser.style.minWidth = `${width}px`;
- this.browser.style.height = `${height}px`;
- this.browser.style.minHeight = `${height}px`;
- }
-
- let event = new this.window.CustomEvent("WebExtPopupResized", {detail});
- this.browser.dispatchEvent(event);
- }
-
- setBackground(background) {
- let panelBackground = "";
- let panelArrow = "";
-
- if (background) {
- let borderColor = this.borderColor || background;
-
- panelBackground = background;
- panelArrow = `url("data:image/svg+xml,${encodeURIComponent(`<?xml version="1.0" encoding="UTF-8"?>
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="10">
- <path d="M 0,10 L 10,0 20,10 z" fill="${borderColor}"/>
- <path d="M 1,10 L 10,1 19,10 z" fill="${background}"/>
- </svg>
- `)}")`;
- }
-
- this.panel.style.setProperty("--arrowpanel-background", panelBackground);
- this.panel.style.setProperty("--panel-arrow-image-vertical", panelArrow);
- this.background = background;
- }
-}
-
-/**
- * A map of active popups for a given browser window.
- *
- * WeakMap[window -> WeakMap[Extension -> BasePopup]]
- */
-BasePopup.instances = new DefaultWeakMap(() => new WeakMap());
-
-class PanelPopup extends BasePopup {
- constructor(extension, imageNode, popupURL, browserStyle) {
- let document = imageNode.ownerDocument;
-
- let panel = document.createElement("panel");
- panel.setAttribute("id", makeWidgetId(extension.id) + "-panel");
- panel.setAttribute("class", "browser-extension-panel");
- panel.setAttribute("tabspecific", "true");
- panel.setAttribute("type", "arrow");
- panel.setAttribute("role", "group");
-
- document.getElementById("mainPopupSet").appendChild(panel);
-
- super(extension, panel, popupURL, browserStyle);
-
- this.contentReady.then(() => {
- panel.openPopup(imageNode, "bottomcenter topright", 0, 0, false, false);
-
- let event = new this.window.CustomEvent("WebExtPopupLoaded", {
- bubbles: true,
- detail: {extension},
- });
- this.browser.dispatchEvent(event);
- });
- }
-
- get DESTROY_EVENT() {
- return "popuphidden";
- }
-
- destroy() {
- super.destroy();
- this.viewNode.remove();
- this.viewNode = null;
- }
-
- closePopup() {
- promisePopupShown(this.viewNode).then(() => {
- // Make sure we're not already destroyed, or removed from the DOM.
- if (this.viewNode && this.viewNode.hidePopup) {
- this.viewNode.hidePopup();
- }
- });
- }
-}
-
-class ViewPopup extends BasePopup {
- constructor(extension, window, popupURL, browserStyle, fixedWidth) {
- let document = window.document;
-
- // Create a temporary panel to hold the browser while it pre-loads its
- // content. This panel will never be shown, but the browser's docShell will
- // be swapped with the browser in the real panel when it's ready.
- let panel = document.createElement("panel");
- panel.setAttribute("type", "arrow");
- document.getElementById("mainPopupSet").appendChild(panel);
-
- super(extension, panel, popupURL, browserStyle, fixedWidth);
-
- this.ignoreResizes = true;
-
- this.attached = false;
- this.shown = false;
- this.tempPanel = panel;
-
- this.browser.classList.add("webextension-preload-browser");
- }
-
- /**
- * Attaches the pre-loaded browser to the given view node, and reserves a
- * promise which resolves when the browser is ready.
- *
- * @param {Element} viewNode
- * The node to attach the browser to.
- * @returns {Promise<boolean>}
- * Resolves when the browser is ready. Resolves to `false` if the
- * browser was destroyed before it was fully loaded, and the popup
- * should be closed, or `true` otherwise.
- */
- attach(viewNode) {
- return Task.spawn(function* () {
- this.viewNode = viewNode;
- this.viewNode.addEventListener(this.DESTROY_EVENT, this);
-
- // Wait until the browser element is fully initialized, and give it at least
- // a short grace period to finish loading its initial content, if necessary.
- //
- // In practice, the browser that was created by the mousdown handler should
- // nearly always be ready by this point.
- yield Promise.all([
- this.browserReady,
- Promise.race([
- // This promise may be rejected if the popup calls window.close()
- // before it has fully loaded.
- this.browserLoaded.catch(() => {}),
- new Promise(resolve => setTimeout(resolve, POPUP_LOAD_TIMEOUT_MS)),
- ]),
- ]);
-
- if (!this.destroyed && !this.panel) {
- this.destroy();
- }
-
- if (this.destroyed) {
- CustomizableUI.hidePanelForNode(viewNode);
- return false;
- }
-
- this.attached = true;
-
-
- // Store the initial height of the view, so that we never resize menu panel
- // sub-views smaller than the initial height of the menu.
- this.viewHeight = this.viewNode.boxObject.height;
-
- // Calculate the extra height available on the screen above and below the
- // menu panel. Use that to calculate the how much the sub-view may grow.
- let popupRect = this.panel.getBoundingClientRect();
-
- this.setBackground(this.background);
-
- let win = this.window;
- let popupBottom = win.mozInnerScreenY + popupRect.bottom;
- let popupTop = win.mozInnerScreenY + popupRect.top;
-
- let screenBottom = win.screen.availTop + win.screen.availHeight;
- this.extraHeight = {
- bottom: Math.max(0, screenBottom - popupBottom),
- top: Math.max(0, popupTop - win.screen.availTop),
- };
-
- // Create a new browser in the real popup.
- let browser = this.browser;
- yield this.createBrowser(this.viewNode);
-
- this.ignoreResizes = false;
-
- this.browser.swapDocShells(browser);
- this.destroyBrowser(browser);
-
- if (this.dimensions && !this.fixedWidth) {
- this.resizeBrowser(this.dimensions);
- }
-
- this.tempPanel.remove();
- this.tempPanel = null;
-
- this.shown = true;
-
- if (this.destroyed) {
- this.closePopup();
- this.destroy();
- return false;
- }
-
- let event = new this.window.CustomEvent("WebExtPopupLoaded", {
- bubbles: true,
- detail: {extension: this.extension},
- });
- this.browser.dispatchEvent(event);
-
- return true;
- }.bind(this));
- }
-
- destroy() {
- return super.destroy().then(() => {
- if (this.tempPanel) {
- this.tempPanel.remove();
- this.tempPanel = null;
- }
- });
- }
-
- get DESTROY_EVENT() {
- return "ViewHiding";
- }
-
- closePopup() {
- if (this.shown) {
- CustomizableUI.hidePanelForNode(this.viewNode);
- } else if (this.attached) {
- this.destroyed = true;
- } else {
- this.destroy();
- }
- }
-}
-
-Object.assign(global, {PanelPopup, ViewPopup});
-
-// Manages tab-specific context data, and dispatching tab select events
-// across all windows.
-global.TabContext = function TabContext(getDefaults, extension) {
- this.extension = extension;
- this.getDefaults = getDefaults;
-
- this.tabData = new WeakMap();
- this.lastLocation = new WeakMap();
-
- AllWindowEvents.addListener("progress", this);
- AllWindowEvents.addListener("TabSelect", this);
-
- EventEmitter.decorate(this);
-};
-
-TabContext.prototype = {
- get(tab) {
- if (!this.tabData.has(tab)) {
- this.tabData.set(tab, this.getDefaults(tab));
- }
-
- return this.tabData.get(tab);
- },
-
- clear(tab) {
- this.tabData.delete(tab);
- },
-
- handleEvent(event) {
- if (event.type == "TabSelect") {
- let tab = event.target;
- this.emit("tab-select", tab);
- this.emit("location-change", tab);
- }
- },
-
- onStateChange(browser, webProgress, request, stateFlags, statusCode) {
- let flags = Ci.nsIWebProgressListener;
-
- if (!(~stateFlags & (flags.STATE_IS_WINDOW | flags.STATE_START) ||
- this.lastLocation.has(browser))) {
- this.lastLocation.set(browser, request.URI);
- }
- },
-
- onLocationChange(browser, webProgress, request, locationURI, flags) {
- let gBrowser = browser.ownerGlobal.gBrowser;
- let lastLocation = this.lastLocation.get(browser);
- if (browser === gBrowser.selectedBrowser &&
- !(lastLocation && lastLocation.equalsExceptRef(browser.currentURI))) {
- let tab = gBrowser.getTabForBrowser(browser);
- this.emit("location-change", tab, true);
- }
- this.lastLocation.set(browser, browser.currentURI);
- },
-
- shutdown() {
- AllWindowEvents.removeListener("progress", this);
- AllWindowEvents.removeListener("TabSelect", this);
- },
-};
-
-// Manages tab mappings and permissions for a specific extension.
-function ExtensionTabManager(extension) {
- this.extension = extension;
-
- // A mapping of tab objects to the inner window ID the extension currently has
- // the active tab permission for. The active permission for a given tab is
- // valid only for the inner window that was active when the permission was
- // granted. If the tab navigates, the inner window ID changes, and the
- // permission automatically becomes stale.
- //
- // WeakMap[tab => inner-window-id<int>]
- this.hasTabPermissionFor = new WeakMap();
-}
-
-ExtensionTabManager.prototype = {
- addActiveTabPermission(tab = TabManager.activeTab) {
- if (this.extension.hasPermission("activeTab")) {
- // Note that, unlike Chrome, we don't currently clear this permission with
- // the tab navigates. If the inner window is revived from BFCache before
- // we've granted this permission to a new inner window, the extension
- // maintains its permissions for it.
- this.hasTabPermissionFor.set(tab, tab.linkedBrowser.innerWindowID);
- }
- },
-
- revokeActiveTabPermission(tab = TabManager.activeTab) {
- this.hasTabPermissionFor.delete(tab);
- },
-
- // Returns true if the extension has the "activeTab" permission for this tab.
- // This is somewhat more permissive than the generic "tabs" permission, as
- // checked by |hasTabPermission|, in that it also allows programmatic script
- // injection without an explicit host permission.
- hasActiveTabPermission(tab) {
- // This check is redundant with addTabPermission, but cheap.
- if (this.extension.hasPermission("activeTab")) {
- return (this.hasTabPermissionFor.has(tab) &&
- this.hasTabPermissionFor.get(tab) === tab.linkedBrowser.innerWindowID);
- }
- return false;
- },
-
- hasTabPermission(tab) {
- return this.extension.hasPermission("tabs") || this.hasActiveTabPermission(tab);
- },
-
- convert(tab) {
- let window = tab.ownerGlobal;
- let browser = tab.linkedBrowser;
-
- let mutedInfo = {muted: tab.muted};
- if (tab.muteReason === null) {
- mutedInfo.reason = "user";
- } else if (tab.muteReason) {
- mutedInfo.reason = "extension";
- mutedInfo.extensionId = tab.muteReason;
- }
-
- let result = {
- id: TabManager.getId(tab),
- index: tab._tPos,
- windowId: WindowManager.getId(window),
- selected: tab.selected,
- highlighted: tab.selected,
- active: tab.selected,
- pinned: tab.pinned,
- status: TabManager.getStatus(tab),
- incognito: WindowManager.isBrowserPrivate(browser),
- width: browser.frameLoader.lazyWidth || browser.clientWidth,
- height: browser.frameLoader.lazyHeight || browser.clientHeight,
- audible: tab.soundPlaying,
- mutedInfo,
- };
- if (this.extension.hasPermission("cookies")) {
- result.cookieStoreId = getCookieStoreIdForTab(result, tab);
- }
-
- if (this.hasTabPermission(tab)) {
- result.url = browser.currentURI.spec;
- let title = browser.contentTitle || tab.label;
- if (title) {
- result.title = title;
- }
- let icon = window.gBrowser.getIcon(tab);
- if (icon) {
- result.favIconUrl = icon;
- }
- }
-
- return result;
- },
-
- // Converts tabs returned from SessionStore.getClosedTabData and
- // SessionStore.getClosedWindowData into API tab objects
- convertFromSessionStoreClosedData(tab, window) {
- let result = {
- sessionId: String(tab.closedId),
- index: tab.pos ? tab.pos : 0,
- windowId: WindowManager.getId(window),
- selected: false,
- highlighted: false,
- active: false,
- pinned: false,
- incognito: Boolean(tab.state && tab.state.isPrivate),
- };
-
- if (this.hasTabPermission(tab)) {
- let entries = tab.state ? tab.state.entries : tab.entries;
- let entry = entries[entries.length - 1];
- result.url = entry.url;
- result.title = entry.title;
- if (tab.image) {
- result.favIconUrl = tab.image;
- }
- }
-
- return result;
- },
-
- getTabs(window) {
- return Array.from(window.gBrowser.tabs)
- .filter(tab => !tab.closing)
- .map(tab => this.convert(tab));
- },
-};
-
-function getBrowserInfo(browser) {
- if (!browser.ownerGlobal.gBrowser) {
- // When we're loaded into a <browser> inside about:addons, we need to go up
- // one more level.
- browser = browser.ownerGlobal.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDocShell)
- .chromeEventHandler;
-
- if (!browser) {
- return {};
- }
- }
-
- let result = {};
-
- let window = browser.ownerGlobal;
- if (window.gBrowser) {
- let tab = window.gBrowser.getTabForBrowser(browser);
- if (tab) {
- result.tabId = TabManager.getId(tab);
- }
-
- result.windowId = WindowManager.getId(window);
- }
-
- return result;
-}
-global.getBrowserInfo = getBrowserInfo;
-
-// Sends the tab and windowId upon request. This is primarily used to support
-// the synchronous `browser.extension.getViews` API.
-let onGetTabAndWindowId = {
- receiveMessage({name, target, sync}) {
- let result = getBrowserInfo(target);
-
- if (result.tabId) {
- if (sync) {
- return result;
- }
- target.messageManager.sendAsyncMessage("Extension:SetTabAndWindowId", result);
- }
- },
-};
-/* eslint-disable mozilla/balanced-listeners */
-Services.mm.addMessageListener("Extension:GetTabAndWindowId", onGetTabAndWindowId);
-/* eslint-enable mozilla/balanced-listeners */
-
-
-// Manages global mappings between XUL tabs and extension tab IDs.
-global.TabManager = {
- _tabs: new WeakMap(),
- _nextId: 1,
- _initialized: false,
-
- // We begin listening for TabOpen and TabClose events once we've started
- // assigning IDs to tabs, so that we can remap the IDs of tabs which are moved
- // between windows.
- initListener() {
- if (this._initialized) {
- return;
- }
-
- AllWindowEvents.addListener("TabOpen", this);
- AllWindowEvents.addListener("TabClose", this);
- WindowListManager.addOpenListener(this.handleWindowOpen.bind(this));
-
- this._initialized = true;
- },
-
- handleEvent(event) {
- if (event.type == "TabOpen") {
- let {adoptedTab} = event.detail;
- if (adoptedTab) {
- // This tab is being created to adopt a tab from a different window.
- // Copy the ID from the old tab to the new.
- let tab = event.target;
- this._tabs.set(tab, this.getId(adoptedTab));
-
- tab.linkedBrowser.messageManager.sendAsyncMessage("Extension:SetTabAndWindowId", {
- windowId: WindowManager.getId(tab.ownerGlobal),
- });
- }
- } else if (event.type == "TabClose") {
- let {adoptedBy} = event.detail;
- if (adoptedBy) {
- // This tab is being closed because it was adopted by a new window.
- // Copy its ID to the new tab, in case it was created as the first tab
- // of a new window, and did not have an `adoptedTab` detail when it was
- // opened.
- this._tabs.set(adoptedBy, this.getId(event.target));
-
- adoptedBy.linkedBrowser.messageManager.sendAsyncMessage("Extension:SetTabAndWindowId", {
- windowId: WindowManager.getId(adoptedBy),
- });
- }
- }
- },
-
- handleWindowOpen(window) {
- if (window.arguments && window.arguments[0] instanceof window.XULElement) {
- // If the first window argument is a XUL element, it means the
- // window is about to adopt a tab from another window to replace its
- // initial tab.
- let adoptedTab = window.arguments[0];
-
- this._tabs.set(window.gBrowser.tabs[0], this.getId(adoptedTab));
- }
- },
-
- getId(tab) {
- if (this._tabs.has(tab)) {
- return this._tabs.get(tab);
- }
- this.initListener();
-
- let id = this._nextId++;
- this._tabs.set(tab, id);
- return id;
- },
-
- getBrowserId(browser) {
- let gBrowser = browser.ownerGlobal.gBrowser;
- // Some non-browser windows have gBrowser but not
- // getTabForBrowser!
- if (gBrowser && gBrowser.getTabForBrowser) {
- let tab = gBrowser.getTabForBrowser(browser);
- if (tab) {
- return this.getId(tab);
- }
- }
- return -1;
- },
-
- /**
- * Returns the XUL <tab> element associated with the given tab ID. If no tab
- * with the given ID exists, and no default value is provided, an error is
- * raised, belonging to the scope of the given context.
- *
- * @param {integer} tabId
- * The ID of the tab to retrieve.
- * @param {ExtensionContext} context
- * The context of the caller.
- * This value may be omitted if `default_` is not `undefined`.
- * @param {*} default_
- * The value to return if no tab exists with the given ID.
- * @returns {Element<tab>}
- * A XUL <tab> element.
- */
- getTab(tabId, context, default_ = undefined) {
- // FIXME: Speed this up without leaking memory somehow.
- for (let window of WindowListManager.browserWindows()) {
- if (!window.gBrowser) {
- continue;
- }
- for (let tab of window.gBrowser.tabs) {
- if (this.getId(tab) == tabId) {
- return tab;
- }
- }
- }
- if (default_ !== undefined) {
- return default_;
- }
- throw new context.cloneScope.Error(`Invalid tab ID: ${tabId}`);
- },
-
- get activeTab() {
- let window = WindowManager.topWindow;
- if (window && window.gBrowser) {
- return window.gBrowser.selectedTab;
- }
- return null;
- },
-
- getStatus(tab) {
- return tab.getAttribute("busy") == "true" ? "loading" : "complete";
- },
-
- convert(extension, tab) {
- return TabManager.for(extension).convert(tab);
- },
-};
-
-// WeakMap[Extension -> ExtensionTabManager]
-let tabManagers = new WeakMap();
-
-// Returns the extension-specific tab manager for the given extension, or
-// creates one if it doesn't already exist.
-TabManager.for = function(extension) {
- if (!tabManagers.has(extension)) {
- tabManagers.set(extension, new ExtensionTabManager(extension));
- }
- return tabManagers.get(extension);
-};
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("shutdown", (type, extension) => {
- tabManagers.delete(extension);
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-function memoize(fn) {
- let weakMap = new DefaultWeakMap(fn);
- return weakMap.get.bind(weakMap);
-}
-
-// Manages mapping between XUL windows and extension window IDs.
-global.WindowManager = {
- // Note: These must match the values in windows.json.
- WINDOW_ID_NONE: -1,
- WINDOW_ID_CURRENT: -2,
-
- get topWindow() {
- return Services.wm.getMostRecentWindow("navigator:browser");
- },
-
- windowType(window) {
- // TODO: Make this work.
-
- let {chromeFlags} = window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDocShell)
- .treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIXULWindow);
-
- if (chromeFlags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) {
- return "popup";
- }
-
- return "normal";
- },
-
- updateGeometry(window, options) {
- if (options.left !== null || options.top !== null) {
- let left = options.left !== null ? options.left : window.screenX;
- let top = options.top !== null ? options.top : window.screenY;
- window.moveTo(left, top);
- }
-
- if (options.width !== null || options.height !== null) {
- let width = options.width !== null ? options.width : window.outerWidth;
- let height = options.height !== null ? options.height : window.outerHeight;
- window.resizeTo(width, height);
- }
- },
-
- isBrowserPrivate: memoize(browser => {
- return PrivateBrowsingUtils.isBrowserPrivate(browser);
- }),
-
- getId: memoize(window => {
- if (window instanceof Ci.nsIInterfaceRequestor) {
- return window.getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
- }
- return null;
- }),
-
- getWindow(id, context) {
- if (id == this.WINDOW_ID_CURRENT) {
- return currentWindow(context);
- }
-
- for (let window of WindowListManager.browserWindows(true)) {
- if (this.getId(window) == id) {
- return window;
- }
- }
- return null;
- },
-
- getState(window) {
- const STATES = {
- [window.STATE_MAXIMIZED]: "maximized",
- [window.STATE_MINIMIZED]: "minimized",
- [window.STATE_NORMAL]: "normal",
- };
- let state = STATES[window.windowState];
- if (window.fullScreen) {
- state = "fullscreen";
- }
- return state;
- },
-
- setState(window, state) {
- if (state != "fullscreen" && window.fullScreen) {
- window.fullScreen = false;
- }
-
- switch (state) {
- case "maximized":
- window.maximize();
- break;
-
- case "minimized":
- case "docked":
- window.minimize();
- break;
-
- case "normal":
- // Restore sometimes returns the window to its previous state, rather
- // than to the "normal" state, so it may need to be called anywhere from
- // zero to two times.
- window.restore();
- if (window.windowState != window.STATE_NORMAL) {
- window.restore();
- }
- if (window.windowState != window.STATE_NORMAL) {
- // And on OS-X, where normal vs. maximized is basically a heuristic,
- // we need to cheat.
- window.sizeToContent();
- }
- break;
-
- case "fullscreen":
- window.fullScreen = true;
- break;
-
- default:
- throw new Error(`Unexpected window state: ${state}`);
- }
- },
-
- convert(extension, window, getInfo) {
- let xulWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDocShell)
- .treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIXULWindow);
-
- let result = {
- id: this.getId(window),
- focused: window.document.hasFocus(),
- top: window.screenY,
- left: window.screenX,
- width: window.outerWidth,
- height: window.outerHeight,
- incognito: PrivateBrowsingUtils.isWindowPrivate(window),
- type: this.windowType(window),
- state: this.getState(window),
- alwaysOnTop: xulWindow.zLevel >= Ci.nsIXULWindow.raisedZ,
- };
-
- if (getInfo && getInfo.populate) {
- result.tabs = TabManager.for(extension).getTabs(window);
- }
-
- return result;
- },
-
- // Converts windows returned from SessionStore.getClosedWindowData
- // into API window objects
- convertFromSessionStoreClosedData(window, extension) {
- let result = {
- sessionId: String(window.closedId),
- focused: false,
- incognito: false,
- type: "normal", // this is always "normal" for a closed window
- state: this.getState(window),
- alwaysOnTop: false,
- };
-
- if (window.tabs.length) {
- result.tabs = [];
- window.tabs.forEach((tab, index) => {
- result.tabs.push(TabManager.for(extension).convertFromSessionStoreClosedData(tab, window, index));
- });
- }
-
- return result;
- },
-};
-
-// Manages listeners for window opening and closing. A window is
-// considered open when the "load" event fires on it. A window is
-// closed when a "domwindowclosed" notification fires for it.
-global.WindowListManager = {
- _openListeners: new Set(),
- _closeListeners: new Set(),
-
- // Returns an iterator for all browser windows. Unless |includeIncomplete| is
- // true, only fully-loaded windows are returned.
- * browserWindows(includeIncomplete = false) {
- // The window type parameter is only available once the window's document
- // element has been created. This means that, when looking for incomplete
- // browser windows, we need to ignore the type entirely for windows which
- // haven't finished loading, since we would otherwise skip browser windows
- // in their early loading stages.
- // This is particularly important given that the "domwindowcreated" event
- // fires for browser windows when they're in that in-between state, and just
- // before we register our own "domwindowcreated" listener.
-
- let e = Services.wm.getEnumerator("");
- while (e.hasMoreElements()) {
- let window = e.getNext();
-
- let ok = includeIncomplete;
- if (window.document.readyState == "complete") {
- ok = window.document.documentElement.getAttribute("windowtype") == "navigator:browser";
- }
-
- if (ok) {
- yield window;
- }
- }
- },
-
- addOpenListener(listener) {
- if (this._openListeners.size == 0 && this._closeListeners.size == 0) {
- Services.ww.registerNotification(this);
- }
- this._openListeners.add(listener);
-
- for (let window of this.browserWindows(true)) {
- if (window.document.readyState != "complete") {
- window.addEventListener("load", this);
- }
- }
- },
-
- removeOpenListener(listener) {
- this._openListeners.delete(listener);
- if (this._openListeners.size == 0 && this._closeListeners.size == 0) {
- Services.ww.unregisterNotification(this);
- }
- },
-
- addCloseListener(listener) {
- if (this._openListeners.size == 0 && this._closeListeners.size == 0) {
- Services.ww.registerNotification(this);
- }
- this._closeListeners.add(listener);
- },
-
- removeCloseListener(listener) {
- this._closeListeners.delete(listener);
- if (this._openListeners.size == 0 && this._closeListeners.size == 0) {
- Services.ww.unregisterNotification(this);
- }
- },
-
- handleEvent(event) {
- event.currentTarget.removeEventListener(event.type, this);
- let window = event.target.defaultView;
- if (window.document.documentElement.getAttribute("windowtype") != "navigator:browser") {
- return;
- }
-
- for (let listener of this._openListeners) {
- listener(window);
- }
- },
-
- observe(window, topic, data) {
- if (topic == "domwindowclosed") {
- if (window.document.documentElement.getAttribute("windowtype") != "navigator:browser") {
- return;
- }
-
- window.removeEventListener("load", this);
- for (let listener of this._closeListeners) {
- listener(window);
- }
- } else {
- window.addEventListener("load", this);
- }
- },
-};
-
-// Provides a facility to listen for DOM events across all XUL windows.
-global.AllWindowEvents = {
- _listeners: new Map(),
-
- // If |type| is a normal event type, invoke |listener| each time
- // that event fires in any open window. If |type| is "progress", add
- // a web progress listener that covers all open windows.
- addListener(type, listener) {
- if (type == "domwindowopened") {
- return WindowListManager.addOpenListener(listener);
- } else if (type == "domwindowclosed") {
- return WindowListManager.addCloseListener(listener);
- }
-
- if (this._listeners.size == 0) {
- WindowListManager.addOpenListener(this.openListener);
- }
-
- if (!this._listeners.has(type)) {
- this._listeners.set(type, new Set());
- }
- let list = this._listeners.get(type);
- list.add(listener);
-
- // Register listener on all existing windows.
- for (let window of WindowListManager.browserWindows()) {
- this.addWindowListener(window, type, listener);
- }
- },
-
- removeListener(eventType, listener) {
- if (eventType == "domwindowopened") {
- return WindowListManager.removeOpenListener(listener);
- } else if (eventType == "domwindowclosed") {
- return WindowListManager.removeCloseListener(listener);
- }
-
- let listeners = this._listeners.get(eventType);
- listeners.delete(listener);
- if (listeners.size == 0) {
- this._listeners.delete(eventType);
- if (this._listeners.size == 0) {
- WindowListManager.removeOpenListener(this.openListener);
- }
- }
-
- // Unregister listener from all existing windows.
- let useCapture = eventType === "focus" || eventType === "blur";
- for (let window of WindowListManager.browserWindows()) {
- if (eventType == "progress") {
- window.gBrowser.removeTabsProgressListener(listener);
- } else {
- window.removeEventListener(eventType, listener, useCapture);
- }
- }
- },
-
- /* eslint-disable mozilla/balanced-listeners */
- addWindowListener(window, eventType, listener) {
- let useCapture = eventType === "focus" || eventType === "blur";
-
- if (eventType == "progress") {
- window.gBrowser.addTabsProgressListener(listener);
- } else {
- window.addEventListener(eventType, listener, useCapture);
- }
- },
- /* eslint-enable mozilla/balanced-listeners */
-
- // Runs whenever the "load" event fires for a new window.
- openListener(window) {
- for (let [eventType, listeners] of AllWindowEvents._listeners) {
- for (let listener of listeners) {
- this.addWindowListener(window, eventType, listener);
- }
- }
- },
-};
-
-AllWindowEvents.openListener = AllWindowEvents.openListener.bind(AllWindowEvents);
-
-// Subclass of EventManager where we just need to call
-// add/removeEventListener on each XUL window.
-global.WindowEventManager = function(context, name, event, listener) {
- EventManager.call(this, context, name, fire => {
- let listener2 = (...args) => listener(fire, ...args);
- AllWindowEvents.addListener(event, listener2);
- return () => {
- AllWindowEvents.removeListener(event, listener2);
- };
- });
-};
-
-WindowEventManager.prototype = Object.create(EventManager.prototype);
diff --git a/application/basilisk/components/extensions/ext-windows.js b/application/basilisk/components/extensions/ext-windows.js
deleted file mode 100644
index 71b8fa426..000000000
--- a/application/basilisk/components/extensions/ext-windows.js
+++ /dev/null
@@ -1,232 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
- "@mozilla.org/browser/aboutnewtab-service;1",
- "nsIAboutNewTabService");
-XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
- "resource://gre/modules/PrivateBrowsingUtils.jsm");
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-var {
- EventManager,
- promiseObserved,
-} = ExtensionUtils;
-
-function onXULFrameLoaderCreated({target}) {
- target.messageManager.sendAsyncMessage("AllowScriptsToClose", {});
-}
-
-extensions.registerSchemaAPI("windows", "addon_parent", context => {
- let {extension} = context;
- return {
- windows: {
- onCreated:
- new WindowEventManager(context, "windows.onCreated", "domwindowopened", (fire, window) => {
- fire(WindowManager.convert(extension, window));
- }).api(),
-
- onRemoved:
- new WindowEventManager(context, "windows.onRemoved", "domwindowclosed", (fire, window) => {
- fire(WindowManager.getId(window));
- }).api(),
-
- onFocusChanged: new EventManager(context, "windows.onFocusChanged", fire => {
- // Keep track of the last windowId used to fire an onFocusChanged event
- let lastOnFocusChangedWindowId;
-
- let listener = event => {
- // Wait a tick to avoid firing a superfluous WINDOW_ID_NONE
- // event when switching focus between two Firefox windows.
- Promise.resolve().then(() => {
- let window = Services.focus.activeWindow;
- let windowId = window ? WindowManager.getId(window) : WindowManager.WINDOW_ID_NONE;
- if (windowId !== lastOnFocusChangedWindowId) {
- fire(windowId);
- lastOnFocusChangedWindowId = windowId;
- }
- });
- };
- AllWindowEvents.addListener("focus", listener);
- AllWindowEvents.addListener("blur", listener);
- return () => {
- AllWindowEvents.removeListener("focus", listener);
- AllWindowEvents.removeListener("blur", listener);
- };
- }).api(),
-
- get: function(windowId, getInfo) {
- let window = WindowManager.getWindow(windowId, context);
- if (!window) {
- return Promise.reject({message: `Invalid window ID: ${windowId}`});
- }
- return Promise.resolve(WindowManager.convert(extension, window, getInfo));
- },
-
- getCurrent: function(getInfo) {
- let window = currentWindow(context);
- return Promise.resolve(WindowManager.convert(extension, window, getInfo));
- },
-
- getLastFocused: function(getInfo) {
- let window = WindowManager.topWindow;
- return Promise.resolve(WindowManager.convert(extension, window, getInfo));
- },
-
- getAll: function(getInfo) {
- let windows = Array.from(WindowListManager.browserWindows(),
- window => WindowManager.convert(extension, window, getInfo));
- return Promise.resolve(windows);
- },
-
- create: function(createData) {
- let needResize = (createData.left !== null || createData.top !== null ||
- createData.width !== null || createData.height !== null);
-
- if (needResize) {
- if (createData.state !== null && createData.state != "normal") {
- return Promise.reject({message: `"state": "${createData.state}" may not be combined with "left", "top", "width", or "height"`});
- }
- createData.state = "normal";
- }
-
- function mkstr(s) {
- let result = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
- result.data = s;
- return result;
- }
-
- let args = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
-
- if (createData.tabId !== null) {
- if (createData.url !== null) {
- return Promise.reject({message: "`tabId` may not be used in conjunction with `url`"});
- }
-
- if (createData.allowScriptsToClose) {
- return Promise.reject({message: "`tabId` may not be used in conjunction with `allowScriptsToClose`"});
- }
-
- let tab = TabManager.getTab(createData.tabId, context);
-
- // Private browsing tabs can only be moved to private browsing
- // windows.
- let incognito = PrivateBrowsingUtils.isBrowserPrivate(tab.linkedBrowser);
- if (createData.incognito !== null && createData.incognito != incognito) {
- return Promise.reject({message: "`incognito` property must match the incognito state of tab"});
- }
- createData.incognito = incognito;
-
- args.appendElement(tab, /* weak = */ false);
- } else if (createData.url !== null) {
- if (Array.isArray(createData.url)) {
- let array = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
- for (let url of createData.url) {
- array.appendElement(mkstr(url), /* weak = */ false);
- }
- args.appendElement(array, /* weak = */ false);
- } else {
- args.appendElement(mkstr(createData.url), /* weak = */ false);
- }
- } else {
- args.appendElement(mkstr(aboutNewTabService.newTabURL), /* weak = */ false);
- }
-
- let features = ["chrome"];
-
- if (createData.type === null || createData.type == "normal") {
- features.push("dialog=no", "all");
- } else {
- // All other types create "popup"-type windows by default.
- features.push("dialog", "resizable", "minimizable", "centerscreen", "titlebar", "close");
- }
-
- if (createData.incognito !== null) {
- if (createData.incognito) {
- features.push("private");
- } else {
- features.push("non-private");
- }
- }
-
- let {allowScriptsToClose, url} = createData;
- if (allowScriptsToClose === null) {
- allowScriptsToClose = typeof url === "string" && url.startsWith("moz-extension://");
- }
-
- let window = Services.ww.openWindow(null, "chrome://browser/content/browser.xul", "_blank",
- features.join(","), args);
-
- WindowManager.updateGeometry(window, createData);
-
- // TODO: focused, type
-
- return new Promise(resolve => {
- window.addEventListener("load", function listener() {
- window.removeEventListener("load", listener);
- if (["maximized", "normal"].includes(createData.state)) {
- window.document.documentElement.setAttribute("sizemode", createData.state);
- }
- resolve(promiseObserved("browser-delayed-startup-finished", win => win == window));
- });
- }).then(() => {
- // Some states only work after delayed-startup-finished
- if (["minimized", "fullscreen", "docked"].includes(createData.state)) {
- WindowManager.setState(window, createData.state);
- }
- if (allowScriptsToClose) {
- for (let {linkedBrowser} of window.gBrowser.tabs) {
- onXULFrameLoaderCreated({target: linkedBrowser});
- linkedBrowser.addEventListener( // eslint-disable-line mozilla/balanced-listeners
- "XULFrameLoaderCreated", onXULFrameLoaderCreated);
- }
- }
- return WindowManager.convert(extension, window, {populate: true});
- });
- },
-
- update: function(windowId, updateInfo) {
- if (updateInfo.state !== null && updateInfo.state != "normal") {
- if (updateInfo.left !== null || updateInfo.top !== null ||
- updateInfo.width !== null || updateInfo.height !== null) {
- return Promise.reject({message: `"state": "${updateInfo.state}" may not be combined with "left", "top", "width", or "height"`});
- }
- }
-
- let window = WindowManager.getWindow(windowId, context);
- if (updateInfo.focused) {
- Services.focus.activeWindow = window;
- }
-
- if (updateInfo.state !== null) {
- WindowManager.setState(window, updateInfo.state);
- }
-
- if (updateInfo.drawAttention) {
- // Bug 1257497 - Firefox can't cancel attention actions.
- window.getAttention();
- }
-
- WindowManager.updateGeometry(window, updateInfo);
-
- // TODO: All the other properties, focused=false...
-
- return Promise.resolve(WindowManager.convert(extension, window));
- },
-
- remove: function(windowId) {
- let window = WindowManager.getWindow(windowId, context);
- window.close();
-
- return new Promise(resolve => {
- let listener = () => {
- AllWindowEvents.removeListener("domwindowclosed", listener);
- resolve();
- };
- AllWindowEvents.addListener("domwindowclosed", listener);
- });
- },
- },
- };
-});
diff --git a/application/basilisk/components/extensions/extension-mac-panel.css b/application/basilisk/components/extensions/extension-mac-panel.css
deleted file mode 100644
index 2e9ed6bdb..000000000
--- a/application/basilisk/components/extensions/extension-mac-panel.css
+++ /dev/null
@@ -1,3 +0,0 @@
-body {
- border-radius: 3.5px;
-}
diff --git a/application/basilisk/components/extensions/extension-mac.css b/application/basilisk/components/extensions/extension-mac.css
deleted file mode 100644
index 49cd3b359..000000000
--- a/application/basilisk/components/extensions/extension-mac.css
+++ /dev/null
@@ -1,11 +0,0 @@
-button,
-select,
-input[type="checkbox"] + label::before {
- border-radius: 4px;
-}
-
-.panel-section-footer {
- border-bottom-left-radius: 4px;
- border-bottom-right-radius: 4px;
- overflow: hidden;
-}
diff --git a/application/basilisk/components/extensions/extension-win-panel.css b/application/basilisk/components/extensions/extension-win-panel.css
deleted file mode 100644
index ddafe3ea5..000000000
--- a/application/basilisk/components/extensions/extension-win-panel.css
+++ /dev/null
@@ -1,7 +0,0 @@
-@media (-moz-os-version: windows-xp),
- (-moz-os-version: windows-vista),
- (-moz-os-version: windows-win7) {
- body {
- border-radius: 4px;
- }
-}
diff --git a/application/basilisk/components/extensions/extension.css b/application/basilisk/components/extensions/extension.css
deleted file mode 100644
index 6b59033e3..000000000
--- a/application/basilisk/components/extensions/extension.css
+++ /dev/null
@@ -1,572 +0,0 @@
-/* stylelint-disable property-no-vendor-prefix */
-/* stylelint-disable property-no-vendor-prefix */
-/* Base */
-button,
-select,
-option,
-input {
- -moz-appearance: none;
-}
-
-/* Variables */
-html,
-body {
- background: transparent;
- box-sizing: border-box;
- color: #222426;
- cursor: default;
- display: flex;
- flex-direction: column;
- font: caption;
- margin: 0;
- padding: 0;
- -moz-user-select: none;
-}
-
-body * {
- box-sizing: border-box;
- text-align: start;
-}
-
-/* stylelint-disable property-no-vendor-prefix */
-/* Buttons */
-button,
-select {
- background-color: #fbfbfb;
- border: 1px solid #b1b1b1;
- box-shadow: 0 0 0 0 transparent;
- font: caption;
- height: 24px;
- outline: 0 !important;
- padding: 0 8px 0;
- transition-duration: 250ms;
- transition-property: box-shadow, border;
-}
-
-select {
- background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg==);
- background-position: calc(100% - 4px) center;
- background-repeat: no-repeat;
- padding-inline-end: 24px;
- text-overflow: ellipsis;
-}
-
-label {
- font: caption;
-}
-
-button::-moz-focus-inner {
- border: 0;
- outline: 0;
-}
-
-/* Dropdowns */
-select {
- background-color: #fbfbfb;
- border: 1px solid #b1b1b1;
- box-shadow: 0 0 0 0 transparent;
- font: caption;
- height: 24px;
- outline: 0 !important;
- padding: 0 8px 0;
- transition-duration: 250ms;
- transition-property: box-shadow, border;
-}
-
-select {
- background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg==);
- background-position: calc(100% - 4px) center;
- background-repeat: no-repeat;
- padding-inline-end: 24px;
- text-overflow: ellipsis;
-}
-
-select:-moz-focusring {
- color: transparent;
- text-shadow: 0 0 0 #000;
-}
-
-select:-moz-focusring * {
- color: #000;
- text-shadow: none;
-}
-
-button.hover,
-select.hover {
- background-color: #ebebeb;
- border: 1px solid #b1b1b1;
-}
-
-button.pressed,
-select.pressed {
- background-color: #d4d4d4;
- border: 1px solid #858585;
-}
-
-button.disabled,
-select.disabled {
- color: #999;
- opacity: .5;
-}
-
-button.focused,
-select.focused {
- border-color: #fff;
- box-shadow: 0 0 0 2px rgba(97, 181, 255, 0.75);
-}
-
-button.default {
- background-color: #0996f8;
- border-color: #0670cc;
- color: #fff;
-}
-
-button.default.hover {
- background-color: #0670cc;
- border-color: #005bab;
-}
-
-button.default.pressed {
- background-color: #005bab;
- border-color: #004480;
-}
-
-button.default.focused {
- border-color: #fff;
-}
-
-/* Radio Buttons */
-.radioItem {
- margin-bottom: 6px;
- text-align: left;
-}
-
-input[type="radio"] {
- display: none;
-}
-
-input[type="radio"] + label {
- -moz-user-select: none;
-}
-
-input[type="radio"] + label::before {
- background-color: #fff;
- background-position: center;
- border: 1px solid #b1b1b1;
- border-radius: 50%;
- content: "";
- display: inline-block;
- height: 16px;
- margin-right: 6px;
- vertical-align: text-top;
- width: 16px;
-}
-
-input[type="radio"]:hover + label::before,
-.radioItem.hover input[type="radio"]:not(active) + label::before {
- background-color: #fbfbfb;
- border-color: #b1b1b1;
-}
-
-input[type="radio"]:hover:active + label::before,
-.radioItem.pressed input[type="radio"]:not(active) + label::before {
- background-color: #ebebeb;
- border-color: #858585;
-}
-
-input[type="radio"]:checked + label::before {
- background-color: #0996f8;
- background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8Y2lyY2xlIGN4PSI4IiBjeT0iOCIgcj0iNCIgZmlsbD0iI2ZmZiIgLz4KPC9zdmc+Cg==);
- border-color: #0670cc;
-}
-
-input[type="radio"]:checked:hover + label::before,
-.radioItem.hover input[type="radio"]:checked:not(active) + label::before {
- background-color: #0670cc;
- border-color: #005bab;
-}
-
-input[type="radio"]:checked:hover:active + label::before,
-.radioItem.pressed input[type="radio"]:checked:not(active) + label::before {
- background-color: #005bab;
- border-color: #004480;
-}
-
-.radioItem.disabled input[type="radio"] + label,
-.radioItem.disabled input[type="radio"]:hover + label,
-.radioItem.disabled input[type="radio"]:hover:active + label {
- color: #999;
- opacity: .5;
-}
-
-.radioItem.focused input[type="radio"] + label::before {
- border-color: #0996f8;
- box-shadow: 0 0 0 2px rgba(97, 181, 255, 0.75);
-}
-
-.radioItem.focused input[type="radio"]:checked + label::before {
- border-color: #fff;
-}
-
-/* Checkboxes */
-.checkboxItem {
- margin-bottom: 6px;
- text-align: left;
-}
-
-input[type="checkbox"] {
- display: none;
-}
-
-input[type="checkbox"] + label {
- -moz-user-select: none;
-}
-
-input[type="checkbox"] + label::before {
- background-color: #fff;
- background-position: center;
- border: 1px solid #b1b1b1;
- content: "";
- display: inline-block;
- height: 16px;
- margin-right: 6px;
- vertical-align: text-top;
- width: 16px;
-}
-
-input[type="checkbox"]:hover + label::before,
-.checkboxItem.hover input[type="checkbox"]:not(active) + label::before {
- background-color: #fbfbfb;
- border-color: #b1b1b1;
-}
-
-input[type="checkbox"]:hover:active + label::before,
-.checkboxItem.pressed input[type="checkbox"]:not(active) + label::before {
- background-color: #ebebeb;
- border-color: #858585;
-}
-
-input[type="checkbox"]:checked + label::before {
- background-color: #0996f8;
- background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNNy43LDEyLjkgQzcuNCwxMy4zIDYuOCwxMy40IDYuNCwxMyBMMy4yLDkuOCBDMi44LDkuNCAyLjgsOC42IDMuMiw4LjIgQzMuNiw3LjggNC40LDcuOCA0LjgsOC4yIEw2LjksMTAuMyBMMTEuMSw0LjQgQzExLjUsMy45IDEyLjIsMy44IDEyLjcsNC4xIEMxMy4yLDQuNSAxMy4zLDUuMiAxMyw1LjcgTDcuNywxMi45IEw3LjcsMTIuOSBaIiBmaWxsPSIjZmZmIiAvPgo8L3N2Zz4K);
- border-color: #0670cc;
-}
-
-input[type="checkbox"]:checked:hover + label::before,
-.checkboxItem.hover input[type="checkbox"]:checked:not(active) + label::before {
- background-color: #0670cc;
- border-color: #005bab;
-}
-
-input[type="checkbox"]:checked:hover:active + label::before,
-.checkboxItem.pressed input[type="checkbox"]:checked:not(active) + label::before {
- background-color: #005bab;
- border-color: #004480;
-}
-
-.checkboxItem.disabled input[type="checkbox"] + label,
-.checkboxItem.disabled input[type="checkbox"]:hover + label,
-.checkboxItem.disabled input[type="checkbox"]:hover:active + label {
- color: #999;
- opacity: .5;
-}
-
-.checkboxItem.focused input[type="checkbox"] + label::before {
- border-color: #0996f8;
- box-shadow: 0 0 0 2px rgba(97, 181, 255, 0.75);
-}
-
-.checkboxItem.focused input[type="checkbox"]:checked + label::before {
- border-color: #fff;
-}
-
-/* Expander Button */
-button.expander {
- background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg==);
- background-position: center;
- background-repeat: no-repeat;
- height: 24px;
- padding: 0;
- width: 24px;
-}
-
-/* Interactive States */
-button:hover:not(.pressed):not(.disabled):not(.focused),
-select:hover:not(.pressed):not(.disabled):not(.focused) {
- background-color: #ebebeb;
- border: 1px solid #b1b1b1;
-}
-
-button:hover:active:not(.hover):not(.disabled):not(.focused),
-select:hover:active:not(.hover):not(.disabled):not(.focused) {
- background-color: #d4d4d4;
- border: 1px solid #858585;
-}
-
-button.default:hover:not(.pressed):not(.disabled):not(.focused) {
- background-color: #0670cc;
- border-color: #005bab;
-}
-
-button.default:hover:active:not(.hover):not(.disabled):not(.focused) {
- background-color: #005bab;
- border-color: #004480;
-}
-
-button:focus:not(.disabled) {
- border-color: #fff !important;
- box-shadow: 0 0 0 2px rgba(97, 181, 255, 0.75);
-}
-
-/* Fields */
-input[type="text"],
-textarea {
- background-color: #fff;
- border: 1px solid #b1b1b1;
- box-shadow: 0 0 0 0 rgba(97, 181, 255, 0);
- font: caption;
- padding: 0 6px 0;
- transition-duration: 250ms;
- transition-property: box-shadow;
-}
-
-input[type="text"] {
- height: 24px;
-}
-
-input[type="text"].hover,
-textarea.hover {
- border: 1px solid #858585;
-}
-
-input[type="text"].disabled,
-textarea.disabled {
- color: #999;
- opacity: .5;
-}
-
-input[type="text"].focused,
-textarea.focused {
- border-color: #0996f8;
- box-shadow: 0 0 0 2px rgba(97, 181, 255, 0.75);
-}
-
-/* Interactive States */
-input[type="text"]:not(disabled):hover,
-textarea:not(disabled):hover {
- border: 1px solid #858585;
-}
-
-input[type="text"]:focus,
-input[type="text"]:focus:hover,
-textarea:focus,
-textarea:focus:hover {
- border-color: #0996f8;
- box-shadow: 0 0 0 2px rgba(97, 181, 255, 0.75);
-}
-
-/* stylelint-disable property-no-vendor-prefix */
-.panel-section {
- display: flex;
- flex-direction: row;
-}
-
-.panel-section-separator {
- background-color: rgba(0, 0, 0, 0.15);
- min-height: 1px;
-}
-
-/* Panel Section - Header */
-.panel-section-header {
- border-bottom: 1px solid rgba(0, 0, 0, 0.15);
- padding: 16px;
-}
-
-.panel-section-header > .icon-section-header {
- background-position: center center;
- background-repeat: no-repeat;
- height: 32px;
- margin-right: 16px;
- position: relative;
- width: 32px;
-}
-
-.panel-section-header > .text-section-header {
- align-self: center;
- font-size: 1.385em;
- font-weight: lighter;
-}
-
-/* Panel Section - List */
-.panel-section-list {
- flex-direction: column;
- padding: 4px 0;
-}
-
-.panel-list-item {
- align-items: center;
- display: flex;
- flex-direction: row;
- height: 24px;
- padding: 0 16px;
-}
-
-.panel-list-item:not(.disabled):hover {
- background-color: rgba(0, 0, 0, 0.06);
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- border-top: 1px solid rgba(0, 0, 0, 0.1);
-}
-
-.panel-list-item:not(.disabled):hover:active {
- background-color: rgba(0, 0, 0, 0.1);
-}
-
-.panel-list-item.disabled {
- color: #999;
-}
-
-.panel-list-item > .icon {
- flex-grow: 0;
- flex-shrink: 0;
-}
-
-.panel-list-item > .text {
- flex-grow: 10;
-}
-
-.panel-list-item > .text-shortcut {
- color: #808080;
- font-family: "Lucida Grande", caption;
- font-size: .847em;
- justify-content: flex-end;
-}
-
-.panel-section-list .panel-section-separator {
- margin: 4px 0;
-}
-
-/* Panel Section - Form Elements */
-.panel-section-formElements {
- display: flex;
- flex-direction: column;
- padding: 16px;
-}
-
-.panel-formElements-item {
- align-items: center;
- display: flex;
- flex-direction: row;
- margin-bottom: 12px;
-}
-
-.panel-formElements-item:last-child {
- margin-bottom: 0;
-}
-
-.panel-formElements-item label {
- flex-shrink: 0;
- margin-right: 6px;
- text-align: right;
-}
-
-.panel-formElements-item input[type="text"],
-.panel-formElements-item select {
- flex-grow: 1;
-}
-
-/* Panel Section - Footer */
-.panel-section-footer {
- background-color: rgba(0, 0, 0, 0.06);
- border-top: 1px solid rgba(0, 0, 0, 0.15);
- color: #1a1a1a;
- display: flex;
- flex-direction: row;
- height: 41px;
- margin-top: -1px;
- padding: 0;
-}
-
-.panel-section-footer-button {
- flex: 1 1 auto;
- height: 100%;
- margin: 0 -1px;
- padding: 12px;
- text-align: center;
-}
-
-.panel-section-footer-button > .text-shortcut {
- color: #808080;
- font-family: "Lucida Grande", caption;
- font-size: .847em;
-}
-
-.panel-section-footer-button:hover {
- background-color: rgba(0, 0, 0, 0.06);
-}
-
-.panel-section-footer-button:hover:active {
- background-color: rgba(0, 0, 0, 0.1);
-}
-
-.panel-section-footer-button.default {
- background-color: #0996f8;
- box-shadow: 0 1px 0 #0670cc inset;
- color: #fff;
-}
-
-.panel-section-footer-button.default:hover {
- background-color: #0670cc;
- box-shadow: 0 1px 0 #005bab inset;
-}
-
-.panel-section-footer-button.default:hover:active {
- background-color: #005bab;
- box-shadow: 0 1px 0 #004480 inset;
-}
-
-.panel-section-footer-separator {
- background-color: rgba(0, 0, 0, 0.1);
- width: 1px;
- z-index: 99;
-}
-
-/* Panel Section - Tabs */
-.panel-section-tabs {
- color: #1a1a1a;
- display: flex;
- flex-direction: row;
- height: 41px;
- margin-bottom: -1px;
- padding: 0;
-}
-
-.panel-section-tabs-button {
- flex: 1 1 auto;
- height: 100%;
- margin: 0 -1px;
- padding: 12px;
- text-align: center;
-}
-
-.panel-section-tabs-button:hover {
- background-color: rgba(0, 0, 0, 0.06);
-}
-
-.panel-section-tabs-button:hover:active {
- background-color: rgba(0, 0, 0, 0.1);
-}
-
-.panel-section-tabs-button.selected {
- box-shadow: 0 -1px 0 #0670cc inset, 0 -4px 0 #0996f8 inset;
- color: #0996f8;
-}
-
-.panel-section-tabs-button.selected:hover {
- color: #0670cc;
-}
-
-.panel-section-tabs-separator {
- background-color: rgba(0, 0, 0, 0.1);
- width: 1px;
- z-index: 99;
-}
diff --git a/application/basilisk/components/extensions/extension.svg b/application/basilisk/components/extensions/extension.svg
deleted file mode 100644
index a16455253..000000000
--- a/application/basilisk/components/extensions/extension.svg
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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/. -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
- width="64" height="64" viewBox="0 0 64 64">
- <defs>
- <style>
- .style-puzzle-piece {
- fill: url('#gradient-linear-puzzle-piece');
- }
- </style>
- <linearGradient id="gradient-linear-puzzle-piece" x1="0%" y1="0%" x2="0%" y2="100%">
- <stop offset="0%" stop-color="#66cc52" stop-opacity="1"/>
- <stop offset="100%" stop-color="#60bf4c" stop-opacity="1"/>
- </linearGradient>
- </defs>
- <path class="style-puzzle-piece" d="M42,62c2.2,0,4-1.8,4-4l0-14.2c0,0,0.4-3.7,2.8-3.7c2.4,0,2.2,3.9,6.7,3.9c2.3,0,6.2-1.2,6.2-8.2 c0-7-3.9-7.9-6.2-7.9c-4.5,0-4.3,3.7-6.7,3.7c-2.4,0-2.8-3.8-2.8-3.8V22c0-2.2-1.8-4-4-4H31.5c0,0-3.4-0.6-3.4-3 c0-2.4,3.8-2.6,3.8-7.1c0-2.3-1.3-5.9-8.3-5.9s-8,3.6-8,5.9c0,4.5,3.4,4.7,3.4,7.1c0,2.4-3.4,3-3.4,3H6c-2.2,0-4,1.8-4,4l0,7.8 c0,0-0.4,6,4.4,6c3.1,0,3.2-4.1,7.3-4.1c2,0,4,1.9,4,6c0,4.2-2,6.3-4,6.3c-4,0-4.2-4.1-7.3-4.1c-4.8,0-4.4,5.8-4.4,5.8L2,58 c0,2.2,1.8,4,4,4H19c0,0,6.3,0.4,6.3-4.4c0-3.1-4-3.6-4-7.7c0-2,2.2-4.5,6.4-4.5c4.2,0,6.6,2.5,6.6,4.5c0,4-3.9,4.6-3.9,7.7 c0,4.9,6.3,4.4,6.3,4.4H42z"/>
-</svg>
diff --git a/application/basilisk/components/extensions/extensions-browser.manifest b/application/basilisk/components/extensions/extensions-browser.manifest
deleted file mode 100644
index c1bbc8150..000000000
--- a/application/basilisk/components/extensions/extensions-browser.manifest
+++ /dev/null
@@ -1,41 +0,0 @@
-# scripts
-category webextension-scripts bookmarks chrome://browser/content/ext-bookmarks.js
-category webextension-scripts browserAction chrome://browser/content/ext-browserAction.js
-category webextension-scripts browsingData chrome://browser/content/ext-browsingData.js
-category webextension-scripts commands chrome://browser/content/ext-commands.js
-category webextension-scripts contextMenus chrome://browser/content/ext-contextMenus.js
-category webextension-scripts desktop-runtime chrome://browser/content/ext-desktop-runtime.js
-category webextension-scripts devtools chrome://browser/content/ext-devtools.js
-category webextension-scripts history chrome://browser/content/ext-history.js
-category webextension-scripts omnibox chrome://browser/content/ext-omnibox.js
-category webextension-scripts pageAction chrome://browser/content/ext-pageAction.js
-category webextension-scripts sessions chrome://browser/content/ext-sessions.js
-category webextension-scripts tabs chrome://browser/content/ext-tabs.js
-category webextension-scripts theme chrome://browser/content/ext-theme.js
-category webextension-scripts utils chrome://browser/content/ext-utils.js
-category webextension-scripts windows chrome://browser/content/ext-windows.js
-
-# scripts specific for devtools extension contexts.
-category webextension-scripts-devtools devtools-inspectedWindow chrome://browser/content/ext-c-devtools-inspectedWindow.js
-
-# scripts that must run in the same process as addon code.
-category webextension-scripts-addon contextMenus chrome://browser/content/ext-c-contextMenus.js
-category webextension-scripts-addon omnibox chrome://browser/content/ext-c-omnibox.js
-category webextension-scripts-addon tabs chrome://browser/content/ext-c-tabs.js
-
-# schemas
-category webextension-schemas bookmarks chrome://browser/content/schemas/bookmarks.json
-category webextension-schemas browser_action chrome://browser/content/schemas/browser_action.json
-category webextension-schemas browsing_data chrome://browser/content/schemas/browsing_data.json
-category webextension-schemas commands chrome://browser/content/schemas/commands.json
-category webextension-schemas context_menus chrome://browser/content/schemas/context_menus.json
-category webextension-schemas context_menus_internal chrome://browser/content/schemas/context_menus_internal.json
-category webextension-schemas devtools chrome://browser/content/schemas/devtools.json
-category webextension-schemas devtools_inspected_window chrome://browser/content/schemas/devtools_inspected_window.json
-category webextension-schemas history chrome://browser/content/schemas/history.json
-category webextension-schemas omnibox chrome://browser/content/schemas/omnibox.json
-category webextension-schemas page_action chrome://browser/content/schemas/page_action.json
-category webextension-schemas sessions chrome://browser/content/schemas/sessions.json
-category webextension-schemas tabs chrome://browser/content/schemas/tabs.json
-category webextension-schemas theme chrome://browser/content/schemas/theme.json
-category webextension-schemas windows chrome://browser/content/schemas/windows.json
diff --git a/application/basilisk/components/extensions/jar.mn b/application/basilisk/components/extensions/jar.mn
deleted file mode 100644
index 0b33b80e0..000000000
--- a/application/basilisk/components/extensions/jar.mn
+++ /dev/null
@@ -1,33 +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/.
-
-browser.jar:
- content/browser/extension.css
-#ifdef XP_MACOSX
- content/browser/extension-mac.css
- content/browser/extension-mac-panel.css
-#endif
-#ifdef XP_WIN
- content/browser/extension-win-panel.css
-#endif
- content/browser/extension.svg
- content/browser/ext-bookmarks.js
- content/browser/ext-browserAction.js
- content/browser/ext-browsingData.js
- content/browser/ext-commands.js
- content/browser/ext-contextMenus.js
- content/browser/ext-desktop-runtime.js
- content/browser/ext-devtools.js
- content/browser/ext-history.js
- content/browser/ext-omnibox.js
- content/browser/ext-pageAction.js
- content/browser/ext-sessions.js
- content/browser/ext-tabs.js
- content/browser/ext-theme.js
-* content/browser/ext-utils.js
- content/browser/ext-windows.js
- content/browser/ext-c-contextMenus.js
- content/browser/ext-c-devtools-inspectedWindow.js
- content/browser/ext-c-omnibox.js
- content/browser/ext-c-tabs.js
diff --git a/application/basilisk/components/extensions/moz.build b/application/basilisk/components/extensions/moz.build
deleted file mode 100644
index 3b892b4e4..000000000
--- a/application/basilisk/components/extensions/moz.build
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-JAR_MANIFESTS += ['jar.mn']
-
-EXTRA_COMPONENTS += [
- 'extensions-browser.manifest',
-]
-
-DIRS += ['schemas']
diff --git a/application/basilisk/components/extensions/schemas/LICENSE b/application/basilisk/components/extensions/schemas/LICENSE
deleted file mode 100644
index 9314092fd..000000000
--- a/application/basilisk/components/extensions/schemas/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/application/basilisk/components/extensions/schemas/bookmarks.json b/application/basilisk/components/extensions/schemas/bookmarks.json
deleted file mode 100644
index fb74c633e..000000000
--- a/application/basilisk/components/extensions/schemas/bookmarks.json
+++ /dev/null
@@ -1,568 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "Permission",
- "choices": [{
- "type": "string",
- "enum": [
- "bookmarks"
- ]
- }]
- }
- ]
- },
- {
- "namespace": "bookmarks",
- "description": "Use the <code>browser.bookmarks</code> API to create, organize, and otherwise manipulate bookmarks. Also see $(topic:override)[Override Pages], which you can use to create a custom Bookmark Manager page.",
- "permissions": ["bookmarks"],
- "types": [
- {
- "id": "BookmarkTreeNodeUnmodifiable",
- "type": "string",
- "enum": ["managed"],
- "description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)."
- },
- {
- "id": "BookmarkTreeNode",
- "type": "object",
- "description": "A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.",
- "properties": {
- "id": {
- "type": "string",
- "description": "The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted."
- },
- "parentId": {
- "type": "string",
- "optional": true,
- "description": "The <code>id</code> of the parent folder. Omitted for the root node."
- },
- "index": {
- "type": "integer",
- "optional": true,
- "description": "The 0-based position of this node within its parent folder."
- },
- "url": {
- "type": "string",
- "optional": true,
- "description": "The URL navigated to when a user clicks the bookmark. Omitted for folders."
- },
- "title": {
- "type": "string",
- "description": "The text displayed for the node."
- },
- "dateAdded": {
- "type": "number",
- "optional": true,
- "description": "When this node was created, in milliseconds since the epoch (<code>new Date(dateAdded)</code>)."
- },
- "dateGroupModified": {
- "type": "number",
- "optional": true,
- "description": "When the contents of this folder last changed, in milliseconds since the epoch."
- },
- "unmodifiable": {
- "$ref": "BookmarkTreeNodeUnmodifiable",
- "optional": true,
- "description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)."
- },
- "children": {
- "type": "array",
- "optional": true,
- "items": { "$ref": "BookmarkTreeNode" },
- "description": "An ordered list of children of this node."
- }
- }
- },
- {
- "id": "CreateDetails",
- "description": "Object passed to the create() function.",
- "type": "object",
- "properties": {
- "parentId": {
- "type": "string",
- "optional": true,
- "description": "Defaults to the Other Bookmarks folder."
- },
- "index": {
- "type": "integer",
- "minimum": 0,
- "optional": true
- },
- "title": {
- "type": "string",
- "optional": true
- },
- "url": {
- "type": "string",
- "optional": true
- }
- }
- }
- ],
- "functions": [
- {
- "name": "get",
- "type": "function",
- "description": "Retrieves the specified BookmarkTreeNode(s).",
- "async": "callback",
- "parameters": [
- {
- "name": "idOrIdList",
- "description": "A single string-valued id, or an array of string-valued ids",
- "choices": [
- {
- "type": "string"
- },
- {
- "type": "array",
- "items": {
- "type": "string"
- },
- "minItems": 1
- }
- ]
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": { "$ref": "BookmarkTreeNode" }
- }
- ]
- }
- ]
- },
- {
- "name": "getChildren",
- "type": "function",
- "description": "Retrieves the children of the specified BookmarkTreeNode id.",
- "async": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": { "$ref": "BookmarkTreeNode"}
- }
- ]
- }
- ]
- },
- {
- "name": "getRecent",
- "type": "function",
- "description": "Retrieves the recently added bookmarks.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "minimum": 1,
- "name": "numberOfItems",
- "description": "The maximum number of items to return."
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": { "$ref": "BookmarkTreeNode" }
- }
- ]
- }
- ]
- },
- {
- "name": "getTree",
- "type": "function",
- "description": "Retrieves the entire Bookmarks hierarchy.",
- "async": "callback",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": { "$ref": "BookmarkTreeNode" }
- }
- ]
- }
- ]
- },
- {
- "name": "getSubTree",
- "type": "function",
- "description": "Retrieves part of the Bookmarks hierarchy, starting at the specified node.",
- "async": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "id",
- "description": "The ID of the root of the subtree to retrieve."
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": { "$ref": "BookmarkTreeNode" }
- }
- ]
- }
- ]
- },
- {
- "name": "search",
- "type": "function",
- "description": "Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.",
- "async": "callback",
- "parameters": [
- {
- "name": "query",
- "description": "Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties <code>query</code>, <code>url</code>, and <code>title</code> may be specified and bookmarks matching all specified properties will be produced.",
- "choices": [
- {
- "type": "string",
- "description": "A string of words and quoted phrases that are matched against bookmark URLs and titles."
- },
- {
- "type": "object",
- "description": "An object specifying properties and values to match when searching. Produces bookmarks matching all properties.",
- "properties": {
- "query": {
- "type": "string",
- "optional": true,
- "description": "A string of words and quoted phrases that are matched against bookmark URLs and titles."
- },
- "url": {
- "type": "string",
- "format": "url",
- "optional": true,
- "description": "The URL of the bookmark; matches verbatim. Note that folders have no URL."
- },
- "title": {
- "type": "string",
- "optional": true,
- "description": "The title of the bookmark; matches verbatim."
- }
- }
- }
- ]
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": { "$ref": "BookmarkTreeNode" }
- }
- ]
- }
- ]
- },
- {
- "name": "create",
- "type": "function",
- "description": "Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.",
- "async": "callback",
- "parameters": [
- {
- "$ref": "CreateDetails",
- "name": "bookmark"
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "result",
- "$ref": "BookmarkTreeNode"
- }
- ]
- }
- ]
- },
- {
- "name": "move",
- "type": "function",
- "description": "Moves the specified BookmarkTreeNode to the provided location.",
- "async": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "object",
- "name": "destination",
- "properties": {
- "parentId": {
- "type": "string",
- "optional": true
- },
- "index": {
- "type": "integer",
- "minimum": 0,
- "optional": true
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "result",
- "$ref": "BookmarkTreeNode"
- }
- ]
- }
- ]
- },
- {
- "name": "update",
- "type": "function",
- "description": "Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported.",
- "async": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "object",
- "name": "changes",
- "properties": {
- "title": {
- "type": "string",
- "optional": true
- },
- "url": {
- "type": "string",
- "optional": true
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "result",
- "$ref": "BookmarkTreeNode"
- }
- ]
- }
- ]
- },
- {
- "name": "remove",
- "type": "function",
- "description": "Removes a bookmark or an empty bookmark folder.",
- "async": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeTree",
- "type": "function",
- "description": "Recursively removes a bookmark folder.",
- "async": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "import",
- "unsupported": true,
- "type": "function",
- "description": "Imports bookmarks from an html bookmark file",
- "async": "callback",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "export",
- "unsupported": true,
- "type": "function",
- "description": "Exports bookmarks to an html bookmark file",
- "async": "callback",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onCreated",
- "type": "function",
- "description": "Fired when a bookmark or folder is created.",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "$ref": "BookmarkTreeNode",
- "name": "bookmark"
- }
- ]
- },
- {
- "name": "onRemoved",
- "type": "function",
- "description": "Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents.",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "object",
- "name": "removeInfo",
- "properties": {
- "parentId": { "type": "string" },
- "index": { "type": "integer" },
- "node": { "$ref": "BookmarkTreeNode" }
- }
- }
- ]
- },
- {
- "name": "onChanged",
- "type": "function",
- "description": "Fired when a bookmark or folder changes. <b>Note:</b> Currently, only title and url changes trigger this.",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "object",
- "name": "changeInfo",
- "properties": {
- "title": { "type": "string" },
- "url": {
- "type": "string",
- "optional": true
- }
- }
- }
- ]
- },
- {
- "name": "onMoved",
- "type": "function",
- "description": "Fired when a bookmark or folder is moved to a different parent folder.",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "object",
- "name": "moveInfo",
- "properties": {
- "parentId": { "type": "string" },
- "index": { "type": "integer" },
- "oldParentId": { "type": "string" },
- "oldIndex": { "type": "integer" }
- }
- }
- ]
- },
- {
- "name": "onChildrenReordered",
- "unsupported": true,
- "type": "function",
- "description": "Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move().",
- "parameters": [
- {
- "type": "string",
- "name": "id"
- },
- {
- "type": "object",
- "name": "reorderInfo",
- "properties": {
- "childIds": {
- "type": "array",
- "items": { "type": "string" }
- }
- }
- }
- ]
- },
- {
- "name": "onImportBegan",
- "unsupported": true,
- "type": "function",
- "description": "Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately.",
- "parameters": []
- },
- {
- "name": "onImportEnded",
- "unsupported": true,
- "type": "function",
- "description": "Fired when a bookmark import session is ended.",
- "parameters": []
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/browser_action.json b/application/basilisk/components/extensions/schemas/browser_action.json
deleted file mode 100644
index 1a7da956a..000000000
--- a/application/basilisk/components/extensions/schemas/browser_action.json
+++ /dev/null
@@ -1,430 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "WebExtensionManifest",
- "properties": {
- "browser_action": {
- "type": "object",
- "additionalProperties": { "$ref": "UnrecognizedProperty" },
- "properties": {
- "default_title": {
- "type": "string",
- "optional": true,
- "preprocess": "localize"
- },
- "default_icon": {
- "$ref": "IconPath",
- "optional": true
- },
- "default_popup": {
- "type": "string",
- "format": "relativeUrl",
- "optional": true,
- "preprocess": "localize"
- },
- "browser_style": {
- "type": "boolean",
- "optional": true
- }
- },
- "optional": true
- }
- }
- }
- ]
- },
- {
- "namespace": "browserAction",
- "description": "Use browser actions to put icons in the main browser toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup.",
- "permissions": ["manifest:browser_action"],
- "types": [
- {
- "id": "ColorArray",
- "type": "array",
- "items": {
- "type": "integer",
- "minimum": 0,
- "maximum": 255
- },
- "minItems": 4,
- "maxItems": 4
- },
- {
- "id": "ImageDataType",
- "type": "object",
- "isInstanceOf": "ImageData",
- "additionalProperties": { "type": "any" },
- "postprocess": "convertImageDataToURL",
- "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)."
- }
- ],
- "functions": [
- {
- "name": "setTitle",
- "type": "function",
- "description": "Sets the title of the browser action. This shows up in the tooltip.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "title": {
- "type": "string",
- "description": "The string the browser action should display when moused over."
- },
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "getTitle",
- "type": "function",
- "description": "Gets the title of the browser action.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Specify the tab to get the title from. If no tab is specified, the non-tab-specific title is returned."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "result",
- "type": "string"
- }
- ]
- }
- ]
- },
- {
- "name": "setIcon",
- "type": "function",
- "description": "Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "imageData": {
- "choices": [
- { "$ref": "ImageDataType" },
- {
- "type": "object",
- "additionalProperties": {"$ref": "ImageDataType"}
- }
- ],
- "optional": true,
- "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'"
- },
- "path": {
- "choices": [
- { "type": "string" },
- {
- "type": "object",
- "additionalProperties": {"type": "string"}
- }
- ],
- "optional": true,
- "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'"
- },
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "setPopup",
- "type": "function",
- "description": "Sets the html document to be opened as a popup when the user clicks on the browser action's icon.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {
- "type": "integer",
- "optional": true,
- "minimum": 0,
- "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
- },
- "popup": {
- "type": "string",
- "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "getPopup",
- "type": "function",
- "description": "Gets the html document set as the popup for this browser action.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Specify the tab to get the popup from. If no tab is specified, the non-tab-specific popup is returned."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "result",
- "type": "string"
- }
- ]
- }
- ]
- },
- {
- "name": "setBadgeText",
- "type": "function",
- "description": "Sets the badge text for the browser action. The badge is displayed on top of the icon.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "text": {
- "type": "string",
- "description": "Any number of characters can be passed, but only about four can fit in the space."
- },
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "getBadgeText",
- "type": "function",
- "description": "Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Specify the tab to get the badge text from. If no tab is specified, the non-tab-specific badge text is returned."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "result",
- "type": "string"
- }
- ]
- }
- ]
- },
- {
- "name": "setBadgeBackgroundColor",
- "type": "function",
- "description": "Sets the background color for the badge.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "color": {
- "description": "An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with a CSS value, with opaque red being <code>#FF0000</code> or <code>#F00</code>.",
- "choices": [
- {"type": "string"},
- {"$ref": "ColorArray"}
- ]
- },
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "getBadgeBackgroundColor",
- "type": "function",
- "description": "Gets the background color of the browser action.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {
- "type": "integer",
- "optional": true,
- "description": "Specify the tab to get the badge background color from. If no tab is specified, the non-tab-specific badge background color is returned."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "result",
- "$ref": "ColorArray"
- }
- ]
- }
- ]
- },
- {
- "name": "enable",
- "type": "function",
- "description": "Enables the browser action for a tab. By default, browser actions are enabled.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "optional": true,
- "name": "tabId",
- "minimum": 0,
- "description": "The id of the tab for which you want to modify the browser action."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "disable",
- "type": "function",
- "description": "Disables the browser action for a tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "optional": true,
- "name": "tabId",
- "minimum": 0,
- "description": "The id of the tab for which you want to modify the browser action."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "openPopup",
- "type": "function",
- "description": "Opens the extension popup window in the active window but does not grant tab permissions.",
- "unsupported": true,
- "async": "callback",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "popupView",
- "type": "object",
- "optional": true,
- "description": "JavaScript 'window' object for the popup window if it was succesfully opened.",
- "additionalProperties": { "type": "any" }
- }
- ]
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onClicked",
- "type": "function",
- "description": "Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.",
- "parameters": [
- {
- "name": "tab",
- "$ref": "tabs.Tab"
- }
- ]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/browsing_data.json b/application/basilisk/components/extensions/schemas/browsing_data.json
deleted file mode 100644
index 6f01f2ee1..000000000
--- a/application/basilisk/components/extensions/schemas/browsing_data.json
+++ /dev/null
@@ -1,413 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "Permission",
- "choices": [{
- "type": "string",
- "enum": [
- "browsingData"
- ]
- }]
- }
- ]
- },
- {
- "namespace": "browsingData",
- "description": "Use the <code>chrome.browsingData</code> API to remove browsing data from a user's local profile.",
- "permissions": ["browsingData"],
- "types": [
- {
- "id": "RemovalOptions",
- "type": "object",
- "description": "Options that determine exactly what data will be removed.",
- "properties": {
- "since": {
- "$ref": "extensionTypes.Date",
- "optional": true,
- "description": "Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the <code>getTime</code> method of the JavaScript <code>Date</code> object). If absent, defaults to 0 (which would remove all browsing data)."
- },
- "originTypes": {
- "type": "object",
- "optional": true,
- "description": "An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only \"unprotected\" origins. Please ensure that you <em>really</em> want to remove application data before adding 'protectedWeb' or 'extensions'.",
- "properties": {
- "unprotectedWeb": {
- "type": "boolean",
- "optional": true,
- "description": "Normal websites."
- },
- "protectedWeb": {
- "type": "boolean",
- "optional": true,
- "description": "Websites that have been installed as hosted applications (be careful!)."
- },
- "extension": {
- "type": "boolean",
- "optional": true,
- "description": "Extensions and packaged applications a user has installed (be _really_ careful!)."
- }
- }
- }
- }
- },
- {
- "id": "DataTypeSet",
- "type": "object",
- "description": "A set of data types. Missing data types are interpreted as <code>false</code>.",
- "properties": {
- "cache": {
- "type": "boolean",
- "optional": true,
- "description": "The browser's cache. Note: when removing data, this clears the <em>entire</em> cache: it is not limited to the range you specify."
- },
- "cookies": {
- "type": "boolean",
- "optional": true,
- "description": "The browser's cookies."
- },
- "downloads": {
- "type": "boolean",
- "optional": true,
- "description": "The browser's download list."
- },
- "formData": {
- "type": "boolean",
- "optional": true,
- "description": "The browser's stored form data."
- },
- "history": {
- "type": "boolean",
- "optional": true,
- "description": "The browser's history."
- },
- "indexedDB": {
- "type": "boolean",
- "optional": true,
- "description": "Websites' IndexedDB data."
- },
- "localStorage": {
- "type": "boolean",
- "optional": true,
- "description": "Websites' local storage data."
- },
- "serverBoundCertificates": {
- "type": "boolean",
- "optional": true,
- "description": "Server-bound certificates."
- },
- "passwords": {
- "type": "boolean",
- "optional": true,
- "description": "Stored passwords."
- },
- "pluginData": {
- "type": "boolean",
- "optional": true,
- "description": "Plugins' data."
- },
- "serviceWorkers": {
- "type": "boolean",
- "optional": true,
- "description": "Service Workers."
- }
- }
- }
- ],
- "functions": [
- {
- "name": "settings",
- "description": "Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "name": "callback",
- "type": "function",
- "parameters": [
- {
- "name": "result",
- "type": "object",
- "properties": {
- "options": {
- "$ref": "RemovalOptions"
- },
- "dataToRemove": {
- "$ref": "DataTypeSet",
- "description": "All of the types will be present in the result, with values of <code>true</code> if they are both selected to be removed and permitted to be removed, otherwise <code>false</code>."
- },
- "dataRemovalPermitted": {
- "$ref": "DataTypeSet",
- "description": "All of the types will be present in the result, with values of <code>true</code> if they are permitted to be removed (e.g., by enterprise policy) and <code>false</code> if not."
- }
- }
- }
- ]
- }
- ]
- },
- {
- "name": "remove",
- "description": "Clears various types of browsing data stored in a user's profile.",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "dataToRemove",
- "$ref": "DataTypeSet",
- "description": "The set of data types to remove."
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when deletion has completed.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeAppcache",
- "description": "Clears websites' appcache data.",
- "type": "function",
- "async": "callback",
- "unsupported": true,
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when websites' appcache data has been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeCache",
- "description": "Clears the browser's cache.",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the browser's cache has been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeCookies",
- "description": "Clears the browser's cookies and server-bound certificates modified within a particular timeframe.",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the browser's cookies and server-bound certificates have been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeDownloads",
- "description": "Clears the browser's list of downloaded files (<em>not</em> the downloaded files themselves).",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the browser's list of downloaded files has been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeFileSystems",
- "description": "Clears websites' file system data.",
- "type": "function",
- "async": "callback",
- "unsupported": true,
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when websites' file systems have been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeFormData",
- "description": "Clears the browser's stored form data (autofill).",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the browser's form data has been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeHistory",
- "description": "Clears the browser's history.",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the browser's history has cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeIndexedDB",
- "description": "Clears websites' IndexedDB data.",
- "type": "function",
- "async": "callback",
- "unsupported": true,
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when websites' IndexedDB data has been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeLocalStorage",
- "description": "Clears websites' local storage data.",
- "type": "function",
- "async": "callback",
- "unsupported": true,
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when websites' local storage has been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removePluginData",
- "description": "Clears plugins' data.",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when plugins' data has been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removePasswords",
- "description": "Clears the browser's stored passwords.",
- "type": "function",
- "async": "callback",
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the browser's passwords have been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "removeWebSQL",
- "description": "Clears websites' WebSQL data.",
- "type": "function",
- "async": "callback",
- "unsupported": true,
- "parameters": [
- {
- "$ref": "RemovalOptions",
- "name": "options"
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when websites' WebSQL databases have been cleared.",
- "optional": true,
- "parameters": []
- }
- ]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/commands.json b/application/basilisk/components/extensions/schemas/commands.json
deleted file mode 100644
index 9dbaf43ee..000000000
--- a/application/basilisk/components/extensions/schemas/commands.json
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "id": "KeyName",
- "choices": [
- {
- "type": "string",
- "pattern": "^\\s*(Alt|Ctrl|Command|MacCtrl)\\s*\\+\\s*(Shift\\s*\\+\\s*)?([A-Z0-9]|Comma|Period|Home|End|PageUp|PageDown|Space|Insert|Delete|Up|Down|Left|Right)\\s*$"
- },
- {
- "type": "string",
- "pattern": "^\\s*((Alt|Ctrl|Command|MacCtrl)\\s*\\+\\s*)?(Shift\\s*\\+\\s*)?(F[1-9]|F1[0-2])\\s*$"
- },
- {
- "type": "string",
- "pattern": "^(MediaNextTrack|MediaPlayPause|MediaPrevTrack|MediaStop)$"
- }
- ]
- },
- {
- "$extend": "WebExtensionManifest",
- "properties": {
- "commands": {
- "type": "object",
- "optional": true,
- "additionalProperties": {
- "type": "object",
- "additionalProperties": { "$ref": "UnrecognizedProperty" },
- "properties": {
- "suggested_key": {
- "type": "object",
- "optional": true,
- "properties": {
- "default": {
- "$ref": "KeyName",
- "optional": true
- },
- "mac": {
- "$ref": "KeyName",
- "optional": true
- },
- "linux": {
- "$ref": "KeyName",
- "optional": true
- },
- "windows": {
- "$ref": "KeyName",
- "optional": true
- },
- "chromeos": {
- "type": "string",
- "optional": true
- },
- "android": {
- "type": "string",
- "optional": true
- },
- "ios": {
- "type": "string",
- "optional": true
- },
- "additionalProperties": {
- "type": "string",
- "deprecated": "Unknown platform name",
- "optional": true
- }
- }
- },
- "description": {
- "type": "string",
- "optional": true
- }
- }
- }
- }
- }
- }
- ]
- },
- {
- "namespace": "commands",
- "description": "Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the xtension.",
- "permissions": ["manifest:commands"],
- "types": [
- {
- "id": "Command",
- "type": "object",
- "properties": {
- "name": {
- "type": "string",
- "optional": true,
- "description": "The name of the Extension Command"
- },
- "description": {
- "type": "string",
- "optional": true,
- "description": "The Extension Command description"
- },
- "shortcut": {
- "type": "string",
- "optional": true,
- "description": "The shortcut active for this command, or blank if not active."
- }
- }
- }
- ],
- "events": [
- {
- "name": "onCommand",
- "description": "Fired when a registered command is activated using a keyboard shortcut.",
- "type": "function",
- "parameters": [
- {
- "name": "command",
- "type": "string"
- }
- ]
- }
- ],
- "functions": [
- {
- "name": "getAll",
- "type": "function",
- "async": "callback",
- "description": "Returns all the registered extension commands for this extension and their shortcut (if active).",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "commands",
- "type": "array",
- "items": {
- "$ref": "Command"
- }
- }
- ],
- "description": "Called to return the registered commands."
- }
- ]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/context_menus.json b/application/basilisk/components/extensions/schemas/context_menus.json
deleted file mode 100644
index 682639b4d..000000000
--- a/application/basilisk/components/extensions/schemas/context_menus.json
+++ /dev/null
@@ -1,424 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "Permission",
- "choices": [{
- "type": "string",
- "enum": [
- "contextMenus"
- ]
- }]
- }
- ]
- },
- {
- "namespace": "contextMenus",
- "description": "Use the <code>browser.contextMenus</code> API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.",
- "permissions": ["contextMenus"],
- "properties": {
- "ACTION_MENU_TOP_LEVEL_LIMIT": {
- "value": 6,
- "description": "The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored."
- }
- },
- "types": [
- {
- "id": "ContextType",
- "type": "string",
- "enum": ["all", "page", "frame", "selection", "link", "editable", "password", "image", "video", "audio", "launcher", "browser_action", "page_action", "tab"],
- "description": "The different contexts a menu can appear in. Specifying 'all' is equivalent to the combination of all other contexts except for 'tab'."
- },
- {
- "id": "ItemType",
- "type": "string",
- "enum": ["normal", "checkbox", "radio", "separator"],
- "description": "The type of menu item."
- },
- {
- "id": "OnClickData",
- "type": "object",
- "description": "Information sent when a context menu item is clicked.",
- "properties": {
- "menuItemId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "description": "The ID of the menu item that was clicked."
- },
- "parentMenuItemId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "optional": true,
- "description": "The parent ID, if any, for the item clicked."
- },
- "mediaType": {
- "type": "string",
- "optional": true,
- "description": "One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements."
- },
- "linkUrl": {
- "type": "string",
- "optional": true,
- "description": "If the element is a link, the URL it points to."
- },
- "srcUrl": {
- "type": "string",
- "optional": true,
- "description": "Will be present for elements with a 'src' URL."
- },
- "pageUrl": {
- "type": "string",
- "optional": true,
- "description": "The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu."
- },
- "frameUrl": {
- "type": "string",
- "optional": true,
- "description": " The URL of the frame of the element where the context menu was clicked, if it was in a frame."
- },
- "selectionText": {
- "type": "string",
- "optional": true,
- "description": "The text for the context selection, if any."
- },
- "editable": {
- "type": "boolean",
- "description": "A flag indicating whether the element is editable (text input, textarea, etc.)."
- },
- "wasChecked": {
- "type": "boolean",
- "optional": true,
- "description": "A flag indicating the state of a checkbox or radio item before it was clicked."
- },
- "checked": {
- "type": "boolean",
- "optional": true,
- "description": "A flag indicating the state of a checkbox or radio item after it is clicked."
- }
- }
- }
- ],
- "functions": [
- {
- "name": "create",
- "type": "function",
- "description": "Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in $(ref:runtime.lastError)).",
- "returns": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "description": "The ID of the newly created item."
- },
- "parameters": [
- {
- "type": "object",
- "name": "createProperties",
- "properties": {
- "type": {
- "$ref": "ItemType",
- "optional": true,
- "description": "The type of menu item. Defaults to 'normal' if not specified."
- },
- "id": {
- "type": "string",
- "optional": true,
- "description": "The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension."
- },
- "title": {
- "type": "string",
- "optional": true,
- "description": "The text to be displayed in the item; this is <em>required</em> unless <code>type</code> is 'separator'. When the context is 'selection', you can use <code>%s</code> within the string to show the selected text. For example, if this parameter's value is \"Translate '%s' to Pig Latin\" and the user selects the word \"cool\", the context menu item for the selection is \"Translate 'cool' to Pig Latin\"."
- },
- "checked": {
- "type": "boolean",
- "optional": true,
- "description": "The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items."
- },
- "contexts": {
- "type": "array",
- "items": {
- "$ref": "ContextType"
- },
- "minItems": 1,
- "optional": true,
- "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
- },
- "onclick": {
- "type": "function",
- "optional": true,
- "description": "A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for $(ref:contextMenus.onClicked).",
- "parameters": [
- {
- "name": "info",
- "$ref": "contextMenusInternal.OnClickData",
- "description": "Information about the item clicked and the context where the click happened."
- },
- {
- "name": "tab",
- "$ref": "tabs.Tab",
- "description": "The details of the tab where the click took place. Note: this parameter only present for extensions."
- }
- ]
- },
- "parentId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "optional": true,
- "description": "The ID of a parent menu item; this makes the item a child of a previously added item."
- },
- "documentUrlPatterns": {
- "type": "array",
- "items": {"type": "string"},
- "optional": true,
- "description": "Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see $(topic:match_patterns)[Match Patterns]."
- },
- "targetUrlPatterns": {
- "type": "array",
- "items": {"type": "string"},
- "optional": true,
- "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags."
- },
- "enabled": {
- "type": "boolean",
- "optional": true,
- "description": "Whether this context menu item is enabled or disabled. Defaults to true."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "description": "Called when the item has been created in the browser. If there were any problems creating the item, details will be available in $(ref:runtime.lastError).",
- "parameters": []
- }
- ]
- },
- {
- "name": "createInternal",
- "type": "function",
- "allowedContexts": ["addon_parent_only"],
- "async": "callback",
- "description": "Identical to contextMenus.create, except: the 'id' field is required and allows an integer, 'onclick' is not allowed, and the method is async (and the return value is not a menu item ID).",
- "parameters": [
- {
- "type": "object",
- "name": "createProperties",
- "properties": {
- "type": {
- "$ref": "ItemType",
- "optional": true
- },
- "id": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ]
- },
- "title": {
- "type": "string",
- "optional": true
- },
- "checked": {
- "type": "boolean",
- "optional": true
- },
- "contexts": {
- "type": "array",
- "items": {
- "$ref": "ContextType"
- },
- "minItems": 1,
- "optional": true
- },
- "parentId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "optional": true
- },
- "documentUrlPatterns": {
- "type": "array",
- "items": {"type": "string"},
- "optional": true
- },
- "targetUrlPatterns": {
- "type": "array",
- "items": {"type": "string"},
- "optional": true
- },
- "enabled": {
- "type": "boolean",
- "optional": true
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "update",
- "type": "function",
- "description": "Updates a previously created context menu item.",
- "async": "callback",
- "parameters": [
- {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "name": "id",
- "description": "The ID of the item to update."
- },
- {
- "type": "object",
- "name": "updateProperties",
- "description": "The properties to update. Accepts the same values as the create function.",
- "properties": {
- "type": {
- "$ref": "ItemType",
- "optional": true
- },
- "title": {
- "type": "string",
- "optional": true
- },
- "checked": {
- "type": "boolean",
- "optional": true
- },
- "contexts": {
- "type": "array",
- "items": {
- "$ref": "ContextType"
- },
- "minItems": 1,
- "optional": true
- },
- "onclick": {
- "type": "function",
- "optional": "omit-key-if-missing",
- "parameters": [
- {
- "name": "info",
- "$ref": "contextMenusInternal.OnClickData"
- },
- {
- "name": "tab",
- "$ref": "tabs.Tab",
- "description": "The details of the tab where the click took place. Note: this parameter only present for extensions."
- }
- ]
- },
- "parentId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "optional": true,
- "description": "Note: You cannot change an item to be a child of one of its own descendants."
- },
- "documentUrlPatterns": {
- "type": "array",
- "items": {"type": "string"},
- "optional": true
- },
- "targetUrlPatterns": {
- "type": "array",
- "items": {"type": "string"},
- "optional": true
- },
- "enabled": {
- "type": "boolean",
- "optional": true
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [],
- "description": "Called when the context menu has been updated."
- }
- ]
- },
- {
- "name": "remove",
- "type": "function",
- "description": "Removes a context menu item.",
- "async": "callback",
- "parameters": [
- {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "name": "menuItemId",
- "description": "The ID of the context menu item to remove."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [],
- "description": "Called when the context menu has been removed."
- }
- ]
- },
- {
- "name": "removeAll",
- "type": "function",
- "description": "Removes all context menu items added by this extension.",
- "async": "callback",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [],
- "description": "Called when removal is complete."
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onClicked",
- "type": "function",
- "description": "Fired when a context menu item is clicked.",
- "parameters": [
- {
- "name": "info",
- "$ref": "OnClickData",
- "description": "Information about the item clicked and the context where the click happened."
- },
- {
- "name": "tab",
- "$ref": "tabs.Tab",
- "description": "The details of the tab where the click took place. If the click did not take place in a tab, this parameter will be missing.",
- "optional": true
- }
- ]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/context_menus_internal.json b/application/basilisk/components/extensions/schemas/context_menus_internal.json
deleted file mode 100644
index c3cb7aff0..000000000
--- a/application/basilisk/components/extensions/schemas/context_menus_internal.json
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "contextMenusInternal",
- "description": "Use the <code>browser.contextMenus</code> API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.",
- "types": [
- {
- "id": "OnClickData",
- "type": "object",
- "description": "Information sent when a context menu item is clicked.",
- "properties": {
- "menuItemId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "description": "The ID of the menu item that was clicked."
- },
- "parentMenuItemId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "optional": true,
- "description": "The parent ID, if any, for the item clicked."
- },
- "mediaType": {
- "type": "string",
- "optional": true,
- "description": "One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements."
- },
- "linkUrl": {
- "type": "string",
- "optional": true,
- "description": "If the element is a link, the URL it points to."
- },
- "srcUrl": {
- "type": "string",
- "optional": true,
- "description": "Will be present for elements with a 'src' URL."
- },
- "pageUrl": {
- "type": "string",
- "optional": true,
- "description": "The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu."
- },
- "frameUrl": {
- "type": "string",
- "optional": true,
- "description": " The URL of the frame of the element where the context menu was clicked, if it was in a frame."
- },
- "selectionText": {
- "type": "string",
- "optional": true,
- "description": "The text for the context selection, if any."
- },
- "editable": {
- "type": "boolean",
- "description": "A flag indicating whether the element is editable (text input, textarea, etc.)."
- },
- "wasChecked": {
- "type": "boolean",
- "optional": true,
- "description": "A flag indicating the state of a checkbox or radio item before it was clicked."
- },
- "checked": {
- "type": "boolean",
- "optional": true,
- "description": "A flag indicating the state of a checkbox or radio item after it is clicked."
- }
- }
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/devtools.json b/application/basilisk/components/extensions/schemas/devtools.json
deleted file mode 100644
index 6956b0921..000000000
--- a/application/basilisk/components/extensions/schemas/devtools.json
+++ /dev/null
@@ -1,16 +0,0 @@
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "WebExtensionManifest",
- "properties": {
- "devtools_page": {
- "$ref": "ExtensionURL",
- "optional": true
- }
- }
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/devtools_inspected_window.json b/application/basilisk/components/extensions/schemas/devtools_inspected_window.json
deleted file mode 100644
index 27800f969..000000000
--- a/application/basilisk/components/extensions/schemas/devtools_inspected_window.json
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "devtools.inspectedWindow",
- "allowedContexts": ["devtools", "devtools_only"],
- "defaultContexts": ["devtools", "devtools_only"],
- "description": "Use the <code>chrome.devtools.inspectedWindow</code> API to interact with the inspected window: obtain the tab ID for the inspected page, evaluate the code in the context of the inspected window, reload the page, or obtain the list of resources within the page.",
- "nocompile": true,
- "types": [
- {
- "id": "Resource",
- "type": "object",
- "description": "A resource within the inspected page, such as a document, a script, or an image.",
- "properties": {
- "url": {
- "type": "string",
- "description": "The URL of the resource."
- }
- },
- "functions": [
- {
- "name": "getContent",
- "unsupported": true,
- "type": "function",
- "async": "callback",
- "description": "Gets the content of the resource.",
- "parameters": [
- {
- "name": "callback",
- "type": "function",
- "description": "A function that receives resource content when the request completes.",
- "parameters": [
- {
- "name": "content",
- "type": "string",
- "description": "Content of the resource (potentially encoded)."
- },
- {
- "name": "encoding",
- "type": "string",
- "description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported."
- }
- ]
- }
- ]
- },
- {
- "name": "setContent",
- "unsupported": true,
- "type": "function",
- "async": "callback",
- "description": "Sets the content of the resource.",
- "parameters": [
- {
- "name": "content",
- "type": "string",
- "description": "New content of the resource. Only resources with the text type are currently supported."
- },
- {
- "name": "commit",
- "type": "boolean",
- "description": "True if the user has finished editing the resource, and the new content of the resource should be persisted; false if this is a minor change sent in progress of the user editing the resource."
- },
- {
- "name": "callback",
- "type": "function",
- "description": "A function called upon request completion.",
- "optional": true,
- "parameters": [
- {
- "name": "error",
- "type": "object",
- "additionalProperties": {"type": "any"},
- "optional": true,
- "description": "Set to undefined if the resource content was set successfully; describes error otherwise."
- }
- ]
- }
- ]
- }
- ]
- }
- ],
- "properties": {
- "tabId": {
- "description": "The ID of the tab being inspected. This ID may be used with chrome.tabs.* API.",
- "type": "integer"
- }
- },
- "functions": [
- {
- "name": "eval",
- "unsupported": true,
- "type": "function",
- "description": "Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the <code>result</code> parameter of the callback is <code>undefined</code>. In the case of a DevTools-side error, the <code>isException</code> parameter is non-null and has <code>isError</code> set to true and <code>code</code> set to an error code. In the case of a JavaScript error, <code>isException</code> is set to true and <code>value</code> is set to the string value of thrown object.",
- "async": "callback",
- "parameters": [
- {
- "name": "expression",
- "type": "string",
- "description": "An expression to evaluate."
- },
- {
- "name": "options",
- "type": "object",
- "optional": true,
- "description": "The options parameter can contain one or more options.",
- "properties": {
- "frameURL": {
- "type": "string",
- "unsupported": true,
- "optional": true,
- "description": "If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page."
- },
- "useContentScriptContext": {
- "type": "boolean",
- "unsupported": true,
- "optional": true,
- "description": "Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the <code>isError</code> field set to true and the <code>code</code> field set to <code>E_NOTFOUND</code>."
- },
- "contextSecurityOrigin": {
- "type": "string",
- "unsupported": true,
- "optional": true,
- "description": "Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext."
- }
- }
- },
- {
- "name": "callback",
- "type": "function",
- "description": "A function called when evaluation completes.",
- "optional": true,
- "parameters": [
- {
- "name": "result",
- "type": "object",
- "additionalProperties": {"type": "any"},
- "description": "The result of evaluation."
- },
- {
- "name": "exceptionInfo",
- "type": "object",
- "description": "An object providing details if an exception occurred while evaluating the expression.",
- "properties": {
- "isError": {
- "type": "boolean",
- "description": "Set if the error occurred on the DevTools side before the expression is evaluated."
- },
- "code": {
- "type": "string",
- "description": "Set if the error occurred on the DevTools side before the expression is evaluated."
- },
- "description": {
- "type": "string",
- "description": "Set if the error occurred on the DevTools side before the expression is evaluated."
- },
- "details": {
- "type": "array",
- "items": { "type": "any" },
- "description": "Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error."
- },
- "isException": {
- "type": "boolean",
- "description": "Set if the evaluated code produces an unhandled exception."
- },
- "value": {
- "type": "string",
- "description": "Set if the evaluated code produces an unhandled exception."
- }
- }
- }
- ]
- }
- ]
- },
- {
- "name": "reload",
- "unsupported": true,
- "type": "function",
- "description": "Reloads the inspected page.",
- "parameters": [
- {
- "type": "object",
- "name": "reloadOptions",
- "optional": true,
- "properties": {
- "ignoreCache": {
- "type": "boolean",
- "optional": true,
- "description": "When true, the loader will bypass the cache for all inspected page resources loaded before the <code>load</code> event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window."
- },
- "userAgent": {
- "type": "string",
- "optional": true,
- "description": "If specified, the string will override the value of the <code>User-Agent</code> HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the <code>navigator.userAgent</code> property that's returned to any scripts that are running within the inspected page."
- },
- "injectedScript": {
- "type": "string",
- "optional": true,
- "description": "If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads&mdash;for example, if the user presses Ctrl+R."
- },
- "preprocessorScript": {
- "unsupported": true,
- "type": "string",
- "deprecated": "Please avoid using this parameter, it will be removed soon.",
- "optional": true,
- "description": "If specified, this script evaluates into a function that accepts three string arguments: the source to preprocess, the URL of the source, and a function name if the source is an DOM event handler. The preprocessorerScript function should return a string to be compiled by Chrome in place of the input source. In the case that the source is a DOM event handler, the returned source must compile to a single JS function."
- }
- }
- }
- ]
- },
- {
- "name": "getResources",
- "unsupported": true,
- "type": "function",
- "description": "Retrieves the list of resources from the inspected page.",
- "unsupported": true,
- "async": "callback",
- "parameters": [
- {
- "name": "callback",
- "type": "function",
- "description": "A function that receives the list of resources when the request completes.",
- "parameters": [
- {
- "name": "resources",
- "type": "array",
- "items": { "$ref": "Resource" },
- "description": "The resources within the page."
- }
- ]
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onResourceAdded",
- "unsupported": true,
- "type": "function",
- "description": "Fired when a new resource is added to the inspected page.",
- "parameters": [
- {
- "name": "resource",
- "$ref": "Resource"
- }
- ]
- },
- {
- "name": "onResourceContentCommitted",
- "unsupported": true,
- "type": "function",
- "description": "Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools).",
- "parameters": [
- {
- "name": "resource",
- "$ref": "Resource"
- },
- {
- "name": "content",
- "type": "string",
- "description": "New content of the resource."
- }
- ]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/history.json b/application/basilisk/components/extensions/schemas/history.json
deleted file mode 100644
index e05569e38..000000000
--- a/application/basilisk/components/extensions/schemas/history.json
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "Permission",
- "choices": [{
- "type": "string",
- "enum": [
- "history"
- ]
- }]
- }
- ]
- },
- {
- "namespace": "history",
- "description": "Use the <code>browser.history</code> API to interact with the browser's record of visited pages. You can add, remove, and query for URLs in the browser's history. To override the history page with your own version, see $(topic:override)[Override Pages].",
- "permissions": ["history"],
- "types": [
- {
- "id": "TransitionType",
- "type": "string",
- "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "auto_toplevel", "form_submit", "reload", "keyword", "keyword_generated"],
- "description": "The $(topic:transition-types)[transition type] for this visit from its referrer."
- },
- {
- "id": "HistoryItem",
- "type": "object",
- "description": "An object encapsulating one result of a history query.",
- "properties": {
- "id": {
- "type": "string",
- "description": "The unique identifier for the item."
- },
- "url": {
- "type": "string",
- "optional": true,
- "description": "The URL navigated to by a user."
- },
- "title": {
- "type": "string",
- "optional": true,
- "description": "The title of the page when it was last loaded."
- },
- "lastVisitTime": {
- "type": "number",
- "optional": true,
- "description": "When this page was last loaded, represented in milliseconds since the epoch."
- },
- "visitCount": {
- "type": "integer",
- "optional": true,
- "description": "The number of times the user has navigated to this page."
- },
- "typedCount": {
- "type": "integer",
- "optional": true,
- "description": "The number of times the user has navigated to this page by typing in the address."
- }
- }
- },
- {
- "id": "VisitItem",
- "type": "object",
- "description": "An object encapsulating one visit to a URL.",
- "properties": {
- "id": {
- "type": "string",
- "description": "The unique identifier for the item."
- },
- "visitId": {
- "type": "string",
- "description": "The unique identifier for this visit."
- },
- "visitTime": {
- "type": "number",
- "optional": true,
- "description": "When this visit occurred, represented in milliseconds since the epoch."
- },
- "referringVisitId": {
- "type": "string",
- "description": "The visit ID of the referrer."
- },
- "transition": {
- "$ref": "TransitionType",
- "description": "The $(topic:transition-types)[transition type] for this visit from its referrer."
- }
- }
- }
- ],
- "functions": [
- {
- "name": "search",
- "type": "function",
- "description": "Searches the history for the last visit time of each page matching the query.",
- "async": "callback",
- "parameters": [
- {
- "name": "query",
- "type": "object",
- "properties": {
- "text": {
- "type": "string",
- "description": "A free-text query to the history service. Leave empty to retrieve all pages."
- },
- "startTime": {
- "$ref": "extensionTypes.Date",
- "optional": true,
- "description": "Limit results to those visited after this date. If not specified, this defaults to 24 hours in the past."
- },
- "endTime": {
- "$ref": "extensionTypes.Date",
- "optional": true,
- "description": "Limit results to those visited before this date."
- },
- "maxResults": {
- "type": "integer",
- "optional": true,
- "minimum": 1,
- "description": "The maximum number of results to retrieve. Defaults to 100."
- }
- }
- },
- {
- "name": "callback",
- "type": "function",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": {
- "$ref": "HistoryItem"
- }
- }
- ]
- }
- ]
- },
- {
- "name": "getVisits",
- "type": "function",
- "description": "Retrieves information about visits to a URL.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "url": {
- "type": "string",
- "description": "The URL for which to retrieve visit information. It must be in the format as returned from a call to history.search."
- }
- }
- },
- {
- "name": "callback",
- "type": "function",
- "parameters": [
- {
- "name": "results",
- "type": "array",
- "items": {
- "$ref": "VisitItem"
- }
- }
- ]
- }
- ]
- },
- {
- "name": "addUrl",
- "type": "function",
- "description": "Adds a URL to the history with a default visitTime of the current time and a default $(topic:transition-types)[transition type] of \"link\".",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "url": {
- "type": "string",
- "description": "The URL to add. Must be a valid URL that can be added to history."
- },
- "title": {
- "type": "string",
- "optional": true,
- "description": "The title of the page."
- },
- "transition": {
- "$ref": "TransitionType",
- "optional": true,
- "description": "The $(topic:transition-types)[transition type] for this visit from its referrer."
- },
- "visitTime": {
- "$ref": "extensionTypes.Date",
- "optional": true,
- "description": "The date when this visit occurred."
- }
- }
- },
- {
- "name": "callback",
- "type": "function",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "deleteUrl",
- "type": "function",
- "description": "Removes all occurrences of the given URL from the history.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "url": {
- "type": "string",
- "description": "The URL to remove."
- }
- }
- },
- {
- "name": "callback",
- "type": "function",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "deleteRange",
- "type": "function",
- "description": "Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.",
- "async": "callback",
- "parameters": [
- {
- "name": "range",
- "type": "object",
- "properties": {
- "startTime": {
- "$ref": "extensionTypes.Date",
- "description": "Items added to history after this date."
- },
- "endTime": {
- "$ref": "extensionTypes.Date",
- "description": "Items added to history before this date."
- }
- }
- },
- {
- "name": "callback",
- "type": "function",
- "parameters": []
- }
- ]
- },
- {
- "name": "deleteAll",
- "type": "function",
- "description": "Deletes all items from the history.",
- "async": "callback",
- "parameters": [
- {
- "name": "callback",
- "type": "function",
- "parameters": []
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onVisited",
- "type": "function",
- "description": "Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded.",
- "parameters": [
- {
- "name": "result",
- "$ref": "HistoryItem"
- }
- ]
- },
- {
- "name": "onVisitRemoved",
- "type": "function",
- "description": "Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history.",
- "parameters": [
- {
- "name": "removed",
- "type": "object",
- "properties": {
- "allHistory": {
- "type": "boolean",
- "description": "True if all history was removed. If true, then urls will be empty."
- },
- "urls": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- }
- ]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/jar.mn b/application/basilisk/components/extensions/schemas/jar.mn
deleted file mode 100644
index bfa402fa8..000000000
--- a/application/basilisk/components/extensions/schemas/jar.mn
+++ /dev/null
@@ -1,20 +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/.
-
-browser.jar:
- content/browser/schemas/bookmarks.json
- content/browser/schemas/browser_action.json
- content/browser/schemas/browsing_data.json
- content/browser/schemas/commands.json
- content/browser/schemas/context_menus.json
- content/browser/schemas/context_menus_internal.json
- content/browser/schemas/devtools.json
- content/browser/schemas/devtools_inspected_window.json
- content/browser/schemas/history.json
- content/browser/schemas/omnibox.json
- content/browser/schemas/page_action.json
- content/browser/schemas/sessions.json
- content/browser/schemas/tabs.json
- content/browser/schemas/theme.json
- content/browser/schemas/windows.json
diff --git a/application/basilisk/components/extensions/schemas/moz.build b/application/basilisk/components/extensions/schemas/moz.build
deleted file mode 100644
index aac3a838c..000000000
--- a/application/basilisk/components/extensions/schemas/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-JAR_MANIFESTS += ['jar.mn']
diff --git a/application/basilisk/components/extensions/schemas/omnibox.json b/application/basilisk/components/extensions/schemas/omnibox.json
deleted file mode 100644
index 34428fab7..000000000
--- a/application/basilisk/components/extensions/schemas/omnibox.json
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "WebExtensionManifest",
- "properties": {
- "omnibox": {
- "type": "object",
- "additionalProperties": { "$ref": "UnrecognizedProperty" },
- "properties": {
- "keyword": {
- "type": "string",
- "pattern": "^[^?\\s:]([^\\s:]*[^/\\s:])?$"
- }
- },
- "optional": true
- }
- }
- }
- ]
- },
- {
- "namespace": "omnibox",
- "description": "The omnibox API allows you to register a keyword with Firefox's address bar.",
- "permissions": ["manifest:omnibox"],
- "types": [
- {
- "id": "DescriptionStyleType",
- "type": "string",
- "description": "The style type.",
- "enum": ["url", "match", "dim"]
- },
- {
- "id": "OnInputEnteredDisposition",
- "type": "string",
- "enum": ["currentTab", "newForegroundTab", "newBackgroundTab"],
- "description": "The window disposition for the omnibox query. This is the recommended context to display results. For example, if the omnibox command is to navigate to a certain URL, a disposition of 'newForegroundTab' means the navigation should take place in a new selected tab."
- },
- {
- "id": "SuggestResult",
- "type": "object",
- "description": "A suggest result.",
- "properties": {
- "content": {
- "type": "string",
- "minLength": 1,
- "description": "The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry."
- },
- "description": {
- "type": "string",
- "minLength": 1,
- "description": "The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. <dim><match>dimmed match</match></dim>. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 "
- },
- "descriptionStyles": {
- "optional": true,
- "unsupported": true,
- "type": "array",
- "description": "An array of style ranges for the description, as provided by the extension.",
- "items": {
- "type": "object",
- "description": "The style ranges for the description, as provided by the extension.",
- "properties": {
- "offset": { "type": "integer" },
- "type": { "description": "The style type", "$ref": "DescriptionStyleType"},
- "length": { "type": "integer", "optional": true }
- }
- }
- },
- "descriptionStylesRaw": {
- "optional": true,
- "unsupported": true,
- "type": "array",
- "description": "An array of style ranges for the description, as provided by ToValue().",
- "items": {
- "type": "object",
- "description": "The style ranges for the description, as provided by ToValue().",
- "properties": {
- "offset": { "type": "integer" },
- "type": { "type": "integer" }
- }
- }
- }
- }
- },
- {
- "id": "DefaultSuggestResult",
- "type": "object",
- "description": "A suggest result.",
- "properties": {
- "description": {
- "type": "string",
- "minLength": 1,
- "description": "The text that is displayed in the URL dropdown."
- },
- "descriptionStyles": {
- "optional": true,
- "unsupported": true,
- "type": "array",
- "description": "An array of style ranges for the description, as provided by the extension.",
- "items": {
- "type": "object",
- "description": "The style ranges for the description, as provided by the extension.",
- "properties": {
- "offset": { "type": "integer" },
- "type": { "description": "The style type", "$ref": "DescriptionStyleType"},
- "length": { "type": "integer", "optional": true }
- }
- }
- },
- "descriptionStylesRaw": {
- "optional": true,
- "unsupported": true,
- "type": "array",
- "description": "An array of style ranges for the description, as provided by ToValue().",
- "items": {
- "type": "object",
- "description": "The style ranges for the description, as provided by ToValue().",
- "properties": {
- "offset": { "type": "integer" },
- "type": { "type": "integer" }
- }
- }
- }
- }
- }
- ],
- "functions": [
- {
- "name": "setDefaultSuggestion",
- "type": "function",
- "description": "Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar.",
- "parameters": [
- {
- "name": "suggestion",
- "$ref": "DefaultSuggestResult",
- "description": "A partial SuggestResult object, without the 'content' parameter."
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onInputStarted",
- "type": "function",
- "description": "User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events.",
- "parameters": []
- },
- {
- "name": "onInputChanged",
- "type": "function",
- "description": "User has changed what is typed into the omnibox.",
- "parameters": [
- {
- "type": "string",
- "name": "text"
- },
- {
- "name": "suggest",
- "type": "function",
- "description": "A callback passed to the onInputChanged event used for sending suggestions back to the browser.",
- "parameters": [
- {
- "name": "suggestResults",
- "type": "array",
- "description": "Array of suggest results",
- "items": {
- "$ref": "SuggestResult"
- }
- }
- ]
- }
- ]
- },
- {
- "name": "onInputEntered",
- "type": "function",
- "description": "User has accepted what is typed into the omnibox.",
- "parameters": [
- {
- "type": "string",
- "name": "text"
- },
- {
- "name": "disposition",
- "$ref": "OnInputEnteredDisposition"
- }
- ]
- },
- {
- "name": "onInputCancelled",
- "type": "function",
- "description": "User has ended the keyword input session without accepting the input.",
- "parameters": []
- }
- ]
- },
- {
- "namespace": "omnibox_internal",
- "description": "The internal namespace used by the omnibox API.",
- "defaultContexts": ["addon_parent_only"],
- "functions": [
- {
- "name": "addSuggestions",
- "type": "function",
- "async": "callback",
- "description": "Internal function used by omnibox.onInputChanged for adding search suggestions",
- "parameters": [
- {
- "name": "id",
- "type": "integer",
- "description": "The ID of the callback received by onInputChangedInternal"
- },
- {
- "name": "suggestResults",
- "type": "array",
- "description": "Array of suggest results",
- "items": {
- "$ref": "omnibox.SuggestResult"
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onInputChanged",
- "type": "function",
- "description": "Identical to omnibox.onInputChanged except no 'suggest' callback is provided.",
- "parameters": [
- {
- "type": "string",
- "name": "text"
- }
- ]
- }
- ]
- }
-] \ No newline at end of file
diff --git a/application/basilisk/components/extensions/schemas/page_action.json b/application/basilisk/components/extensions/schemas/page_action.json
deleted file mode 100644
index f4f9ee8db..000000000
--- a/application/basilisk/components/extensions/schemas/page_action.json
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "WebExtensionManifest",
- "properties": {
- "page_action": {
- "type": "object",
- "additionalProperties": { "$ref": "UnrecognizedProperty" },
- "properties": {
- "default_title": {
- "type": "string",
- "optional": true,
- "preprocess": "localize"
- },
- "default_icon": {
- "$ref": "IconPath",
- "optional": true
- },
- "default_popup": {
- "type": "string",
- "format": "relativeUrl",
- "optional": true,
- "preprocess": "localize"
- },
- "browser_style": {
- "type": "boolean",
- "optional": true
- }
- },
- "optional": true
- }
- }
- }
- ]
- },
- {
- "namespace": "pageAction",
- "description": "Use the <code>browser.pageAction</code> API to put icons inside the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages.",
- "permissions": ["manifest:page_action"],
- "types": [
- {
- "id": "ImageDataType",
- "type": "object",
- "isInstanceOf": "ImageData",
- "additionalProperties": { "type": "any" },
- "postprocess": "convertImageDataToURL",
- "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)."
- }
- ],
- "functions": [
- {
- "name": "show",
- "type": "function",
- "async": "callback",
- "description": "Shows the page action. The page action is shown whenever the tab is selected.",
- "parameters": [
- {"type": "integer", "name": "tabId", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."},
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "hide",
- "type": "function",
- "async": "callback",
- "description": "Hides the page action.",
- "parameters": [
- {"type": "integer", "name": "tabId", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."},
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "setTitle",
- "type": "function",
- "description": "Sets the title of the page action. This is displayed in a tooltip over the page action.",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {"type": "integer", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."},
- "title": {"type": "string", "description": "The tooltip string."}
- }
- }
- ]
- },
- {
- "name": "getTitle",
- "type": "function",
- "description": "Gets the title of the page action.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {
- "type": "integer",
- "description": "Specify the tab to get the title from."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "result",
- "type": "string"
- }
- ]
- }
- ]
- },
- {
- "name": "setIcon",
- "type": "function",
- "description": "Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {"type": "integer", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."},
- "imageData": {
- "choices": [
- { "$ref": "ImageDataType" },
- {
- "type": "object",
- "additionalProperties": {"$ref": "ImageDataType"}
- }
- ],
- "optional": true,
- "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'"
- },
- "path": {
- "choices": [
- { "type": "string" },
- {
- "type": "object",
- "additionalProperties": {"type": "string"}
- }
- ],
- "optional": true,
- "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'"
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "setPopup",
- "type": "function",
- "description": "Sets the html document to be opened as a popup when the user clicks on the page action's icon.",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {"type": "integer", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."},
- "popup": {
- "type": "string",
- "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown."
- }
- }
- }
- ]
- },
- {
- "name": "getPopup",
- "type": "function",
- "description": "Gets the html document set as the popup for this page action.",
- "async": "callback",
- "parameters": [
- {
- "name": "details",
- "type": "object",
- "properties": {
- "tabId": {
- "type": "integer",
- "description": "Specify the tab to get the popup from."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "result",
- "type": "string"
- }
- ]
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onClicked",
- "type": "function",
- "description": "Fired when a page action icon is clicked. This event will not fire if the page action has a popup.",
- "parameters": [
- {
- "name": "tab",
- "$ref": "tabs.Tab"
- }
- ]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/sessions.json b/application/basilisk/components/extensions/schemas/sessions.json
deleted file mode 100644
index 2178c0006..000000000
--- a/application/basilisk/components/extensions/schemas/sessions.json
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "Permission",
- "choices": [{
- "type": "string",
- "enum": [
- "sessions"
- ]
- }]
- }
- ]
- },
- {
- "namespace": "sessions",
- "description": "Use the <code>chrome.sessions</code> API to query and restore tabs and windows from a browsing session.",
- "permissions": ["sessions"],
- "types": [
- {
- "id": "Filter",
- "type": "object",
- "properties": {
- "maxResults": {
- "type": "integer",
- "minimum": 0,
- "maximum": 25,
- "optional": true,
- "description": "The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries ($(ref:sessions.MAX_SESSION_RESULTS))."
- }
- }
- },
- {
- "id": "Session",
- "type": "object",
- "properties": {
- "lastModified": {"type": "integer", "description": "The time when the window or tab was closed or modified, represented in milliseconds since the epoch."},
- "tab": {"$ref": "tabs.Tab", "optional": true, "description": "The $(ref:tabs.Tab), if this entry describes a tab. Either this or $(ref:sessions.Session.window) will be set."},
- "window": {"$ref": "windows.Window", "optional": true, "description": "The $(ref:windows.Window), if this entry describes a window. Either this or $(ref:sessions.Session.tab) will be set."}
- }
- },
- {
- "id": "Device",
- "type": "object",
- "properties": {
- "info": {"type": "string"},
- "deviceName": {"type": "string", "description": "The name of the foreign device."},
- "sessions": {"type": "array", "items": {"$ref": "Session"}, "description": "A list of open window sessions for the foreign device, sorted from most recently to least recently modified session."}
- }
- }
- ],
- "functions": [
- {
- "name": "getRecentlyClosed",
- "type": "function",
- "description": "Gets the list of recently closed tabs and/or windows.",
- "async": "callback",
- "parameters": [
- {
- "$ref": "Filter",
- "name": "filter",
- "optional": true,
- "default": {}
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "sessions", "type": "array", "items": { "$ref": "Session" }, "description": "The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index <code>0</code>). The entries may contain either tabs or windows."
- }
- ]
- }
- ]
- },
- {
- "name": "getDevices",
- "unsupported": true,
- "type": "function",
- "description": "Retrieves all devices with synced sessions.",
- "async": "callback",
- "parameters": [
- {
- "$ref": "Filter",
- "name": "filter",
- "optional": true
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "devices", "type": "array", "items": { "$ref": "Device" }, "description": "The list of $(ref:sessions.Device) objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. $(ref:tabs.Tab) objects are sorted by recency in the $(ref:windows.Window) of the $(ref:sessions.Session) objects."
- }
- ]
- }
- ]
- },
- {
- "name": "restore",
- "type": "function",
- "description": "Reopens a $(ref:windows.Window) or $(ref:tabs.Tab), with an optional callback to run when the entry has been restored.",
- "async": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "sessionId",
- "optional": true,
- "description": "The $(ref:windows.Window.sessionId), or $(ref:tabs.Tab.sessionId) to restore. If this parameter is not specified, the most recently closed session is restored."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "$ref": "Session",
- "name": "restoredSession",
- "description": "A $(ref:sessions.Session) containing the restored $(ref:windows.Window) or $(ref:tabs.Tab) object."
- }
- ]
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onChanged",
- "description": "Fired when recently closed tabs and/or windows are changed. This event does not monitor synced sessions changes.",
- "type": "function"
- }
- ],
- "properties": {
- "MAX_SESSION_RESULTS": {
- "value": 25,
- "description": "The maximum number of $(ref:sessions.Session) that will be included in a requested list."
- }
- }
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/tabs.json b/application/basilisk/components/extensions/schemas/tabs.json
deleted file mode 100644
index 23ce33a4b..000000000
--- a/application/basilisk/components/extensions/schemas/tabs.json
+++ /dev/null
@@ -1,1295 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "$extend": "Permission",
- "choices": [{
- "type": "string",
- "enum": [
- "activeTab",
- "tabs"
- ]
- }]
- }
- ]
- },
- {
- "namespace": "tabs",
- "description": "Use the <code>browser.tabs</code> API to interact with the browser's tab system. You can use this API to create, modify, and rearrange tabs in the browser.",
- "types": [
- { "id": "MutedInfoReason",
- "type": "string",
- "description": "An event that caused a muted state change.",
- "enum": [
- {"name": "user", "description": "A user input action has set/overridden the muted state."},
- {"name": "capture", "description": "Tab capture started, forcing a muted state change."},
- {"name": "extension", "description": "An extension, identified by the extensionId field, set the muted state."}
- ]
- },
- {
- "id": "MutedInfo",
- "type": "object",
- "description": "Tab muted state and the reason for the last state change.",
- "properties": {
- "muted": {
- "type": "boolean",
- "description": "Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound). Equivalent to whether the muted audio indicator is showing."
- },
- "reason": {
- "$ref": "MutedInfoReason",
- "optional": true,
- "description": "The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed."
- },
- "extensionId": {
- "type": "string",
- "optional": true,
- "description": "The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed."
- }
- }
- },
- {
- "id": "Tab",
- "type": "object",
- "properties": {
- "id": {"type": "integer", "minimum": -1, "optional": true, "description": "The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, for example when querying foreign tabs using the $(ref:sessions) API, in which case a session ID may be present. Tab ID can also be set to $(ref:tabs.TAB_ID_NONE) for apps and devtools windows."},
- "index": {"type": "integer", "minimum": -1, "description": "The zero-based index of the tab within its window."},
- "windowId": {"type": "integer", "minimum": 0, "description": "The ID of the window the tab is contained within."},
- "openerTabId": {"unsupported": true, "type": "integer", "minimum": 0, "optional": true, "description": "The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists."},
- "selected": {"type": "boolean", "description": "Whether the tab is selected.", "deprecated": "Please use $(ref:tabs.Tab.highlighted).", "unsupported": true},
- "highlighted": {"type": "boolean", "description": "Whether the tab is highlighted."},
- "active": {"type": "boolean", "description": "Whether the tab is active in its window. (Does not necessarily mean the window is focused.)"},
- "pinned": {"type": "boolean", "description": "Whether the tab is pinned."},
- "audible": {"type": "boolean", "optional": true, "description": "Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing."},
- "mutedInfo": {"$ref": "MutedInfo", "optional": true, "description": "Current tab muted state and the reason for the last state change."},
- "url": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The URL the tab is displaying. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission."},
- "title": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The title of the tab. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission."},
- "favIconUrl": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The URL of the tab's favicon. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission. It may also be an empty string if the tab is loading."},
- "status": {"type": "string", "optional": true, "description": "Either <em>loading</em> or <em>complete</em>."},
- "incognito": {"type": "boolean", "description": "Whether the tab is in an incognito window."},
- "width": {"type": "integer", "optional": true, "description": "The width of the tab in pixels."},
- "height": {"type": "integer", "optional": true, "description": "The height of the tab in pixels."},
- "sessionId": {"unsupported": true, "type": "string", "optional": true, "description": "The session ID used to uniquely identify a Tab obtained from the $(ref:sessions) API."},
- "cookieStoreId": {"type": "string", "description": "The CookieStoreId used for the tab."}
- }
- },
- {
- "id": "ZoomSettingsMode",
- "type": "string",
- "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.",
- "enum": [
- {
- "name": "automatic",
- "description": "Zoom changes are handled automatically by the browser."
- },
- {
- "name": "manual",
- "description": "Overrides the automatic handling of zoom changes. The <code>onZoomChange</code> event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support <code>per-origin</code> zooming, and will thus ignore the <code>scope</code> zoom setting and assume <code>per-tab</code>."
- },
- {
- "name": "disabled",
- "description": "Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored."
- }
- ]
- },
- {
- "id": "ZoomSettingsScope",
- "type": "string",
- "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.",
- "enum": [
- {
- "name": "per-origin",
- "description": "Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, <code>per-origin</code> zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The <code>per-origin</code> scope is only available in the <code>automatic</code> mode."
- },
- {
- "name": "per-tab",
- "description": "Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, <code>per-tab</code> zoom changes are reset on navigation; navigating a tab will always load pages with their <code>per-origin</code> zoom factors."
- }
- ]
- },
- {
- "id": "ZoomSettings",
- "type": "object",
- "description": "Defines how zoom changes in a tab are handled and at what scope.",
- "properties": {
- "mode": {
- "$ref": "ZoomSettingsMode",
- "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.",
- "optional": true
- },
- "scope": {
- "$ref": "ZoomSettingsScope",
- "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.",
- "optional": true
- },
- "defaultZoomFactor": {
- "type": "number",
- "optional": true,
- "description": "Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings."
- }
- }
- },
- {
- "id": "TabStatus",
- "type": "string",
- "enum": ["loading", "complete"],
- "description": "Whether the tabs have completed loading."
- },
- {
- "id": "WindowType",
- "type": "string",
- "enum": ["normal", "popup", "panel", "app", "devtools"],
- "description": "The type of window."
- }
- ],
- "properties": {
- "TAB_ID_NONE": {
- "value": -1,
- "description": "An ID which represents the absence of a browser tab."
- }
- },
- "functions": [
- {
- "name": "get",
- "type": "function",
- "description": "Retrieves details about the specified tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {"name": "tab", "$ref": "Tab"}
- ]
- }
- ]
- },
- {
- "name": "getCurrent",
- "type": "function",
- "description": "Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).",
- "async": "callback",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "tab",
- "$ref": "Tab",
- "optional": true
- }
- ]
- }
- ]
- },
- {
- "name": "connect",
- "type": "function",
- "description": "Connects to the content script(s) in the specified tab. The $(ref:runtime.onConnect) event is fired in each content script running in the specified tab for the current extension. For more details, see $(topic:messaging)[Content Script Messaging].",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0
- },
- {
- "type": "object",
- "name": "connectInfo",
- "properties": {
- "name": { "type": "string", "optional": true, "description": "Will be passed into onConnect for content scripts that are listening for the connection event." },
- "frameId": {
- "type": "integer",
- "optional": true,
- "minimum": 0,
- "description": "Open a port to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab."
- }
- },
- "optional": true
- }
- ],
- "returns": {
- "$ref": "runtime.Port",
- "description": "A port that can be used to communicate with the content scripts running in the specified tab. The port's $(ref:runtime.Port) event is fired if the tab closes or does not exist. "
- }
- },
- {
- "name": "sendRequest",
- "deprecated": "Please use $(ref:runtime.sendMessage).",
- "unsupported": true,
- "type": "function",
- "description": "Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The $(ref:extension.onRequest) event is fired in each content script running in the specified tab for the current extension.",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0
- },
- {
- "type": "any",
- "name": "request"
- },
- {
- "type": "function",
- "name": "responseCallback",
- "optional": true,
- "parameters": [
- {
- "name": "response",
- "type": "any",
- "description": "The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message."
- }
- ]
- }
- ]
- },
- {
- "name": "sendMessage",
- "type": "function",
- "description": "Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The $(ref:runtime.onMessage) event is fired in each content script running in the specified tab for the current extension.",
- "async": "responseCallback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0
- },
- {
- "type": "any",
- "name": "message"
- },
- {
- "type": "object",
- "name": "options",
- "properties": {
- "frameId": {
- "type": "integer",
- "optional": true,
- "minimum": 0,
- "description": "Send a message to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab."
- }
- },
- "optional": true
- },
- {
- "type": "function",
- "name": "responseCallback",
- "optional": true,
- "parameters": [
- {
- "name": "response",
- "type": "any",
- "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message."
- }
- ]
- }
- ]
- },
- {
- "name": "getSelected",
- "deprecated": "Please use $(ref:tabs.query) <code>{active: true}</code>.",
- "unsupported": true,
- "type": "function",
- "description": "Gets the tab that is selected in the specified window.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": -2,
- "optional": true,
- "description": "Defaults to the $(topic:current-window)[current window]."
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {"name": "tab", "$ref": "Tab"}
- ]
- }
- ]
- },
- {
- "name": "getAllInWindow",
- "deprecated": "Please use $(ref:tabs.query) <code>{windowId: windowId}</code>.",
- "unsupported": true,
- "type": "function",
- "description": "Gets details about all tabs in the specified window.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": -2,
- "optional": true,
- "description": "Defaults to the $(topic:current-window)[current window]."
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {"name": "tabs", "type": "array", "items": { "$ref": "Tab" } }
- ]
- }
- ]
- },
- {
- "name": "create",
- "type": "function",
- "description": "Creates a new tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "object",
- "name": "createProperties",
- "properties": {
- "windowId": {
- "type": "integer",
- "minimum": -2,
- "optional": true,
- "description": "The window to create the new tab in. Defaults to the $(topic:current-window)[current window]."
- },
- "index": {
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window."
- },
- "url": {
- "type": "string",
- "optional": true,
- "description": "The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page."
- },
- "active": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see $(ref:windows.update)). Defaults to <var>true</var>."
- },
- "selected": {
- "deprecated": "Please use <em>active</em>.",
- "unsupported": true,
- "type": "boolean",
- "optional": true,
- "description": "Whether the tab should become the selected tab in the window. Defaults to <var>true</var>"
- },
- "pinned": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tab should be pinned. Defaults to <var>false</var>"
- },
- "openerTabId": {
- "unsupported": true,
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab."
- },
- "cookieStoreId": {
- "type": "string",
- "optional": true,
- "description": "The CookieStoreId for the tab that opened this tab."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "tab",
- "$ref": "Tab",
- "description": "Details about the created tab. Will contain the ID of the new tab."
- }
- ]
- }
- ]
- },
- {
- "name": "duplicate",
- "type": "function",
- "description": "Duplicates a tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "description": "The ID of the tab which is to be duplicated."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "tab",
- "optional": true,
- "description": "Details about the duplicated tab. The $(ref:tabs.Tab) object doesn't contain <code>url</code>, <code>title</code> and <code>favIconUrl</code> if the <code>\"tabs\"</code> permission has not been requested.",
- "$ref": "Tab"
- }
- ]
- }
- ]
- },
- {
- "name": "query",
- "type": "function",
- "description": "Gets all tabs that have the specified properties, or all tabs if no properties are specified.",
- "async": "callback",
- "parameters": [
- {
- "type": "object",
- "name": "queryInfo",
- "properties": {
- "active": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tabs are active in their windows."
- },
- "pinned": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tabs are pinned."
- },
- "audible": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tabs are audible."
- },
- "muted": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tabs are muted."
- },
- "highlighted": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tabs are highlighted."
- },
- "currentWindow": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tabs are in the $(topic:current-window)[current window]."
- },
- "lastFocusedWindow": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tabs are in the last focused window."
- },
- "status": {
- "$ref": "TabStatus",
- "optional": true,
- "description": "Whether the tabs have completed loading."
- },
- "title": {
- "type": "string",
- "optional": true,
- "description": "Match page titles against a pattern."
- },
- "url": {
- "choices": [
- {"type": "string"},
- {"type": "array", "items": {"type": "string"}}
- ],
- "optional": true,
- "description": "Match tabs against one or more $(topic:match_patterns)[URL patterns]. Note that fragment identifiers are not matched."
- },
- "windowId": {
- "type": "integer",
- "optional": true,
- "minimum": -2,
- "description": "The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the $(topic:current-window)[current window]."
- },
- "windowType": {
- "$ref": "WindowType",
- "optional": true,
- "description": "The type of window the tabs are in."
- },
- "index": {
- "type": "integer",
- "optional": true,
- "minimum": 0,
- "description": "The position of the tabs within their windows."
- },
- "cookieStoreId": {
- "type": "string",
- "optional": true,
- "description": "The CookieStoreId used for the tab."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "result",
- "type": "array",
- "items": {
- "$ref": "Tab"
- }
- }
- ]
- }
- ]
- },
- {
- "name": "highlight",
- "type": "function",
- "description": "Highlights the given tabs.",
- "async": "callback",
- "parameters": [
- {
- "type": "object",
- "name": "highlightInfo",
- "properties": {
- "windowId": {
- "type": "integer",
- "optional": true,
- "description": "The window that contains the tabs.",
- "minimum": -2
- },
- "tabs": {
- "description": "One or more tab indices to highlight.",
- "choices": [
- {"type": "array", "items": {"type": "integer", "minimum": 0}},
- {"type": "integer"}
- ]
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "window",
- "$ref": "windows.Window",
- "description": "Contains details about the window whose tabs were highlighted."
- }
- ]
- }
- ]
- },
- {
- "name": "update",
- "type": "function",
- "description": "Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "Defaults to the selected tab of the $(topic:current-window)[current window]."
- },
- {
- "type": "object",
- "name": "updateProperties",
- "properties": {
- "url": {
- "type": "string",
- "optional": true,
- "description": "A URL to navigate the tab to."
- },
- "active": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tab should be active. Does not affect whether the window is focused (see $(ref:windows.update))."
- },
- "highlighted": {
- "unsupported": true,
- "type": "boolean",
- "optional": true,
- "description": "Adds or removes the tab from the current selection."
- },
- "selected": {
- "unsupported": true,
- "deprecated": "Please use <em>highlighted</em>.",
- "type": "boolean",
- "optional": true,
- "description": "Whether the tab should be selected."
- },
- "pinned": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tab should be pinned."
- },
- "muted": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the tab should be muted."
- },
- "openerTabId": {
- "unsupported": true,
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "tab",
- "$ref": "Tab",
- "optional": true,
- "description": "Details about the updated tab. The $(ref:tabs.Tab) object doesn't contain <code>url</code>, <code>title</code> and <code>favIconUrl</code> if the <code>\"tabs\"</code> permission has not been requested."
- }
- ]
- }
- ]
- },
- {
- "name": "move",
- "type": "function",
- "description": "Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === \"normal\") windows.",
- "async": "callback",
- "parameters": [
- {
- "name": "tabIds",
- "description": "The tab or list of tabs to move.",
- "choices": [
- {"type": "integer", "minimum": 0},
- {"type": "array", "items": {"type": "integer", "minimum": 0}}
- ]
- },
- {
- "type": "object",
- "name": "moveProperties",
- "properties": {
- "windowId": {
- "type": "integer",
- "minimum": -2,
- "optional": true,
- "description": "Defaults to the window the tab is currently in."
- },
- "index": {
- "type": "integer",
- "minimum": -1,
- "description": "The position to move the window to. -1 will place the tab at the end of the window."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "tabs",
- "description": "Details about the moved tabs.",
- "choices": [
- {"$ref": "Tab"},
- {"type": "array", "items": {"$ref": "Tab"}}
- ]
- }
- ]
- }
- ]
- },
- {
- "name": "reload",
- "type": "function",
- "description": "Reload a tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab to reload; defaults to the selected tab of the current window."
- },
- {
- "type": "object",
- "name": "reloadProperties",
- "optional": true,
- "properties": {
- "bypassCache": {
- "type": "boolean",
- "optional": true,
- "description": "Whether using any local cache. Default is false."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "remove",
- "type": "function",
- "description": "Closes one or more tabs.",
- "async": "callback",
- "parameters": [
- {
- "name": "tabIds",
- "description": "The tab or list of tabs to close.",
- "choices": [
- {"type": "integer", "minimum": 0},
- {"type": "array", "items": {"type": "integer", "minimum": 0}}
- ]
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
- "name": "detectLanguage",
- "type": "function",
- "description": "Detects the primary language of the content in a tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "Defaults to the active tab of the $(topic:current-window)[current window]."
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "language",
- "description": "An ISO language code such as <code>en</code> or <code>fr</code>. For a complete list of languages supported by this method, see <a href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, <code>und</code> will be returned."
- }
- ]
- }
- ]
- },
- {
- "name": "captureVisibleTab",
- "type": "function",
- "description": "Captures the visible area of the currently active tab in the specified window. You must have $(topic:declare_permissions)[&lt;all_urls&gt;] permission to use this method.",
- "permissions": ["<all_urls>"],
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": -2,
- "optional": true,
- "description": "The target window. Defaults to the $(topic:current-window)[current window]."
- },
- {
- "$ref": "extensionTypes.ImageDetails",
- "name": "options",
- "optional": true
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "type": "string",
- "name": "dataUrl",
- "description": "A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display."
- }
- ]
- }
- ]
- },
- {
- "name": "executeScript",
- "type": "function",
- "description": "Injects JavaScript code into a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab in which to run the script; defaults to the active tab of the current window."
- },
- {
- "$ref": "extensionTypes.InjectDetails",
- "name": "details",
- "description": "Details of the script to run."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "description": "Called after all the JavaScript has been executed.",
- "parameters": [
- {
- "name": "result",
- "optional": true,
- "type": "array",
- "items": {"type": "any"},
- "description": "The result of the script in every injected frame."
- }
- ]
- }
- ]
- },
- {
- "name": "insertCSS",
- "type": "function",
- "description": "Injects CSS into a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab in which to insert the CSS; defaults to the active tab of the current window."
- },
- {
- "$ref": "extensionTypes.InjectDetails",
- "name": "details",
- "description": "Details of the CSS text to insert."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "description": "Called when all the CSS has been inserted.",
- "parameters": []
- }
- ]
- },
- {
- "name": "removeCSS",
- "type": "function",
- "description": "Removes injected CSS from a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab from which to remove the injected CSS; defaults to the active tab of the current window."
- },
- {
- "$ref": "extensionTypes.InjectDetails",
- "name": "details",
- "description": "Details of the CSS text to remove."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "description": "Called when all the CSS has been removed.",
- "parameters": []
- }
- ]
- },
- {
- "name": "setZoom",
- "type": "function",
- "description": "Zooms a specified tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab to zoom; defaults to the active tab of the current window."
- },
- {
- "type": "number",
- "name": "zoomFactor",
- "description": "The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "description": "Called after the zoom factor has been changed.",
- "parameters": []
- }
- ]
- },
- {
- "name": "getZoom",
- "type": "function",
- "description": "Gets the current zoom factor of a specified tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "optional": true,
- "description": "The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window."
- },
- {
- "type": "function",
- "name": "callback",
- "description": "Called with the tab's current zoom factor after it has been fetched.",
- "parameters": [
- {
- "type": "number",
- "name": "zoomFactor",
- "description": "The tab's current zoom factor."
- }
- ]
- }
- ]
- },
- {
- "name": "setZoomSettings",
- "type": "function",
- "description": "Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "optional": true,
- "minimum": 0,
- "description": "The ID of the tab to change the zoom settings for; defaults to the active tab of the current window."
- },
- {
- "$ref": "ZoomSettings",
- "name": "zoomSettings",
- "description": "Defines how zoom changes are handled and at what scope."
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "description": "Called after the zoom settings have been changed.",
- "parameters": []
- }
- ]
- },
- {
- "name": "getZoomSettings",
- "type": "function",
- "description": "Gets the current zoom settings of a specified tab.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "optional": true,
- "minimum": 0,
- "description": "The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window."
- },
- {
- "type": "function",
- "name": "callback",
- "description": "Called with the tab's current zoom settings.",
- "parameters": [
- {
- "$ref": "ZoomSettings",
- "name": "zoomSettings",
- "description": "The tab's current zoom settings."
- }
- ]
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onCreated",
- "type": "function",
- "description": "Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.",
- "parameters": [
- {
- "$ref": "Tab",
- "name": "tab",
- "description": "Details of the tab that was created."
- }
- ]
- },
- {
- "name": "onUpdated",
- "type": "function",
- "description": "Fired when a tab is updated.",
- "parameters": [
- {"type": "integer", "name": "tabId", "minimum": 0},
- {
- "type": "object",
- "name": "changeInfo",
- "description": "Lists the changes to the state of the tab that was updated.",
- "properties": {
- "status": {
- "type": "string",
- "optional": true,
- "description": "The status of the tab. Can be either <em>loading</em> or <em>complete</em>."
- },
- "url": {
- "type": "string",
- "optional": true,
- "description": "The tab's URL if it has changed."
- },
- "pinned": {
- "type": "boolean",
- "optional": true,
- "description": "The tab's new pinned state."
- },
- "audible": {
- "type": "boolean",
- "optional": true,
- "description": "The tab's new audible state."
- },
- "mutedInfo": {
- "$ref": "MutedInfo",
- "optional": true,
- "description": "The tab's new muted state and the reason for the change."
- },
- "favIconUrl": {
- "type": "string",
- "optional": true,
- "description": "The tab's new favicon URL."
- }
- }
- },
- {
- "$ref": "Tab",
- "name": "tab",
- "description": "Gives the state of the tab that was updated."
- }
- ]
- },
- {
- "name": "onMoved",
- "type": "function",
- "description": "Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see $(ref:tabs.onDetached).",
- "parameters": [
- {"type": "integer", "name": "tabId", "minimum": 0},
- {
- "type": "object",
- "name": "moveInfo",
- "properties": {
- "windowId": {"type": "integer", "minimum": 0},
- "fromIndex": {"type": "integer", "minimum": 0},
- "toIndex": {"type": "integer", "minimum": 0}
- }
- }
- ]
- },
- {
- "name": "onSelectionChanged",
- "deprecated": "Please use $(ref:tabs.onActivated).",
- "unsupported": true,
- "type": "function",
- "description": "Fires when the selected tab in a window changes.",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "description": "The ID of the tab that has become active."
- },
- {
- "type": "object",
- "name": "selectInfo",
- "properties": {
- "windowId": {
- "type": "integer",
- "minimum": 0,
- "description": "The ID of the window the selected tab changed inside of."
- }
- }
- }
- ]
- },
- {
- "name": "onActiveChanged",
- "deprecated": "Please use $(ref:tabs.onActivated).",
- "unsupported": true,
- "type": "function",
- "description": "Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to $(ref:tabs.onUpdated) events to be notified when a URL is set.",
- "parameters": [
- {
- "type": "integer",
- "name": "tabId",
- "minimum": 0,
- "description": "The ID of the tab that has become active."
- },
- {
- "type": "object",
- "name": "selectInfo",
- "properties": {
- "windowId": {
- "type": "integer",
- "minimum": 0,
- "description": "The ID of the window the selected tab changed inside of."
- }
- }
- }
- ]
- },
- {
- "name": "onActivated",
- "type": "function",
- "description": "Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.",
- "parameters": [
- {
- "type": "object",
- "name": "activeInfo",
- "properties": {
- "tabId": {
- "type": "integer",
- "minimum": 0,
- "description": "The ID of the tab that has become active."
- },
- "windowId": {
- "type": "integer",
- "minimum": 0,
- "description": "The ID of the window the active tab changed inside of."
- }
- }
- }
- ]
- },
- {
- "name": "onHighlightChanged",
- "deprecated": "Please use $(ref:tabs.onHighlighted).",
- "unsupported": true,
- "type": "function",
- "description": "Fired when the highlighted or selected tabs in a window changes.",
- "parameters": [
- {
- "type": "object",
- "name": "selectInfo",
- "properties": {
- "windowId": {
- "type": "integer",
- "minimum": 0,
- "description": "The window whose tabs changed."
- },
- "tabIds": {
- "type": "array",
- "items": {"type": "integer", "minimum": 0},
- "description": "All highlighted tabs in the window."
- }
- }
- }
- ]
- },
- {
- "name": "onHighlighted",
- "type": "function",
- "description": "Fired when the highlighted or selected tabs in a window changes.",
- "parameters": [
- {
- "type": "object",
- "name": "highlightInfo",
- "properties": {
- "windowId": {
- "type": "integer",
- "minimum": 0,
- "description": "The window whose tabs changed."
- },
- "tabIds": {
- "type": "array",
- "items": {"type": "integer", "minimum": 0},
- "description": "All highlighted tabs in the window."
- }
- }
- }
- ]
- },
- {
- "name": "onDetached",
- "type": "function",
- "description": "Fired when a tab is detached from a window, for example because it is being moved between windows.",
- "parameters": [
- {"type": "integer", "name": "tabId", "minimum": 0},
- {
- "type": "object",
- "name": "detachInfo",
- "properties": {
- "oldWindowId": {"type": "integer", "minimum": 0},
- "oldPosition": {"type": "integer", "minimum": 0}
- }
- }
- ]
- },
- {
- "name": "onAttached",
- "type": "function",
- "description": "Fired when a tab is attached to a window, for example because it was moved between windows.",
- "parameters": [
- {"type": "integer", "name": "tabId", "minimum": 0},
- {
- "type": "object",
- "name": "attachInfo",
- "properties": {
- "newWindowId": {"type": "integer", "minimum": 0},
- "newPosition": {"type": "integer", "minimum": 0}
- }
- }
- ]
- },
- {
- "name": "onRemoved",
- "type": "function",
- "description": "Fired when a tab is closed.",
- "parameters": [
- {"type": "integer", "name": "tabId", "minimum": 0},
- {
- "type": "object",
- "name": "removeInfo",
- "properties": {
- "windowId": {"type": "integer", "minimum": 0, "description": "The window whose tab is closed." },
- "isWindowClosing": {"type": "boolean", "description": "True when the tab is being closed because its window is being closed." }
- }
- }
- ]
- },
- {
- "name": "onReplaced",
- "type": "function",
- "description": "Fired when a tab is replaced with another tab due to prerendering or instant.",
- "parameters": [
- {"type": "integer", "name": "addedTabId", "minimum": 0},
- {"type": "integer", "name": "removedTabId", "minimum": 0}
- ]
- },
- {
- "name": "onZoomChange",
- "type": "function",
- "description": "Fired when a tab is zoomed.",
- "parameters": [{
- "type": "object",
- "name": "ZoomChangeInfo",
- "properties": {
- "tabId": {"type": "integer", "minimum": 0},
- "oldZoomFactor": {"type": "number"},
- "newZoomFactor": {"type": "number"},
- "zoomSettings": {"$ref": "ZoomSettings"}
- }
- }]
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/theme.json b/application/basilisk/components/extensions/schemas/theme.json
deleted file mode 100644
index 1a9bea703..000000000
--- a/application/basilisk/components/extensions/schemas/theme.json
+++ /dev/null
@@ -1,24 +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/.
-
-[
- {
- "namespace": "manifest",
- "types": [
- {
- "id": "ThemeType",
- "type": "object"
- },
- {
- "$extend": "WebExtensionManifest",
- "properties": {
- "theme": {
- "optional": true,
- "$ref": "ThemeType"
- }
- }
- }
- ]
- }
-]
diff --git a/application/basilisk/components/extensions/schemas/windows.json b/application/basilisk/components/extensions/schemas/windows.json
deleted file mode 100644
index f4b2563ab..000000000
--- a/application/basilisk/components/extensions/schemas/windows.json
+++ /dev/null
@@ -1,506 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "windows",
- "description": "Use the <code>browser.windows</code> API to interact with browser windows. You can use this API to create, modify, and rearrange windows in the browser.",
- "types": [
- {
- "id": "WindowType",
- "type": "string",
- "description": "The type of browser window this is. Under some circumstances a Window may not be assigned type property, for example when querying closed windows from the $(ref:sessions) API.",
- "enum": ["normal", "popup", "panel", "app", "devtools"]
- },
- {
- "id": "WindowState",
- "type": "string",
- "description": "The state of this browser window. Under some circumstances a Window may not be assigned state property, for example when querying closed windows from the $(ref:sessions) API.",
- "enum": ["normal", "minimized", "maximized", "fullscreen", "docked"]
- },
- {
- "id": "Window",
- "type": "object",
- "properties": {
- "id": {
- "type": "integer",
- "optional": true,
- "minimum": 0,
- "description": "The ID of the window. Window IDs are unique within a browser session. Under some circumstances a Window may not be assigned an ID, for example when querying windows using the $(ref:sessions) API, in which case a session ID may be present."
- },
- "focused": {
- "type": "boolean",
- "description": "Whether the window is currently the focused window."
- },
- "top": {
- "type": "integer",
- "optional": true,
- "description": "The offset of the window from the top edge of the screen in pixels. Under some circumstances a Window may not be assigned top property, for example when querying closed windows from the $(ref:sessions) API."
- },
- "left": {
- "type": "integer",
- "optional": true,
- "description": "The offset of the window from the left edge of the screen in pixels. Under some circumstances a Window may not be assigned left property, for example when querying closed windows from the $(ref:sessions) API."
- },
- "width": {
- "type": "integer",
- "optional": true,
- "description": "The width of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned width property, for example when querying closed windows from the $(ref:sessions) API."
- },
- "height": {
- "type": "integer",
- "optional": true,
- "description": "The height of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned height property, for example when querying closed windows from the $(ref:sessions) API."
- },
- "tabs": {
- "type": "array",
- "items": { "$ref": "tabs.Tab" },
- "optional": true,
- "description": "Array of $(ref:tabs.Tab) objects representing the current tabs in the window."
- },
- "incognito": {
- "type": "boolean",
- "description": "Whether the window is incognito."
- },
- "type": {
- "$ref": "WindowType",
- "optional": true,
- "description": "The type of browser window this is."
- },
- "state": {
- "$ref": "WindowState",
- "optional": true,
- "description": "The state of this browser window."
- },
- "alwaysOnTop": {
- "type": "boolean",
- "description": "Whether the window is set to be always on top."
- },
- "sessionId": {
- "type": "string",
- "optional": true,
- "description": "The session ID used to uniquely identify a Window obtained from the $(ref:sessions) API."
- }
- }
- },
- {
- "id": "CreateType",
- "type": "string",
- "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set.",
- "enum": ["normal", "popup", "panel", "detached_panel"]
- }
- ],
- "properties": {
- "WINDOW_ID_NONE": {
- "value": -1,
- "description": "The windowId value that represents the absence of a browser window."
- },
- "WINDOW_ID_CURRENT": {
- "value": -2,
- "description": "The windowId value that represents the $(topic:current-window)[current window]."
- }
- },
- "functions": [
- {
- "name": "get",
- "type": "function",
- "description": "Gets details about a window.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": -2
- },
- {
- "type": "object",
- "name": "getInfo",
- "optional": true,
- "description": "",
- "properties": {
- "populate": {
- "type": "boolean",
- "optional": true,
- "description": "If true, the $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission."
- },
- "windowTypes": {
- "type": "array",
- "items": {
- "$ref": "WindowType"
- },
- "optional": true,
- "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "window",
- "$ref": "Window"
- }
- ]
- }
- ]
- },
- {
- "name": "getCurrent",
- "type": "function",
- "description": "Gets the $(topic:current-window)[current window].",
- "async": "callback",
- "parameters": [
- {
- "type": "object",
- "name": "getInfo",
- "optional": true,
- "description": "",
- "properties": {
- "populate": {
- "type": "boolean",
- "optional": true,
- "description": "If true, the $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission."
- },
- "windowTypes": {
- "type": "array",
- "items": { "$ref": "WindowType" },
- "optional": true,
- "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "window",
- "$ref": "Window"
- }
- ]
- }
- ]
- },
- {
- "name": "getLastFocused",
- "type": "function",
- "description": "Gets the window that was most recently focused &mdash; typically the window 'on top'.",
- "async": "callback",
- "parameters": [
- {
- "type": "object",
- "name": "getInfo",
- "optional": true,
- "description": "",
- "properties": {
- "populate": {
- "type": "boolean",
- "optional": true,
- "description": "If true, the $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission."
- },
- "windowTypes": {
- "type": "array",
- "items": { "$ref": "WindowType" },
- "optional": true,
- "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "window",
- "$ref": "Window"
- }
- ]
- }
- ]
- },
- {
- "name": "getAll",
- "type": "function",
- "description": "Gets all windows.",
- "async": "callback",
- "parameters": [
- {
- "type": "object",
- "name": "getInfo",
- "optional": true,
- "description": "",
- "properties": {
- "populate": {
- "type": "boolean",
- "optional": true,
- "description": "If true, each $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects for that window. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission."
- },
- "windowTypes": {
- "type": "array",
- "items": { "$ref": "WindowType" },
- "optional": true,
- "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "windows",
- "type": "array",
- "items": { "$ref": "Window" }
- }
- ]
- }
- ]
- },
- {
- "name": "create",
- "type": "function",
- "description": "Creates (opens) a new browser with any optional sizing, position or default URL provided.",
- "async": "callback",
- "parameters": [
- {
- "type": "object",
- "name": "createData",
- "properties": {
- "url": {
- "description": "A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.",
- "optional": true,
- "choices": [
- { "type": "string", "format": "relativeUrl" },
- {
- "type": "array",
- "items": { "type": "string", "format": "relativeUrl" }
- }
- ]
- },
- "tabId": {
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The id of the tab for which you want to adopt to the new window."
- },
- "left": {
- "type": "integer",
- "optional": true,
- "description": "The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels."
- },
- "top": {
- "type": "integer",
- "optional": true,
- "description": "The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels."
- },
- "width": {
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The width in pixels of the new window, including the frame. If not specified defaults to a natural width."
- },
- "height": {
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The height in pixels of the new window, including the frame. If not specified defaults to a natural height."
- },
- "focused": {
- "unsupported": true,
- "type": "boolean",
- "optional": true,
- "description": "If true, opens an active window. If false, opens an inactive window."
- },
- "incognito": {
- "type": "boolean",
- "optional": true,
- "description": "Whether the new window should be an incognito window."
- },
- "type": {
- "$ref": "CreateType",
- "optional": true,
- "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set."
- },
- "state": {
- "$ref": "WindowState",
- "optional": true,
- "description": "The initial state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'."
- },
- "allowScriptsToClose": {
- "type": "boolean",
- "optional": true,
- "description": "Allow scripts to close the window."
- }
- },
- "optional": true
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "window",
- "$ref": "Window",
- "description": "Contains details about the created window.",
- "optional": true
- }
- ]
- }
- ]
- },
- {
- "name": "update",
- "type": "function",
- "description": "Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": -2
- },
- {
- "type": "object",
- "name": "updateInfo",
- "properties": {
- "left": {
- "type": "integer",
- "optional": true,
- "description": "The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels."
- },
- "top": {
- "type": "integer",
- "optional": true,
- "description": "The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels."
- },
- "width": {
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The width to resize the window to in pixels. This value is ignored for panels."
- },
- "height": {
- "type": "integer",
- "minimum": 0,
- "optional": true,
- "description": "The height to resize the window to in pixels. This value is ignored for panels."
- },
- "focused": {
- "type": "boolean",
- "optional": true,
- "description": "If true, brings the window to the front. If false, brings the next window in the z-order to the front."
- },
- "drawAttention": {
- "type": "boolean",
- "optional": true,
- "description": "If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request."
- },
- "state": {
- "$ref": "WindowState",
- "optional": true,
- "description": "The new state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'."
- }
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": [
- {
- "name": "window",
- "$ref": "Window"
- }
- ]
- }
- ]
- },
- {
- "name": "remove",
- "type": "function",
- "description": "Removes (closes) a window, and all the tabs inside it.",
- "async": "callback",
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": 0
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onCreated",
- "type": "function",
- "description": "Fired when a window is created.",
- "filters": [
- {
- "name": "windowTypes",
- "type": "array",
- "items": { "$ref": "WindowType" },
- "description": "Conditions that the window's type being created must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows."
- }
- ],
- "parameters": [
- {
- "$ref": "Window",
- "name": "window",
- "description": "Details of the window that was created."
- }
- ]
- },
- {
- "name": "onRemoved",
- "type": "function",
- "description": "Fired when a window is removed (closed).",
- "filters": [
- {
- "name": "windowTypes",
- "type": "array",
- "items": { "$ref": "WindowType" },
- "description": "Conditions that the window's type being removed must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows."
- }
- ],
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": 0,
- "description": "ID of the removed window."
- }
- ]
- },
- {
- "name": "onFocusChanged",
- "type": "function",
- "description": "Fired when the currently focused window changes. Will be $(ref:windows.WINDOW_ID_NONE) if all browser windows have lost focus. Note: On some Linux window managers, WINDOW_ID_NONE will always be sent immediately preceding a switch from one browser window to another.",
- "filters": [
- {
- "name": "windowTypes",
- "type": "array",
- "items": { "$ref": "WindowType" },
- "description": "Conditions that the window's type being removed must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows."
- }
- ],
- "parameters": [
- {
- "type": "integer",
- "name": "windowId",
- "minimum": -1,
- "description": "ID of the newly focused window."
- }
- ]
- }
- ]
- }
-]