Backed out 2 changesets (bug 1295807) for build bustage a=backout
authorWes Kocher <wkocher@mozilla.com>
Thu, 02 Mar 2017 18:19:10 -0800
changeset 374720 830a13c24b225b54e0bdf0b2585c0f7943f88a7d
parent 374719 41a721007e82d448a1c8bf84fdd78c051e32d7e7
child 374721 605fd6c8ee11674bda8d1848c41da3557323b2e5
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1295807
milestone54.0a1
backs out1b162d4857b5928d370bcff9cf270d3482d464ee
1a9f4c3c782d969e64394573c8030aaf9ef42167
Backed out 2 changesets (bug 1295807) for build bustage a=backout Backed out changeset 1b162d4857b5 (bug 1295807) Backed out changeset 1a9f4c3c782d (bug 1295807) MozReview-Commit-ID: A7E4wtTcBNM
toolkit/components/extensions/ExtensionCommon.jsm
toolkit/components/extensions/MessageChannel.jsm
toolkit/components/extensions/ProxyScriptContext.jsm
toolkit/components/extensions/ext-c-runtime.js
toolkit/components/extensions/ext-proxy.js
toolkit/components/extensions/extensions-toolkit.manifest
toolkit/components/extensions/jar.mn
toolkit/components/extensions/moz.build
toolkit/components/extensions/schemas/jar.mn
toolkit/components/extensions/schemas/runtime.json
toolkit/components/extensions/test/mochitest/mochitest-common.ini
toolkit/components/extensions/test/mochitest/test_ext_proxy.html
toolkit/components/extensions/test/xpcshell/test_proxy_scripts.js
toolkit/components/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/components/extensions/ExtensionCommon.jsm
+++ b/toolkit/components/extensions/ExtensionCommon.jsm
@@ -538,31 +538,29 @@ class LocalAPIImplementation extends Sch
  */
 class SchemaAPIManager extends EventEmitter {
   /**
    * @param {string} processType
    *     "main" - The main, one and only chrome browser process.
    *     "addon" - An addon process.
    *     "content" - A content process.
    *     "devtools" - A devtools process.
-   *     "proxy" - A proxy script process.
    */
   constructor(processType) {
     super();
     this.processType = processType;
     this.global = this._createExtGlobal();
     this._scriptScopes = [];
     this._schemaApis = {
       addon_parent: [],
       addon_child: [],
       content_parent: [],
       content_child: [],
       devtools_parent: [],
       devtools_child: [],
-      proxy_script: [],
     };
   }
 
   /**
    * Create a global object that is used as the shared global for all ext-*.js
    * scripts that are loaded via `loadScript`.
    *
    * @returns {object} A sandbox that is used as the global by `loadScript`.
@@ -604,23 +602,22 @@ class SchemaAPIManager extends EventEmit
   /**
    * Called by an ext-*.js script to register an API.
    *
    * @param {string} namespace The API namespace.
    *     Intended to match the namespace of the generated API, but not used at
    *     the moment - see bugzil.la/1295774.
    * @param {string} envType Restricts the API to contexts that run in the
    *    given environment. Must be one of the following:
-   *     - "addon_parent" - addon APIs that run in the main process.
-   *     - "addon_child" - addon APIs that run in an addon process.
-   *     - "content_parent" - content script APIs that run in the main process.
-   *     - "content_child" - content script APIs that run in a content process.
-   *     - "devtools_parent" - devtools APIs that run in the main process.
-   *     - "devtools_child" - devtools APIs that run in a devtools process.
-   *     - "proxy_script" - proxy script APIs that run in the main process.
+   *     - "addon_parent" - addon APIs that runs in the main process.
+   *     - "addon_child" - addon APIs that runs in an addon process.
+   *     - "content_parent" - content script APIs that runs in the main process.
+   *     - "content_child" - content script APIs that runs in a content process.
+   *     - "devtools_parent" - devtools APIs that runs in the main process.
+   *     - "devtools_child" - devtools APIs that runs in a devtools process.
    * @param {function(BaseContext)} getAPI A function that returns an object
    *     that will be merged with |chrome| and |browser|. The next example adds
    *     the create, update and remove methods to the tabs API.
    *
    *     registerSchemaAPI("tabs", "addon_parent", (context) => ({
    *       tabs: { create, update },
    *     }));
    *     registerSchemaAPI("tabs", "addon_parent", (context) => ({
--- a/toolkit/components/extensions/MessageChannel.jsm
+++ b/toolkit/components/extensions/MessageChannel.jsm
@@ -365,25 +365,30 @@ this.MessageChannel = {
       // of messages that expect a reply, such as MessageChannel:Message, do
       // actually receive a default reply even if there are no explicit message
       // handlers.
       this.messageManagers.get(mm);
     }
   },
 
   /**
+   * Returns true if the properties of the `data` object match those in
+   * the `filter` object. Matching is done on a strict equality basis,
+   * and the behavior varies depending on the value of the `strict`
+   * parameter.
+   *
    * @param {object} filter
    *    The filter object to match against.
    * @param {object} data
    *    The data object being matched.
-   * @param {boolean} [strict=true]
-   *    If true, all properties in the `filter` object must have a
+   * @param {boolean} [strict=false]
+   *    If true, all properties in the `filter` object have a
    *    corresponding property in `data` with the same value. If
    *    false, properties present in both objects must have the same
-   *    value. Matching is done on a strict equality basis.
+   *    value.
    * @returns {boolean} True if the objects match.
    */
   matchesFilter(filter, data, strict = true) {
     if (strict) {
       return Object.keys(filter).every(key => {
         return key in data && data[key] === filter[key];
       });
     }
deleted file mode 100644
--- a/toolkit/components/extensions/ProxyScriptContext.jsm
+++ /dev/null
@@ -1,298 +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";
-
-this.EXPORTED_SYMBOLS = ["ProxyScriptContext"];
-
-/* exported ProxyScriptContext */
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/ExtensionChild.jsm");
-Cu.import("resource://gre/modules/ExtensionCommon.jsm");
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Schemas",
-                                  "resource://gre/modules/Schemas.jsm");
-XPCOMUtils.defineLazyServiceGetter(this, "ProxyService",
-                                   "@mozilla.org/network/protocol-proxy-service;1",
-                                   "nsIProtocolProxyService");
-
-const CATEGORY_EXTENSION_SCRIPTS_CONTENT = "webextension-scripts-content";
-
-// The length of time (seconds) to wait for a proxy to resolve before ignoring it.
-const PROXY_TIMEOUT_SEC = 10;
-
-const {
-  defineLazyGetter,
-} = ExtensionUtils;
-
-const {
-  BaseContext,
-  LocalAPIImplementation,
-  SchemaAPIManager,
-} = ExtensionCommon;
-
-const {
-  Messenger,
-} = ExtensionChild;
-
-const PROXY_TYPES = Object.freeze({
-  DIRECT: "direct",
-  HTTPS: "https",
-  PROXY: "proxy",
-  SOCKS: "socks",
-});
-
-class ProxyScriptContext extends BaseContext {
-  constructor(extension, url, contextInfo = {}) {
-    super("proxy_script", extension);
-    this.contextInfo = contextInfo;
-    this.extension = extension;
-    this.messageManager = Services.cpmm;
-    this.sandbox = Cu.Sandbox(this.extension.principal, {
-      sandboxName: `proxyscript:${extension.id}:${url}`,
-      metadata: {addonID: extension.id},
-    });
-    this.url = url;
-    this.FindProxyForURL = null;
-  }
-
-  /**
-   * Loads and validates a proxy script into the sandbox, and then
-   * registers a new proxy filter for the context.
-   *
-   * @returns {boolean} true if load succeeded; false otherwise.
-   */
-  load() {
-    Schemas.exportLazyGetter(this.sandbox, "browser", () => this.browserObj);
-
-    try {
-      Services.scriptloader.loadSubScript(this.url, this.sandbox, "UTF-8");
-    } catch (error) {
-      this.extension.emit("proxy-error", {
-        message: this.normalizeError(error).message,
-      });
-      return false;
-    }
-
-    this.FindProxyForURL = Cu.unwaiveXrays(this.sandbox.FindProxyForURL);
-    if (typeof this.FindProxyForURL !== "function") {
-      this.extension.emit("proxy-error", {
-        message: "The proxy script must define FindProxyForURL as a function",
-      });
-      return false;
-    }
-
-    ProxyService.registerFilter(
-      this /* nsIProtocolProxyFilter aFilter */,
-      0 /* unsigned long aPosition */
-    );
-
-    return true;
-  }
-
-  get principal() {
-    return this.extension.principal;
-  }
-
-  get cloneScope() {
-    return this.sandbox;
-  }
-
-  /**
-   * This method (which is required by the nsIProtocolProxyService interface)
-   * is called to apply proxy filter rules for the given URI and proxy object
-   * (or list of proxy objects).
-   *
-   * @param {Object} service A reference to the Protocol Proxy Service.
-   * @param {Object} uri The URI for which these proxy settings apply.
-   * @param {Object} defaultProxyInfo The proxy (or list of proxies) that
-   *     would be used by default for the given URI. This may be null.
-   * @returns {Object} The proxy info to apply for the given URI.
-   */
-  applyFilter(service, uri, defaultProxyInfo) {
-    let ret;
-    try {
-      // Bug 1337001 - provide path and query components to non-https URLs.
-      ret = this.FindProxyForURL(uri.prePath, uri.host, this.contextInfo);
-    } catch (e) {
-      let error = this.normalizeError(e);
-      this.extension.emit("proxy-error", {
-        message: error.message,
-        fileName: error.fileName,
-        lineNumber: error.lineNumber,
-        stack: error.stack,
-      });
-      return defaultProxyInfo;
-    }
-
-    if (!ret || typeof ret !== "string") {
-      this.extension.emit("proxy-error", {
-        message: "FindProxyForURL: Return type must be a string",
-      });
-      return defaultProxyInfo;
-    }
-
-    let rules = ret.split(";");
-    let proxyInfo = this.createProxyInfo(rules);
-
-    return proxyInfo || defaultProxyInfo;
-  }
-
-  /**
-   * Creates a new proxy info object using the return value of FindProxyForURL.
-   *
-   * @param {Array<string>} rules The list of proxy rules returned by FindProxyForURL.
-   *    (e.g. ["PROXY 1.2.3.4:8080", "SOCKS 1.1.1.1:9090", "DIRECT"])
-   * @returns {nsIProxyInfo} The proxy info to apply for the given URI.
-   */
-  createProxyInfo(rules) {
-    if (!rules.length) {
-      return null;
-    }
-
-    let rule = rules[0].trim();
-
-    if (!rule) {
-      this.extension.emit("proxy-error", {
-        message: "FindProxyForURL: Expected Proxy Rule",
-      });
-      return null;
-    }
-
-    let parts = rule.split(/\s+/);
-    if (!parts[0] || parts.length !== 2) {
-      this.extension.emit("proxy-error", {
-        message: `FindProxyForURL: Invalid Proxy Rule: ${rule}`,
-      });
-      return null;
-    }
-
-    parts[0] = parts[0].toLowerCase();
-
-    switch (parts[0]) {
-      case PROXY_TYPES.PROXY:
-      case PROXY_TYPES.SOCKS:
-        if (!parts[1]) {
-          this.extension.emit("proxy-error", {
-            message: `FindProxyForURL: Missing argument for "${parts[0]}"`,
-          });
-          return null;
-        }
-
-        let [host, port] = parts[1].split(":");
-        if (!host || !port) {
-          this.extension.emit("proxy-error", {
-            message: `FindProxyForURL: Unable to parse argument for ${rule}`,
-          });
-          return null;
-        }
-
-        let type = PROXY_TYPES.SOCKS;
-        if (parts[0] == PROXY_TYPES.PROXY) {
-          type = PROXY_TYPES.HTTPS;
-        }
-
-        let failoverProxy = this.createProxyInfo(rules.slice(1));
-        return ProxyService.newProxyInfo(type, host, port, 0,
-          PROXY_TIMEOUT_SEC, failoverProxy);
-      case PROXY_TYPES.DIRECT:
-        return null;
-      default:
-        this.extension.emit("proxy-error", {
-          message: `FindProxyForURL: Unrecognized proxy type: "${parts[0]}"`,
-        });
-        return null;
-    }
-  }
-
-  /**
-   * Unloads the proxy filter and shuts down the sandbox.
-   */
-  unload() {
-    super.unload();
-    ProxyService.unregisterFilter(this);
-    Cu.nukeSandbox(this.sandbox);
-    this.sandbox = null;
-  }
-}
-
-class ProxyScriptAPIManager extends SchemaAPIManager {
-  constructor() {
-    super("proxy");
-    this.initialized = false;
-  }
-
-  generateAPIs(...args) {
-    if (!this.initialized) {
-      for (let [/* name */, value] of XPCOMUtils.enumerateCategoryEntries(
-          CATEGORY_EXTENSION_SCRIPTS_CONTENT)) {
-        this.loadScript(value);
-      }
-      this.initialized = true;
-    }
-    return super.generateAPIs(...args);
-  }
-
-  registerSchemaAPI(namespace, envType, getAPI) {
-    if (envType == "proxy_script") {
-      super.registerSchemaAPI(namespace, envType, getAPI);
-    }
-  }
-}
-
-class ProxyScriptInjectionContext {
-  constructor(context, localAPIs) {
-    this.context = context;
-    this.localAPIs = localAPIs;
-  }
-
-  shouldInject(namespace, name, allowedContexts) {
-    if (this.context.envType !== "proxy_script") {
-      throw new Error(`Unexpected context type "${this.context.envType}"`);
-    }
-
-    // Do not generate proxy script APIs unless explicitly allowed.
-    return allowedContexts.includes("proxy");
-  }
-
-  getImplementation(namespace, name) {
-    let obj = namespace.split(".").reduce(
-      (object, prop) => object && object[prop],
-      this.localAPIs);
-    if (obj && name in obj) {
-      return new LocalAPIImplementation(obj, name, this.context);
-    }
-  }
-
-  get cloneScope() {
-    return this.context.cloneScope;
-  }
-
-  get principal() {
-    return this.context.principal;
-  }
-}
-
-defineLazyGetter(ProxyScriptContext.prototype, "messenger", function() {
-  let sender = {id: this.extension.uuid, url: this.url};
-  let filter = {extensionId: this.extension.id, toProxyScript: true};
-  return new Messenger(this, [this.messageManager], sender, filter);
-});
-
-let proxyScriptAPIManager = new ProxyScriptAPIManager();
-
-defineLazyGetter(ProxyScriptContext.prototype, "browserObj", function() {
-  let localAPIs = {};
-  proxyScriptAPIManager.generateAPIs(this, localAPIs);
-
-  let browserObj = Cu.createObjectIn(this.sandbox);
-  let injectionContext = new ProxyScriptInjectionContext(this, localAPIs);
-  Schemas.inject(browserObj, injectionContext);
-  return browserObj;
-});
--- a/toolkit/components/extensions/ext-c-runtime.js
+++ b/toolkit/components/extensions/ext-c-runtime.js
@@ -15,55 +15,48 @@ function runtimeApiFactory(context) {
         let recipient = {extensionId};
 
         return context.messenger.connect(context.messageManager, name, recipient);
       },
 
       sendMessage: function(...args) {
         let options; // eslint-disable-line no-unused-vars
         let extensionId, message, responseCallback;
-        if (typeof args[args.length - 1] === "function") {
+        if (typeof args[args.length - 1] == "function") {
           responseCallback = args.pop();
         }
         if (!args.length) {
           return Promise.reject({message: "runtime.sendMessage's message argument is missing"});
-        } else if (args.length === 1) {
+        } else if (args.length == 1) {
           message = args[0];
-        } else if (args.length === 2) {
-          if (typeof args[0] === "string" && args[0]) {
+        } else if (args.length == 2) {
+          if (typeof args[0] == "string" && args[0]) {
             [extensionId, message] = args;
           } else {
             [message, options] = args;
           }
-        } else if (args.length === 3) {
+        } else if (args.length == 3) {
           [extensionId, message, options] = args;
-        } else if (args.length === 4 && !responseCallback) {
+        } else if (args.length == 4 && !responseCallback) {
           return Promise.reject({message: "runtime.sendMessage's last argument is not a function"});
         } else {
           return Promise.reject({message: "runtime.sendMessage received too many arguments"});
         }
 
-        if (extensionId != null && typeof extensionId !== "string") {
+        if (extensionId != null && typeof extensionId != "string") {
           return Promise.reject({message: "runtime.sendMessage's extensionId argument is invalid"});
         }
+        if (options != null && typeof options != "object") {
+          return Promise.reject({message: "runtime.sendMessage's options argument is invalid"});
+        }
+        // TODO(robwu): Validate option keys and values when we support it.
 
         extensionId = extensionId || extension.id;
         let recipient = {extensionId};
 
-        if (options != null) {
-          if (typeof options !== "object") {
-            return Promise.reject({message: "runtime.sendMessage's options argument is invalid"});
-          }
-          if (typeof options.toProxyScript === "boolean") {
-            recipient.toProxyScript = options.toProxyScript;
-          } else {
-            return Promise.reject({message: "runtime.sendMessage's options.toProxyScript argument is invalid"});
-          }
-        }
-
         return context.messenger.sendMessage(context.messageManager, message, recipient, responseCallback);
       },
 
       connectNative(application) {
         let recipient = {
           childId: context.childManager.id,
           toNativeApp: application,
         };
@@ -94,9 +87,8 @@ function runtimeApiFactory(context) {
       },
     },
   };
 }
 
 extensions.registerSchemaAPI("runtime", "addon_child", runtimeApiFactory);
 extensions.registerSchemaAPI("runtime", "content_child", runtimeApiFactory);
 extensions.registerSchemaAPI("runtime", "devtools_child", runtimeApiFactory);
-extensions.registerSchemaAPI("runtime", "proxy_script", runtimeApiFactory);
deleted file mode 100644
--- a/toolkit/components/extensions/ext-proxy.js
+++ /dev/null
@@ -1,62 +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/. */
-
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-
-"use strict";
-
-var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/ExtensionUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "ProxyScriptContext",
-                                  "resource://gre/modules/ProxyScriptContext.jsm");
-
-var {
-  SingletonEventManager,
-} = ExtensionUtils;
-
-// WeakMap[Extension -> ProxyScriptContext]
-let proxyScriptContextMap = new WeakMap();
-
-/* eslint-disable mozilla/balanced-listeners */
-extensions.on("shutdown", (type, extension) => {
-  let proxyScriptContext = proxyScriptContextMap.get(extension);
-  if (proxyScriptContext) {
-    proxyScriptContext.unload();
-    proxyScriptContextMap.delete(extension);
-  }
-});
-/* eslint-enable mozilla/balanced-listeners */
-
-extensions.registerSchemaAPI("proxy", "addon_parent", context => {
-  let {extension} = context;
-  return {
-    proxy: {
-      registerProxyScript: (url) => {
-        // Unload the current proxy script if one is loaded.
-        if (proxyScriptContextMap.has(extension)) {
-          proxyScriptContextMap.get(extension).unload();
-          proxyScriptContextMap.delete(extension);
-        }
-
-        let proxyScriptContext = new ProxyScriptContext(extension, url);
-        if (proxyScriptContext.load()) {
-          proxyScriptContextMap.set(extension, proxyScriptContext);
-        }
-      },
-
-      onProxyError: new SingletonEventManager(context, "proxy.onProxyError", fire => {
-        let listener = (name, error) => {
-          fire.async(error);
-        };
-        extension.on("proxy-error", listener);
-        return () => {
-          extension.off("proxy-error", listener);
-        };
-      }).api(),
-    },
-  };
-});
--- a/toolkit/components/extensions/extensions-toolkit.manifest
+++ b/toolkit/components/extensions/extensions-toolkit.manifest
@@ -7,85 +7,16 @@ category webextension-scripts downloads 
 category webextension-scripts extension chrome://extensions/content/ext-extension.js
 category webextension-scripts geolocation chrome://extensions/content/ext-geolocation.js
 category webextension-scripts handlers chrome://extensions/content/ext-protocolHandlers.js
 category webextension-scripts i18n chrome://extensions/content/ext-i18n.js
 category webextension-scripts idle chrome://extensions/content/ext-idle.js
 category webextension-scripts management chrome://extensions/content/ext-management.js
 category webextension-scripts notifications chrome://extensions/content/ext-notifications.js
 category webextension-scripts privacy chrome://extensions/content/ext-privacy.js
-category webextension-scripts proxy chrome://extensions/content/ext-proxy.js
-category webextension-scripts runtime chrome://extensions/content/ext-runtime.js
-category webextension-scripts storage chrome://extensions/content/ext-storage.js
-category webextension-scripts theme chrome://extensions/content/ext-theme.js
-category webextension-scripts topSites chrome://extensions/content/ext-topSites.js
-category webextension-scripts webNavigation chrome://extensions/content/ext-webNavigation.js
-category webextension-scripts webRequest chrome://extensions/content/ext-webRequest.js
-
-# scripts specific for content process.
-category webextension-scripts-content extension chrome://extensions/content/ext-c-extension.js
-category webextension-scripts-content i18n chrome://extensions/content/ext-i18n.js
-category webextension-scripts-content runtime chrome://extensions/content/ext-c-runtime.js
-category webextension-scripts-content storage chrome://extensions/content/ext-c-storage.js
-category webextension-scripts-content test chrome://extensions/content/ext-c-test.js
-
-# scripts specific for devtools extension contexts.
-category webextension-scripts-devtools extension chrome://extensions/content/ext-c-extension.js
-category webextension-scripts-devtools i18n chrome://extensions/content/ext-i18n.js
-category webextension-scripts-devtools runtime chrome://extensions/content/ext-c-runtime.js
-category webextension-scripts-devtools storage chrome://extensions/content/ext-c-storage.js
-category webextension-scripts-devtools test chrome://extensions/content/ext-c-test.js
-
-# scripts that must run in the same process as addon code.
-category webextension-scripts-addon backgroundPage chrome://extensions/content/ext-c-backgroundPage.js
-category webextension-scripts-addon extension chrome://extensions/content/ext-c-extension.js
-category webextension-scripts-addon i18n chrome://extensions/content/ext-i18n.js
-#ifndef ANDROID
-category webextension-scripts-addon identity chrome://extensions/content/ext-c-identity.js
-#endif
-category webextension-scripts-addon runtime chrome://extensions/content/ext-c-runtime.js
-category webextension-scripts-addon storage chrome://extensions/content/ext-c-storage.js
-category webextension-scripts-addon test chrome://extensions/content/ext-c-test.js
-
-# schemas
-category webextension-schemas alarms chrome://extensions/content/schemas/alarms.json
-category webextension-schemas contextualIdentities chrome://extensions/content/schemas/contextual_identities.json
-category webextension-schemas cookies chrome://extensions/content/schemas/cookies.json
-category webextension-schemas downloads chrome://extensions/content/schemas/downloads.json
-category webextension-schemas events chrome://extensions/content/schemas/events.json
-category webextension-schemas extension chrome://extensions/content/schemas/extension.json
-category webextension-schemas extension_types chrome://extensions/content/schemas/extension_types.json
-category webextension-schemas handlers chrome://extensions/content/schemas/extension_protocol_handlers.json
-category webextension-schemas i18n chrome://extensions/content/schemas/i18n.json
-#ifndef ANDROID
-category webextension-schemas identity chrome://extensions/content/schemas/identity.json
-#endif
-category webextension-schemas idle chrome://extensions/content/schemas/idle.json
-category webextension-schemas management chrome://extensions/content/schemas/management.json
-category webextension-schemas native_host_manifest chrome://extensions/content/schemas/native_host_manifest.json
-category webextension-schemas notifications chrome://extensions/content/schemas/notifications.json
-category webextension-schemas privacy chrome://extensions/content/schemas/privacy.json
-category webextension-schemas proxy chrome://extensions/content/schemas/proxy.json
-category webextension-schemas runtime chrome://extensions/content/schemas/runtime.json
-category webextension-schemas storage chrome://extensions/content/schemas/storage.json
-category webextension-schemas test chrome://extensions/content/schemas/test.json
-category webextension-schemas theme chrome://extensions/content/schemas/theme.json# scripts
-category webextension-scripts alarms chrome://extensions/content/ext-alarms.js
-category webextension-scripts backgroundPage chrome://extensions/content/ext-backgroundPage.js
-category webextension-scripts contextualIdentities chrome://extensions/content/ext-contextualIdentities.js
-category webextension-scripts cookies chrome://extensions/content/ext-cookies.js
-category webextension-scripts downloads chrome://extensions/content/ext-downloads.js
-category webextension-scripts extension chrome://extensions/content/ext-extension.js
-category webextension-scripts geolocation chrome://extensions/content/ext-geolocation.js
-category webextension-scripts handlers chrome://extensions/content/ext-protocolHandlers.js
-category webextension-scripts i18n chrome://extensions/content/ext-i18n.js
-category webextension-scripts idle chrome://extensions/content/ext-idle.js
-category webextension-scripts management chrome://extensions/content/ext-management.js
-category webextension-scripts notifications chrome://extensions/content/ext-notifications.js
-category webextension-scripts privacy chrome://extensions/content/ext-privacy.js
 category webextension-scripts runtime chrome://extensions/content/ext-runtime.js
 category webextension-scripts storage chrome://extensions/content/ext-storage.js
 category webextension-scripts theme chrome://extensions/content/ext-theme.js
 category webextension-scripts topSites chrome://extensions/content/ext-topSites.js
 category webextension-scripts webNavigation chrome://extensions/content/ext-webNavigation.js
 category webextension-scripts webRequest chrome://extensions/content/ext-webRequest.js
 
 # scripts specific for content process.
@@ -134,13 +65,8 @@ category webextension-schemas privacy ch
 category webextension-schemas runtime chrome://extensions/content/schemas/runtime.json
 category webextension-schemas storage chrome://extensions/content/schemas/storage.json
 category webextension-schemas test chrome://extensions/content/schemas/test.json
 category webextension-schemas theme chrome://extensions/content/schemas/theme.json
 category webextension-schemas top_sites chrome://extensions/content/schemas/top_sites.json
 category webextension-schemas types chrome://extensions/content/schemas/types.json
 category webextension-schemas web_navigation chrome://extensions/content/schemas/web_navigation.json
 category webextension-schemas web_request chrome://extensions/content/schemas/web_request.json
-
-category webextension-schemas top_sites chrome://extensions/content/schemas/top_sites.json
-category webextension-schemas types chrome://extensions/content/schemas/types.json
-category webextension-schemas web_navigation chrome://extensions/content/schemas/web_navigation.json
-category webextension-schemas web_request chrome://extensions/content/schemas/web_request.json
--- a/toolkit/components/extensions/jar.mn
+++ b/toolkit/components/extensions/jar.mn
@@ -13,17 +13,16 @@ toolkit.jar:
     content/extensions/ext-extension.js
     content/extensions/ext-geolocation.js
     content/extensions/ext-i18n.js
     content/extensions/ext-idle.js
     content/extensions/ext-management.js
     content/extensions/ext-notifications.js
     content/extensions/ext-privacy.js
     content/extensions/ext-protocolHandlers.js
-    content/extensions/ext-proxy.js
     content/extensions/ext-runtime.js
     content/extensions/ext-storage.js
     content/extensions/ext-theme.js
     content/extensions/ext-topSites.js
     content/extensions/ext-webRequest.js
     content/extensions/ext-webNavigation.js
     # Below is a separate group using the naming convention ext-c-*.js that run
     # in the child process.
--- a/toolkit/components/extensions/moz.build
+++ b/toolkit/components/extensions/moz.build
@@ -16,17 +16,16 @@ EXTRA_JS_MODULES += [
     'ExtensionSettingsStore.jsm',
     'ExtensionStorage.jsm',
     'ExtensionStorageSync.jsm',
     'ExtensionTabs.jsm',
     'ExtensionUtils.jsm',
     'LegacyExtensionsUtils.jsm',
     'MessageChannel.jsm',
     'NativeMessaging.jsm',
-    'ProxyScriptContext.jsm',
     'Schemas.jsm',
 ]
 
 EXTRA_PP_COMPONENTS += [
     'extensions-toolkit.manifest',
 ]
 
 TESTING_JS_MODULES += [
--- a/toolkit/components/extensions/schemas/jar.mn
+++ b/toolkit/components/extensions/schemas/jar.mn
@@ -17,17 +17,16 @@ toolkit.jar:
 #ifndef ANDROID
     content/extensions/schemas/identity.json
 #endif
     content/extensions/schemas/idle.json
     content/extensions/schemas/management.json
     content/extensions/schemas/manifest.json
     content/extensions/schemas/native_host_manifest.json
     content/extensions/schemas/notifications.json
-    content/extensions/schemas/proxy.json
     content/extensions/schemas/privacy.json
     content/extensions/schemas/runtime.json
     content/extensions/schemas/storage.json
     content/extensions/schemas/test.json
     content/extensions/schemas/theme.json
     content/extensions/schemas/top_sites.json
     content/extensions/schemas/types.json
     content/extensions/schemas/web_navigation.json
--- a/toolkit/components/extensions/schemas/runtime.json
+++ b/toolkit/components/extensions/schemas/runtime.json
@@ -14,17 +14,17 @@
             "nativeMessaging"
           ]
         }]
       }
     ]
   },
   {
     "namespace": "runtime",
-    "allowedContexts": ["content", "devtools", "proxy"],
+    "allowedContexts": ["content", "devtools"],
     "description": "Use the <code>browser.runtime</code> API to retrieve the background page, return details about the manifest, and listen for and respond to events in the app or extension lifecycle. You can also use this API to convert the relative path of URLs to fully-qualified URLs.",
     "types": [
       {
         "id": "Port",
         "type": "object",
         "allowedContexts": ["content", "devtools"],
         "description": "An object which allows two way communication with other pages.",
         "properties": {
@@ -326,28 +326,27 @@
           "$ref": "Port",
           "description": "Port through which messages can be sent and received with the application"
         }
       },
       {
         "name": "sendMessage",
         "type": "function",
         "allowAmbiguousOptionalArguments": true,
-        "allowedContexts": ["content", "devtools", "proxy"],
+        "allowedContexts": ["content", "devtools"],
         "description": "Sends a single message to event listeners within your extension/app or a different extension/app. Similar to $(ref:runtime.connect) but only sends a single message, with an optional response. If sending to your extension, the $(ref:runtime.onMessage) event will be fired in each page, or $(ref:runtime.onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use $(ref:tabs.sendMessage).",
         "async": "responseCallback",
         "parameters": [
           {"type": "string", "name": "extensionId", "optional": true, "description": "The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for $(topic:manifest/externally_connectable)[web messaging]."},
           { "type": "any", "name": "message" },
           {
             "type": "object",
             "name": "options",
             "properties": {
-              "includeTlsChannelId": { "type": "boolean", "optional": true, "description": "Whether the TLS channel ID will be passed into onMessageExternal for processes that are listening for the connection event." },
-              "toProxyScriptSandbox": { "type": "boolean", "optional": true, "description": "If true, the message will be directed to the extension's proxy sandbox."}
+              "includeTlsChannelId": { "type": "boolean", "optional": true, "description": "Whether the TLS channel ID will be passed into onMessageExternal for processes that are listening for the connection event." }
             },
             "optional": true
           },
           {
             "type": "function",
             "name": "responseCallback",
             "optional": true,
             "parameters": [
@@ -541,17 +540,17 @@
         "description": "Fired when a connection is made from another extension.",
         "parameters": [
           {"$ref": "Port", "name": "port"}
         ]
       },
       {
         "name": "onMessage",
         "type": "function",
-        "allowedContexts": ["content", "devtools", "proxy"],
+        "allowedContexts": ["content", "devtools"],
         "description": "Fired when a message is sent from either an extension process or a content script.",
         "parameters": [
           {"name": "message", "type": "any", "optional": true, "description": "The message sent by the calling script."},
           {"name": "sender", "$ref": "MessageSender" },
           {"name": "sendResponse", "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called)." }
         ],
         "returns": {
           "type": "boolean",
--- a/toolkit/components/extensions/test/mochitest/mochitest-common.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini
@@ -68,17 +68,16 @@ skip-if = os == 'android' # Android does
 [test_ext_contentscript_teardown.html]
 [test_ext_exclude_include_globs.html]
 [test_ext_i18n_css.html]
 [test_ext_generate.html]
 [test_ext_geolocation.html]
 skip-if = os == 'android' # Android support Bug 1336194
 [test_ext_notifications.html]
 [test_ext_permission_xhr.html]
-[test_ext_proxy.html]
 [test_ext_runtime_connect.html]
 [test_ext_runtime_connect_twoway.html]
 [test_ext_runtime_connect2.html]
 [test_ext_runtime_disconnect.html]
 [test_ext_runtime_id.html]
 [test_ext_sandbox_var.html]
 [test_ext_sendmessage_reply.html]
 [test_ext_sendmessage_reply2.html]
deleted file mode 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_proxy.html
+++ /dev/null
@@ -1,100 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Tests for the proxy API</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
-  <script type="text/javascript" src="head.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-
-<script type="text/javascript">
-/* eslint no-unused-vars: ["error", {"args": "none", "varsIgnorePattern": "^(FindProxyForURL)$"}] */
-
-"use strict";
-
-function* testProxyScript(script, expected) {
-  let extension = ExtensionTestUtils.loadExtension({
-    background() {
-      browser.proxy.onProxyError.addListener(error => {
-        browser.test.sendMessage("proxy-error-received", error);
-      });
-
-      browser.proxy.registerProxyScript("proxy_script.js");
-    },
-    manifest: {
-      "permissions": ["proxy"],
-    },
-    files: {
-      "proxy_script.js": String(script).replace(/^.*?\{([^]*)\}$/, "$1"),
-    },
-  });
-
-  yield extension.startup();
-
-  let win = window.open("http://example.com/");
-  let error = yield extension.awaitMessage("proxy-error-received");
-  is(error.message, expected.message, "Correct error message received");
-  win.close();
-
-  if (expected.errorInfo) {
-    ok(error.fileName.includes("proxy_script.js"), "Error should include file name");
-    is(error.lineNumber, 3, "Error should include line number");
-    ok(error.stack.includes("proxy_script.js:3:9"), "Error should include stack trace");
-  }
-
-  yield extension.unload();
-}
-
-add_task(function* test_invalid_FindProxyForURL_type() {
-  yield testProxyScript(
-    () => { }, {
-      message: "The proxy script must define FindProxyForURL as a function",
-    });
-
-  yield testProxyScript(
-    () => {
-      var FindProxyForURL = 5; // eslint-disable-line mozilla/var-only-at-top-level
-    }, {
-      message: "The proxy script must define FindProxyForURL as a function",
-    });
-});
-
-add_task(function* test_invalid_FindProxyForURL_return_type() {
-  yield testProxyScript(
-    () => {
-      function FindProxyForURL() {
-        return 5;
-      }
-    }, {
-      message: "FindProxyForURL: Return type must be a string",
-    });
-
-  yield testProxyScript(
-    () => {
-      function FindProxyForURL() {
-        return "INVALID";
-      }
-    }, {
-      message: "FindProxyForURL: Invalid Proxy Rule: INVALID",
-    });
-});
-
-add_task(function* test_runtime_error_in_FindProxyForURL() {
-  yield testProxyScript(
-    () => {
-      function FindProxyForURL() {
-        return not_defined; // eslint-disable-line no-undef
-      }
-    }, {
-      message: "not_defined is not defined",
-      errorInfo: true,
-    });
-});
-
-</script>
-
-</body>
-</html>
deleted file mode 100644
--- a/toolkit/components/extensions/test/xpcshell/test_proxy_scripts.js
+++ /dev/null
@@ -1,321 +0,0 @@
-"use strict";
-
-/* eslint no-unused-vars: ["error", {"args": "none", "varsIgnorePattern": "^(FindProxyForURL)$"}] */
-
-Cu.import("resource://gre/modules/Extension.jsm");
-Cu.import("resource://gre/modules/ProxyScriptContext.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gProxyService",
-                                   "@mozilla.org/network/protocol-proxy-service;1",
-                                   "nsIProtocolProxyService");
-
-function* testProxyScript(options, expected = {}) {
-  let scriptData = String(options.scriptData).replace(/^.*?\{([^]*)\}$/, "$1");
-  let extensionData = {
-    background() {
-      browser.test.onMessage.addListener((message, data) => {
-        if (message === "runtime-message") {
-          browser.runtime.onMessage.addListener((msg, sender, respond) => {
-            if (msg === "finish-from-pac-script") {
-              browser.test.notifyPass("proxy");
-              return Promise.resolve(msg);
-            }
-          });
-          browser.runtime.sendMessage(data, {toProxyScript: true}).then(response => {
-            browser.test.sendMessage("runtime-message-sent");
-          });
-        } else if (message === "finish-from-xpcshell-test") {
-          browser.test.notifyPass("proxy");
-        }
-      });
-    },
-    files: {
-      "proxy.js": scriptData,
-    },
-  };
-
-  let extension = ExtensionTestUtils.loadExtension(extensionData);
-  let extension_internal = extension.extension;
-
-  yield extension.startup();
-
-  let script = new ProxyScriptContext(extension_internal, extension_internal.getURL("proxy.js"));
-
-  try {
-    yield script.load();
-  } catch (error) {
-    equal(error, expected.error, "Expected error received");
-    script.unload();
-    yield extension.unload();
-    return;
-  }
-
-  if (options.runtimeMessage) {
-    extension.sendMessage("runtime-message", options.runtimeMessage);
-    yield extension.awaitMessage("runtime-message-sent");
-  } else {
-    extension.sendMessage("finish-from-xpcshell-test");
-  }
-
-  yield extension.awaitFinish("proxy");
-
-  let proxyInfo = yield new Promise((resolve, reject) => {
-    let channel = NetUtil.newChannel({
-      uri: "http://www.mozilla.org/",
-      loadUsingSystemPrincipal: true,
-    });
-
-    gProxyService.asyncResolve(channel, 0, {
-      onProxyAvailable(req, uri, pi, status) {
-        resolve(pi);
-      },
-    });
-  });
-
-  if (!proxyInfo) {
-    equal(proxyInfo, expected.proxyInfo, "Expected proxyInfo to be null");
-  } else {
-    let expectedProxyInfo = expected.proxyInfo;
-    for (let proxy = proxyInfo; proxy; proxy = proxy.failoverProxy) {
-      equal(proxy.host, expectedProxyInfo.host, `Expected proxy host to be ${expectedProxyInfo.host}`);
-      equal(proxy.port, expectedProxyInfo.port, `Expected proxy port to be ${expectedProxyInfo.port}`);
-      equal(proxy.type, expectedProxyInfo.type, `Expected proxy type to be ${expectedProxyInfo.type}`);
-      expectedProxyInfo = expectedProxyInfo.failoverProxy;
-    }
-  }
-
-  yield extension.unload();
-  script.unload();
-}
-
-add_task(function* testUndefinedFindProxyForURL() {
-  yield testProxyScript({
-    scriptData() { },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testWrongTypeForFindProxyForURL() {
-  yield testProxyScript({
-    scriptData() {
-      let FindProxyForURL = "foo";
-    },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testInvalidReturnTypeForFindProxyForURL() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return -1;
-      }
-    },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testSimpleProxyScript() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        if (host === "www.mozilla.org") {
-          return "DIRECT";
-        }
-      }
-    },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testRuntimeErrorInProxyScript() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return RUNTIME_ERROR; // eslint-disable-line no-undef
-      }
-    },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testProxyScriptWithUnexpectedReturnType() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return "UNEXPECTED 1.2.3.4:8080";
-      }
-    },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testSocksReturnType() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        if (host === "www.mozilla.org") {
-          return "SOCKS 4.4.4.4:9002";
-        }
-      }
-    },
-  }, {
-    proxyInfo: {
-      host: "4.4.4.4",
-      port: "9002",
-      type: "socks",
-      failoverProxy: null,
-    },
-  });
-});
-
-add_task(function* testProxyReturnType() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return "PROXY 1.2.3.4:8080";
-      }
-    },
-  }, {
-    proxyInfo: {
-      host: "1.2.3.4",
-      port: "8080",
-      type: "https",
-      failoverProxy: null,
-    },
-  });
-});
-
-add_task(function* testUnusualWhitespaceForFindProxyForURL() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return "   PROXY    1.2.3.4:8080      ";
-      }
-    },
-  }, {
-    proxyInfo: {
-      host: "1.2.3.4",
-      port: "8080",
-      type: "https",
-      failoverProxy: null,
-    },
-  });
-});
-
-add_task(function* testInvalidProxyScriptIgnoresFailover() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return "PROXY 1.2.3.4:8080; UNEXPECTED; SOCKS 1.2.3.4:8080";
-      }
-    },
-  }, {
-    proxyInfo: {
-      host: "1.2.3.4",
-      port: "8080",
-      type: "https",
-      failoverProxy: null,
-    },
-  });
-});
-
-add_task(function* testProxyScriptWithValidFailovers() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return "PROXY 1.2.3.4:8080; SOCKS 4.4.4.4:9000; DIRECT";
-      }
-    },
-  }, {
-    proxyInfo: {
-      host: "1.2.3.4",
-      port: "8080",
-      type: "https",
-      failoverProxy: {
-        host: "4.4.4.4",
-        port: "9000",
-        type: "socks",
-        failoverProxy: null,
-      },
-    },
-  });
-});
-
-add_task(function* testProxyScriptWithAnInvalidFailover() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return "PROXY 1.2.3.4:8080; INVALID 1.2.3.4:9090; SOCKS 4.4.4.4:9000; DIRECT";
-      }
-    },
-  }, {
-    proxyInfo: {
-      host: "1.2.3.4",
-      port: "8080",
-      type: "https",
-      failoverProxy: null,
-    },
-  });
-});
-
-add_task(function* testProxyScriptWithEmptyFailovers() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return ";;;;;PROXY 1.2.3.4:8080";
-      }
-    },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testProxyScriptWithInvalidReturn() {
-  yield testProxyScript({
-    scriptData() {
-      function FindProxyForURL(url, host) {
-        return "SOCKS :8080;";
-      }
-    },
-  }, {
-    proxyInfo: null,
-  });
-});
-
-add_task(function* testProxyScriptWithRuntimeUpdate() {
-  yield testProxyScript({
-    scriptData() {
-      let settings = {};
-      function FindProxyForURL(url, host) {
-        if (settings.host === "www.mozilla.org") {
-          return "PROXY 1.2.3.4:8080;";
-        }
-        return "DIRECT";
-      }
-      browser.runtime.onMessage.addListener((msg, sender, respond) => {
-        if (msg.host) {
-          settings.host = msg.host;
-          browser.runtime.sendMessage("finish-from-pac-script");
-          return Promise.resolve(msg);
-        }
-      });
-    },
-    runtimeMessage: {
-      host: "www.mozilla.org",
-    },
-  }, {
-    proxyInfo: {
-      host: "1.2.3.4",
-      port: "8080",
-      type: "https",
-      failoverProxy: null,
-    },
-  });
-});
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -75,9 +75,8 @@ skip-if = os == "android"
 skip-if = os == "android"
 [test_getAPILevelForWindow.js]
 [test_ext_legacy_extension_context.js]
 [test_ext_legacy_extension_embedding.js]
 [test_locale_converter.js]
 [test_locale_data.js]
 [test_native_messaging.js]
 skip-if = os == "android"
-[test_proxy_scripts.js]
\ No newline at end of file