merge mozilla-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 18 Oct 2016 10:38:37 +0200
changeset 363418 dc89484d4b45abf442162e5ea2dd46f9de40197d
parent 363403 64b5c3fc34ede1862d6f597ed3483a6fbb067d98 (current diff)
parent 363417 6232409dfcb203db0d7b090f16d56d2952811d41 (diff)
child 363419 d29bc94fd3c1926f2f8f14d117774322c5bd15a8
child 363435 d87df32f5c1f5565de9e7e6108ea1d47c410d6f8
child 363528 16fdc95e863845fb782a36715839ec898110e7d8
child 363591 02397de5394827e5de1623c9ed13493222bcc048
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone52.0a1
first release with
nightly linux32
dc89484d4b45 / 52.0a1 / 20161018030211 / files
nightly mac
dc89484d4b45 / 52.0a1 / 20161018030211 / files
nightly win32
dc89484d4b45 / 52.0a1 / 20161018030211 / files
nightly win64
dc89484d4b45 / 52.0a1 / 20161018030211 / files
nightly linux64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central a=merge
devtools/client/responsive.html/test/browser/browser_shutdown_close_sync.js
devtools/client/responsive.html/test/browser/head.js
dom/apps/MessageBroadcaster.jsm
dom/apps/UserCustomizations.jsm
dom/apps/tests/unit/test_has_widget_criterion.js
netwerk/base/PACGenerator.js
netwerk/base/PACGenerator.manifest
netwerk/base/moz.build
netwerk/base/nsIPACGenerator.idl
netwerk/ipc/NeckoParent.cpp
netwerk/test/unit/test_pac_generator.js
netwerk/test/unit/xpcshell_b2g.ini
--- a/accessible/ipc/win/ProxyAccessible.cpp
+++ b/accessible/ipc/win/ProxyAccessible.cpp
@@ -31,17 +31,22 @@ ProxyAccessible::GetCOMInterface(void** 
     return false;
   }
 
   if (!mCOMProxy) {
     // See if we can lazily obtain a COM proxy
     AccessibleWrap* wrap = WrapperFor(this);
     bool isDefunct = false;
     ProxyAccessible* thisPtr = const_cast<ProxyAccessible*>(this);
-    thisPtr->mCOMProxy = wrap->GetIAccessibleFor(kChildIdSelf, &isDefunct);
+    // NB: Don't pass CHILDID_SELF here, use the absolute MSAA ID. Otherwise
+    // GetIAccessibleFor will recurse into this function and we will just
+    // overflow the stack.
+    VARIANT realId = {VT_I4};
+    realId.ulVal = wrap->GetExistingID();
+    thisPtr->mCOMProxy = wrap->GetIAccessibleFor(realId, &isDefunct);
   }
 
   RefPtr<IAccessible> addRefed = mCOMProxy;
   addRefed.forget(aOutAccessible);
   return !!mCOMProxy;
 }
 
 void
--- a/addon-sdk/source/python-lib/cuddlefish/prefs.py
+++ b/addon-sdk/source/python-lib/cuddlefish/prefs.py
@@ -224,17 +224,16 @@ DEFAULT_TEST_PREFS = {
     # Indicate that the download panel has been shown once so that whichever
     # download test runs first doesn't show the popup inconsistently.
     'browser.download.panel.shown': True,
     # Assume the about:newtab page's intro panels have been shown to not depend on
     # which test runs first and happens to open about:newtab
     'browser.newtabpage.introShown': True,
     # Disable useragent updates.
     'general.useragent.updates.enabled': False,
-    'dom.apps.customization.enabled': True,
     'media.eme.enabled': True,
     'media.eme.apiVisible': True,
     # Don't forceably kill content processes after a timeout
     'dom.ipc.tabs.shutdownTimeoutSecs': 0,
     'general.useragent.locale': "en-US",
     'intl.locale.matchOS': "en-US",
     'dom.indexedDB.experimental': True
 }
--- a/addon-sdk/source/test/preferences/test.json
+++ b/addon-sdk/source/test/preferences/test.json
@@ -32,16 +32,15 @@
   "layout.css.grid.enabled": true,
   "layout.spammy_warnings.enabled": false,
   "dom.mozSettings.enabled": true,
   "network.http.bypass-cachelock-threshold": 200000,
   "geo.provider.testing": true,
   "browser.pagethumbnails.capturing_disabled": true,
   "browser.download.panel.shown": true,
   "general.useragent.updates.enabled": false,
-  "dom.apps.customization.enabled": true,
   "media.eme.enabled": true,
   "media.eme.apiVisible": true,
   "dom.ipc.tabs.shutdownTimeoutSecs": 0,
   "general.useragent.locale": "en-US",
   "intl.locale.matchOS": "en-US",
   "dom.indexedDB.experimental": true
 }
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -871,23 +871,16 @@ pref("gfx.canvas.max-size-for-skia-gl", 
 pref("gfx.gralloc.fence-with-readpixels", true);
 
 // enable screen mirroring to external display
 pref("gfx.screen-mirroring.enabled", true);
 
 // The url of the page used to display network error details.
 pref("b2g.neterror.url", "net_error.html");
 
-// Enable PAC generator for B2G.
-pref("network.proxy.pac_generator", true);
-
-// List of app origins to apply browsing traffic proxy setting, separated by
-// comma.  Specify '*' in the list to apply to all apps.
-pref("network.proxy.browsing.app_origins", "app://system.gaiamobile.org");
-
 // Enable Web Speech synthesis API
 pref("media.webspeech.synth.enabled", true);
 
 // Enable Web Speech recognition API
 pref("media.webspeech.recognition.enable", true);
 
 // Downloads API
 pref("dom.mozDownloads.enabled", true);
@@ -933,17 +926,16 @@ pref("gfx.canvas.willReadFrequently.enab
 // Disable autofocus until we can have it not bring up the keyboard.
 // https://bugzilla.mozilla.org/show_bug.cgi?id=965763
 pref("browser.autofocus", false);
 
 // Enable wakelock
 pref("dom.wakelock.enabled", true);
 
 // Enable webapps add-ons
-pref("dom.apps.customization.enabled", true);
 pref("dom.apps.reviewer_paths", "/reviewers/,/extension/reviewers/");
 
 // New implementation to unify touch-caret and selection-carets.
 pref("layout.accessiblecaret.enabled", true);
 
 // Show the selection bars at the two ends of the selection highlight. Required
 // by the spec in bug 921965.
 pref("layout.accessiblecaret.bar.enabled", true);
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -30,20 +30,16 @@ if (isGonk) {
     return libcutils;
   });
 }
 
 XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
                                    "@mozilla.org/uuid-generator;1",
                                    "nsIUUIDGenerator");
 
-XPCOMUtils.defineLazyServiceGetter(this, "gPACGenerator",
-                                   "@mozilla.org/pac-generator;1",
-                                   "nsIPACGenerator");
-
 // Once Bug 731746 - Allow chrome JS object to implement nsIDOMEventTarget
 // is resolved this helper could be removed.
 var SettingsListener = {
   _callbacks: {},
 
   init: function sl_init() {
     if ('mozSettings' in navigator && navigator.mozSettings) {
       navigator.mozSettings.onsettingchange = this.onchange.bind(this);
@@ -476,50 +472,16 @@ setUpdateTrackingId();
         window.navigator.mozSettings.createLock().set(setting);
       } catch (e) {
         console.log('Unable to read pref layers.low-precision-opacity: ' + e);
       }
     }
   });
 })();
 
