зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1494615 - Remove concept of availableAddons in WebIDE;r=ladybenko
There is only one addon to manage in WebIDe, removing the concept of available addons will make it easier to move the ADBAddon module to a shared folder. Differential Revision: https://phabricator.services.mozilla.com/D7402 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
790a682fc3
Коммит
aa8196aae8
|
@ -5,7 +5,7 @@
|
|||
"use strict";
|
||||
|
||||
const { ADBScanner } = require("devtools/shared/adb/adb-scanner");
|
||||
const { GetAvailableAddons } = require("devtools/client/webide/modules/addons");
|
||||
const { getADBAddon } = require("devtools/client/webide/modules/addons");
|
||||
|
||||
/**
|
||||
* This module provides a collection of helper methods to detect USB runtimes whom Firefox
|
||||
|
@ -22,8 +22,8 @@ function disableUSBRuntimes() {
|
|||
exports.disableUSBRuntimes = disableUSBRuntimes;
|
||||
|
||||
async function enableUSBRuntimes() {
|
||||
const { adb } = GetAvailableAddons();
|
||||
if (adb.status !== "installed") {
|
||||
const adbAddon = getADBAddon();
|
||||
if (adbAddon.status !== "installed") {
|
||||
console.error("ADB extension is not installed");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const Services = require("Services");
|
||||
const {gDevTools} = require("devtools/client/framework/devtools");
|
||||
const {GetAvailableAddons, ForgetAddonsList} = require("devtools/client/webide/modules/addons");
|
||||
const {getADBAddon, forgetADBAddon} = require("devtools/client/webide/modules/addons");
|
||||
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
|
||||
const {ADBScanner} = require("devtools/shared/adb/adb-scanner");
|
||||
const {RuntimeScanners} = require("devtools/client/webide/modules/runtimes");
|
||||
|
@ -18,22 +18,20 @@ window.addEventListener("load", function() {
|
|||
}
|
||||
};
|
||||
document.querySelector("#close").onclick = CloseUI;
|
||||
BuildUI(GetAvailableAddons());
|
||||
BuildUI();
|
||||
}, {capture: true, once: true});
|
||||
|
||||
window.addEventListener("unload", function() {
|
||||
ForgetAddonsList();
|
||||
forgetADBAddon();
|
||||
}, {capture: true, once: true});
|
||||
|
||||
function CloseUI() {
|
||||
window.parent.UI.openProject();
|
||||
}
|
||||
|
||||
function BuildUI(addons) {
|
||||
BuildItem(addons.adb, "adb");
|
||||
}
|
||||
function BuildUI() {
|
||||
const addon = getADBAddon();
|
||||
|
||||
function BuildItem(addon, type) {
|
||||
function onAddonUpdate(arg) {
|
||||
progress.removeAttribute("value");
|
||||
li.setAttribute("status", addon.status);
|
||||
|
@ -73,12 +71,8 @@ function BuildItem(addon, type) {
|
|||
const name = document.createElement("span");
|
||||
name.className = "name";
|
||||
|
||||
switch (type) {
|
||||
case "adb":
|
||||
li.setAttribute("addon", type);
|
||||
name.textContent = "ADB Extension";
|
||||
break;
|
||||
}
|
||||
li.setAttribute("addon", "adb");
|
||||
name.textContent = "ADB Extension";
|
||||
|
||||
li.appendChild(name);
|
||||
|
||||
|
@ -102,12 +96,10 @@ function BuildItem(addon, type) {
|
|||
const progress = document.createElement("progress");
|
||||
li.appendChild(progress);
|
||||
|
||||
if (type == "adb") {
|
||||
const warning = document.createElement("p");
|
||||
warning.textContent = Strings.GetStringFromName("addons_adb_warning");
|
||||
warning.className = "warning";
|
||||
li.appendChild(warning);
|
||||
}
|
||||
const warning = document.createElement("p");
|
||||
warning.textContent = Strings.GetStringFromName("addons_adb_warning");
|
||||
warning.className = "warning";
|
||||
li.appendChild(warning);
|
||||
|
||||
document.querySelector("ul").appendChild(li);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ const {Connection} = require("devtools/shared/client/connection-manager");
|
|||
const {AppManager} = require("devtools/client/webide/modules/app-manager");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const promise = require("promise");
|
||||
const {GetAvailableAddons} = require("devtools/client/webide/modules/addons");
|
||||
const {getADBAddon} = require("devtools/client/webide/modules/addons");
|
||||
const {getJSON} = require("devtools/client/shared/getjson");
|
||||
const Telemetry = require("devtools/client/shared/telemetry");
|
||||
const {RuntimeScanners} = require("devtools/client/webide/modules/runtimes");
|
||||
|
@ -86,8 +86,8 @@ var UI = {
|
|||
// If the user decides to uninstall any of this addon, we won't install it again.
|
||||
const autoinstallADBExtension = Services.prefs.getBoolPref("devtools.webide.autoinstallADBExtension");
|
||||
if (autoinstallADBExtension) {
|
||||
const addons = GetAvailableAddons();
|
||||
addons.adb.install();
|
||||
const adbAddon = getADBAddon();
|
||||
adbAddon.install();
|
||||
}
|
||||
|
||||
Services.prefs.setBoolPref("devtools.webide.autoinstallADBExtension", false);
|
||||
|
|
|
@ -34,23 +34,20 @@ addonsListener.onEnabled =
|
|||
addonsListener.onDisabled =
|
||||
addonsListener.onInstalled =
|
||||
addonsListener.onUninstalled = (updatedAddon) => {
|
||||
const addons = GetAvailableAddons();
|
||||
addons.adb.updateInstallStatus();
|
||||
getADBAddon().updateInstallStatus();
|
||||
};
|
||||
AddonManager.addAddonListener(addonsListener);
|
||||
|
||||
var AvailableAddons = null;
|
||||
var GetAvailableAddons = exports.GetAvailableAddons = function() {
|
||||
if (!AvailableAddons) {
|
||||
AvailableAddons = {
|
||||
adb: new ADBAddon()
|
||||
};
|
||||
var adbAddon = null;
|
||||
var getADBAddon = exports.getADBAddon = function() {
|
||||
if (!adbAddon) {
|
||||
adbAddon = new ADBAddon();
|
||||
}
|
||||
return AvailableAddons;
|
||||
return adbAddon;
|
||||
};
|
||||
|
||||
exports.ForgetAddonsList = function() {
|
||||
AvailableAddons = null;
|
||||
exports.forgetADBAddon = function() {
|
||||
adbAddon = null;
|
||||
};
|
||||
|
||||
function ADBAddon() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче