Bug 1350646: Part 5 - Remove sdk/addon/* modules. r?Mossop draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 06 Aug 2017 00:20:25 -0700
changeset 641185 894a8b2af13295c4046c2a86dab68a904b89091d
parent 641184 61eb59c45332b9357a2e6b7fa03b63847acefb20
child 641186 2c80406822f134a806f93b39d7a8458ef7942159
push id72469
push usermaglione.k@gmail.com
push dateSun, 06 Aug 2017 07:23:41 +0000
reviewersMossop
bugs1350646
milestone57.0a1
Bug 1350646: Part 5 - Remove sdk/addon/* modules. r?Mossop MozReview-Commit-ID: 7QvnQX7Qx2O
addon-sdk/moz.build
addon-sdk/source/lib/sdk/addon/bootstrap.js
addon-sdk/source/lib/sdk/addon/events.js
addon-sdk/source/lib/sdk/addon/host.js
addon-sdk/source/lib/sdk/addon/manager.js
addon-sdk/source/lib/sdk/addon/runner.js
addon-sdk/source/lib/sdk/webextension.js
devtools/client/debugger/test/mochitest/addon3.xpi
devtools/client/debugger/test/mochitest/browser.ini
devtools/client/debugger/test/mochitest/browser_dbg_addon-panels.js
devtools/client/debugger/test/mochitest/browser_dbg_addon-sources.js
devtools/client/debugger/test/mochitest/browser_dbg_addon-workers-dbg-enabled.js
devtools/client/debugger/test/mochitest/browser_dbg_addonactor.js
toolkit/components/extensions/test/mochitest/chrome.ini
toolkit/components/extensions/test/mochitest/test_chrome_ext_hybrid_addons.html
--- a/addon-sdk/moz.build
+++ b/addon-sdk/moz.build
@@ -38,22 +38,17 @@ modules = [
     'index.js',
     'jetpack-id/index.js',
     'method/core.js',
     'method/test/browser.js',
     'method/test/common.js',
     'mozilla-toolkit-versioning/index.js',
     'mozilla-toolkit-versioning/lib/utils.js',
     'node/os.js',
-    'sdk/addon/bootstrap.js',
-    'sdk/addon/events.js',
-    'sdk/addon/host.js',
     'sdk/addon/installer.js',
-    'sdk/addon/manager.js',
-    'sdk/addon/runner.js',
     'sdk/addon/window.js',
     'sdk/base64.js',
     'sdk/browser/events.js',
     'sdk/clipboard.js',
     'sdk/console/plain-text.js',
     'sdk/console/traceback.js',
     'sdk/content/content-worker.js',
     'sdk/content/content.js',
@@ -226,17 +221,16 @@ modules = [
     'sdk/util/dispatcher.js',
     'sdk/util/list.js',
     'sdk/util/match-pattern.js',
     'sdk/util/object.js',
     'sdk/util/rules.js',
     'sdk/util/sequence.js',
     'sdk/util/uuid.js',
     'sdk/view/core.js',
-    'sdk/webextension.js',
     'sdk/window/browser.js',
     'sdk/window/events.js',
     'sdk/window/helpers.js',
     'sdk/window/namespace.js',
     'sdk/window/utils.js',
     'sdk/windows.js',
     'sdk/windows/fennec.js',
     'sdk/windows/firefox.js',
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/addon/bootstrap.js
+++ /dev/null
@@ -1,183 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-const { Cu } = require("chrome");
-const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
-const { Task: { spawn } } = require("resource://gre/modules/Task.jsm");
-const { readURI } = require("sdk/net/url");
-const { mount, unmount } = require("sdk/uri/resource");
-const { setTimeout } = require("sdk/timers");
-const { Loader, Require, Module, main, unload } = require("toolkit/loader");
-const prefs = require("sdk/preferences/service");
-
-// load below now, so that it can be used by sdk/addon/runner
-// see bug https://bugzilla.mozilla.org/show_bug.cgi?id=1042239
-const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {});
-
-const REASON = [ "unknown", "startup", "shutdown", "enable", "disable",
-                 "install", "uninstall", "upgrade", "downgrade" ];
-
-const UUID_PATTERN = /^\{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\}$/;
-// Takes add-on ID and normalizes it to a domain name so that add-on
-// can be mapped to resource://domain/
-const readDomain = id =>
-  // If only `@` character is the first one, than just substract it,
-  // otherwise fallback to legacy normalization code path. Note: `.`
-  // is valid character for resource substitutaiton & we intend to
-  // make add-on URIs intuitive, so it's best to just stick to an
-  // add-on author typed input.
-  id.lastIndexOf("@") === 0 ? id.substr(1).toLowerCase() :
-  id.toLowerCase().
-     replace(/@/g, "-at-").
-     replace(/\./g, "-dot-").
-     replace(UUID_PATTERN, "$1");
-
-const readPaths = id => {
-  const base = `extensions.modules.${id}.path.`;
-  const domain = readDomain(id);
-  return prefs.keys(base).reduce((paths, key) => {
-    const value = prefs.get(key);
-    const name = key.replace(base, "");
-    const path = name.split(".").join("/");
-    const prefix = path.length ? `${path}/` : path;
-    const uri = value.endsWith("/") ? value : `${value}/`;
-    const root = `extensions.modules.${domain}.commonjs.path.${name}`;
-
-    mount(root, uri);
-
-    paths[prefix] = `resource://${root}/`;
-    return paths;
-  }, {});
-};
-
-const Bootstrap = function(mountURI) {
-  this.mountURI = mountURI;
-  this.install = this.install.bind(this);
-  this.uninstall = this.uninstall.bind(this);
-  this.startup = this.startup.bind(this);
-  this.shutdown = this.shutdown.bind(this);
-};
-Bootstrap.prototype = {
-  constructor: Bootstrap,
-  mount(domain, rootURI) {
-    mount(domain, rootURI);
-    this.domain = domain;
-  },
-  unmount() {
-    if (this.domain) {
-      unmount(this.domain);
-      this.domain = null;
-    }
-  },
-  install(addon, reason) {
-    return new Promise(resolve => resolve());
-  },
-  uninstall(addon, reason) {
-    return new Promise(resolve => {
-      const {id} = addon;
-
-      prefs.reset(`extensions.${id}.sdk.domain`);
-      prefs.reset(`extensions.${id}.sdk.version`);
-      prefs.reset(`extensions.${id}.sdk.rootURI`);
-      prefs.reset(`extensions.${id}.sdk.baseURI`);
-      prefs.reset(`extensions.${id}.sdk.load.reason`);
-
-      resolve();
-    });
-  },
-  startup(addon, reasonCode) {
-    const { id, version, resourceURI: { spec: addonURI } } = addon;
-    const rootURI = this.mountURI || addonURI;
-    const reason = REASON[reasonCode];
-    const self = this;
-
-    return spawn(function*() {
-      const metadata = JSON.parse(yield readURI(`${rootURI}package.json`));
-      const domain = readDomain(id);
-      const baseURI = `resource://${domain}/`;
-
-      this.mount(domain, rootURI);
-
-      prefs.set(`extensions.${id}.sdk.domain`, domain);
-      prefs.set(`extensions.${id}.sdk.version`, version);
-      prefs.set(`extensions.${id}.sdk.rootURI`, rootURI);
-      prefs.set(`extensions.${id}.sdk.baseURI`, baseURI);
-      prefs.set(`extensions.${id}.sdk.load.reason`, reason);
-
-      const command = prefs.get(`extensions.${id}.sdk.load.command`);
-
-      const loader = Loader({
-        id,
-        isNative: true,
-        checkCompatibility: true,
-        prefixURI: baseURI,
-        rootURI: baseURI,
-        name: metadata.name,
-        paths: Object.assign({
-          "": "resource://gre/modules/commonjs/",
-          "devtools/": "resource://devtools/",
-          "./": baseURI
-        }, readPaths(id)),
-        manifest: metadata,
-        metadata: metadata,
-        modules: {
-          "@test/options": {},
-        },
-        noQuit: prefs.get(`extensions.${id}.sdk.test.no-quit`, false)
-      });
-      self.loader = loader;
-
-      const module = Module("package.json", `${baseURI}package.json`);
-      const require = Require(loader, module);
-      const main = command === "test" ? "sdk/test/runner" : null;
-      const prefsURI = `${baseURI}defaults/preferences/prefs.js`;
-
-      // Init the 'sdk/webextension' module from the bootstrap addon parameter.
-      if (addon.webExtension)
-        require("sdk/webextension").initFromBootstrapAddonParam(addon);
-
-      const { startup } = require("sdk/addon/runner");
-      startup(reason, {loader, main, prefsURI});
-    }.bind(this)).catch(error => {
-      console.error(`Failed to start ${id} addon`, error);
-      throw error;
-    });
-  },
-  shutdown(addon, code) {
-    this.unmount();
-    return this.unload(REASON[code]);
-  },
-  unload(reason) {
-    return new Promise(resolve => {
-      const { loader } = this;
-      if (loader) {
-        this.loader = null;
-        unload(loader, reason);
-
-        setTimeout(() => {
-          for (let uri of Object.keys(loader.sandboxes)) {
-            let sandbox = loader.sandboxes[uri];
-            if (Cu.getClassName(sandbox, true) == "Sandbox")
-              Cu.nukeSandbox(sandbox);
-            delete loader.sandboxes[uri];
-            delete loader.modules[uri];
-          }
-
-          try {
-            Cu.nukeSandbox(loader.sharedGlobalSandbox);
-          } catch (e) {
-            Cu.reportError(e);
-          }
-
-          resolve();
-        }, 1000);
-      }
-      else {
-        resolve();
-      }
-    });
-  }
-};
-exports.Bootstrap = Bootstrap;
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/addon/events.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-'use strict';
-
-module.metadata = {
-  'stability': 'experimental'
-};
-
-var { request: hostReq, response: hostRes } = require('./host');
-var { defer: async } = require('../lang/functional');
-var { defer } = require('../core/promise');
-var { emit: emitSync, on, off } = require('../event/core');
-var { uuid } = require('../util/uuid');
-var emit = async(emitSync);
-
-// Map of IDs to deferreds
-var requests = new Map();
-
-// May not be necessary to wrap this in `async`
-// once promises are async via bug 881047
-var receive = async(function ({data, id, error}) {
-  let request = requests.get(id);
-  if (request) {
-    if (error) request.reject(error);
-    else request.resolve(clone(data));
-    requests.delete(id);
-  }
-});
-on(hostRes, 'data', receive);
-
-/*
- * Send is a helper to be used in client APIs to send
- * a request to host
- */
-function send (eventName, data) {
-  let id = uuid();
-  let deferred = defer();
-  requests.set(id, deferred);
-  emit(hostReq, 'data', {
-    id: id,
-    data: clone(data),
-    event: eventName
-  });
-  return deferred.promise;
-}
-exports.send = send;
-
-/*
- * Implement internal structured cloning algorithm in the future?
- * http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#internal-structured-cloning-algorithm
- */
-function clone (obj) {
-  return JSON.parse(JSON.stringify(obj || {}));
-}
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/addon/host.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-module.metadata = {
-  "stability": "experimental"
-};
-
-exports.request = {};
-exports.response = {};
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/addon/manager.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-module.metadata = {
-  "stability": "experimental"
-};
-
-const { AddonManager } = require("resource://gre/modules/AddonManager.jsm");
-const { defer } = require("../core/promise");
-
-function getAddonByID(id) {
-  let { promise, resolve } = defer();
-  AddonManager.getAddonByID(id, resolve);
-  return promise;
-}
-exports.getAddonByID = getAddonByID;
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/addon/runner.js
+++ /dev/null
@@ -1,176 +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/. */
-
-module.metadata = {
-  "stability": "experimental"
-};
-
-const { Cc, Ci, Cu } = require('chrome');
-const { rootURI, metadata, isNative } = require('@loader/options');
-const { id, loadReason } = require('../self');
-const { descriptor, Sandbox, evaluate, main, resolveURI } = require('toolkit/loader');
-const { exit, env, staticArgs } = require('../system');
-const { when: unload } = require('../system/unload');
-const globals = require('../system/globals');
-const { get } = require('../preferences/service');
-const { preferences } = metadata;
-
-const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyGetter(this, "DevToolsShim", function () {
-  return Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {}).
-         DevToolsShim;
-});
-
-// Initializes default preferences
-function setDefaultPrefs(prefsURI) {
-  const prefs = Cc['@mozilla.org/preferences-service;1'].
-                getService(Ci.nsIPrefService).
-                QueryInterface(Ci.nsIPrefBranch2);
-  const branch = prefs.getDefaultBranch('');
-  const sandbox = Sandbox({
-    name: prefsURI,
-    prototype: {
-      pref: function(key, val) {
-        switch (typeof val) {
-          case 'boolean':
-            branch.setBoolPref(key, val);
-            break;
-          case 'number':
-            if (val % 1 == 0) // number must be a integer, otherwise ignore it
-              branch.setIntPref(key, val);
-            break;
-          case 'string':
-            branch.setCharPref(key, val);
-            break;
-        }
-      }
-    }
-  });
-  // load preferences.
-  evaluate(sandbox, prefsURI);
-}
-
-function definePseudo(loader, id, exports) {
-  let uri = resolveURI(id, loader.mapping);
-  loader.modules[uri] = { exports: exports };
-}
-
-function startup(reason, options) {
-  return Startup.onceInitialized.then(() => {
-    // Inject globals ASAP in order to have console API working ASAP
-    Object.defineProperties(options.loader.globals, descriptor(globals));
-
-    // NOTE: Module is intentionally required only now because it relies
-    // on existence of hidden window, which does not exists until startup.
-    let { ready } = require('../addon/window');
-    // Load localization manifest and .properties files.
-    // Run the addon even in case of error (best effort approach)
-    require('../l10n/loader').
-      load(rootURI).
-      catch(function failure(error) {
-        if (!isNative)
-          console.info("Error while loading localization: " + error.message);
-      }).
-      then(function onLocalizationReady(data) {
-        // Exports data to a pseudo module so that api-utils/l10n/core
-        // can get access to it
-        definePseudo(options.loader, '@l10n/data', data ? data : null);
-        return ready;
-      }).then(function() {
-        run(options);
-      }).catch(console.exception);
-    return void 0; // otherwise we raise a warning, see bug 910304
-  });
-}
-
-function run(options) {
-  try {
-    // Try initializing HTML localization before running main module. Just print
-    // an exception in case of error, instead of preventing addon to be run.
-    try {
-      // Do not enable HTML localization while running test as it is hard to
-      // disable. Because unit tests are evaluated in a another Loader who
-      // doesn't have access to this current loader.
-      if (options.main !== 'sdk/test/runner') {
-        require('../l10n/html').enable();
-      }
-    }
-    catch(error) {
-      console.exception(error);
-    }
-
-    // native-options does stuff directly with preferences key from package.json
-    if (preferences && preferences.length > 0) {
-      try {
-        require('../preferences/native-options').
-          enable({ preferences: preferences, id: id }).
-          catch(console.exception);
-      }
-      catch (error) {
-        console.exception(error);
-      }
-    }
-    else {
-      // keeping support for addons packaged with older SDK versions,
-      // when cfx didn't include the 'preferences' key in @loader/options
-
-      // Initialize inline options localization, without preventing addon to be
-      // run in case of error
-      try {
-        require('../l10n/prefs').enable();
-      }
-      catch(error) {
-        console.exception(error);
-      }
-
-      // TODO: When bug 564675 is implemented this will no longer be needed
-      // Always set the default prefs, because they disappear on restart
-      if (options.prefsURI) {
-        // Only set if `prefsURI` specified
-        try {
-          setDefaultPrefs(options.prefsURI);
-        }
-        catch (err) {
-          // cfx bootstrap always passes prefsURI, even in addons without prefs
-        }
-      }
-    }
-
-    // this is where the addon's main.js finally run.
-    let program = main(options.loader, options.main);
-
-    if (typeof(program.onUnload) === 'function')
-      unload(program.onUnload);
-
-    if (typeof(program.main) === 'function') {
-      program.main({
-        loadReason: loadReason,
-        staticArgs: staticArgs
-      }, {
-        print: function print(_) { dump(_ + '\n') },
-        quit: exit
-      });
-    }
-
-    if (get("extensions." + id + ".sdk.debug.show", false)) {
-      DevToolsShim.initBrowserToolboxProcessForAddon(id);
-    }
-  } catch (error) {
-    console.exception(error);
-    throw error;
-  }
-}
-exports.startup = startup;
-
-// If add-on is lunched via `cfx run` we need to use `system.exit` to let
-// cfx know we're done (`cfx test` will take care of exit so we don't do
-// anything here).
-if (env.CFX_COMMAND === 'run') {
-  unload(function(reason) {
-    if (reason === 'shutdown')
-      exit(0);
-  });
-}
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/webextension.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-module.metadata = {
-  "stability": "experimental"
-};
-
-let webExtension;
-let waitForWebExtensionAPI;
-
-module.exports = {
-  initFromBootstrapAddonParam(data) {
-    if (webExtension) {
-      throw new Error("'sdk/webextension' module has been already initialized");
-    }
-
-    webExtension = data.webExtension;
-  },
-
-  startup() {
-    if (!webExtension) {
-      return Promise.reject(new Error(
-        "'sdk/webextension' module is currently disabled. " +
-        "('hasEmbeddedWebExtension' option is missing or set to false)"
-      ));
-    }
-
-    // NOTE: calling `startup` more than once raises an "Embedded Extension already started"
-    // error, but given that SDK addons are going to have access to the startup method through
-    // an SDK module that can be required in any part of the addon, it will be nicer if any
-    // additional startup calls return the startup promise instead of raising an exception,
-    // so that the SDK addon can access the API object in the other addon modules without the
-    // need to manually pass this promise around.
-    if (!waitForWebExtensionAPI) {
-      waitForWebExtensionAPI = webExtension.startup();
-    }
-
-    return waitForWebExtensionAPI;
-  }
-};
deleted file mode 100644
index b22fc3da7566196e9676deb799e0d4d957885c8f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/devtools/client/debugger/test/mochitest/browser.ini
+++ b/devtools/client/debugger/test/mochitest/browser.ini
@@ -3,17 +3,16 @@
 
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 skip-if = (os == 'linux' && debug && bits == 32)
 support-files =
   addon1.xpi
   addon2.xpi