-// =================== Proxy server ======================
-(function setupBrowsingProxySettings() {
-  function setPAC() {
-    let usePAC;
-    try {
-      usePAC = Services.prefs.getBoolPref('network.proxy.pac_generator');
-    } catch (ex) {}
-
-    if (usePAC) {
-      Services.prefs.setCharPref('network.proxy.autoconfig_url',
-                                 gPACGenerator.generate());
-      Services.prefs.setIntPref('network.proxy.type',
-                                Ci.nsIProtocolProxyService.PROXYCONFIG_PAC);
-    }
-  }
-
-  SettingsListener.observe('browser.proxy.enabled', false, function(value) {
-    Services.prefs.setBoolPref('network.proxy.browsing.enabled', value);
-    setPAC();
-  });
-
-  SettingsListener.observe('browser.proxy.host', '', function(value) {
-    Services.prefs.setCharPref('network.proxy.browsing.host', value);
-    setPAC();
-  });
-
-  SettingsListener.observe('browser.proxy.port', 0, function(value) {
-    Services.prefs.setIntPref('network.proxy.browsing.port', value);
-    setPAC();
-  });
-
-  setPAC();
-})();
-
 // ======================= Dogfooders FOTA ==========================
 if (AppConstants.MOZ_B2G_RIL) {
   XPCOMUtils.defineLazyModuleGetter(this, "AppsUtils",
                                     "resource://gre/modules/AppsUtils.jsm");
 
   SettingsListener.observe('debug.performance_data.dogfooding', false,
     isDogfooder => {
       if (!isDogfooder) {
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -619,19 +619,16 @@
 @RESPATH@/components/SystemUpdateManager.js
 
 #ifdef MOZ_DEBUG
 @RESPATH@/components/TestInterfaceJS.js
 @RESPATH@/components/TestInterfaceJS.manifest
 @RESPATH@/components/TestInterfaceJSMaplike.js
 #endif
 
-@RESPATH@/components/PACGenerator.js
-@RESPATH@/components/PACGenerator.manifest
-
 ; Modules
 @RESPATH@/modules/*
 
 ; Safe Browsing
 @RESPATH@/components/nsURLClassifier.manifest
 @RESPATH@/components/nsUrlClassifierHashCompleter.js
 @RESPATH@/components/nsUrlClassifierListManager.js
 @RESPATH@/components/nsUrlClassifierLib.js
--- a/browser/base/content/test/general/browser_clipboard_pastefile.js
+++ b/browser/base/content/test/general/browser_clipboard_pastefile.js
@@ -1,21 +1,22 @@
 // This test is used to check that pasting files removes all non-file data from
 // event.clipboardData.
 
 add_task(function*() {
-  var searchbar = document.getElementById("searchbar");
+  var textbox = document.createElement("textbox");
+  document.documentElement.appendChild(textbox);
 
-  searchbar.focus();
-  searchbar.value = "Text";
-  searchbar.select();
+  textbox.focus();
+  textbox.value = "Text";
+  textbox.select();
 
   yield new Promise((resolve, reject) => {
-    searchbar.addEventListener("copy", function copyEvent(event) {
-      searchbar.removeEventListener("copy", copyEvent, true);
+    textbox.addEventListener("copy", function copyEvent(event) {
+      textbox.removeEventListener("copy", copyEvent, true);
       event.clipboardData.setData("text/plain", "Alternate");
       // For this test, it doesn't matter that the file isn't actually a file.
       event.clipboardData.setData("application/x-moz-file", "Sample");
       event.preventDefault();
       resolve();
     }, true)
 
     EventUtils.synthesizeKey("c", { accelKey: true });
@@ -31,29 +32,31 @@ add_task(function*() {
 
   yield BrowserTestUtils.synthesizeKey("v", { accelKey: true }, browser);
 
   let output = yield ContentTask.spawn(browser, { }, function* (arg) {
     return content.document.getElementById("output").textContent;
   });
   is (output, "Passed", "Paste file");
 
-  searchbar.focus();
+  textbox.focus();
 
   yield new Promise((resolve, reject) => {
-    searchbar.addEventListener("paste", function copyEvent(event) {
-      searchbar.removeEventListener("paste", copyEvent, true);
+    textbox.addEventListener("paste", function copyEvent(event) {
+      textbox.removeEventListener("paste", copyEvent, true);
 
       let dt = event.clipboardData;
       is(dt.types.length, 3, "number of types");
       ok(dt.types.includes("text/plain"), "text/plain exists in types");
       ok(dt.mozTypesAt(0).contains("text/plain"), "text/plain exists in mozTypesAt");
       is(dt.getData("text/plain"), "Alternate", "text/plain returned in getData");
       is(dt.mozGetDataAt("text/plain", 0), "Alternate", "text/plain returned in mozGetDataAt");
 
       resolve();
     }, true);
 
     EventUtils.synthesizeKey("v", { accelKey: true });
   });
 
+  document.documentElement.removeChild(textbox);
+
   yield BrowserTestUtils.removeTab(tab);
 });
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -564,19 +564,16 @@
 @RESPATH@/components/InputMethod.manifest
 
 #ifdef MOZ_DEBUG
 @RESPATH@/components/TestInterfaceJS.js
 @RESPATH@/components/TestInterfaceJS.manifest
 @RESPATH@/components/TestInterfaceJSMaplike.js
 #endif
 
-@RESPATH@/components/PACGenerator.js
-@RESPATH@/components/PACGenerator.manifest
-
 ; [Extensions]
 @RESPATH@/components/extensions-toolkit.manifest
 @RESPATH@/browser/components/extensions-browser.manifest
 
 ; Modules
 @RESPATH@/browser/modules/*
 @RESPATH@/modules/*
 
--- a/caps/nsPrincipal.cpp
+++ b/caps/nsPrincipal.cpp
@@ -26,17 +26,16 @@
 #include "jswrapper.h"
 
 #include "mozilla/dom/nsCSPContext.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/HashFunctions.h"
 
 #include "nsIAppsService.h"
-#include "mozIApplication.h"
 
 using namespace mozilla;
 
 static bool gIsWhitelistingTestDomains = false;
 static bool gCodeBasePrincipalSupport = false;
 
 static bool URIIsImmutable(nsIURI* aURI)
 {
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -913,22 +913,19 @@ cargo_build_flags += --manifest-path $(C
 cargo_build_flags += --target=$(RUST_TARGET)
 cargo_build_flags += --verbose
 
 # Assume any system libraries rustc links against are already in the target's LIBS.
 #
 # We need to run cargo unconditionally, because cargo is the only thing that
 # has full visibility into how changes in Rust sources might affect the final
 # build.
-#
-# XXX: We're passing `-C debuginfo=1` to rustc to work around an llvm-dsymutil
-# crash (bug 1301751). This should be temporary until we upgrade to Rust 1.12.
 force-cargo-build:
 	$(REPORT_BUILD)
-	env CARGO_TARGET_DIR=. RUSTC=$(RUSTC) RUSTFLAGS='-C debuginfo=1' $(CARGO) build $(cargo_build_flags) --
+	env CARGO_TARGET_DIR=. RUSTC=$(RUSTC) $(CARGO) build $(cargo_build_flags) --
 
 $(RUST_LIBRARY_FILE): force-cargo-build
 endif # CARGO_FILE
 endif # MOZ_RUST
 
 $(SOBJS):
 	$(REPORT_BUILD)
 	$(AS) -o $@ $(DEFINES) $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) -c $<
--- a/devtools/client/responsive.html/browser/tunnel.js
+++ b/devtools/client/responsive.html/browser/tunnel.js
@@ -94,23 +94,17 @@ function tunnelToInnerBrowser(outer, inn
       // so this has the effect of overriding the message manager for browser UI code.
       mmTunnel = new MessageManagerTunnel(outer, inner);
 
       // We are tunneling to an inner browser with a specific remoteness, so it is simpler
       // for the logic of the browser UI to assume this tab has taken on that remoteness,
       // even though it's not true.  Since the actions the browser UI performs are sent
       // down to the inner browser by this tunnel, the tab's remoteness effectively is the
       // remoteness of the inner browser.
-      Object.defineProperty(outer, "isRemoteBrowser", {
-        get() {
-          return true;
-        },
-        configurable: true,
-        enumerable: true,
-      });
+      outer.setAttribute("remote", "true");
 
       // Clear out any cached state that references the current non-remote XBL binding,
       // such as form fill controllers.  Otherwise they will remain in place and leak the
       // outer docshell.
       outer.destroy();
       // The XBL binding for remote browsers uses the message manager for many actions in
       // the UI and that works well here, since it gives us one main thing we need to
       // route to the inner browser (the messages), instead of having to tweak many
@@ -217,21 +211,23 @@ function tunnelToInnerBrowser(outer, inn
 
       // Reset the XBL binding back to the default.
       outer.destroy();
       outer.style.MozBinding = "";
 
       // Reset overridden XBL properties and methods.  Deleting the override
       // means it will fallback to the original XBL binding definitions which
       // are on the prototype.
-      delete outer.isRemoteBrowser;
       delete outer.hasContentOpener;
       delete outer.docShellIsActive;
       delete outer.preserveLayers;
 
+      // Reset @remote since this is now back to a regular, non-remote browser
+      outer.setAttribute("remote", "false");
+
       // Delete the PopupNotifications getter added for permission doorhangers
       delete inner.ownerGlobal.PopupNotifications;
 
       mmTunnel.destroy();
       mmTunnel = null;
 
       // Invalidate outer's permanentKey so that SessionStore stops associating
       // things that happen to the outer browser with the content inside in the
--- a/devtools/client/responsive.html/manager.js
+++ b/devtools/client/responsive.html/manager.js
@@ -319,16 +319,18 @@ ResponsiveUI.prototype = {
         yield message.request(toolWindow, "init");
         toolWindow.addInitialViewport("about:blank");
         yield message.wait(toolWindow, "browser-mounted");
         return ui.getViewportBrowser();
       })
     });
     yield this.swap.start();
 
+    this.tab.addEventListener("BeforeTabRemotenessChange", this);
+
     // Notify the inner browser to start the frame script
     yield message.request(this.toolWindow, "start-frame-script");
 
     // Get the protocol ready to speak with emulation actor
     yield this.connectToServer();
   }),
 
   /**
@@ -345,45 +347,48 @@ ResponsiveUI.prototype = {
       return false;
     }
     this.destroying = true;
 
     // If our tab is about to be closed, there's not enough time to exit
     // gracefully, but that shouldn't be a problem since the tab will go away.
     // So, skip any yielding when we're about to close the tab.
     let isWindowClosing = options && options.reason === "unload";
-    let isTabClosing = (options && options.reason === "TabClose") || isWindowClosing;
+    let isTabContentDestroying =
+      isWindowClosing || (options && (options.reason === "TabClose" ||
+                                      options.reason === "BeforeTabRemotenessChange"));
 
     // Ensure init has finished before starting destroy
-    if (!isTabClosing) {
+    if (!isTabContentDestroying) {
       yield this.inited;
     }
 
     this.tab.removeEventListener("TabClose", this);
+    this.tab.removeEventListener("BeforeTabRemotenessChange", this);
     this.browserWindow.removeEventListener("unload", this);
     this.toolWindow.removeEventListener("message", this);
 
-    if (!isTabClosing) {
+    if (!isTabContentDestroying) {
       // Notify the inner browser to stop the frame script
       yield message.request(this.toolWindow, "stop-frame-script");
     }
 
     // Destroy local state
     let swap = this.swap;
     this.browserWindow = null;
     this.tab = null;
     this.inited = null;
     this.toolWindow = null;
     this.swap = null;
 
     // Close the debugger client used to speak with emulation actor.
     // The actor handles clearing any overrides itself, so it's not necessary to clear
     // anything on shutdown client side.
     let clientClosed = this.client.close();
-    if (!isTabClosing) {
+    if (!isTabContentDestroying) {
       yield clientClosed;
     }
     this.client = this.emulationFront = null;
 
     if (!isWindowClosing) {
       // Undo the swap and return the content back to a normal tab
       swap.stop();
     }
@@ -406,18 +411,19 @@ ResponsiveUI.prototype = {
 
   handleEvent(event) {
     let { browserWindow, tab } = this;
 
     switch (event.type) {
       case "message":
         this.handleMessage(event);
         break;
+      case "BeforeTabRemotenessChange":
+      case "TabClose":
       case "unload":
-      case "TabClose":
         ResponsiveUIManager.closeIfNeeded(browserWindow, tab, {
           reason: event.type,
         });
         break;
     }
   },
 
   handleMessage(event) {
--- a/devtools/client/responsive.html/test/browser/browser.ini
+++ b/devtools/client/responsive.html/test/browser/browser.ini
@@ -27,15 +27,16 @@ support-files =
 [browser_menu_item_02.js]
 [browser_mouse_resize.js]
 [browser_navigation.js]
 [browser_network_throttling.js]
 [browser_page_state.js]
 [browser_permission_doorhanger.js]
 [browser_resize_cmd.js]
 [browser_screenshot_button.js]
-[browser_shutdown_close_sync.js]
+[browser_tab_close.js]
+[browser_tab_remoteness_change.js]
 [browser_toolbox_computed_view.js]
 [browser_toolbox_rule_view.js]
 [browser_toolbox_swap_browsers.js]
 [browser_touch_simulation.js]
 [browser_viewport_basics.js]
 [browser_window_close.js]
deleted file mode 100644
--- a/devtools/client/responsive.html/test/browser/browser_shutdown_close_sync.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Verify RDM closes synchronously when tabs are closed.
-
-const TEST_URL = "http://example.com/";
-
-function waitForClientClose(ui) {
-  return new Promise(resolve => {
-    info("RDM's debugger client is now closed");
-    ui.client.addOneTimeListener("closed", resolve);
-  });
-}
-
-add_task(function* () {
-  let tab = yield addTab(TEST_URL);
-
-  let { ui } = yield openRDM(tab);
-  let clientClosed = waitForClientClose(ui);
-
-  closeRDM(tab, {
-    reason: "TabClose",
-  });
-
-  // This flag is set at the end of `ResponsiveUI.destroy`.  If it is true
-  // without yielding on `closeRDM` above, then we must have closed
-  // synchronously.
-  is(ui.destroyed, true, "RDM closed synchronously");
-
-  yield clientClosed;
-  yield removeTab(tab);
-});
-
-add_task(function* () {
-  let tab = yield addTab(TEST_URL);
-
-  let { ui } = yield openRDM(tab);
-  let clientClosed = waitForClientClose(ui);
-
-  yield removeTab(tab);
-
-  // This flag is set at the end of `ResponsiveUI.destroy`.  If it is true without
-  // yielding on `closeRDM` itself and only removing the tab, then we must have closed
-  // synchronously in response to tab closing.
-  is(ui.destroyed, true, "RDM closed synchronously");
-
-  yield clientClosed;
-});
new file mode 100644
--- /dev/null
+++ b/devtools/client/responsive.html/test/browser/browser_tab_close.js
@@ -0,0 +1,43 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Verify RDM closes synchronously when tabs are closed.
+
+const TEST_URL = "http://example.com/";
+
+add_task(function* () {
+  let tab = yield addTab(TEST_URL);
+
+  let { ui } = yield openRDM(tab);
+  let clientClosed = waitForClientClose(ui);
+
+  closeRDM(tab, {
+    reason: "TabClose",
+  });
+
+  // This flag is set at the end of `ResponsiveUI.destroy`.  If it is true
+  // without yielding on `closeRDM` above, then we must have closed
+  // synchronously.
+  is(ui.destroyed, true, "RDM closed synchronously");
+
+  yield clientClosed;
+  yield removeTab(tab);
+});
+
+add_task(function* () {
+  let tab = yield addTab(TEST_URL);
+
+  let { ui } = yield openRDM(tab);
+  let clientClosed = waitForClientClose(ui);
+
+  yield removeTab(tab);
+
+  // This flag is set at the end of `ResponsiveUI.destroy`.  If it is true without
+  // yielding on `closeRDM` itself and only removing the tab, then we must have closed
+  // synchronously in response to tab closing.
+  is(ui.destroyed, true, "RDM closed synchronously");
+
+  yield clientClosed;
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/responsive.html/test/browser/browser_tab_remoteness_change.js
@@ -0,0 +1,44 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Verify RDM closes synchronously when tabs change remoteness.
+
+const TEST_URL = "http://example.com/";
+
+add_task(function* () {
+  let tab = yield addTab(TEST_URL);
+
+  let { ui } = yield openRDM(tab);
+  let clientClosed = waitForClientClose(ui);
+
+  closeRDM(tab, {
+    reason: "BeforeTabRemotenessChange",
+  });
+
+  // This flag is set at the end of `ResponsiveUI.destroy`.  If it is true
+  // without yielding on `closeRDM` above, then we must have closed
+  // synchronously.
+  is(ui.destroyed, true, "RDM closed synchronously");
+
+  yield clientClosed;
+  yield removeTab(tab);
+});
+
+add_task(function* () {
+  let tab = yield addTab(TEST_URL);
+
+  let { ui } = yield openRDM(tab);
+  let clientClosed = waitForClientClose(ui);
+
+  // Load URL that requires the main process, forcing a remoteness flip
+  yield load(tab.linkedBrowser, "about:robots");
+
+  // This flag is set at the end of `ResponsiveUI.destroy`.  If it is true without
+  // yielding on `closeRDM` itself and only removing the tab, then we must have closed
+  // synchronously in response to tab closing.
+  is(ui.destroyed, true, "RDM closed synchronously");
+
+  yield clientClosed;
+});
--- a/devtools/client/responsive.html/test/browser/head.js
+++ b/devtools/client/responsive.html/test/browser/head.js
@@ -331,8 +331,15 @@ function addDeviceForTest(device) {
   info(`Adding Test Device "${device.name}" to the list.`);
   addDevice(device);
 
   registerCleanupFunction(() => {
     // Note that assertions in cleanup functions are not displayed unless they failed.
     ok(removeDevice(device), `Removed Test Device "${device.name}" from the list.`);
   });
 }
+
+function waitForClientClose(ui) {
+  return new Promise(resolve => {
+    info("RDM's debugger client is now closed");
+    ui.client.addOneTimeListener("closed", resolve);
+  });
+}
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -38,17 +38,16 @@
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 
 #include "nsArray.h"
 #include "nsArrayUtils.h"
 #include "nsIDOMStorage.h"
 #include "nsIContentViewer.h"
 #include "nsIDocumentLoaderFactory.h"
-#include "nsIMozBrowserFrame.h"
 #include "nsCURILoader.h"
 #include "nsDocShellCID.h"
 #include "nsDOMCID.h"
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "mozilla/net/ReferrerPolicy.h"
 #include "nsRect.h"
 #include "prenv.h"
@@ -1248,20 +1247,16 @@ nsDocShell::LoadURI(nsIURI* aURI,
   // so we pass false as the second parameter to IsNavigationAllowed.
   // However, we don't allow the page to change location *in the middle of*
   // firing beforeunload, so we do need to check if *beforeunload* is currently
   // firing, so we call IsNavigationAllowed rather than just IsPrintingOrPP.
   if (!IsNavigationAllowed(true, false)) {
     return NS_OK; // JS may not handle returning of an error code
   }
 
-  if (DoAppRedirectIfNeeded(aURI, aLoadInfo, aFirstParty)) {
-    return NS_OK;
-  }
-
   nsCOMPtr<nsIURI> referrer;
   nsCOMPtr<nsIURI> originalURI;
   bool loadReplace = false;
   nsCOMPtr<nsIInputStream> postStream;
   nsCOMPtr<nsIInputStream> headersStream;
   nsCOMPtr<nsIPrincipal> triggeringPrincipal;
   bool inheritPrincipal = false;
   bool principalIsExplicit = false;
@@ -6724,42 +6719,16 @@ nsDocShell::ForceRefreshURIFromTimer(nsI
         break;
       }
     }
   }
 
   return ForceRefreshURI(aURI, aDelay, aMetaRefresh);
 }
 
-bool
-nsDocShell::DoAppRedirectIfNeeded(nsIURI* aURI,
-                                  nsIDocShellLoadInfo* aLoadInfo,
-                                  bool aFirstParty)
-{
-  uint32_t appId = nsIDocShell::GetAppId();
-
-  if (appId != nsIScriptSecurityManager::NO_APP_ID &&
-      appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
-    nsCOMPtr<nsIAppsService> appsService =
-      do_GetService(APPS_SERVICE_CONTRACTID);
-    NS_ASSERTION(appsService, "No AppsService available");
-    nsCOMPtr<nsIURI> redirect;
-    nsresult rv = appsService->GetRedirect(appId, aURI, getter_AddRefs(redirect));
-    if (NS_SUCCEEDED(rv) && redirect) {
-      rv = LoadURI(redirect, aLoadInfo, nsIWebNavigation::LOAD_FLAGS_NONE,
-                   aFirstParty);
-      if (NS_SUCCEEDED(rv)) {
-        return true;
-      }
-    }
-  }
-
-  return false;
-}
-
 NS_IMETHODIMP
 nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh)
 {
   NS_ENSURE_ARG(aURI);
 
   nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
   CreateLoadInfo(getter_AddRefs(loadInfo));
   NS_ENSURE_TRUE(loadInfo, NS_ERROR_OUT_OF_MEMORY);
@@ -7455,20 +7424,16 @@ nsDocShell::OnRedirectStateChange(nsICha
 
   nsCOMPtr<nsIURI> oldURI, newURI;
   aOldChannel->GetURI(getter_AddRefs(oldURI));
   aNewChannel->GetURI(getter_AddRefs(newURI));
   if (!oldURI || !newURI) {
     return;
   }
 
-  if (DoAppRedirectIfNeeded(newURI, nullptr, false)) {
-    return;
-  }
-
   // Below a URI visit is saved (see AddURIVisit method doc).
   // The visit chain looks something like:
   //   ...
   //   Site N - 1
   //                =>  Site N
   //   (redirect to =>) Site N + 1 (we are here!)
 
   // Get N - 1 and transition type
@@ -10803,45 +10768,16 @@ nsDocShell::DoURILoad(nsIURI* aURI,
       nestedURI->GetInnerURI(getter_AddRefs(tempURI));
       nestedURI = do_QueryInterface(tempURI);
     }
   } else {
     MOZ_ASSERT(aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT,
     "DoURILoad thinks this is a document and InternalLoad does not");
   }
 
-
-  // For mozWidget, display a load error if we navigate to a page which is not
-  // claimed in |widgetPages|.
-  // When we go to display a load error for an invalid mozWidget page, we will
-  // try to load an about:neterror page, which is also an invalid mozWidget
-  // page. To avoid recursion, we skip this check if aURI's scheme is "about".
-
-  // The goal is to prevent leaking sensitive information of an invalid page of
-  // an app, so allowing about:blank would not be conflict to the goal.
-  bool isAbout = false;
-  rv = aURI->SchemeIs("about", &isAbout);
-  if (NS_SUCCEEDED(rv) && !isAbout &&
-      nsIDocShell::GetIsApp()) {
-    nsCOMPtr<Element> frameElement = mScriptGlobal->AsOuter()->GetFrameElementInternal();
-    if (frameElement) {
-      nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(frameElement);
-      // |GetReallyIsApp| indicates the browser frame is a valid app or widget.
-      // Here we prevent navigating to an app or widget which loses its validity
-      // by loading invalid page or other way.
-      if (browserFrame && !browserFrame->GetReallyIsApp()) {
-        nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
-        if (serv) {
-            serv->NotifyObservers(GetDocument(), "invalid-widget", nullptr);
-        }
-        return NS_ERROR_MALFORMED_URI;
-      }
-    }
-  }
-
   // open a channel for the url
   nsCOMPtr<nsIChannel> channel;
 
   bool isSrcdoc = !aSrcdoc.IsVoid();
 
   // There are two cases we care about:
   // * Top-level load: In this case, loadingNode is null, but loadingWindow
   //   is our mScriptGlobal. We pass null for loadingPrincipal in this case.
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -722,22 +722,16 @@ protected:
 
   nsIChannel* GetCurrentDocChannel();
 
   bool ShouldBlockLoadingForBackButton();
 
   // Convenience method for getting our parent docshell. Can return null
   already_AddRefed<nsDocShell> GetParentDocshell();
 
-  // Check if we have an app redirect registered for the URI and redirect if
-  // needed. Returns true if a redirect happened, false otherwise.
-  bool DoAppRedirectIfNeeded(nsIURI* aURI,
-                             nsIDocShellLoadInfo* aLoadInfo,
-                             bool aFirstParty);
-
   // Check if aURI is about:newtab.
   bool IsAboutNewtab(nsIURI* aURI);
 
 protected:
   nsresult GetCurScrollPos(int32_t aScrollOrientation, int32_t* aCurPos);
   nsresult SetCurScrollPosEx(int32_t aCurHorizontalPos,
                              int32_t aCurVerticalPos);
 
--- a/dom/apps/AppsService.js
+++ b/dom/apps/AppsService.js
@@ -12,19 +12,16 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "UserCustomizations",
-  "resource://gre/modules/UserCustomizations.jsm");
-
 const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}");
 
 function AppsService()
 {
   debug("AppsService Constructor");
   this.inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
                     .processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
   debug("inParent: " + this.inParent);
@@ -111,42 +108,23 @@ AppsService.prototype = {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   getAppInfo: function getAppInfo(aAppId) {
     debug("getAppInfo()");
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
-  getRedirect: function getRedirect(aLocalId, aURI) {
-    debug("getRedirect for " + aLocalId + " " + aURI.spec);
-    if (this.isInvalidId(aLocalId)) {
-      return null;
-    }
-
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
   getScopeByLocalId: function(aLocalId) {
     debug("getScopeByLocalId( " + aLocalId + " )");
     if (this.isInvalidId(aLocalId)) {
       return null;
     }
     // TODO : implement properly!
     // We just return null for now to not break PushService.jsm
     return null;
   },
 
-  isExtensionResource: function(aURI) {
-    // This is only expected to be used by NeckoParent, and will not work
-    // properly in child processes.
-    if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
-      throw Cr.NS_ERROR_FAILURE;
-    }
-
-    return UserCustomizations.isFromExtension(aURI);
-  },
-
   classID : APPS_SERVICE_CID,
   QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService])
 }
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AppsService])
--- a/dom/apps/AppsUtils.jsm
+++ b/dom/apps/AppsUtils.jsm
@@ -48,25 +48,16 @@ mozIApplication.prototype = {
     // This helper checks an URI inside |aApp|'s origin and part of |aApp| has a
     // specific permission. It is not checking if browsers inside |aApp| have such
     // permission.
     let perm = Services.perms.testExactPermissionFromPrincipal(this.principal,
                                                                aPermission);
     return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
   },
 
-  hasWidgetPage: function(aPageURL) {
-    let uri = Services.io.newURI(aPageURL, null, null);
-    let filepath = AppsUtils.getFilePath(uri.path);
-    let eliminatedUri = Services.io.newURI(uri.prePath + filepath, null, null);
-    let equalCriterion = aUrl => Services.io.newURI(aUrl, null, null)
-                                            .equals(eliminatedUri);
-    return this.widgetPages.find(equalCriterion) !== undefined;
-  },
-
   get principal() {
     if (this._principal) {
       return this._principal;
     }
 
     this._principal = null;
 
     try {
@@ -117,18 +108,16 @@ function _setAppProperties(aObj, aApp) {
   aObj.manifestHash = aApp.manifestHash;
   aObj.packageHash = aApp.packageHash;
   aObj.staged = aApp.staged;
   aObj.installerAppId = aApp.installerAppId || Ci.nsIScriptSecurityManager.NO_APP_ID;
   aObj.installerIsBrowser = !!aApp.installerIsBrowser;
   aObj.storeId = aApp.storeId || "";
   aObj.storeVersion = aApp.storeVersion || 0;
   aObj.role = aApp.role || "";
-  aObj.redirects = aApp.redirects;
-  aObj.widgetPages = aApp.widgetPages || [];
   aObj.kind = aApp.kind;
   aObj.enabled = aApp.enabled !== undefined ? aApp.enabled : true;
   aObj.sideloaded = aApp.sideloaded;
   aObj.extensionVersion = aApp.extensionVersion;
   aObj.blockedStatus =
     aApp.blockedStatus !== undefined ? aApp.blockedStatus
                                      : Ci.nsIBlocklistService.STATE_NOT_BLOCKED;
   aObj.blocklistId = aApp.blocklistId;
@@ -850,20 +839,16 @@ ManifestHelper.prototype = {
   get orientation() {
     return this._localeProp("orientation");
   },
 
   get package_path() {
     return this._localeProp("package_path");
   },
 
-  get widgetPages() {
-    return this._localeProp("widgetPages");
-  },
-
   get size() {
     return this._manifest["size"] || 0;
   },
 
   get permissions() {
     if (this._manifest.permissions) {
       return this._manifest.permissions;
     }
deleted file mode 100644
--- a/dom/apps/MessageBroadcaster.jsm
+++ /dev/null
@@ -1,132 +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";
-
-// Manages registration of message managers from child processes and
-// broadcasting messages to them.
-
-this.EXPORTED_SYMBOLS = ["MessageBroadcaster"];
-
-this.MessageBroadcaster = {
-  appGetter: null,
-  children: [],
-
-  init: function(aAppGetter) {
-    if (!aAppGetter || typeof aAppGetter !== "function") {
-      throw "MessageBroadcaster.init needs a function parameter";
-    }
-    this.appGetter = aAppGetter;
-  },
-
-  // We manage refcounting of listeners per message manager.
-  addMessageListener: function(aMsgNames, aApp, aMm) {
-    aMsgNames.forEach(aMsgName => {
-      let manifestURL = aApp && aApp.manifestURL;
-      if (!(aMsgName in this.children)) {
-        this.children[aMsgName] = [];
-      }
-
-      let mmFound = this.children[aMsgName].some(mmRef => {
-        if (mmRef.mm === aMm) {
-          mmRef.refCount++;
-          return true;
-        }
-        return false;
-      });
-
-      if (!mmFound) {
-        this.children[aMsgName].push({
-          mm: aMm,
-          refCount: 1
-        });
-      }
-
-      // If the state reported by the registration is outdated, update it now.
-      if (manifestURL && ((aMsgName === 'Webapps:FireEvent') ||
-          (aMsgName === 'Webapps:UpdateState'))) {
-        let app = this.appGetter(aApp.manifestURL);
-        if (app && ((aApp.installState !== app.installState) ||
-                    (aApp.downloading !== app.downloading))) {
-          debug("Got a registration from an outdated app: " +
-                manifestURL);
-          let aEvent ={
-            type: app.installState,
-            app: app,
-            manifestURL: app.manifestURL,
-            manifest: app.manifest
-          };
-          aMm.sendAsyncMessage(aMsgName, aEvent);
-        }
-      }
-    });
-  },
-
-  removeMessageListener: function(aMsgNames, aMm) {
-    if (aMsgNames.length === 1 &&
-        aMsgNames[0] === "Webapps:Internal:AllMessages") {
-      for (let msgName in this.children) {
-        let msg = this.children[msgName];
-
-        for (let mmI = msg.length - 1; mmI >= 0; mmI -= 1) {
-          let mmRef = msg[mmI];
-          if (mmRef.mm === aMm) {
-            msg.splice(mmI, 1);
-          }
-        }
-
-        if (msg.length === 0) {
-          delete this.children[msgName];
-        }
-      }
-      return;
-    }
-
-    aMsgNames.forEach(aMsgName => {
-      if (!(aMsgName in this.children)) {
-        return;
-      }
-
-      let removeIndex;
-      this.children[aMsgName].some((mmRef, index) => {
-        if (mmRef.mm === aMm) {
-          mmRef.refCount--;
-          if (mmRef.refCount === 0) {
-            removeIndex = index;
-          }
-          return true;
-        }
-        return false;
-      });
-
-      if (removeIndex) {
-        this.children[aMsgName].splice(removeIndex, 1);
-      }
-    });
-  },
-
-  // Some messages can be listened by several content processes:
-  // Webapps:AddApp
-  // Webapps:RemoveApp
-  // Webapps:Install:Return:OK
-  // Webapps:Uninstall:Return:OK
-  // Webapps:Uninstall:Broadcast:Return:OK
-  // Webapps:FireEvent
-  // Webapps:checkForUpdate:Return:OK
-  // Webapps:UpdateState
-  broadcastMessage: function(aMsgName, aContent) {
-    if (!(aMsgName in this.children)) {
-      return;
-    }
-    this.children[aMsgName].forEach((mmRef) => {
-      mmRef.mm.sendAsyncMessage(aMsgName, this.formatMessage(aContent));
-    });
-  },
-
-  formatMessage: function(aData) {
-    let msg = aData;
-    delete msg["mm"];
-    return msg;
-  },
-}
--- a/dom/apps/PermissionsTable.jsm
+++ b/dom/apps/PermissionsTable.jsm
@@ -263,21 +263,16 @@ this.PermissionsTable =  { geolocation: 
                              privileged: DENY_ACTION,
                              certified: ALLOW_ACTION
                            },
                            "embed-apps": {
                              app: DENY_ACTION,
                              privileged: DENY_ACTION,
                              certified: ALLOW_ACTION
                            },
-                           "embed-widgets": {
-                             app: DENY_ACTION,
-                             privileged: ALLOW_ACTION,
-                             certified: ALLOW_ACTION
-                           },
                            "background-sensors": {
                              app: DENY_ACTION,
                              privileged: DENY_ACTION,
                              certified: ALLOW_ACTION
                            },
                            "audio-channel-normal": {
                              app: ALLOW_ACTION,
                              privileged: ALLOW_ACTION,
deleted file mode 100644
--- a/dom/apps/UserCustomizations.jsm
+++ /dev/null
@@ -1,177 +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 = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-this.EXPORTED_SYMBOLS = ["UserCustomizations"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppsUtils.jsm");
-Cu.import("resource://gre/modules/Extension.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "ValueExtractor",
-  "resource://gre/modules/ValueExtractor.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "console",
-                                   "@mozilla.org/consoleservice;1",
-                                   "nsIConsoleService");
-
-function debug(aMsg) {
-  if (!UserCustomizations._debug) {
-    return;
-  }
-  dump("-*-*- UserCustomizations " + aMsg + "\n");
-}
-
-function log(aStr) {
-  console.logStringMessage(aStr);
-}
-
-this.UserCustomizations = {
-  extensions: new Map(), // id -> extension. Needed to disable extensions.
-  appId: new Set(),
-
-  register: function(aApp) {
-    if (!this._enabled || !aApp.enabled || aApp.role != "addon") {
-      debug("Rejecting registration (global enabled=" + this._enabled +
-            ") (app role=" + aApp.role +
-            ", enabled=" + aApp.enabled + ")");
-      return;
-    }
-
-    debug("Starting customization registration for " + aApp.manifestURL + "\n");
-
-    let extension = new Extension({
-      id: AppsUtils.computeHash(aApp.manifestURL),
-      resourceURI: Services.io.newURI(aApp.origin + "/", null, null)
-    });
-
-    this.extensions.set(aApp.manifestURL, extension);
-    let uri = Services.io.newURI(aApp.origin, null, null);
-    debug(`Adding ${uri.host} to appId set`);
-    this.appId.add(uri.host);
-
-    extension.startup()
-      .then(() => { })
-      .catch((err) => {
-        debug(`extension.startup failed: ${err}`);
-        this.appId.delete(uri.host);
-      });
-  },
-
-  unregister: function(aApp) {
-    if (!this._enabled) {
-      return;
-    }
-
-    debug("Starting customization unregistration for " + aApp.manifestURL);
-    if (this.extensions.has(aApp.manifestURL)) {
-      this.extensions.get(aApp.manifestURL).shutdown();
-      this.extensions.delete(aApp.manifestURL);
-      let uri = Services.io.newURI(aApp.origin, null, null);
-      this.appId.delete(uri.host);
-    }
-  },
-
-  isFromExtension: function(aURI) {
-    if (!aURI && Services.prefs.getBoolPref("webextensions.tests")) {
-      // That's the case in mochitests because of the packaging setup:
-      // aURI is expected to be the appURI from the jarChannel but there is
-      // no real app associated to mochitest's jar:remoteopenfile:/// uris.
-      return true;
-    }
-    return this.appId.has(aURI.host);
-  },
-
-  // Checks that this is a valid extension manifest.
-  // The format is documented at https://developer.chrome.com/extensions/manifest
-  checkExtensionManifest: function(aManifest) {
-    if (!aManifest) {
-      return false;
-    }
-
-    const extractor = new ValueExtractor(console);
-    const manifestVersionSpec = {
-      objectName: "extension manifest",
-      object: aManifest,
-      property: "manifest_version",
-      expectedType: "number",
-      trim: true
-    }
-
-    const nameSpec = {
-      objectName: "extension manifest",
-      object: aManifest,
-      property: "name",
-      expectedType: "string",
-      trim: true
-    }
-
-    const versionSpec = {
-      objectName: "extension manifest",
-      object: aManifest,
-      property: "version",
-      expectedType: "string",
-      trim: true
-    }
-
-    let res =
-      extractor.extractValue(manifestVersionSpec) !== undefined &&
-      extractor.extractValue(nameSpec)  !== undefined &&
-      extractor.extractValue(versionSpec) !== undefined;
-
-    return res;
-  },
-
-  // Converts a chrome extension manifest into a webapp manifest.
-  convertManifest: function(aManifest) {
-    if (!aManifest) {
-      return null;
-    }
-
-    // Set the type to privileged to ensure we only allow signed addons.
-    let result = {
-      "type": "privileged",
-      "name": aManifest.name,
-      "role": "addon"
-    }
-
-    if (aManifest.description) {
-      result.description = aManifest.description;
-    }
-
-    if (aManifest.icons) {
-      result.icons = aManifest.icons;
-    }
-
-    if (aManifest.version) {
-      result.version = aManifest.version;
-    }
-
-    // chrome extension manifests have a single 'author' property, that we
-    // map to 'developer.name'.
-    // Note that it has to match the one in the mini-manifest.
-    if (aManifest.author) {
-      result.developer = {
-        name: aManifest.author
-      }
-    }
-
-    return result;
-  },
-
-  init: function() {
-    this._enabled = false;
-    try {
-      this._enabled = Services.prefs.getBoolPref("dom.apps.customization.enabled");
-    } catch(e) {}
-  },
-}
-
-UserCustomizations.init();
--- a/dom/apps/moz.build
+++ b/dom/apps/moz.build
@@ -12,17 +12,15 @@ MOCHITEST_CHROME_MANIFESTS += [
 
 EXTRA_COMPONENTS += [
     'AppsService.js',
     'AppsService.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'AppsServiceChild.jsm',
-    'MessageBroadcaster.jsm',
     'PermissionsInstaller.jsm',
     'PermissionsTable.jsm',
-    'UserCustomizations.jsm',
 ]
 
 EXTRA_PP_JS_MODULES += [
     'AppsUtils.jsm',
 ]
deleted file mode 100644
--- a/dom/apps/tests/unit/test_has_widget_criterion.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource:///modules/AppsUtils.jsm");
-Cu.import("resource:///modules/Services.jsm");
-
-add_test(function test_has_widget_criterion() {
-
-  // follow the logic |_saveWidgetsFullPath|
-  let baseUri = Services.io.newURI('http://example.com', null, null);
-  let resolve = (aPage)=>{
-    let filepath = AppsUtils.getFilePath(aPage);
-
-    return baseUri.resolve(filepath);
-  };
-
-  let widgetPages = ['/widget.html',
-                     '/foo/bar.html'];
-  let resolvedWidgetPages = widgetPages.map(resolve);
-
-  let app = new mozIApplication({widgetPages:resolvedWidgetPages});
-
-  let widgetPageCheck = aPage => app.hasWidgetPage(baseUri.resolve(aPage));
-
-  Assert.ok(widgetPageCheck('/widget.html'), 'should pass for identical path');
-  Assert.ok(widgetPageCheck('/foo/bar.html'), 'should pass for identical path');
-
-  Assert.ok(!widgetPageCheck('/wrong.html'), 'should not pass for wrong path');
-  Assert.ok(!widgetPageCheck('/WIDGET.html'), 'should be case _sensitive_ for path');
-  Assert.ok(!widgetPageCheck('/widget.HTML'), 'should be case _sensitive_ for file extension');
-
-  Assert.ok(widgetPageCheck('/widget.html?aQuery'), 'should be query insensitive');
-  Assert.ok(widgetPageCheck('/widget.html#aHash'), 'should be hash insensitive');
-  Assert.ok(widgetPageCheck('/widget.html?aQuery=aquery#aHash'),
-                            'should be hash/query insensitive');
-
-  Assert.ok(widgetPageCheck('HTTP://example.com/widget.html'),
-                            'should be case insensitive for protocol');
-  Assert.ok(widgetPageCheck('http://EXAMPLE.COM/widget.html'),
-                            'should be case insensitive for domain');
-  Assert.ok(widgetPageCheck('http://example.com:80/widget.html'),
-                            'should pass for default port');
-
-  Assert.ok(widgetPageCheck('HTTP://EXAMPLE.COM:80/widget.html?QueryA=queryA&QueryB=queryB#aHash'),
-                            'should pass for a really mess one');
-
-  Assert.ok(!widgetPageCheck('foo://example.com/widget.html'),
-                            'should not pass for wrong protocol');
-  Assert.ok(!widgetPageCheck('https://example.com/widget.html'),
-                            'should not pass for wrong protocol');
-  Assert.ok(!widgetPageCheck('/wrong/widget.html'),
-                            'should not pass for additional path');
-  Assert.ok(!widgetPageCheck('/bar.html'),
-                            'should not pass for reduced path');
-  Assert.ok(!widgetPageCheck('http://username:password@example.com/widget.html'),
-                            'should not pass for userinfo');
-  Assert.ok(!widgetPageCheck('http://example.com:8080/widget.html'),
-                             'should not pass non-default port');
-  run_next_test();
-});
-
-function run_test() {
-  run_next_test();
-}
--- a/dom/apps/tests/unit/test_moziapplication.js
+++ b/dom/apps/tests/unit/test_moziapplication.js
@@ -29,17 +29,16 @@ add_test(() => {
     manifestHash: "aManifestHash",
     packageHash: "aPackageHash",
     staged: false,
     installerAppId: 345,
     installerIsBrowser: false,
     storeId: "aStoreId",
     storeVersion: 1,
     role: "aRole",
-    redirects: "aRedirects",
     kind: "aKind",
     enabled: true,
     sideloaded: false
   };
 
   let mozapp = new mozIApplication(app);
 
   Object.keys(app).forEach((key) => {
--- a/dom/apps/tests/unit/xpcshell.ini
+++ b/dom/apps/tests/unit/xpcshell.ini
@@ -1,6 +1,5 @@
 [DEFAULT]
 
-[test_has_widget_criterion.js]
 [test_manifestSanitizer.js]
 [test_manifestHelper.js]
 [test_moziapplication.js]
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -1761,32 +1761,16 @@ nsFrameLoader::OwnerIsMozBrowserOrAppFra
 NS_IMETHODIMP
 nsFrameLoader::GetOwnerIsMozBrowserOrAppFrame(bool* aResult)
 {
   *aResult = OwnerIsMozBrowserOrAppFrame();
   return NS_OK;
 }
 
 bool
-nsFrameLoader::OwnerIsWidget()
-{
-  nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
-  return browserFrame ? browserFrame->GetReallyIsWidget() : false;
-}
-
-
-// The xpcom getter version
-NS_IMETHODIMP
-nsFrameLoader::GetOwnerIsWidget(bool* aResult)
-{
-  *aResult = OwnerIsWidget();
-  return NS_OK;
-}
-
-bool
 nsFrameLoader::OwnerIsAppFrame()
 {
   nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
   return browserFrame ? browserFrame->GetReallyIsApp() : false;
 }
 
 bool
 nsFrameLoader::OwnerIsMozBrowserFrame()
--- a/dom/base/nsFrameLoader.h
+++ b/dom/base/nsFrameLoader.h
@@ -244,22 +244,16 @@ private:
    * Is this a frameloader for a bona fide <iframe mozbrowser> or
    * <iframe mozapp>?  (I.e., does the frame return true for
    * nsIMozBrowserFrame::GetReallyIsBrowserOrApp()?)
    * <xul:browser> is not a mozbrowser or app, so this is false for that case.
    */
   bool OwnerIsMozBrowserOrAppFrame();
 
   /**
-   * Is this a frameloader for a bona fide <iframe mozwidget>?  (I.e., does the
-   * frame return true for nsIMozBrowserFrame::GetReallyIsWidget()?)
-   */
-  bool OwnerIsWidget();
-
-  /**
    * Is this a frameloader for a bona fide <iframe mozapp>?  (I.e., does the
    * frame return true for nsIMozBrowserFrame::GetReallyIsApp()?)
    */
   bool OwnerIsAppFrame();
 
   /**
    * Is this a frame loader for a bona fide <iframe mozbrowser>?
    * <xul:browser> is not a mozbrowser, so this is false for that case.
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -97,17 +97,16 @@ GK_ATOM(ancestor, "ancestor")
 GK_ATOM(ancestorOrSelf, "ancestor-or-self")
 GK_ATOM(anchor, "anchor")
 GK_ATOM(_and, "and")
 GK_ATOM(animations, "animations")
 GK_ATOM(anonid, "anonid")
 GK_ATOM(anonlocation, "anonlocation")
 GK_ATOM(any, "any")
 GK_ATOM(mozapp, "mozapp")
-GK_ATOM(mozwidget, "mozwidget")
 GK_ATOM(applet, "applet")
 GK_ATOM(applyImports, "apply-imports")
 GK_ATOM(applyTemplates, "apply-templates")
 GK_ATOM(mozapptype, "mozapptype")
 GK_ATOM(archive, "archive")
 GK_ATOM(area, "area")
 GK_ATOM(arrow, "arrow")
 GK_ATOM(article, "article")
--- a/dom/base/nsIFrameLoader.idl
+++ b/dom/base/nsIFrameLoader.idl
@@ -209,22 +209,16 @@ interface nsIFrameLoader : nsISupports
   /**
    * Find out whether the owner content really is a mozbrowser or app frame
    * Especially, a widget frame is regarded as an app frame.  <xul:browser> is
    * not considered to be a mozbrowser frame.
    */
   readonly attribute boolean ownerIsMozBrowserOrAppFrame;
 
   /**
-   * Find out whether the owner content really is a widget. If this attribute
-   * returns true, |ownerIsMozBrowserOrAppFrame| must return true.
-   */
-  readonly attribute boolean ownerIsWidget;
-
-  /**
    * The last known width of the frame. Reading this property will not trigger
    * a reflow, and therefore may not reflect the current state of things. It
    * should only be used in asynchronous APIs where values are not guaranteed
    * to be up-to-date when received.
    */
   readonly attribute unsigned long lazyWidth;
 
   /**
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -65,17 +65,16 @@ function sendSyncMsg(msg, data) {
 }
 
 var CERTIFICATE_ERROR_PAGE_PREF = 'security.alternate_certificate_error_page';
 
 var OBSERVED_EVENTS = [
   'xpcom-shutdown',
   'audio-playback',
   'activity-done',
-  'invalid-widget',
   'will-launch-app'
 ];
 
 var LISTENED_EVENTS = [
   { type: "DOMTitleChanged", useCapture: true, wantsUntrusted: false },
   { type: "DOMLinkAdded", useCapture: true, wantsUntrusted: false },
   { type: "MozScrolledAreaChanged", useCapture: true, wantsUntrusted: false },
   { type: "MozDOMFullscreen:Request", useCapture: true, wantsUntrusted: false },
@@ -392,19 +391,16 @@ BrowserElementChild.prototype = {
       case 'audio-playback':
         if (subject === content) {
           sendAsyncMsg('audioplaybackchange', { _payload_: data });
         }
         break;
       case 'xpcom-shutdown':
         this._shuttingDown = true;
         break;
-      case 'invalid-widget':
-        sendAsyncMsg('error', { type: 'invalid-widget' });
-        break;
       case 'will-launch-app':
         // If the launcher is not visible, let's ignore the message.
         if (!docShell.isActive) {
           return;
         }
 
         // If this is not a content process, let's not freeze painting.
         if (Services.appinfo.processType != Services.appinfo.PROCESS_TYPE_CONTENT) {
--- a/dom/browser-element/BrowserElementParent.cpp
+++ b/dom/browser-element/BrowserElementParent.cpp
@@ -172,23 +172,16 @@ BrowserElementParent::DispatchOpenWindow
 
   JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
   JSAutoCompartment ac(cx, global);
   if (!ToJSValue(cx, detail, &val)) {
     MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
     return BrowserElementParent::OPEN_WINDOW_IGNORED;
   }
 
-  // Do not dispatch a mozbrowseropenwindow event of a widget to its embedder
-  nsCOMPtr<nsIMozBrowserFrame> browserFrame =
-    do_QueryInterface(aOpenerFrameElement);
-  if (browserFrame && browserFrame->GetReallyIsWidget()) {
-    return BrowserElementParent::OPEN_WINDOW_CANCELLED;
-  }
-
   nsEventStatus status = nsEventStatus_eIgnore;
   bool dispatchSucceeded =
     DispatchCustomDOMEvent(aOpenerFrameElement,
                            NS_LITERAL_STRING("mozbrowseropenwindow"),
                            cx,
                            val, &status);
 
   if (dispatchSucceeded) {
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -314,19 +314,16 @@ BrowserElementParent.prototype = {
         debug('Exception when running pending API call: ' +  e);
       }
     }
     delete this._pendingAPICalls;
   },
 
   _setupMessageListener: function() {
     this._mm = this._frameLoader.messageManager;
-    this._isWidget = this._frameLoader
-                         .QueryInterface(Ci.nsIFrameLoader)
-                         .ownerIsWidget;
     this._mm.addMessageListener('browser-element-api:call', this);
     this._mm.loadFrameScript("chrome://global/content/extensions.js", true);
   },
 
   receiveMessage: function(aMsg) {
     if (!this._isAlive()) {
       return;
     }
@@ -384,17 +381,17 @@ BrowserElementParent.prototype = {
       "resize": this._fireEventFromMsg,
       "activitydone": this._fireEventFromMsg,
       "scroll": this._fireEventFromMsg,
       "opentab": this._fireEventFromMsg
     };
 
     if (aMsg.data.msg_name in mmCalls) {
       return mmCalls[aMsg.data.msg_name].apply(this, arguments);
-    } else if (!this._isWidget && aMsg.data.msg_name in mmSecuritySensitiveCalls) {
+    } else if (aMsg.data.msg_name in mmSecuritySensitiveCalls) {
       return mmSecuritySensitiveCalls[aMsg.data.msg_name].apply(this, arguments);
     }
   },
 
   _removeMessageListener: function() {
     this._mm.removeMessageListener('browser-element-api:call', this);
   },
 
@@ -423,20 +420,18 @@ BrowserElementParent.prototype = {
     let callbackCalled = false;
     let cancelCallback = function() {
       if (!callbackCalled) {
         callbackCalled = true;
         callback(false, null, null);
       }
     };
 
-    // 1. We don't handle password-only prompts.
-    // 2. We don't handle for widget case because of security concern.
-    if (authDetail.isOnlyPassword ||
-        this._frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerIsWidget) {
+    // We don't handle password-only prompts.
+    if (authDetail.isOnlyPassword) {
       cancelCallback();
       return;
     }
 
     /* username and password */
     let detail = {
       host:     authDetail.host,
       path:     authDetail.path,
--- a/dom/html/nsBrowserElement.cpp
+++ b/dom/html/nsBrowserElement.cpp
@@ -35,36 +35,24 @@ nsBrowserElement::IsBrowserElementOrThro
 {
   if (mBrowserElementAPI) {
     return true;
   }
   aRv.Throw(NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
   return false;
 }
 
-bool
-nsBrowserElement::IsNotWidgetOrThrow(ErrorResult& aRv)
-{
-  if (!mOwnerIsWidget) {
-    return true;
-  }
-  aRv.Throw(NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
-  return false;
-}
-
 void
 nsBrowserElement::InitBrowserElementAPI()
 {
   bool isMozBrowserOrApp;
   nsCOMPtr<nsIFrameLoader> frameLoader = GetFrameLoader();
   NS_ENSURE_TRUE_VOID(frameLoader);
   nsresult rv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
   NS_ENSURE_SUCCESS_VOID(rv);
-  rv = frameLoader->GetOwnerIsWidget(&mOwnerIsWidget);
-  NS_ENSURE_SUCCESS_VOID(rv);
 
   if (!isMozBrowserOrApp) {
     return;
   }
 
   if (!mBrowserElementAPI) {
     mBrowserElementAPI = do_CreateInstance("@mozilla.org/dom/browser-element-api;1");
     if (NS_WARN_IF(!mBrowserElementAPI)) {
@@ -144,17 +132,16 @@ nsBrowserElement::SendMouseEvent(const n
                                  uint32_t aX,
                                  uint32_t aY,
                                  uint32_t aButton,
                                  uint32_t aClickCount,
                                  uint32_t aModifiers,
                                  ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->SendMouseEvent(aType,
                                                    aX,
                                                    aY,
                                                    aButton,
                                                    aClickCount,
                                                    aModifiers);
 
@@ -172,17 +159,16 @@ nsBrowserElement::SendTouchEvent(const n
                                  const Sequence<uint32_t>& aRys,
                                  const Sequence<float>& aRotationAngles,
                                  const Sequence<float>& aForces,
                                  uint32_t aCount,
                                  uint32_t aModifiers,
                                  ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   if (aIdentifiers.Length() != aCount ||
       aXs.Length() != aCount ||
       aYs.Length() != aCount ||
       aRxs.Length() != aCount ||
       aRys.Length() != aCount ||
       aRotationAngles.Length() != aCount ||
       aForces.Length() != aCount) {
@@ -205,71 +191,66 @@ nsBrowserElement::SendTouchEvent(const n
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 void
 nsBrowserElement::GoBack(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->GoBack();
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 void
 nsBrowserElement::GoForward(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->GoForward();
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 void
 nsBrowserElement::Reload(bool aHardReload, ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->Reload(aHardReload);
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 void
 nsBrowserElement::Stop(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->Stop();
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::Download(const nsAString& aUrl,
                            const BrowserElementDownloadOptions& aOptions,
                            ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(mBrowserElementAPI);
   MOZ_ASSERT(wrappedObj, "Failed to get wrapped JS from XPCOM component.");
   AutoJSAPI jsapi;
   if (!jsapi.Init(wrappedObj->GetJSObject())) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
@@ -290,17 +271,16 @@ nsBrowserElement::Download(const nsAStri
 
   return req.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::PurgeHistory(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsresult rv = mBrowserElementAPI->PurgeHistory(getter_AddRefs(req));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
@@ -310,17 +290,16 @@ nsBrowserElement::PurgeHistory(ErrorResu
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::GetScreenshot(uint32_t aWidth,
                                 uint32_t aHeight,
                                 const nsAString& aMimeType,
                                 ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsresult rv = mBrowserElementAPI->GetScreenshot(aWidth, aHeight, aMimeType,
                                                   getter_AddRefs(req));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     if (rv == NS_ERROR_INVALID_ARG) {
       aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
@@ -332,64 +311,60 @@ nsBrowserElement::GetScreenshot(uint32_t
 
   return req.forget().downcast<DOMRequest>();
 }
 
 void
 nsBrowserElement::Zoom(float aZoom, ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->Zoom(aZoom);
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::GetCanGoBack(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsresult rv = mBrowserElementAPI->GetCanGoBack(getter_AddRefs(req));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   return req.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::GetCanGoForward(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsresult rv = mBrowserElementAPI->GetCanGoForward(getter_AddRefs(req));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   return req.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::GetContentDimensions(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsresult rv = mBrowserElementAPI->GetContentDimensions(getter_AddRefs(req));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
@@ -398,17 +373,16 @@ nsBrowserElement::GetContentDimensions(E
 }
 
 void
 nsBrowserElement::FindAll(const nsAString& aSearchString,
                           BrowserFindCaseSensitivity aCaseSensitivity,
                           ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   uint32_t caseSensitivity;
   if (aCaseSensitivity == BrowserFindCaseSensitivity::Case_insensitive) {
     caseSensitivity = nsIBrowserElementAPI::FIND_CASE_INSENSITIVE;
   } else {
     caseSensitivity = nsIBrowserElementAPI::FIND_CASE_SENSITIVE;
   }
 
@@ -419,17 +393,16 @@ nsBrowserElement::FindAll(const nsAStrin
   }
 }
 
 void
 nsBrowserElement::FindNext(BrowserFindDirection aDirection,
                           ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   uint32_t direction;
   if (aDirection == BrowserFindDirection::Backward) {
     direction = nsIBrowserElementAPI::FIND_BACKWARD;
   } else {
     direction = nsIBrowserElementAPI::FIND_FORWARD;
   }
 
@@ -439,17 +412,16 @@ nsBrowserElement::FindNext(BrowserFindDi
     aRv.Throw(rv);
   }
 }
 
 void
 nsBrowserElement::ClearMatch(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->ClearMatch();
 
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
   }
 }
 
@@ -628,77 +600,72 @@ nsBrowserElement::GenerateAllowedAudioCh
 
   aAudioChannels.SwapElements(channels);
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::GetMuted(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsresult rv = mBrowserElementAPI->GetMuted(getter_AddRefs(req));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   return req.forget().downcast<DOMRequest>();
 }
 
 void
 nsBrowserElement::Mute(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->Mute();
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 void
 nsBrowserElement::Unmute(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->Unmute();
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::GetVolume(ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsresult rv = mBrowserElementAPI->GetVolume(getter_AddRefs(req));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   return req.forget().downcast<DOMRequest>();
 }
 
 void
 nsBrowserElement::SetVolume(float aVolume, ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
 
   nsresult rv = mBrowserElementAPI->SetVolume(aVolume);
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 }
 
@@ -715,17 +682,16 @@ nsBrowserElement::SetNFCFocus(bool aIsFo
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::ExecuteScript(const nsAString& aScript,
                                 const BrowserElementExecuteScriptOptions& aOptions,
                                 ErrorResult& aRv)
 {
   NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-  NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
 
   nsCOMPtr<nsIDOMDOMRequest> req;
   nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(mBrowserElementAPI);
   MOZ_ASSERT(wrappedObj, "Failed to get wrapped JS from XPCOM component.");
   AutoJSAPI jsapi;
   if (!jsapi.Init(wrappedObj->GetJSObject())) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
--- a/dom/html/nsBrowserElement.h
+++ b/dom/html/nsBrowserElement.h
@@ -29,17 +29,17 @@ enum class BrowserFindDirection: uint32_
 class ErrorResult;
 
 /**
  * A helper class for browser-element frames
  */
 class nsBrowserElement
 {
 public:
-  nsBrowserElement() : mOwnerIsWidget(false) {}
+  nsBrowserElement() {}
   virtual ~nsBrowserElement() {}
 
   void SetVisible(bool aVisible, ErrorResult& aRv);
   already_AddRefed<dom::DOMRequest> GetVisible(ErrorResult& aRv);
   void SetActive(bool aActive, ErrorResult& aRv);
   bool GetActive(ErrorResult& aRv);
 
   void SendMouseEvent(const nsAString& aType,
@@ -131,15 +131,13 @@ protected:
 
   void InitBrowserElementAPI();
   void DestroyBrowserElementFrameScripts();
   nsCOMPtr<nsIBrowserElementAPI> mBrowserElementAPI;
   nsTArray<RefPtr<dom::BrowserElementAudioChannel>> mBrowserElementAudioChannels;
 
 private:
   bool IsBrowserElementOrThrow(ErrorResult& aRv);
-  bool IsNotWidgetOrThrow(ErrorResult& aRv);
-  bool mOwnerIsWidget;
 };
 
 } // namespace mozilla
 
 #endif // nsBrowserElement_h
--- a/dom/html/nsGenericHTMLFrameElement.cpp
+++ b/dom/html/nsGenericHTMLFrameElement.cpp
@@ -502,50 +502,32 @@ nsGenericHTMLFrameElement::GetReallyIsBr
   nsIPrincipal *principal = NodePrincipal();
   nsCOMPtr<nsIPermissionManager> permMgr =
     services::GetPermissionManager();
   NS_ENSURE_TRUE(permMgr, NS_OK);
 
   uint32_t permission = nsIPermissionManager::DENY_ACTION;
   nsresult rv = permMgr->TestPermissionFromPrincipal(principal, "browser", &permission);
   NS_ENSURE_SUCCESS(rv, NS_OK);
-  if (permission != nsIPermissionManager::ALLOW_ACTION) {
-    rv = permMgr->TestPermissionFromPrincipal(principal, "embed-widgets", &permission);
-    NS_ENSURE_SUCCESS(rv, NS_OK);
-  }
   *aOut = permission == nsIPermissionManager::ALLOW_ACTION;
   return NS_OK;
 }
 
 /* [infallible] */ NS_IMETHODIMP
 nsGenericHTMLFrameElement::GetReallyIsApp(bool *aOut)
 {
   nsAutoString manifestURL;
   GetAppManifestURL(manifestURL);
 
   *aOut = !manifestURL.IsEmpty();
   return NS_OK;
 }
 
 namespace {
 
-bool WidgetsEnabled()
-{
-  static bool sMozWidgetsEnabled = false;
-  static bool sBoolVarCacheInitialized = false;
-
-  if (!sBoolVarCacheInitialized) {
-    sBoolVarCacheInitialized = true;
-    Preferences::AddBoolVarCache(&sMozWidgetsEnabled,
-                                 "dom.enable_widgets");
-  }
-
-  return sMozWidgetsEnabled;
-}
-
 bool NestedEnabled()
 {
   static bool sMozNestedEnabled = false;
   static bool sBoolVarCacheInitialized = false;
 
   if (!sBoolVarCacheInitialized) {
     sBoolVarCacheInitialized = true;
     Preferences::AddBoolVarCache(&sMozNestedEnabled,
@@ -553,73 +535,47 @@ bool NestedEnabled()
   }
 
   return sMozNestedEnabled;
 }
 
 } // namespace
 
 /* [infallible] */ NS_IMETHODIMP
-nsGenericHTMLFrameElement::GetReallyIsWidget(bool *aOut)
-{
-  *aOut = false;
-  if (!WidgetsEnabled()) {
-    return NS_OK;
-  }
-
-  nsAutoString appManifestURL;
-  GetManifestURLByType(nsGkAtoms::mozapp, appManifestURL);
-  bool isApp = !appManifestURL.IsEmpty();
-
-  nsAutoString widgetManifestURL;
-  GetManifestURLByType(nsGkAtoms::mozwidget, widgetManifestURL);
-  bool isWidget = !widgetManifestURL.IsEmpty();
-
-  *aOut = isWidget && !isApp;
-  return NS_OK;
-}
-
-/* [infallible] */ NS_IMETHODIMP
 nsGenericHTMLFrameElement::GetIsolated(bool *aOut)
 {
   *aOut = true;
 
   if (!nsContentUtils::IsSystemPrincipal(NodePrincipal())) {
     return NS_OK;
   }
 
   // Isolation is only disabled if the attribute is present
   *aOut = !HasAttr(kNameSpaceID_None, nsGkAtoms::noisolation);
   return NS_OK;
 }
 
-/** Get manifest url of app or widget
- * @param AppType: nsGkAtoms::mozapp or nsGkAtoms::mozwidget
+/*
+ * Get manifest url of app.
  */
-void nsGenericHTMLFrameElement::GetManifestURLByType(nsIAtom *aAppType,
-                                                     nsAString& aManifestURL)
+void nsGenericHTMLFrameElement::GetManifestURL(nsAString& aManifestURL)
 {
   aManifestURL.Truncate();
 
-  if (aAppType != nsGkAtoms::mozapp && aAppType != nsGkAtoms::mozwidget) {
-    return;
-  }
-
   nsAutoString manifestURL;
-  GetAttr(kNameSpaceID_None, aAppType, manifestURL);
+  GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifestURL);
   if (manifestURL.IsEmpty()) {
     return;
   }
 
   // Check permission.
   nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
   NS_ENSURE_TRUE_VOID(permMgr);
   nsIPrincipal *principal = NodePrincipal();
-  const char* aPermissionType = (aAppType == nsGkAtoms::mozapp) ? "embed-apps"
-                                                                : "embed-widgets";
+  const char* aPermissionType = "embed-apps";
   uint32_t permission = nsIPermissionManager::DENY_ACTION;
   nsresult rv = permMgr->TestPermissionFromPrincipal(principal,
                                                      aPermissionType,
                                                      &permission);
   NS_ENSURE_SUCCESS_VOID(rv);
   if (permission != nsIPermissionManager::ALLOW_ACTION) {
     return;
   }
@@ -629,27 +585,16 @@ void nsGenericHTMLFrameElement::GetManif
 
   nsCOMPtr<mozIApplication> app;
   appsService->GetAppByManifestURL(manifestURL, getter_AddRefs(app));
 
   if (!app) {
     return;
   }
 
-  bool hasWidgetPage = false;
-  nsAutoString src;
-  if (aAppType == nsGkAtoms::mozwidget) {
-    GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
-    nsresult rv = app->HasWidgetPage(src, &hasWidgetPage);
-
-    if (!NS_SUCCEEDED(rv) || !hasWidgetPage) {
-      return;
-    }
-  }
-
   aManifestURL.Assign(manifestURL);
 }
 
 NS_IMETHODIMP
 nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
 {
   aOut.Truncate();
 
@@ -663,42 +608,34 @@ nsGenericHTMLFrameElement::GetAppManifes
   if (!XRE_IsParentProcess() &&
       !(GetBoolAttr(nsGkAtoms::Remote) && NestedEnabled())){
     NS_WARNING("Can't embed-apps. Embed-apps is restricted to in-proc apps "
                "or content processes with nested pref enabled, see bug 1097479");
     return NS_OK;
   }
 
   nsAutoString appManifestURL;
-  nsAutoString widgetManifestURL;
 
-  GetManifestURLByType(nsGkAtoms::mozapp, appManifestURL);
-
-  if (WidgetsEnabled()) {
-    GetManifestURLByType(nsGkAtoms::mozwidget, widgetManifestURL);
-  }
+  GetManifestURL(appManifestURL);
 
   bool isApp = !appManifestURL.IsEmpty();
-  bool isWidget = !widgetManifestURL.IsEmpty();
 
-  if (!isApp && !isWidget) {
+  if (!isApp) {
     // No valid case to get manifest
     return NS_OK;
   }
 
-  if (isApp && isWidget) {
-    NS_WARNING("Can not simultaneously be mozapp and mozwidget");
+  if (isApp) {
+    NS_WARNING("Can not simultaneously be mozapp");
     return NS_OK;
   }
 
   nsAutoString manifestURL;
   if (isApp) {
     manifestURL.Assign(appManifestURL);
-  } else if (isWidget) {
-    manifestURL.Assign(widgetManifestURL);
   }
 
   aOut.Assign(manifestURL);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/dom/html/nsGenericHTMLFrameElement.h
+++ b/dom/html/nsGenericHTMLFrameElement.h
@@ -120,12 +120,12 @@ protected:
   bool mFrameLoaderCreationDisallowed;
 
   // This flag is only used by <iframe>. See HTMLIFrameElement::
   // FullscreenFlag() for details. It is placed here so that we
   // do not bloat any struct.
   bool mFullscreenFlag = false;
 
 private:
-  void GetManifestURLByType(nsIAtom *aAppType, nsAString& aOut);
+  void GetManifestURL(nsAString& aOut);
 };
 
 #endif // nsGenericHTMLFrameElement_h
--- a/dom/interfaces/apps/mozIApplication.idl
+++ b/dom/interfaces/apps/mozIApplication.idl
@@ -14,22 +14,16 @@ interface nsIPrincipal;
  * sub-interface.
  */
 [scriptable, uuid(e76aa5e0-80b2-404f-bccc-1067828bb6ed)]
 interface mozIApplication: nsISupports
 {
   /* Return true if this app has |permission|. */
   boolean hasPermission(in string permission);
 
-  /**
-   *  Return true if this app can be a widget and
-   *  its |widgetPages| contains |page|
-   */
-  boolean hasWidgetPage(in DOMString pageURL);
-
   /* Application status as defined in nsIPrincipal. */
   readonly attribute unsigned short appStatus;
 
   /* Returns the uuid of the app. */
   readonly attribute DOMString id;
 
   /* Returns the origin of the app. */
   readonly attribute DOMString origin;
--- a/dom/interfaces/apps/nsIAppsService.idl
+++ b/dom/interfaces/apps/nsIAppsService.idl
@@ -69,30 +69,17 @@ interface nsIAppsService : nsISupports
   /**
    * Returns true if at least one app is in the registry.
    */
   boolean areAnyAppsInstalled();
 
   jsval getAppInfo(in DOMString appId);
 
   /**
-   * Returns a URI to redirect to when we get a redirection to 'uri'.
-   * Returns null if no redirection is declared for this uri.
-   */
-  nsIURI getRedirect(in unsigned long localId, in nsIURI uri);
-
-  /**
    * Returns the localId if the app was installed from a store
    */
   DOMString getAppLocalIdByStoreId(in DOMString storeID);
 
   /**
    * Returns the scope for app to use with service workers.
    */
   DOMString getScopeByLocalId(in unsigned long localId);
-
-  /**
-   * Returns true if this uri is a script or css resource loaded
-   * from an extension.
-   * Available only in the parent process.
-   */
-  bool isExtensionResource(in nsIURI uri);
 };
--- a/dom/interfaces/html/nsIMozBrowserFrame.idl
+++ b/dom/interfaces/html/nsIMozBrowserFrame.idl
@@ -20,51 +20,37 @@ interface nsIMozBrowserFrame : nsIDOMMoz
    * may have to pass various security checks.
    */
   [infallible] readonly attribute boolean reallyIsBrowserOrApp;
 
   /**
    * Gets whether this frame really is an app frame.
    *
    * In order to really be an app frame, this frame must really be a browser
-   * frame (this requirement will go away eventually), and must satisfy one
-   * and only one of the following conditions:
-   * 1. the frame's mozapp attribute must point to the manifest of a valid app
-   * 2. the frame's mozwidget attribute must point to the manifest of a valid
-   * app, and the src should be in the |widgetPages| specified by the manifest.
+   * frame (this requirement will go away eventually), and  the frame's mozapp
+   * attribute must point to the manifest of a valid app.
    */
   [infallible] readonly attribute boolean reallyIsApp;
 
   /**
-   * Gets whether this frame really is a widget frame.
-   *
-   * In order to really be a frame, this frame must really be a browser
-   * frame (this requirement will go away eventually), the frame's mozwidget
-   * attribute must point to the manifest of a valid app, and the src should
-   * be in the |widgetPages| specified by the manifest.
-   */
-  [infallible] readonly attribute boolean reallyIsWidget;
-
-  /**
    * Gets whether this frame is an isolated frame.
    *
    * By default, browser frames are isolated, meaning they have a principal
    * where OriginAttributes.mIsInIsolatedMozBrowser == true.  This isolates
    * storage and other origin related items from non-browser apps, xul:browsers,
    * etc.
    *
    * Isolation can be disabled by setting the frame's isolated attribute to
    * false.  Disabling isolation is only allowed if the containing document has
    * browser permission (or equivalent access).
    */
   [infallible] readonly attribute boolean isolated;
 
   /**
-   * Gets this frame's app manifest URL or widget manifest URL, if the frame
-   * really is an app frame.
+   * Gets this frame's app manifest URL, if the frame really is an app frame.
    * Otherwise, returns the empty string.
    *
    * This method is guaranteed not to fail.
    */
   readonly attribute AString appManifestURL;
 
   /**
    * Normally, a frame tries to create its frame loader when its src is
--- a/dom/ipc/preload.js
+++ b/dom/ipc/preload.js
@@ -100,24 +100,16 @@ var DoPreloadPostfork = function(aCallba
 
   // Register an observer for topic "preload_postfork" after we fork a content
   // process.
   DoPreloadPostfork(function () {
     // Load AppsServiceChild.jsm after fork since it sends an async message to
     // the chrome process in its init() function.
     Cu.import("resource://gre/modules/AppsServiceChild.jsm");
 
-    // Load UserCustomizations.jsm after fork since it sends an async message to
-    // the chrome process in its init() function.
-    try {
-      if (Services.prefs.getBoolPref("dom.apps.customization.enabled")) {
-        Cu.import("resource://gre/modules/UserCustomizations.jsm");
-      }
-    } catch(e) {}
-
     // Load nsIAppsService after fork since its implementation loads
     // AppsServiceChild.jsm
     Cc["@mozilla.org/AppsService;1"].getService(Ci["nsIAppsService"]);
 
     // Load nsICookieService after fork since it sends an IPC constructor
     // message to the chrome process.
     Cc["@mozilla.org/cookieService;1"].getService(Ci["nsICookieService"]);
 
--- a/dom/system/gonk/NetworkManager.js
+++ b/dom/system/gonk/NetworkManager.js
@@ -26,20 +26,16 @@ XPCOMUtils.defineLazyGetter(this, "ppmm"
 XPCOMUtils.defineLazyServiceGetter(this, "gDNSService",
                                    "@mozilla.org/network/dns-service;1",
                                    "nsIDNSService");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gNetworkService",
                                    "@mozilla.org/network/service;1",
                                    "nsINetworkService");
 
-XPCOMUtils.defineLazyServiceGetter(this, "gPACGenerator",
-                                   "@mozilla.org/pac-generator;1",
-                                   "nsIPACGenerator");
-
 XPCOMUtils.defineLazyServiceGetter(this, "gTetheringService",
                                    "@mozilla.org/tethering/service;1",
                                    "nsITetheringService");
 
 const TOPIC_INTERFACE_REGISTERED     = "network-interface-registered";
 const TOPIC_INTERFACE_UNREGISTERED   = "network-interface-unregistered";
 const TOPIC_ACTIVE_CHANGED           = "network-active-changed";
 const TOPIC_PREF_CHANGED             = "nsPref:changed";
@@ -57,18 +53,17 @@ const IPV6_MAX_PREFIX_LENGTH           =
 // Connection Type for Network Information API
 const CONNECTION_TYPE_CELLULAR  = 0;
 const CONNECTION_TYPE_BLUETOOTH = 1;
 const CONNECTION_TYPE_ETHERNET  = 2;
 const CONNECTION_TYPE_WIFI      = 3;
 const CONNECTION_TYPE_OTHER     = 4;
 const CONNECTION_TYPE_NONE      = 5;
 
-const PROXY_TYPE_MANUAL = Ci.nsIProtocolProxyService.PROXYCONFIG_MANUAL;
-const PROXY_TYPE_PAC    = Ci.nsIProtocolProxyService.PROXYCONFIG_PAC;
+const MANUAL_PROXY_CONFIGURATION = 1;
 
 var debug;
 function updateDebug() {
   let debugPref = false; // set default value here.
   try {
     debugPref = debugPref || Services.prefs.getBoolPref(PREF_NETWORK_DEBUG_ENABLED);
   } catch (e) {}
 
@@ -1106,64 +1101,41 @@ NetworkManager.prototype = {
         // Sets direct connection to internet.
         this.clearNetworkProxy();
 
         debug("No proxy support for " + aNetwork.info.name + " network interface.");
         return;
       }
 
       debug("Going to set proxy settings for " + aNetwork.info.name + " network interface.");
+      // Sets manual proxy configuration.
+      Services.prefs.setIntPref("network.proxy.type", MANUAL_PROXY_CONFIGURATION);
 
       // Do not use this proxy server for all protocols.
       Services.prefs.setBoolPref("network.proxy.share_proxy_settings", false);
       Services.prefs.setCharPref("network.proxy.http", aNetwork.httpProxyHost);
       Services.prefs.setCharPref("network.proxy.ssl", aNetwork.httpProxyHost);
       let port = aNetwork.httpProxyPort === 0 ? 8080 : aNetwork.httpProxyPort;
       Services.prefs.setIntPref("network.proxy.http_port", port);
       Services.prefs.setIntPref("network.proxy.ssl_port", port);
-
-      let usePAC;
-      try {
-        usePAC = Services.prefs.getBoolPref("network.proxy.pac_generator");
-      } catch (ex) {}
-
-      if (usePAC) {
-        Services.prefs.setCharPref("network.proxy.autoconfig_url",
-                                   gPACGenerator.generate());
-        Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-      } else {
-        Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_MANUAL);
-      }
     } catch(ex) {
         debug("Exception " + ex + ". Unable to set proxy setting for " +
               aNetwork.info.name + " network interface.");
     }
   },
 
   clearNetworkProxy: function() {
     debug("Going to clear all network proxy.");
 
+    Services.prefs.clearUserPref("network.proxy.type");
     Services.prefs.clearUserPref("network.proxy.share_proxy_settings");
     Services.prefs.clearUserPref("network.proxy.http");
     Services.prefs.clearUserPref("network.proxy.http_port");
     Services.prefs.clearUserPref("network.proxy.ssl");
     Services.prefs.clearUserPref("network.proxy.ssl_port");
-
-    let usePAC;
-    try {
-      usePAC = Services.prefs.getBoolPref("network.proxy.pac_generator");
-    } catch (ex) {}
-
-    if (usePAC) {
-      Services.prefs.setCharPref("network.proxy.autoconfig_url",
-                                 gPACGenerator.generate());
-      Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-    } else {
-      Services.prefs.clearUserPref("network.proxy.type");
-    }
   },
 };
 
 var CaptivePortalDetectionHelper = (function() {
 
   const EVENT_CONNECT = "Connect";
   const EVENT_DISCONNECT = "Disconnect";
   let _ongoingInterface = null;
--- a/dom/system/gonk/tests/marionette/test_data_connection_proxy.js
+++ b/dom/system/gonk/tests/marionette/test_data_connection_proxy.js
@@ -1,18 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = "head.js";
 
 const HTTP_PROXY = "10.0.2.200";
 const HTTP_PROXY_PORT = "8080";
-const PROXY_TYPE_MANUAL = Ci.nsIProtocolProxyService.PROXYCONFIG_MANUAL;
-const PROXY_TYPE_PAC = Ci.nsIProtocolProxyService.PROXYCONFIG_PAC;
+const MANUAL_PROXY_CONFIGURATION = 1;
 
 // Test initial State
 function verifyInitialState() {
   log("= verifyInitialState =");
 
   // Data should be off before starting any test.
   return getSettings(SETTINGS_KEY_DATA_ENABLED)
     .then(value => {
@@ -34,34 +33,30 @@ function setTestApn() {
 }
 
 function waitForHttpProxyVerified(aShouldBeSet) {
   let TIME_OUT_VALUE = 20000;
 
   return new Promise(function(aResolve, aReject) {
     try {
       waitFor(aResolve, () => {
-        let usePAC = SpecialPowers.getBoolPref("network.proxy.pac_generator");
         let proxyType = SpecialPowers.getIntPref("network.proxy.type");
         let httpProxy = SpecialPowers.getCharPref("network.proxy.http");
         let sslProxy = SpecialPowers.getCharPref("network.proxy.ssl");
         let httpProxyPort = SpecialPowers.getIntPref("network.proxy.http_port");
         let sslProxyPort = SpecialPowers.getIntPref("network.proxy.ssl_port");
 
         if ((aShouldBeSet &&
-             (usePAC ? proxyType == PROXY_TYPE_PAC :
-                       proxyType == PROXY_TYPE_MANUAL) &&
+             proxyType == MANUAL_PROXY_CONFIGURATION &&
              httpProxy == HTTP_PROXY &&
              sslProxy == HTTP_PROXY &&
              httpProxyPort == HTTP_PROXY_PORT &&
              sslProxyPort == HTTP_PROXY_PORT) ||
-             (!aShouldBeSet &&
-              (usePAC ? proxyType == PROXY_TYPE_PAC :
-                        proxyType != PROXY_TYPE_MANUAL) &&
-              !httpProxy && !sslProxy && !httpProxyPort && !sslProxyPort)) {
+            (!aShouldBeSet && proxyType != MANUAL_PROXY_CONFIGURATION &&
+             !httpProxy && !sslProxy && !httpProxyPort && !sslProxyPort)) {
           return true;
         }
 
         return false;
       }, TIME_OUT_VALUE);
     } catch(aError) {
       // Timed out.
       aReject(aError);
--- a/js/src/vm/EnvironmentObject.cpp
+++ b/js/src/vm/EnvironmentObject.cpp
@@ -2870,16 +2870,17 @@ GetDebugEnvironmentForMissing(JSContext*
      * maintained via DebugEnvironments hooks.
      */
     Rooted<DebugEnvironmentProxy*> debugEnv(cx);
     if (ei.scope().is<FunctionScope>()) {
         RootedFunction callee(cx, ei.scope().as<FunctionScope>().canonicalFunction());
         // Generators should always reify their scopes.
         MOZ_ASSERT(!callee->isGenerator());
 
+        JS::ExposeObjectToActiveJS(callee);
         Rooted<CallObject*> callobj(cx, CallObject::createHollowForDebug(cx, callee));
         if (!callobj)
             return nullptr;
 
         debugEnv = DebugEnvironmentProxy::create(cx, *callobj, enclosingDebug);
     } else if (ei.scope().is<LexicalScope>()) {
         Rooted<LexicalScope*> lexicalScope(cx, &ei.scope().as<LexicalScope>());
         Rooted<LexicalEnvironmentObject*> env(cx,
--- a/mobile/android/chrome/content/geckoview.xul
+++ b/mobile/android/chrome/content/geckoview.xul
@@ -1,14 +1,16 @@
 <?xml version="1.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/. -->
 
+<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
+
 <window id="main-window"
         onload="startup();"
         windowtype="navigator:browser"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-  <browser id="content" type="content-targetable" src="https://mozilla.com" flex="1"/>
+  <browser id="content" type="content-primary" src="https://mozilla.com" flex="1" remote="true"/>
 
   <script type="application/javascript" src="chrome://browser/content/geckoview.js"/>
 </window>
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -409,19 +409,16 @@
 @BINPATH@/components/PresentationControlService.js
 @BINPATH@/components/PresentationNetworkHelper.js
 @BINPATH@/components/PresentationNetworkHelper.manifest
 @BINPATH@/components/PresentationDataChannelSessionTransport.js
 @BINPATH@/components/PresentationDataChannelSessionTransport.manifest
 @BINPATH@/components/LegacyProviders.manifest
 @BINPATH@/components/LegacyPresentationControlService.js
 
-@BINPATH@/components/PACGenerator.js
-@BINPATH@/components/PACGenerator.manifest
-
 @BINPATH@/components/TVSimulatorService.js
 @BINPATH@/components/TVSimulatorService.manifest
 
 ; Modules
 @BINPATH@/modules/*
 
 ; Safe Browsing
 @BINPATH@/components/nsURLClassifier.manifest
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -960,17 +960,17 @@ pref("devtools.debugger.remote-port", 60
 pref("devtools.debugger.remote-websocket", false);
 // Force debugger server binding on the loopback interface
 pref("devtools.debugger.force-local", true);
 // Display a prompt when a new connection starts to accept/reject it
 pref("devtools.debugger.prompt-connection", true);
 // Block tools from seeing / interacting with certified apps
 pref("devtools.debugger.forbid-certified-apps", true);
 // List of permissions that a sideloaded app can't ask for
-pref("devtools.apps.forbidden-permissions", "embed-apps,embed-widgets");
+pref("devtools.apps.forbidden-permissions", "embed-apps");
 
 // DevTools default color unit
 pref("devtools.defaultColorUnit", "authored");
 
 // Used for devtools debugging
 pref("devtools.dump.emit", false);
 
 // Disable device discovery logging
deleted file mode 100644
--- a/netwerk/base/PACGenerator.js
+++ /dev/null
@@ -1,165 +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 {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-
-var DEBUG = false;
-
-if (DEBUG) {
-  debug = function (s) { dump("-*- PACGenerator: " + s + "\n"); };
-}
-else {
-  debug = function (s) {};
-}
-
-const PACGENERATOR_CONTRACTID = "@mozilla.org/pac-generator;1";
-const PACGENERATOR_CID = Components.ID("{788507c4-eb5f-4de8-b19b-e0d531974e8a}");
-
-//
-// RFC 2396 section 3.2.2:
-//
-// host = hostname | IPv4address
-// hostname = *( domainlabel "." ) toplabel [ "." ]
-// domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
-// toplabel = alpha | alpha *( alphanum | "-" ) alphanum
-// IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
-//
-const HOST_REGEX =
-  new RegExp("^(?:" +
-               // *( domainlabel "." )
-               "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)*" +
-               // toplabel
-               "[a-z](?:[a-z0-9-]*[a-z0-9])?" +
-             "|" +
-               // IPv4 address
-               "\\d+\\.\\d+\\.\\d+\\.\\d+" +
-             ")$",
-             "i");
-
-function PACGenerator() {
-  debug("Starting PAC Generator service.");
-}
-
-PACGenerator.prototype = {
-
-  classID : PACGENERATOR_CID,
-
-  QueryInterface : XPCOMUtils.generateQI([Ci.nsIPACGenerator]),
-
-  classInfo : XPCOMUtils.generateCI({classID: PACGENERATOR_CID,
-                                     contractID: PACGENERATOR_CONTRACTID,
-                                     classDescription: "PACGenerator",
-                                     interfaces: [Ci.nsIPACGenerator]}),
-
-  /**
-   * Validate the the host.
-   */
-  isValidHost: function isValidHost(host) {
-    if (!HOST_REGEX.test(host)) {
-      debug("Unexpected host: '" + host + "'");
-      return false;
-    }
-    return true;
-  },
-
-  /**
-   * Returns a PAC string based on proxy settings in the preference.
-   * Only effective when the network.proxy.pac_generator preference is true.
-   */
-  generate: function generate() {
-    let enabled, host, port, proxy;
-
-    try {
-      enabled = Services.prefs.getBoolPref("network.proxy.pac_generator");
-    } catch (ex) {}
-    if (!enabled) {
-      debug("PAC Generator disabled.");
-      return "";
-    }
-
-    let pac = "data:text/plain,function FindProxyForURL(url, host) { ";
-
-    // Direct connection for localhost.
-    pac += "if (shExpMatch(host, 'localhost') || " +
-           "shExpMatch(host, '127.0.0.1')) {" +
-           " return 'DIRECT'; } ";
-
-    // Rules for browsing proxy.
-    try {
-      enabled = Services.prefs.getBoolPref("network.proxy.browsing.enabled");
-      host = Services.prefs.getCharPref("network.proxy.browsing.host");
-      port = Services.prefs.getIntPref("network.proxy.browsing.port");
-    } catch (ex) {}
-
-    if (enabled && host && this.isValidHost(host)) {
-      proxy = host + ":" + ((port && port !== 0) ? port : 8080);
-      let appOrigins;
-      try {
-        appOrigins = Services.prefs.getCharPref("network.proxy.browsing.app_origins");
-      } catch (ex) {}
-
-      pac += "var origins ='" + appOrigins +
-             "'.split(/[ ,]+/).filter(Boolean); " +
-             "if ((origins.indexOf('*') > -1 || origins.indexOf(myAppOrigin()) > -1)" +
-             " && isInIsolatedMozBrowser()) { return 'PROXY " + proxy + "'; } ";
-    }
-
-    // Rules for system proxy.
-    let share;
-    try {
-      share = Services.prefs.getBoolPref("network.proxy.share_proxy_settings");
-    } catch (ex) {}
-
-    if (share) {
-      // Add rules for all protocols.
-      try {
-        host = Services.prefs.getCharPref("network.proxy.http");
-        port = Services.prefs.getIntPref("network.proxy.http_port");
-      } catch (ex) {}
-
-      if (host && this.isValidHost(host)) {
-        proxy = host + ":" + ((port && port !== 0) ? port : 8080);
-        pac += "return 'PROXY " + proxy + "'; "
-      } else {
-        pac += "return 'DIRECT'; ";
-      }
-    } else {
-      // Add rules for specific protocols.
-      const proxyTypes = [
-        {"scheme": "http:", "pref": "http"},
-        {"scheme": "https:", "pref": "ssl"},
-        {"scheme": "ftp:", "pref": "ftp"}
-      ];
-      for (let i = 0; i < proxyTypes.length; i++) {
-       try {
-          host = Services.prefs.getCharPref("network.proxy." +
-                                            proxyTypes[i]["pref"]);
-          port = Services.prefs.getIntPref("network.proxy." +
-                                            proxyTypes[i]["pref"] + "_port");
-        } catch (ex) {}
-
-        if (host && this.isValidHost(host)) {
-          proxy = host + ":" + (port === 0 ? 8080 : port);
-          pac += "if (url.substring(0, " + (proxyTypes[i]["scheme"]).length +
-                 ") == '" + proxyTypes[i]["scheme"] + "') { return 'PROXY " +
-                 proxy + "'; } ";
-         }
-      }
-      pac += "return 'DIRECT'; ";
-    }
-
-    pac += "}";
-
-    debug("PAC: " + pac);
-
-    return pac;
-  }
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PACGenerator]);
deleted file mode 100644
--- a/netwerk/base/PACGenerator.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {788507c4-eb5f-4de8-b19b-e0d531974e8a} PACGenerator.js
-contract @mozilla.org/pac-generator;1 {788507c4-eb5f-4de8-b19b-e0d531974e8a}
--- a/netwerk/base/ProxyAutoConfig.cpp
+++ b/netwerk/base/ProxyAutoConfig.cpp
@@ -502,74 +502,16 @@ bool PACMyIpAddress(JSContext *cx, unsig
   if (!GetRunning()) {
     NS_WARNING("PAC myIPAddress without a running ProxyAutoConfig object");
     return false;
   }
 
   return GetRunning()->MyIPAddress(args);
 }
 
-// myAppId() javascript implementation
-static
-bool PACMyAppId(JSContext *cx, unsigned int argc, JS::Value *vp)
-{
-  JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
-
-  if (NS_IsMainThread()) {
-    NS_WARNING("PACMyAppId on Main Thread. How did that happen?");
-    return false;
-  }
-
-  if (!GetRunning()) {
-    NS_WARNING("PACMyAppId without a running ProxyAutoConfig object");
-    return false;
-  }
-
-  return GetRunning()->MyAppId(args);
-}
-
-// myAppOrigin() javascript implementation
-static
-bool PACMyAppOrigin(JSContext *cx, unsigned int argc, JS::Value *vp)
-{
-  JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
-
-  if (NS_IsMainThread()) {
-    NS_WARNING("PACMyAppOrigin on Main Thread. How did that happen?");
-    return false;
-  }
-
-  if (!GetRunning()) {
-    NS_WARNING("PACMyAppOrigin without a running ProxyAutoConfig object");
-    return false;
-  }
-
-  return GetRunning()->MyAppOrigin(args);
-}
-
-// IsInIsolatedMozBrowser() javascript implementation
-static
-bool PACIsInIsolatedMozBrowser(JSContext *cx, unsigned int argc, JS::Value *vp)
-{
-  JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
-
-  if (NS_IsMainThread()) {
-    NS_WARNING("PACIsInIsolatedMozBrowser on Main Thread. How did that happen?");
-    return false;
-  }
-
-  if (!GetRunning()) {
-    NS_WARNING("PACIsInIsolatedMozBrowser without a running ProxyAutoConfig"
-               "object");
-    return false;
-  }
-
-  return GetRunning()->IsInIsolatedMozBrowser(args);
-}
-
 // proxyAlert(msg) javascript implementation
 static
 bool PACProxyAlert(JSContext *cx, unsigned int argc, JS::Value *vp)
 {
   JS::CallArgs args = CallArgsFromVp(argc, vp);
 
   if (!args.requireAtLeast(cx, "alert", 1))
     return false;
@@ -593,19 +535,16 @@ bool PACProxyAlert(JSContext *cx, unsign
 }
 
 static const JSFunctionSpec PACGlobalFunctions[] = {
   JS_FS("dnsResolve", PACDnsResolve, 1, 0),
 
   // a global "var pacUseMultihomedDNS = true;" will change behavior
   // of myIpAddress to actively use DNS
   JS_FS("myIpAddress", PACMyIpAddress, 0, 0),
-  JS_FS("myAppId", PACMyAppId, 0, 0),
-  JS_FS("myAppOrigin", PACMyAppOrigin, 0, 0),
-  JS_FS("isInIsolatedMozBrowser", PACIsInIsolatedMozBrowser, 0, 0),
   JS_FS("alert", PACProxyAlert, 1, 0),
   JS_FS_END
 };
 
 // JSContextWrapper is a c++ object that manages the context for the JS engine
 // used on the PAC thread. It is initialized and destroyed on the PAC thread.
 class JSContextWrapper
 {
@@ -814,19 +753,16 @@ ProxyAutoConfig::SetupJS()
   mPACURI.Truncate();
 
   return NS_OK;
 }
 
 nsresult
 ProxyAutoConfig::GetProxyForURI(const nsCString &aTestURI,
                                 const nsCString &aTestHost,
-                                uint32_t aAppId,
-                                const nsString &aAppOrigin,
-                                bool aIsInIsolatedMozBrowser,
                                 nsACString &result)
 {
   if (mJSNeedsSetup)
     SetupJS();
 
   if (!mJSContext || !mJSContext->IsOK())
     return NS_ERROR_NOT_AVAILABLE;
 
@@ -834,19 +770,16 @@ ProxyAutoConfig::GetProxyForURI(const ns
   JSAutoRequest ar(cx);
   JSAutoCompartment ac(cx, mJSContext->Global());
   AutoPACErrorReporter aper(cx);
 
   // the sRunning flag keeps a new PAC file from being installed
   // while the event loop is spinning on a DNS function. Don't early return.
   SetRunning(this);
   mRunningHost = aTestHost;
-  mRunningAppId = aAppId;
-  mRunningAppOrigin = aAppOrigin;
-  mRunningIsInIsolatedMozBrowser = aIsInIsolatedMozBrowser;
 
   nsresult rv = NS_ERROR_FAILURE;
   nsCString clensedURI = aTestURI;
 
   if (!mIncludePath) {
     nsCOMPtr<nsIURLParser> urlParser =
       do_GetService(NS_STDURLPARSER_CONTRACTID);
     int32_t pathLen = 0;
@@ -1072,38 +1005,10 @@ ProxyAutoConfig::MyIPAddress(const JS::C
   if (!dottedDecimalString) {
     return false;
   }
 
   aArgs.rval().setString(dottedDecimalString);
   return true;
 }
 
-bool
-ProxyAutoConfig::MyAppId(const JS::CallArgs &aArgs)
-{
-  aArgs.rval().setNumber(mRunningAppId);
-  return true;
-}
-
-bool
-ProxyAutoConfig::MyAppOrigin(const JS::CallArgs &aArgs)
-{
-  JSContext *cx = mJSContext->Context();
-  JSString *origin =
-    JS_NewStringCopyZ(cx, NS_ConvertUTF16toUTF8(mRunningAppOrigin).get());
-  if (!origin) {
-    return false;
-  }
-
-  aArgs.rval().setString(origin);
-  return true;
-}
-
-bool
-ProxyAutoConfig::IsInIsolatedMozBrowser(const JS::CallArgs &aArgs)
-{
-  aArgs.rval().setBoolean(mRunningIsInIsolatedMozBrowser);
-  return true;
-}
-
 } // namespace net
 } // namespace mozilla
--- a/netwerk/base/ProxyAutoConfig.h
+++ b/netwerk/base/ProxyAutoConfig.h
@@ -31,19 +31,16 @@ public:
 
   nsresult Init(const nsCString &aPACURI,
                 const nsCString &aPACScript,
                 bool aIncludePath);
   void     SetThreadLocalIndex(uint32_t index);
   void     Shutdown();
   void     GC();
   bool     MyIPAddress(const JS::CallArgs &aArgs);
-  bool     MyAppId(const JS::CallArgs &aArgs);
-  bool     MyAppOrigin(const JS::CallArgs &aArgs);
-  bool     IsInIsolatedMozBrowser(const JS::CallArgs &aArgs);
   bool     ResolveAddress(const nsCString &aHostName,
                           NetAddr *aNetAddr, unsigned int aTimeout);
 
   /**
    * Get the proxy string for the specified URI.  The proxy string is
    * given by the following:
    *
    *   result      = proxy-spec *( proxy-sep proxy-spec )
@@ -67,35 +64,22 @@ public:
    *
    * XXX add support for IPv6 address literals.
    * XXX quote whatever the official standard is for PAC.
    *
    * @param aTestURI
    *        The URI as an ASCII string to test.
    * @param aTestHost
    *        The ASCII hostname to test.
-   * @param aAppId
-   *        The id of the app requesting connection.
-   * @param aAppOrigin
-   *        The origin of the app requesting connection.
-   * @param aIsInIsolatedMozBrowser
-   *        True if the frame is an isolated mozbrowser element. <iframe
-   *        mozbrowser mozapp> and <xul:browser> are not considered to be
-   *        mozbrowser elements.  <iframe mozbrowser noisolation> does not count
-   *        as isolated since isolation is disabled.  Isolation can only be
-   *        disabled if the containing document is chrome.
    *
    * @param result
    *        result string as defined above.
    */
   nsresult GetProxyForURI(const nsCString &aTestURI,
                           const nsCString &aTestHost,
-                          uint32_t aAppId,
-                          const nsString &aAppOrigin,
-                          bool aIsInIsolatedMozBrowser,
                           nsACString &result);
 
 private:
   // allow 665ms for myipaddress dns queries. That's 95th percentile.
   const static unsigned int kTimeout = 665;
 
   // used to compile the PAC file and setup the execution context
   nsresult SetupJS();
@@ -106,18 +90,15 @@ private:
 
   JSContextWrapper *mJSContext;
   bool              mJSNeedsSetup;
   bool              mShutdown;
   nsCString         mPACScript;
   nsCString         mPACURI;
   bool              mIncludePath;
   nsCString         mRunningHost;
-  uint32_t          mRunningAppId;
-  nsString          mRunningAppOrigin;
-  bool              mRunningIsInIsolatedMozBrowser;
   nsCOMPtr<nsITimer> mTimer;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif  // ProxyAutoConfig_h__
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -68,17 +68,16 @@ XPIDL_SOURCES += [
     'nsINetworkInfoService.idl',
     'nsINetworkInterceptController.idl',
     'nsINetworkLinkService.idl',
     'nsINetworkPredictor.idl',
     'nsINetworkPredictorVerifier.idl',
     'nsINetworkProperties.idl',
     'nsINSSErrorsService.idl',
     'nsINullChannel.idl',
-    'nsIPACGenerator.idl',
     'nsIPackagedAppService.idl',
     'nsIPackagedAppUtils.idl',
     'nsIPackagedAppVerifier.idl',
     'nsIParentChannel.idl',
     'nsIParentRedirectingChannel.idl',
     'nsIPermission.idl',
     'nsIPermissionManager.idl',
     'nsIPrivateBrowsingChannel.idl',
@@ -289,21 +288,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
         'nsNetworkInfoService.cpp',
     ]
 elif CONFIG['OS_ARCH'] == 'Linux':
     SOURCES += [
         'NetworkInfoServiceLinux.cpp',
         'nsNetworkInfoService.cpp',
     ]
 
-EXTRA_COMPONENTS += [
-    'PACGenerator.js',
-    'PACGenerator.manifest'
-]
-
 EXTRA_JS_MODULES += [
     'NetUtil.jsm',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
deleted file mode 100644
--- a/netwerk/base/nsIPACGenerator.idl
+++ /dev/null
@@ -1,15 +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/. */
-
-#include "nsISupports.idl"
-
-[scriptable, uuid(4b3eeeea-1108-4aa0-8f26-e3ebdeb0454c)]
-interface nsIPACGenerator : nsISupports
-{
-  /**
-   * Returns a PAC string based on proxy settings in the preference.
-   * Only effective when the network.proxy.pac_generator preference is true.
-   */
-  DOMString generate();
-};
--- a/netwerk/base/nsPACMan.cpp
+++ b/netwerk/base/nsPACMan.cpp
@@ -1,17 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
 #include "nsPACMan.h"
-#include "mozIApplication.h"
-#include "nsIAppsService.h"
 #include "nsThreadUtils.h"
 #include "nsIAuthPrompt.h"
 #include "nsIPromptFactory.h"
 #include "nsIHttpChannel.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsNetUtil.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
@@ -229,41 +227,26 @@ private:
   bool                 mSetupPAC;
   nsCString            mSetupPACData;
   nsCString            mSetupPACURI;
 };
 
 //-----------------------------------------------------------------------------
 
 PendingPACQuery::PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
-                                 uint32_t appId, bool isInIsolatedMozBrowser,
                                  nsPACManCallback *callback,
                                  bool mainThreadResponse)
   : mPACMan(pacMan)
-  , mAppId(appId)
-  , mIsInIsolatedMozBrowser(isInIsolatedMozBrowser)
   , mCallback(callback)
   , mOnMainThreadOnly(mainThreadResponse)
 {
   uri->GetAsciiSpec(mSpec);
   uri->GetAsciiHost(mHost);
   uri->GetScheme(mScheme);
   uri->GetPort(&mPort);
-
-  nsCOMPtr<nsIAppsService> appsService =
-      do_GetService(APPS_SERVICE_CONTRACTID);
-  if (!appsService) {
-    return;
-  }
-  nsCOMPtr<mozIApplication> mozApp;
-  nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(mozApp));
-  if (NS_FAILED(rv) || !mozApp) {
-      return;
-  }
-  mozApp->GetOrigin(mAppOrigin);
 }
 
 void
 PendingPACQuery::Complete(nsresult status, const nsCString &pacString)
 {
   if (!mCallback)
     return;
   RefPtr<ExecuteCallback> runnable = new ExecuteCallback(mCallback, status);
@@ -346,36 +329,34 @@ nsPACMan::Shutdown()
   CancelExistingLoad();
   PostCancelPendingQ(NS_ERROR_ABORT);
 
   RefPtr<WaitForThreadShutdown> runnable = new WaitForThreadShutdown(this);
   NS_DispatchToMainThread(runnable);
 }
 
 nsresult
-nsPACMan::AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
-                              bool isInIsolatedMozBrowser,
+nsPACMan::AsyncGetProxyForURI(nsIURI *uri,
                               nsPACManCallback *callback,
                               bool mainThreadResponse)
 {
   MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
   if (mShutdown)
     return NS_ERROR_NOT_AVAILABLE;
 
   // Maybe Reload PAC
   if (!mPACURISpec.IsEmpty() && !mScheduledReload.IsNull() &&
       TimeStamp::Now() > mScheduledReload) {
     LOG(("nsPACMan::AsyncGetProxyForURI reload as scheduled\n"));
 
     LoadPACFromURI(EmptyCString());
   }
 
   RefPtr<PendingPACQuery> query =
-    new PendingPACQuery(this, uri, appId, isInIsolatedMozBrowser, callback,
-                        mainThreadResponse);
+    new PendingPACQuery(this, uri, callback, mainThreadResponse);
 
   if (IsPACURI(uri)) {
     // deal with this directly instead of queueing it
     query->Complete(NS_OK, EmptyCString());
     return NS_OK;
   }
 
   return mPACThread->Dispatch(query, nsIEventTarget::DISPATCH_NORMAL);
@@ -624,18 +605,16 @@ nsPACMan::ProcessPending()
     LOG(("Use proxy from system settings: %s\n", pacString.get()));
     query->Complete(NS_OK, pacString);
     completed = true;
   }
 
   // the systemproxysettings didn't complete the resolution. try via PAC
   if (!completed) {
     nsresult status = mPAC.GetProxyForURI(query->mSpec, query->mHost,
-                                          query->mAppId, query->mAppOrigin,
-                                          query->mIsInIsolatedMozBrowser,
                                           pacString);
     LOG(("Use proxy from PAC: %s\n", pacString.get()));
     query->Complete(status, pacString);
   }
 
   mInProgress = false;
   return true;
 }
--- a/netwerk/base/nsPACMan.h
+++ b/netwerk/base/nsPACMan.h
@@ -54,39 +54,34 @@ public:
                                const nsCString &pacString,
                                const nsCString &newPACURL) = 0;
 };
 
 class PendingPACQuery final : public Runnable,
                               public LinkedListElement<PendingPACQuery>
 {
 public:
-  PendingPACQuery(nsPACMan *pacMan, nsIURI *uri, uint32_t appId,
-                  bool isInIsolatedMozBrowser, nsPACManCallback *callback,
+  PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
+                  nsPACManCallback *callback,
                   bool mainThreadResponse);
 
   // can be called from either thread
   void Complete(nsresult status, const nsCString &pacString);
   void UseAlternatePACFile(const nsCString &pacURL);
 
   nsCString                  mSpec;
   nsCString                  mScheme;
   nsCString                  mHost;
   int32_t                    mPort;
 
   NS_IMETHOD Run(void);     /* Runnable */
 
 private:
   nsPACMan                  *mPACMan;  // weak reference
 
-public:
-  uint32_t                   mAppId;
-  bool                       mIsInIsolatedMozBrowser;
-  nsString                   mAppOrigin;
-
 private:
   RefPtr<nsPACManCallback> mCallback;
   bool                       mOnMainThreadOnly;
 };
 
 /**
  * This class provides an abstraction layer above the PAC thread.  The methods
  * defined on this class are intended to be called on the main thread only.
@@ -111,27 +106,22 @@ public:
   /**
    * This method queries a PAC result asynchronously.  The callback runs on the
    * calling thread.  If the PAC file has not yet been loaded, then this method
    * will queue up the request, and complete it once the PAC file has been
    * loaded.
    *
    * @param uri
    *        The URI to query.
-   * @param appId
-   *        The appId of the app making the connection.
-   * @param isInBrowser
-   *        True if the iframe has mozbrowser but has no mozapp attribute.
    * @param callback
    *        The callback to run once the PAC result is available.
    * @param mustCallbackOnMainThread
    *        If set to false the callback can be made from the PAC thread
    */
-  nsresult AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
-                               bool isInBrowser,
+  nsresult AsyncGetProxyForURI(nsIURI *uri,
                                nsPACManCallback *callback,
                                bool mustCallbackOnMainThread);
 
   /**
    * This method may be called to reload the PAC file.  While we are loading
    * the PAC file, any asynchronous PAC queries will be queued up to be
    * processed once the PAC file finishes loading.
    *
--- a/netwerk/base/nsProtocolProxyService.cpp
+++ b/netwerk/base/nsProtocolProxyService.cpp
@@ -98,27 +98,24 @@ GetProxyURI(nsIChannel *channel, nsIURI 
 class nsAsyncResolveRequest final : public nsIRunnable
                                   , public nsPACManCallback
                                   , public nsICancelable
 {
 public:
     NS_DECL_THREADSAFE_ISUPPORTS
 
     nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIChannel *channel,
-                          uint32_t aAppId, bool aIsInIsolatedMozBrowser,
                           uint32_t aResolveFlags,
                           nsIProtocolProxyCallback *callback)
         : mStatus(NS_OK)
         , mDispatched(false)
         , mResolveFlags(aResolveFlags)
         , mPPS(pps)
         , mXPComPPS(pps)
         , mChannel(channel)
-        , mAppId(aAppId)
-        , mIsInIsolatedMozBrowser(aIsInIsolatedMozBrowser)
         , mCallback(callback)
     {
         NS_ASSERTION(mCallback, "null callback");
     }
 
 private:
     ~nsAsyncResolveRequest()
     {
@@ -256,21 +253,19 @@ private:
             nsCOMPtr<nsIURI> proxyURI;
             GetProxyURI(mChannel, getter_AddRefs(proxyURI));
 
             // trigger load of new pac url
             nsresult rv = mPPS->ConfigureFromPAC(mPACURL, false);
             if (NS_SUCCEEDED(rv)) {
                 // now that the load is triggered, we can resubmit the query
                 RefPtr<nsAsyncResolveRequest> newRequest =
-                    new nsAsyncResolveRequest(mPPS, mChannel, mAppId,
-                                              mIsInIsolatedMozBrowser, mResolveFlags,
+                    new nsAsyncResolveRequest(mPPS, mChannel, mResolveFlags,
                                               mCallback);
-                rv = mPPS->mPACMan->AsyncGetProxyForURI(proxyURI, mAppId,
-                                                        mIsInIsolatedMozBrowser,
+                rv = mPPS->mPACMan->AsyncGetProxyForURI(proxyURI,
                                                         newRequest,
                                                         true);
             }
 
             if (NS_FAILED(rv))
                 mCallback->OnProxyAvailable(this, mChannel, nullptr, rv);
 
             // do not call onproxyavailable() in SUCCESS case - the newRequest will
@@ -299,18 +294,16 @@ private:
     nsCString mPACString;
     nsCString mPACURL;
     bool      mDispatched;
     uint32_t  mResolveFlags;
 
     nsProtocolProxyService            *mPPS;
     nsCOMPtr<nsIProtocolProxyService>  mXPComPPS;
     nsCOMPtr<nsIChannel>               mChannel;
-    uint32_t                           mAppId;
-    bool                               mIsInIsolatedMozBrowser;
     nsCOMPtr<nsIProtocolProxyCallback> mCallback;
     nsCOMPtr<nsIProxyInfo>             mProxyInfo;
 };
 
 NS_IMPL_ISUPPORTS(nsAsyncResolveRequest, nsICancelable, nsIRunnable)
 
 //----------------------------------------------------------------------------
 
@@ -1202,33 +1195,32 @@ nsProtocolProxyService::DeprecatedBlocki
 
     nsCOMPtr<nsIProxyInfo> pi;
     bool usePACThread;
 
     // SystemProxySettings and PAC files can block the main thread
     // but if neither of them are in use, we can just do the work
     // right here and directly invoke the callback
 
-    rv = Resolve_Internal(aChannel, NECKO_NO_APP_ID, false, info, aFlags,
+    rv = Resolve_Internal(aChannel, info, aFlags,
                           &usePACThread, getter_AddRefs(pi));
     if (NS_FAILED(rv))
         return rv;
 
     if (!usePACThread || !mPACMan) {
         ApplyFilters(aChannel, info, pi);
         pi.forget(retval);
         return NS_OK;
     }
 
     // Use the PAC thread to do the work, so we don't have to reimplement that
     // code, but block this thread on that completion.
     RefPtr<nsAsyncBridgeRequest> ctx = new nsAsyncBridgeRequest();
     ctx->Lock();
-    if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForURI(uri, NECKO_NO_APP_ID, false,
-                                                  ctx, false))) {
+    if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForURI(uri, ctx, false))) {
         // this can really block the main thread, so cap it at 3 seconds
        ctx->Wait();
     }
     ctx->Unlock();
     if (!ctx->mCompleted)
         return NS_ERROR_FAILURE;
     if (NS_FAILED(ctx->mStatus))
         return ctx->mStatus;
@@ -1270,38 +1262,33 @@ nsProtocolProxyService::AsyncResolveInte
 {
     NS_ENSURE_ARG_POINTER(channel);
     NS_ENSURE_ARG_POINTER(callback);
 
     nsCOMPtr<nsIURI> uri;
     nsresult rv = GetProxyURI(channel, getter_AddRefs(uri));
     if (NS_FAILED(rv)) return rv;
 
-    uint32_t appId = NECKO_NO_APP_ID;
-    bool isInIsolatedMozBrowser = false;
-    NS_GetAppInfo(channel, &appId, &isInIsolatedMozBrowser);
-
     *result = nullptr;
     RefPtr<nsAsyncResolveRequest> ctx =
-        new nsAsyncResolveRequest(this, channel, appId, isInIsolatedMozBrowser,
-                                  flags, callback);
+        new nsAsyncResolveRequest(this, channel, flags, callback);
 
     nsProtocolInfo info;
     rv = GetProtocolInfo(uri, &info);
     if (NS_FAILED(rv))
         return rv;
 
     nsCOMPtr<nsIProxyInfo> pi;
     bool usePACThread;
 
     // SystemProxySettings and PAC files can block the main thread
     // but if neither of them are in use, we can just do the work
     // right here and directly invoke the callback
 
-    rv = Resolve_Internal(channel, appId, isInIsolatedMozBrowser, info, flags,
+    rv = Resolve_Internal(channel, info, flags,
                           &usePACThread, getter_AddRefs(pi));
     if (NS_FAILED(rv))
         return rv;
 
     if (!usePACThread || !mPACMan) {
         // we can do it locally
         ApplyFilters(channel, info, pi);
         ctx->SetResult(NS_OK, pi);
@@ -1313,18 +1300,17 @@ nsProtocolProxyService::AsyncResolveInte
         rv = ctx->DispatchCallback();
         if (NS_SUCCEEDED(rv))
             ctx.forget(result);
         return rv;
     }
 
     // else kick off a PAC thread query
 
-    rv = mPACMan->AsyncGetProxyForURI(uri, appId, isInIsolatedMozBrowser, ctx,
-                                      true);
+    rv = mPACMan->AsyncGetProxyForURI(uri, ctx, true);
     if (NS_SUCCEEDED(rv))
         ctx.forget(result);
     return rv;
 }
 
 // nsIProtocolProxyService
 NS_IMETHODIMP
 nsProtocolProxyService::AsyncResolve2(nsIChannel *channel, uint32_t flags,
@@ -1765,18 +1751,16 @@ nsProtocolProxyService::NewProxyInfo_Int
     failover.swap(proxyInfo->mNext);
 
     NS_ADDREF(*aResult = proxyInfo);
     return NS_OK;
 }
 
 nsresult
 nsProtocolProxyService::Resolve_Internal(nsIChannel *channel,
-                                         uint32_t appId,
-                                         bool isInBrowser,
                                          const nsProtocolInfo &info,
                                          uint32_t flags,
                                          bool *usePACThread,
                                          nsIProxyInfo **result)
 {
     NS_ENSURE_ARG_POINTER(channel);
     nsresult rv = SetupPACThread();
     if (NS_FAILED(rv))
--- a/netwerk/base/nsProtocolProxyService.h
+++ b/netwerk/base/nsProtocolProxyService.h
@@ -210,33 +210,27 @@ protected:
     /**
      * This method is an internal version of Resolve that does not query PAC.
      * It performs all of the built-in processing, and reports back to the
      * caller with either the proxy info result or a flag to instruct the
      * caller to use PAC instead.
      *
      * @param channel
      *        The channel to test.
-     * @param appId
-     *        The id of the app making the query.
-     * @param isInBrowser
-     *        True if the iframe has mozbrowser but has no mozapp attribute.
      * @param info
      *        Information about the URI's protocol.
      * @param flags
      *        The flags passed to either the resolve or the asyncResolve method.
      * @param usePAC
      *        If this flag is set upon return, then PAC should be queried to
      *        resolve the proxy info.
      * @param result
      *        The resulting proxy info or null.
      */
     nsresult Resolve_Internal(nsIChannel *channel,
-                              uint32_t appId,
-                              bool isInBrowser,
                               const nsProtocolInfo &info,
                               uint32_t flags,
                               bool *usePAC,
                               nsIProxyInfo **result);
 
     /**
      * This method applies the registered filters to the given proxy info
      * list, and returns a possibly modified list.
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -642,27 +642,17 @@ NeckoParent::AllocPRemoteOpenFileParent(
         if (NS_FAILED(rv)) {
           break;
         }
         haveValidBrowser = true;
         break;
       }
     }
 
-    nsCOMPtr<nsIURI> appUri = DeserializeURI(aAppURI);
-
     if (!haveValidBrowser) {
-      // Extension loads come from chrome and have no valid browser, so we check
-      // for these early on.
-      bool fromExtension = false;
-      if (NS_SUCCEEDED(appsService->IsExtensionResource(appUri, &fromExtension)) &&
-          fromExtension) {
-        RemoteOpenFileParent* parent = new RemoteOpenFileParent(fileURL);
-        return parent;
-      }
       return nullptr;
     }
   }
 
   RemoteOpenFileParent* parent = new RemoteOpenFileParent(fileURL);
   return parent;
 }
 
--- a/netwerk/test/moz.build
+++ b/netwerk/test/moz.build
@@ -6,17 +6,16 @@
 
 TEST_DIRS += ['httpserver', 'gtest']
 
 BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
 MOCHITEST_MANIFESTS += ['mochitests/mochitest.ini']
 
 XPCSHELL_TESTS_MANIFESTS += [
     'unit/xpcshell.ini',
-    'unit/xpcshell_b2g.ini',
     'unit_ipc/xpcshell.ini',
 ]
 
 GeckoSimplePrograms([
     'PropertiesTest',
     'ReadNTLM',
     'TestBlockingSocket',
     'TestDNS',
deleted file mode 100644
--- a/netwerk/test/unit/test_pac_generator.js
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-
-var ios = Cc["@mozilla.org/network/io-service;1"]
-             .getService(Components.interfaces.nsIIOService);
-
-var pps = Cc["@mozilla.org/network/protocol-proxy-service;1"].getService();
-
-var prefs = Cc["@mozilla.org/preferences-service;1"]
-               .getService(Components.interfaces.nsIPrefBranch);
-
-var pgen = Cc["@mozilla.org/pac-generator;1"]
-              .getService(Components.interfaces.nsIPACGenerator);
-
-const TARGET_HOST ="www.mozilla.org";
-const HTTP_HOST = "httpHost";
-const HTTP_PORT = 1111;
-const HTTPS_HOST = "httpsHost";
-const HTTPS_PORT = 2222;
-const FTP_HOST= "ftpHost";
-const FTP_PORT = 3333;
-const MY_APP_ID = 10;
-const MY_APP_ORIGIN = "apps://browser.gaiamobile.com";
-const APP_ORIGINS_LIST = "apps://test1.com, apps://browser.gaiamobile.com";
-const BROWSING_HOST = "browsingHost";
-const BROWSING_PORT = 4444;
-const PROXY_TYPE_PAC = Ci.nsIProtocolProxyService.PROXYCONFIG_PAC;
-
-const proxyTypes = {
-  "http": {"pref": "http", "host": HTTP_HOST, "port": HTTP_PORT},
-  "https": {"pref": "ssl", "host": HTTPS_HOST, "port": HTTPS_PORT},
-  "ftp": {"pref": "ftp", "host": FTP_HOST, "port": FTP_PORT}
-};
-
-function default_proxy_settings() {
-  prefs.setBoolPref("network.proxy.pac_generator", true);
-  prefs.setIntPref("network.proxy.type", 0);
-  prefs.setCharPref("network.proxy.autoconfig_url", "");
-  for (let i in proxyTypes) {
-    let p = proxyTypes[i];
-    prefs.setCharPref("network.proxy." + p["pref"], p["host"]);
-    prefs.setIntPref("network.proxy." + p["pref"] + "_port", p["port"]);
-  }
-}
-
-function TestResolveCallback(type, host, callback) {
-  this.type = type;
-  this.host = host;
-  this.callback = callback;
-}
-TestResolveCallback.prototype = {
-  QueryInterface:
-  function TestResolveCallback_QueryInterface(iid) {
-    if (iid.equals(Components.interfaces.nsIProtocolProxyCallback) ||
-        iid.equals(Components.interfaces.nsISupports))
-      return this;
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  },
-
-  onProxyAvailable:
-  function TestResolveCallback_onProxyAvailable(req, channel, pi, status) {
-    if (this.type) {
-      // Check for localhost.
-      if (this.host == "localhost" || this.host == "127.0.0.1") {
-          do_check_eq(pi, null);
-          this.callback();
-          return;
-      }
-
-      // Check for browsing proxy.
-      let browsingEnabled;
-      try {
-        browsingEnabled = prefs.getBoolPref("network.proxy.browsing.enabled");
-      } catch (ex) {}
-
-      if (browsingEnabled) {
-        let proxyHost, proxyPort;
-        try {
-          proxyHost = prefs.getCharPref("network.proxy.browsing.host");
-          proxyPort = prefs.getIntPref("network.proxy.browsing.port");
-        } catch (ex) {}
-
-        if (proxyHost) {
-          do_check_eq(pi.host, proxyHost);
-          do_check_eq(pi.port, proxyPort);
-          this.callback();
-          return;
-        }
-      }
-
-      // Check for system proxy.
-      let share;
-      try {
-        share = prefs.getBoolPref("network.proxy.share_proxy_settings");
-      } catch (ex) {}
-
-      let p = share ? proxyTypes["http"] : proxyTypes[this.type];
-      if (p) {
-        let proxyHost, proxyPort;
-        try {
-          proxyHost = prefs.getCharPref("network.proxy." + p["pref"]);
-          proxyPort = prefs.getIntPref("network.proxy." + p["pref"] + "_port");
-        } catch (ex) {}
-
-        if (proxyHost) {
-          // Connection through proxy.
-          do_check_neq(pi, null);
-          do_check_eq(pi.host, proxyHost);
-          do_check_eq(pi.port, proxyPort);
-        } else {
-          // Direct connection.
-          do_check_eq(pi, null);
-        }
-      }
-    }
-
-    this.callback();
-  }
-};
-
-function test_resolve_type(type, host, callback) {
-  // We have to setup a profile, otherwise indexed db used by webapps
-  // will throw random exception when trying to get profile folder.
-  do_get_profile();
-
-  // We also need a valid nsIXulAppInfo service as Webapps.jsm is querying it.
-  Cu.import("resource://testing-common/AppInfo.jsm");
-  updateAppInfo();
-
-  // Mock getAppByLocalId() to return testing app origin.
-  Cu.import("resource://gre/modules/AppsUtils.jsm");
-  AppsUtils.getAppByLocalId = function(aAppId) {
-    let app = { origin: MY_APP_ORIGIN};
-    return app;
-  };
-
-  let channel = NetUtil.newChannel({
-    uri: type + "://" + host + "/",
-    loadUsingSystemPrincipal: true
-  });
-  channel.loadInfo.originAttributes = { appId: MY_APP_ID,
-                                        inIsolatedMozBrowser: true
-                                      };
-
-  let req = pps.asyncResolve(channel, 0, new TestResolveCallback(type, host, callback));
-}
-
-function test_resolve(host, callback) {
-  test_resolve_type("http", host, function() {
-    test_resolve_type("https", host, function() {
-      test_resolve_type("ftp", host, run_next_test);
-    });
-  });
-}
-
-add_test(function test_localhost() {
-  default_proxy_settings();
-  prefs.setBoolPref("network.proxy.share_proxy_settings", true);
-  Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
-  Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-  test_resolve("localhost", run_next_test);
-});
-
-add_test(function test_share_on_proxy() {
-  default_proxy_settings();
-  prefs.setBoolPref("network.proxy.share_proxy_settings", true);
-  Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
-  Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-  test_resolve(TARGET_HOST, run_next_test);
-});
-
-add_test(function test_share_on_direct() {
-  default_proxy_settings();
-  prefs.setBoolPref("network.proxy.share_proxy_settings", true);
-  prefs.setCharPref("network.proxy.http", "");
-  prefs.setCharPref("network.proxy.ssl", "");
-  prefs.setCharPref("network.proxy.ftp", "");
-  Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
-  Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-  test_resolve(TARGET_HOST, run_next_test);
-});
-
-add_test(function test_share_off_proxy() {
-  default_proxy_settings();
-  prefs.setBoolPref("network.proxy.share_proxy_settings", false);
-  Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
-  Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-  test_resolve(TARGET_HOST, run_next_test);
-});
-
-add_test(function test_share_off_direct() {
-  default_proxy_settings();
-  prefs.setBoolPref("network.proxy.share_proxy_settings", false);
-  prefs.setCharPref("network.proxy.http", "");
-  prefs.setCharPref("network.proxy.ssl", "");
-  prefs.setCharPref("network.proxy.ftp", "");
-  Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
-  Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-  test_resolve(TARGET_HOST, run_next_test);
-});
-
-add_test(function test_browsing_proxy() {
-  default_proxy_settings();
-  prefs.setBoolPref("network.proxy.browsing.enabled", true);
-  prefs.setCharPref("network.proxy.browsing.host", BROWSING_HOST);
-  prefs.setIntPref("network.proxy.browsing.port", BROWSING_PORT);
-  prefs.setCharPref("network.proxy.browsing.app_origins", APP_ORIGINS_LIST);
-  Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
-  Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
-  test_resolve(TARGET_HOST, run_next_test);
-});
-
-function run_test(){
-  do_register_cleanup(() => {
-    prefs.clearUserPref("network.proxy.pac_generator");
-    prefs.clearUserPref("network.proxy.type");
-    prefs.clearUserPref("network.proxy.autoconfig_url");
-    prefs.clearUserPref("network.proxy.share_proxy_settings");
-    prefs.clearUserPref("network.proxy.http");
-    prefs.clearUserPref("network.proxy.http_port");
-    prefs.clearUserPref("network.proxy.ssl");
-    prefs.clearUserPref("network.proxy.ssl_port");
-    prefs.clearUserPref("network.proxy.ftp");
-    prefs.clearUserPref("network.proxy.ftp_port");
-    prefs.clearUserPref("network.proxy.browsing.enabled");
-    prefs.clearUserPref("network.proxy.browsing.host");
-    prefs.clearUserPref("network.proxy.browsing.port");
-    prefs.clearUserPref("network.proxy.browsing.app_origins");
-  });
-  run_next_test();
-}
deleted file mode 100644
--- a/netwerk/test/unit/xpcshell_b2g.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-[DEFAULT]
-head = head_channels.js head_cache.js head_cache2.js
-tail =
-skip-if = buildapp != 'b2g'
-
-# For bug 1148503.  This is to accommodate non-mozilla-central that didn't
-# include required files for this test.
-[test_pac_generator.js]
-requesttimeoutfactor = 4
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -284,19 +284,16 @@ user_pref("security.ssl.errorReporting.u
 user_pref("browser.translation.bing.authURL", "http://%(server)s/browser/browser/components/translation/test/bing.sjs");
 user_pref("browser.translation.bing.translateArrayURL", "http://%(server)s/browser/browser/components/translation/test/bing.sjs");
 user_pref("browser.translation.yandex.translateURLOverride", "http://%(server)s/browser/browser/components/translation/test/yandex.sjs");
 user_pref("browser.translation.engine", "bing");
 
 // Make sure we don't try to load snippets from the network.
 user_pref("browser.aboutHomeSnippets.updateUrl", "nonexistent://test");
 
-// Enable apps customizations
-user_pref("dom.apps.customization.enabled", true);
-
 // Don't fetch or send directory tiles data from real servers
 user_pref("browser.newtabpage.directory.source", 'data:application/json,{"testing":1}');
 user_pref("browser.newtabpage.directory.ping", "");
 
 // Ensure UITour won't hit the network
 user_pref("browser.uitour.pinnedTabUrl", "http://%(server)s/uitour-dummy/pinnedTab");
 user_pref("browser.uitour.url", "http://%(server)s/uitour-dummy/tour");
 
@@ -325,20 +322,16 @@ user_pref("browser.tabs.remote.autostart
 user_pref("dom.ipc.tabs.shutdownTimeoutSecs", 0);
 
 // Don't block add-ons for e10s
 user_pref("extensions.e10sBlocksEnabling", false);
 
 // Avoid performing Reader Mode intros during tests.
 user_pref("browser.reader.detectedFirstArticle", true);
 
-// Don't let PAC generator to set PAC, as mochitest framework has its own PAC
-// rules during testing.
-user_pref("network.proxy.pac_generator", false);
-
 // Make tests run consistently on DevEdition (which has a lightweight theme
 // selected by default).
 user_pref("lightweightThemes.selectedThemeID", "");
 
 // Enable speech synth test service, and disable built in platform services.
 user_pref("media.webspeech.synth.test", true);
 
 // Turn off search suggestions in the location bar so as not to trigger network
--- a/toolkit/library/gtest/rust/Cargo.toml
+++ b/toolkit/library/gtest/rust/Cargo.toml
@@ -18,30 +18,26 @@ doctest = false
 bench = false
 doc = false
 plugin = false
 harness = false
 
 # Explicitly specify what our profiles use.
 [profile.dev]
 opt-level = 1
-# XXX: We're passing `-C debuginfo=1` to rustc to work around an llvm-dsymutil
-# crash (bug 1301751), but rustc can't handle -g with that option, so
-# turn off debug for now.
-# This should be temporary until we upgrade to Rust 1.12.
-debug = false
+debug = true
 rpath = false
 lto = false
 debug-assertions = true
 codegen-units = 1
 panic = "abort"
 
 [profile.release]
 opt-level = 2
-debug = false
+debug = true
 rpath = false
 # This would normally be 'true' for release configurations, but using LTO on
 # rul-gtest causes link failures due to symbols also being found in libxul's
 # librul.a.  But LTO'ing things here is not crucial and not LTO'ing things
 # enables us to link libxul-gtest, so we leave it turned off.
 lto = false
 debug-assertions = false
 codegen-units = 1
--- a/toolkit/library/rust/Cargo.toml
+++ b/toolkit/library/rust/Cargo.toml
@@ -16,26 +16,22 @@ doctest = false
 bench = false
 doc = false
 plugin = false
 harness = false
 
 # Explicitly specify what our profiles use.
 [profile.dev]
 opt-level = 1
-# XXX: We're passing `-C debuginfo=1` to rustc to work around an llvm-dsymutil
-# crash (bug 1301751), but rustc can't handle -g with that option, so
-# turn off debug for now.
-# This should be temporary until we upgrade to Rust 1.12.
-debug = false
+debug = true
 rpath = false
 lto = false
 debug-assertions = true
 codegen-units = 1
 panic = "abort"
 
 [profile.release]
 opt-level = 2
-debug = false
+debug = true
 rpath = false
 lto = true
 debug-assertions = false
 panic = "abort"
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1334,17 +1334,17 @@ nsWindow::GeckoViewSupport::Open(const j
     } else {
         url = Preferences::GetCString("toolkit.defaultChromeURI");
         if (!url) {
             url = NS_LITERAL_CSTRING("chrome://browser/content/browser.xul");
         }
     }
 
     nsCOMPtr<mozIDOMWindowProxy> domWindow;
-    ww->OpenWindow(nullptr, url, nullptr, "chrome,dialog=0,resizable",
+    ww->OpenWindow(nullptr, url, nullptr, "chrome,dialog=0,resizable,scrollbars=yes",
                    nullptr, getter_AddRefs(domWindow));
     MOZ_RELEASE_ASSERT(domWindow);
 
     nsCOMPtr<nsPIDOMWindowOuter> pdomWindow =
             nsPIDOMWindowOuter::From(domWindow);
     nsCOMPtr<nsIWidget> widget = WidgetUtils::DOMWindowToWidget(pdomWindow);
     MOZ_ASSERT(widget);
 
--- a/widget/cocoa/VibrancyManager.mm
+++ b/widget/cocoa/VibrancyManager.mm
@@ -199,19 +199,21 @@ HasVibrantForeground(VibrancyType aType)
   switch (aType) {
     case VibrancyType::MENU:
       return YES;
     default:
       return NO;
   }
 }
 
+#if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
 enum {
-  NSVisualEffectMaterialMenuItem = 4
+  NSVisualEffectMaterialSelection = 4
 };
+#endif
 
 @interface NSView(NSVisualEffectViewMethods)
 - (void)setState:(NSUInteger)state;
 - (void)setMaterial:(NSUInteger)material;
 - (void)setEmphasized:(BOOL)emphasized;
 @end
 
 NSView*
@@ -234,17 +236,17 @@ VibrancyManager::CreateEffectView(Vibran
     // is the one that comes closest.
     [effectView setMaterial:canUseElCapitanMaterials ? NSVisualEffectMaterialMenu
                                                      : NSVisualEffectMaterialTitlebar];
   } else if (aType == VibrancyType::SOURCE_LIST && canUseElCapitanMaterials) {
     [effectView setMaterial:NSVisualEffectMaterialSidebar];
   } else if (aType == VibrancyType::HIGHLIGHTED_MENUITEM ||
              aType == VibrancyType::SOURCE_LIST_SELECTION ||
              aType == VibrancyType::ACTIVE_SOURCE_LIST_SELECTION) {
-    [effectView setMaterial:NSVisualEffectMaterialMenuItem];
+    [effectView setMaterial:NSVisualEffectMaterialSelection];
     if ([effectView respondsToSelector:@selector(setEmphasized:)] &&
         aType != VibrancyType::SOURCE_LIST_SELECTION) {
       [effectView setEmphasized:YES];
     }
   }
 
   return effectView;
 }