-  addon3.xpi
   addon4.xpi
   addon5.xpi
   addon-webext-contentscript.xpi
   addon-source/browser_dbg_addon5/*
   code_binary_search.coffee
   code_binary_search.js
   code_binary_search.map
   code_blackboxing_blackboxme.js
@@ -131,30 +130,22 @@ support-files =
   sjs_post-page.sjs
   sjs_random-javascript.sjs
   testactors.js
   !/devtools/client/commandline/test/helpers.js
   !/devtools/client/framework/test/shared-head.js
 
 [browser_dbg_aaa_run_first_leaktest.js]
 skip-if = e10s && debug
-[browser_dbg_addonactor.js]
-tags = addons
-[browser_dbg_addon-sources.js]
-tags = addons
-[browser_dbg_addon-workers-dbg-enabled.js]
-tags = addons
 [browser_dbg_addon-modules.js]
 skip-if = e10s # TODO
 tags = addons
 [browser_dbg_addon-modules-unpacked.js]
 skip-if = e10s # TODO
 tags = addons
-[browser_dbg_addon-panels.js]
-tags = addons
 [browser_dbg_addon-console.js]
 skip-if = e10s && debug || os == 'win' # bug 1005274
 tags = addons
 [browser_dbg_auto-pretty-print-01.js]
 [browser_dbg_auto-pretty-print-02.js]
 [browser_dbg_auto-pretty-print-03.js]
 [browser_dbg_bfcache.js]
 skip-if = e10s || true # bug 1113935
deleted file mode 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg_addon-panels.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Ensure that only panels that are relevant to the addon debugger
-// display in the toolbox
-
-const ADDON_ID = "jid1-ami3akps3baaeg@jetpack";
-const ADDON_PATH = "addon3.xpi";
-
-var gAddon, gClient, gThreadClient, gDebugger, gSources;
-var PREFS = [
-  ["devtools.canvasdebugger.enabled", true],
-  ["devtools.shadereditor.enabled", true],
-  ["devtools.performance.enabled", true],
-  ["devtools.netmonitor.enabled", true],
-  ["devtools.scratchpad.enabled", true]
-];
-
-function test() {
-  Task.spawn(function* () {
-    // Store and enable all optional dev tools panels
-    yield pushPrefs(...PREFS);
-
-    let addon = yield addTemporaryAddon(ADDON_PATH);
-    let addonDebugger = yield initAddonDebugger(ADDON_ID);
-
-    // Check only valid tabs are shown
-    let tabs = addonDebugger.frame.contentDocument.querySelectorAll(".toolbox-tabs button")
-
-    let expectedTabs = ["webconsole", "jsdebugger", "scratchpad"];
-
-    is(tabs.length, expectedTabs.length, "displaying only " + expectedTabs.length + " tabs in addon debugger");
-    Array.forEach(tabs, (tab, i) => {
-      let toolName = expectedTabs[i];
-      is(tab.getAttribute("data-id"), toolName, "displaying " + toolName);
-    });
-
-    // Check no toolbox buttons are shown
-    let buttons = addonDebugger.frame.contentDocument.querySelectorAll("#toolbox-buttons-end button");
-    is(buttons.length, 0, "no toolbox buttons for the addon debugger");
-
-    yield addonDebugger.destroy();
-    yield removeAddon(addon);
-
-    finish();
-  });
-}
deleted file mode 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg_addon-sources.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Ensure that the sources listed when debugging an addon are either from the
-// addon itself, or the SDK, with proper groups and labels.
-
-const ADDON_ID = "jid1-ami3akps3baaeg@jetpack";
-const ADDON_PATH = "addon3.xpi";
-const ADDON_URL = getTemporaryAddonURLFromPath(ADDON_PATH);
-
-var gClient;
-
-function test() {
-  Task.spawn(function* () {
-    let addon = yield addTemporaryAddon(ADDON_PATH);
-    let addonDebugger = yield initAddonDebugger(ADDON_ID);
-
-    is(addonDebugger.title, `Developer Tools - browser_dbg_addon3 - ${ADDON_URL}`,
-       "Saw the right toolbox title.");
-
-    // Check the inital list of sources is correct
-    let groups = yield addonDebugger.getSourceGroups();
-    is(groups[0].name, "jid1-ami3akps3baaeg@jetpack", "Add-on code should be the first group");
-    is(groups[1].name, "Add-on SDK", "Add-on SDK should be the second group");
-    is(groups.length, 2, "Should be only two groups.");
-
-    let sources = groups[0].sources;
-    is(sources.length, 2, "Should be two sources");
-    ok(sources[0].url.endsWith("/addon3.xpi!/bootstrap.js"), "correct url for bootstrap code");
-    is(sources[0].label, "bootstrap.js", "correct label for bootstrap code");
-    is(sources[1].url, "resource://jid1-ami3akps3baaeg-at-jetpack/browser_dbg_addon3/lib/main.js", "correct url for add-on code");
-    is(sources[1].label, "resources/browser_dbg_addon3/lib/main.js", "correct label for add-on code");
-
-    ok(groups[1].sources.length > 10, "SDK modules are listed");
-
-    yield addonDebugger.destroy();
-    yield removeAddon(addon);
-    finish();
-  });
-}
deleted file mode 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg_addon-workers-dbg-enabled.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test that the Addon Debugger works when devtools.debugger.workers is enabled.
-// Workers controller cannot be used when debugging an Addon actor.
-
-const ADDON_ID = "jid1-ami3akps3baaeg@jetpack";
-const ADDON_PATH = "addon3.xpi";
-const ADDON_URL = getTemporaryAddonURLFromPath(ADDON_PATH);
-
-function test() {
-  Task.spawn(function* () {
-    info("Enable worker debugging.");
-    yield new Promise(resolve => {
-      SpecialPowers.pushPrefEnv({
-        "set": [["devtools.debugger.workers", true]]
-      }, resolve);
-    });
-
-    let addon = yield addTemporaryAddon(ADDON_PATH);
-    let addonDebugger = yield initAddonDebugger(ADDON_ID);
-
-    is(addonDebugger.title,
-       `Developer Tools - browser_dbg_addon3 - ${ADDON_URL}`,
-       "Saw the right toolbox title.");
-
-    info("Check that groups and sources are displayed.");
-    let groups = yield addonDebugger.getSourceGroups();
-    is(groups.length, 2, "Should be only two groups.");
-    let sources = groups[0].sources;
-    is(sources.length, 2, "Should be two sources");
-
-    yield addonDebugger.destroy();
-    yield removeAddon(addon);
-    finish();
-  });
-}
deleted file mode 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg_addonactor.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Make sure we can attach to addon actors.
-
-const ADDON3_PATH = "addon3.xpi";
-const ADDON3_ID = "jid1-ami3akps3baaeg@jetpack";
-const ADDON_MODULE_URL = "resource://jid1-ami3akps3baaeg-at-jetpack/browser_dbg_addon3/lib/main.js";
-
-var gAddon, gClient, gThreadClient;
-
-function test() {
-  if (!DebuggerServer.initialized) {
-    DebuggerServer.init();
-    DebuggerServer.addBrowserActors();
-  }
-
-  let transport = DebuggerServer.connectPipe();
-  gClient = new DebuggerClient(transport);
-  gClient.connect().then(([aType, aTraits]) => {
-    is(aType, "browser",
-      "Root actor should identify itself as a browser.");
-
-    installAddon()
-      .then(attachAddonActorForId.bind(null, gClient, ADDON3_ID))
-      .then(attachAddonThread)
-      .then(testDebugger)
-      .then(testSources)
-      .then(() => gClient.close())
-      .then(uninstallAddon)
-      .then(finish)
-      .catch(aError => {
-        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
-      });
-  });
-}
-
-function installAddon() {
-  return addTemporaryAddon(ADDON3_PATH).then(aAddon => {
-    gAddon = aAddon;
-  });
-}
-
-function attachAddonThread([aGrip, aResponse]) {
-  info("attached addon actor for Addon ID");
-  let deferred = promise.defer();
-
-  gClient.attachThread(aResponse.threadActor, (aResponse, aThreadClient) => {
-    info("attached thread");
-    gThreadClient = aThreadClient;
-    gThreadClient.resume(deferred.resolve);
-  });
-  return deferred.promise;
-}
-
-function testDebugger() {
-  info("Entering testDebugger");
-  let deferred = promise.defer();
-
-  once(gClient, "paused").then(() => {
-    ok(true, "Should be able to attach to addon actor");
-    gThreadClient.resume(deferred.resolve);
-  });
-
-  Services.obs.notifyObservers(null, "debuggerAttached");
-
-  return deferred.promise;
-}
-
-function testSources() {
-  let deferred = promise.defer();
-
-  gThreadClient.getSources(aResponse => {
-    // source URLs contain launch-specific temporary directory path,
-    // hence the ".contains" call.
-    const matches = aResponse.sources.filter(s => s.url.includes(ADDON_MODULE_URL));
-    ok(matches.length > 0,
-       "the main script of the addon is present in the source list");
-    deferred.resolve();
-  });
-
-  return deferred.promise;
-}
-
-function uninstallAddon() {
-  return removeAddon(gAddon);
-}
-
-registerCleanupFunction(function () {
-  gClient = null;
-  gAddon = null;
-  gThreadClient = null;
-});
--- a/toolkit/components/extensions/test/mochitest/chrome.ini
+++ b/toolkit/components/extensions/test/mochitest/chrome.ini
@@ -16,17 +16,16 @@ tags = webextensions in-process-webexten
 [test_chrome_ext_background_page.html]
 skip-if = (toolkit == 'android') # android doesn't have devtools
 [test_chrome_ext_contentscript_data_uri.html]
 [test_chrome_ext_contentscript_telemetry.html]
 [test_chrome_ext_contentscript_unrecognizedprop_warning.html]
 [test_chrome_ext_downloads_open.html]
 [test_chrome_ext_downloads_saveAs.html]
 [test_chrome_ext_eventpage_warning.html]
-[test_chrome_ext_hybrid_addons.html]
 [test_chrome_ext_idle.html]
 [test_chrome_ext_identity.html]
 skip-if = os == 'android' # unsupported.
 [test_chrome_ext_permissions.html]
 skip-if = os == 'android' # Bug 1350559
 [test_chrome_ext_storage_cleanup.html]
 [test_chrome_ext_trackingprotection.html]
 [test_chrome_ext_trustworthy_origin.html]
deleted file mode 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_hybrid_addons.html
+++ /dev/null
@@ -1,141 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for hybrid addons: SDK or bootstrap.js + embedded WebExtension</title>
-  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
-  <script src="chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js"></script>
-  <script type="text/javascript" src="head.js"></script>
-  <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-
-<script type="text/javascript">
-"use strict";
-
-/**
- * This test contains additional tests that ensure that an SDK hybrid addon
- * which is using the new module loader can embed a webextension correctly:
- *
- * while the other tests related to the "Embedded WebExtension" are focused
- * on unit testing a specific component, these tests are testing that a complete
- * hybrid SDK addon works as expected.
- *
- * NOTE: this tests are also the only ones which tests an SDK hybrid addon that
- * uses the new module loader (the one actually used in production by real world
- * addons these days), while the Addon SDK "embedded-webextension" test addon
- * uses the old deprecated module loader (as all the other Addon SDK test addons).
- */
-
-function generateClassicExtensionFiles({id, files}) {
-  // The addon install.rdf file, as it would be generated by jpm from the addon
-  // package.json metadata.
-  files["install.rdf"] = `<?xml version="1.0" encoding="utf-8"?>
-    <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-      <Description about="urn:mozilla:install-manifest">
-        <em:id>${id}</em:id>
-        <em:type>2</em:type>
-        <em:bootstrap>true</em:bootstrap>
-        <em:hasEmbeddedWebExtension>true</em:hasEmbeddedWebExtension>
-        <em:unpack>false</em:unpack>
-        <em:version>0.1.0</em:version>
-        <em:name>Fake Hybrid Addon</em:name>
-        <em:description>A fake hybrid addon</em:description>
-
-        <!-- Firefox -->
-        <em:targetApplication>
-          <Description>
-            <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
-            <em:minVersion>51.0a1</em:minVersion>
-            <em:maxVersion>*</em:maxVersion>
-          </Description>
-        </em:targetApplication>
-
-        <!-- Fennec -->
-        <em:targetApplication>
-          <Description>
-            <em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
-            <em:minVersion>51.0a1</em:minVersion>
-            <em:maxVersion>*</em:maxVersion>
-          </Description>
-        </em:targetApplication>
-      </Description>
-    </RDF>`;
-
-  // The addon package.json file.
-  files["package.json"] = `{
-    "id": "${id}",
-    "name": "hybrid-addon",
-    "version": "0.1.0",
-    "description": "A fake hybrid addon",
-    "main": "index.js",
-    "engines": {
-      "firefox": ">= 51.0a1",
-      "fennec": ">= 51.0a1"
-    },
-    "license": "MPL-2.0",
-    "hasEmbeddedWebExtension": true
-  }`;
-
-  // The bootstrap file that jpm bundle in any SDK addon built with it.
-  files["bootstrap.js"] = `
-    const { utils: Cu } = Components;
-    const rootURI = __SCRIPT_URI_SPEC__.replace("bootstrap.js", "");
-    const COMMONJS_URI = "resource://gre/modules/commonjs";
-    const { require } = Cu.import(COMMONJS_URI + "/toolkit/require.js", {});
-    const { Bootstrap } = require(COMMONJS_URI + "/sdk/addon/bootstrap.js");
-    var { startup, shutdown, install, uninstall } = new Bootstrap(rootURI);
-  `;
-
-  return files;
-}
-
-add_task(async function test_sdk_hybrid_addon_with_jpm_module_loader() {
-  function backgroundScript() {
-    browser.runtime.sendMessage("background message", (reply) => {
-      browser.test.assertEq("sdk received message: background message", reply,
-                            "Got the expected reply from the SDK context");
-      browser.test.notifyPass("sdk.webext-api.onmessage");
-    });
-  }
-
-  async function sdkMainScript() {
-    /* globals require */
-    const webext = require("sdk/webextension");
-    let {browser} = await webext.startup();
-    browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
-      sendReply(`sdk received message: ${msg}`);
-    });
-  }
-
-  let id = "fake@sdk.hybrid.addon";
-  let extension = ExtensionTestUtils.loadExtension({
-    useAddonManager: "temporary",
-    files: generateClassicExtensionFiles({
-      id,
-      files: {
-        "index.js": sdkMainScript,
-        "webextension/manifest.json": {
-          name: "embedded webextension name",
-          manifest_version: 2,
-          version: "0.1.0",
-          background: {
-            scripts: ["bg.js"],
-          },
-        },
-        "webextension/bg.js": backgroundScript,
-      },
-    }),
-  }, id);
-
-  extension.startup();
-
-  await extension.awaitFinish("sdk.webext-api.onmessage");
-
-  await extension.unload();
-});
-</script>
-
-</body>
-</html>