Bug 1238160 - Rename nsILoadContext::GetIsInBrowserElement. r=smaug,mayhemer
authorJ. Ryan Stinnett <jryans@gmail.com>
Wed, 17 Feb 2016 20:55:57 -0600
changeset 322808 267ab6361fa18937288c482612d996c7bf074d3f
parent 322807 b2a21a014436551942179dd3e70c2642bb6e4e7a
child 322809 86b3d7cbff15bf6edb96cc771036a86d5e06d436
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, mayhemer
bugs1238160
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1238160 - Rename nsILoadContext::GetIsInBrowserElement. r=smaug,mayhemer This change renames nsILoadContext::GetIsInBrowserElement to GetIsInIsolatedMozBrowserElement. Other methods that pass these values around also have name changes. Tokens such as "isInBrowserElement" have previously been serialized into cache keys, used as DB column names, stored in app registries, etc. No changes are made to any serialization formats. Only runtime method and variable names are updated. No behavior changes are made in this patch, so some renamed methods may have nonsensical implementations. These are corrected in subsequent patches focused on behavior. MozReview-Commit-ID: CUttXANQjSv
docshell/base/LoadContext.cpp
docshell/base/nsDocShell.cpp
docshell/base/nsIDocShell.idl
docshell/base/nsILoadContext.idl
dom/apps/AppsUtils.jsm
dom/apps/Webapps.jsm
dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
dom/ipc/TabParent.cpp
dom/network/NetworkStatsService.jsm
dom/network/NetworkStatsServiceProxy.js
dom/network/interfaces/nsINetworkStatsServiceProxy.idl
dom/requestsync/RequestSyncManager.js
extensions/cookie/test/channel_utils.js
netwerk/base/NetStatistics.h
netwerk/base/PACGenerator.js
netwerk/base/ProxyAutoConfig.cpp
netwerk/base/ProxyAutoConfig.h
netwerk/base/nsNetUtil.cpp
netwerk/base/nsNetUtil.h
netwerk/base/nsPACMan.cpp
netwerk/base/nsPACMan.h
netwerk/base/nsProtocolProxyService.cpp
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/http/nsHttpTransaction.h
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/websocket/WebSocketChannel.h
netwerk/test/unit/head_channels.js
netwerk/test/unit/test_cache_jar.js
netwerk/test/unit/test_protocolproxyservice.js
netwerk/test/unit_ipc/child_app_offline.js
uriloader/prefetch/OfflineCacheUpdateParent.cpp
--- a/docshell/base/LoadContext.cpp
+++ b/docshell/base/LoadContext.cpp
@@ -29,17 +29,17 @@ nsILoadContext::GetOriginAttributes(mozi
   JSAutoCompartment ac(jsapi.cx(), obj);
 
   mozilla::DocShellOriginAttributes attrs;
   ok = attrs.Init(jsapi.cx(), v);
   NS_ENSURE_TRUE(ok, false);
   aAttrs = attrs;
   return true;
 }
-  
+
 namespace mozilla {
 
 NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
 
 LoadContext::LoadContext(nsIPrincipal* aPrincipal,
                          nsILoadContext* aOptionalBase)
   : mTopFrameElement(nullptr)
   , mNestedFrameId(0)
@@ -167,23 +167,23 @@ LoadContext::SetRemoteTabs(bool aUseRemo
 {
   MOZ_ASSERT(mIsNotNull);
 
   // We shouldn't need this on parent...
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-LoadContext::GetIsInBrowserElement(bool* aIsInBrowserElement)
+LoadContext::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
 {
   MOZ_ASSERT(mIsNotNull);
 
-  NS_ENSURE_ARG_POINTER(aIsInBrowserElement);
+  NS_ENSURE_ARG_POINTER(aIsInIsolatedMozBrowserElement);
 
-  *aIsInBrowserElement = mOriginAttributes.mInIsolatedMozBrowser;
+  *aIsInIsolatedMozBrowserElement = mOriginAttributes.mInIsolatedMozBrowser;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 LoadContext::GetAppId(uint32_t* aAppId)
 {
   MOZ_ASSERT(mIsNotNull);
 
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -3495,17 +3495,18 @@ nsDocShell::CanAccessItem(nsIDocShellTre
 
   nsCOMPtr<nsIDocShell> targetDS = do_QueryInterface(aTargetItem);
   nsCOMPtr<nsIDocShell> accessingDS = do_QueryInterface(aAccessingItem);
   if (!targetDS || !accessingDS) {
     // We must be able to convert both to nsIDocShell.
     return false;
   }
 
-  if (targetDS->GetIsInBrowserElement() != accessingDS->GetIsInBrowserElement() ||
+  if (targetDS->GetIsInIsolatedMozBrowserElement() !=
+        accessingDS->GetIsInIsolatedMozBrowserElement() ||
       targetDS->GetAppId() != accessingDS->GetAppId()) {
     return false;
   }
 
   // A private document can't access a non-private one, and vice versa.
   if (static_cast<nsDocShell*>(targetDS.get())->UsePrivateBrowsing() !=
       static_cast<nsDocShell*>(accessingDS.get())->UsePrivateBrowsing()) {
     return false;
@@ -13933,19 +13934,19 @@ nsDocShell::GetInheritedFrameType()
   if (!parent) {
     return eFrameTypeRegular;
   }
 
   return static_cast<nsDocShell*>(parent.get())->GetInheritedFrameType();
 }
 
 /* [infallible] */ NS_IMETHODIMP
-nsDocShell::GetIsInBrowserElement(bool* aIsInBrowserElement)
-{
-  *aIsInBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser);
+nsDocShell::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
+{
+  *aIsInIsolatedMozBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser);
   return NS_OK;
 }
 
 /* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsInBrowserOrApp(bool* aIsInBrowserOrApp)
 {
   switch (GetInheritedFrameType()) {
     case eFrameTypeRegular:
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -775,26 +775,31 @@ interface nsIDocShell : nsIDocShellTreeI
   [infallible] readonly attribute boolean isApp;
 
   /**
    * Returns isBrowserElement || isApp.
    */
   [infallible] readonly attribute boolean isBrowserOrApp;
 
   /**
-   * Returns true if this docshell corresponds to an <iframe mozbrowser> or if
-   * the docshell is contained in an <iframe mozbrowser>.  (<iframe mozapp
-   * mozbrowser> does not count as a browser.)
+   * Returns true if this docshell corresponds to an isolated <iframe
+   * mozbrowser> or if the docshell is contained in an isolated <iframe
+   * mozbrowser>.
+   *
+   * <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.
    *
    * Our notion here of "contained in" means: Walk up the docshell hierarchy in
    * this process until we hit an <iframe mozapp> or <iframe mozbrowser> (or
    * until the hierarchy ends).  Return true iff the docshell we stopped on has
-   * isBrowserElement == true.
+   * isIsolatedMozBrowserElement == true.
    */
-  [infallible] readonly attribute boolean isInBrowserElement;
+  [infallible] readonly attribute boolean isInIsolatedMozBrowserElement;
 
   /**
    * Returns true if this docshell corresponds to an <iframe mozbrowser> or
    * <iframe mozapp>, or if this docshell is contained in an <iframe mozbrowser>
    * or <iframe mozapp>.
    *
    * To compute this value, we walk up the docshell hierarchy.  If we encounter
    * a docshell with isBrowserElement or isApp before we hit the end of the
--- a/docshell/base/nsILoadContext.idl
+++ b/docshell/base/nsILoadContext.idl
@@ -111,19 +111,23 @@ interface nsILoadContext : nsISupports
   [noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);
 
   /**
    * Set the remote tabs state of the load context, meant to be used internally.
    */
   [noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
 
   /**
-   * Returns true iff the load is occurring inside a browser element.
+   * Returns true iff the load is occurring inside 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.
    */
-  readonly attribute boolean isInBrowserElement;
+  readonly attribute boolean isInIsolatedMozBrowserElement;
 
   /**
    * Returns the app id of the app the load is occurring is in. Returns
    * nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app.
    */
   readonly attribute unsigned long appId;
 
   /**
--- a/dom/apps/AppsUtils.jsm
+++ b/dom/apps/AppsUtils.jsm
@@ -151,17 +151,17 @@ this.AppsUtils = {
 
   // Creates a nsILoadContext object with a given appId and inIsolatedMozBrowser
   // flag.
   createLoadContext: function createLoadContext(aAppId, aInIsolatedMozBrowser) {
     return {
        associatedWindow: null,
        topWindow : null,
        appId: aAppId,
-       isInBrowserElement: aInIsolatedMozBrowser,
+       isInIsolatedMozBrowserElement: aInIsolatedMozBrowser,
        originAttributes: {
          appId: aAppId,
          inIsolatedMozBrowser: aInIsolatedMozBrowser
        },
        usePrivateBrowsing: false,
        isContent: false,
 
        isAppOfType: function(appType) {
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -3531,17 +3531,17 @@ this.DOMApplicationRegistry = {
           lastProgressTime = now;
           this._saveApps();
         }
       }).bind(this),
       onStatus: function(aRequest, aContext, aStatus, aStatusArg) { },
 
       // nsILoadContext
       appId: aOldApp.installerAppId,
-      isInBrowserElement: aOldApp.installerIsBrowser,
+      isInIsolatedMozBrowserElement: aOldApp.installerIsBrowser,
       originAttributes: {
         appId: aOldApp.installerAppId,
         inIsolatedMozBrowser: aOldApp.installerIsBrowser
       },
       usePrivateBrowsing: false,
       isContent: false,
       associatedWindow: null,
       topWindow : null,
--- a/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
@@ -57,17 +57,17 @@ function runTests() {
   }
 
   iframe.addEventListener('mozbrowserloadend', audio_loadend);
   iframe.addEventListener('mozbrowsershowmodalprompt', listener, false);
   document.body.appendChild(iframe);
 
   var context = { 'url': 'http://example.org',
                   'appId': SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
-                  'isInBrowserElement': true };
+                  'isInIsolatedMozBrowserElement': true };
   SpecialPowers.pushPermissions([
     {'type': 'browser', 'allow': 1, 'context': context},
     {'type': 'embed-apps', 'allow': 1, 'context': context}
   ], function() {
     iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html';
   });
 }
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3098,17 +3098,17 @@ public:
     return NS_OK;
   }
   NS_IMETHOD GetNestedFrameId(uint64_t*) NO_IMPL
   NS_IMETHOD IsAppOfType(uint32_t, bool*) NO_IMPL
   NS_IMETHOD GetIsContent(bool*) NO_IMPL
   NS_IMETHOD GetUsePrivateBrowsing(bool*) NO_IMPL
   NS_IMETHOD SetUsePrivateBrowsing(bool) NO_IMPL
   NS_IMETHOD SetPrivateBrowsing(bool) NO_IMPL
-  NS_IMETHOD GetIsInBrowserElement(bool*) NO_IMPL
+  NS_IMETHOD GetIsInIsolatedMozBrowserElement(bool*) NO_IMPL
   NS_IMETHOD GetAppId(uint32_t*) NO_IMPL
   NS_IMETHOD GetOriginAttributes(JS::MutableHandleValue) NO_IMPL
   NS_IMETHOD GetUseRemoteTabs(bool*) NO_IMPL
   NS_IMETHOD SetRemoteTabs(bool) NO_IMPL
 #undef NO_IMPL
 
 protected:
   ~FakeChannel() {}
--- a/dom/network/NetworkStatsService.jsm
+++ b/dom/network/NetworkStatsService.jsm
@@ -733,19 +733,19 @@ this.NetworkStatsService = {
         aCallback(true, "OK");
       }
     });
   },
 
   /*
    * Function responsible for receiving stats which are not from netd.
    */
-  saveStats: function saveStats(aAppId, aIsInBrowser, aServiceType, aNetworkInfo,
-                                aTimeStamp, aRxBytes, aTxBytes, aIsAccumulative,
-                                aCallback) {
+  saveStats: function saveStats(aAppId, aIsInIsolatedMozBrowser, aServiceType,
+                                aNetworkInfo, aTimeStamp, aRxBytes, aTxBytes,
+                                aIsAccumulative, aCallback) {
     let netId = this.convertNetworkInfo(aNetworkInfo);
     if (!netId) {
       if (aCallback) {
         aCallback(false, "Invalid network type");
       }
       return;
     }
 
@@ -756,17 +756,17 @@ this.NetworkStatsService = {
     // b. Both |aAppId| is zero and |aServiceType| is empty.
     if (!this._networks[netId] || (aAppId && aServiceType) ||
         (!aAppId && !aServiceType)) {
       debug("Invalid network interface, appId or serviceType");
       return;
     }
 
     let stats = { appId:          aAppId,
-                  isInBrowser:    aIsInBrowser,
+                  isInBrowser:    aIsInIsolatedMozBrowser,
                   serviceType:    aServiceType,
                   networkId:      this._networks[netId].network.id,
                   networkType:    this._networks[netId].network.type,
                   date:           new Date(aTimeStamp),
                   rxBytes:        aRxBytes,
                   txBytes:        aTxBytes,
                   isAccumulative: aIsAccumulative };
 
--- a/dom/network/NetworkStatsServiceProxy.js
+++ b/dom/network/NetworkStatsServiceProxy.js
@@ -24,37 +24,37 @@ function NetworkStatsServiceProxy() {
   }
 }
 
 NetworkStatsServiceProxy.prototype = {
   /*
    * Function called in the protocol layer (HTTP, FTP, WebSocket ...etc)
    * to pass the per-app stats to NetworkStatsService.
    */
-  saveAppStats: function saveAppStats(aAppId, aIsInBrowser, aNetworkInfo, aTimeStamp,
+  saveAppStats: function saveAppStats(aAppId, aIsInIsolatedMozBrowser, aNetworkInfo, aTimeStamp,
                                       aRxBytes, aTxBytes, aIsAccumulative,
                                       aCallback) {
     if (!aNetworkInfo) {
       if (DEBUG) {
         debug("|aNetworkInfo| is not specified. Failed to save stats. Returning.");
       }
       return;
     }
 
     if (DEBUG) {
-      debug("saveAppStats: " + aAppId + " " + aIsInBrowser + " " +
+      debug("saveAppStats: " + aAppId + " " + aIsInIsolatedMozBrowser + " " +
             aNetworkInfo.type + " " + aTimeStamp + " " +
             aRxBytes + " " + aTxBytes + " " + aIsAccumulative);
     }
 
     if (aCallback) {
       aCallback = aCallback.notify;
     }
 
-    NetworkStatsService.saveStats(aAppId, aIsInBrowser, "", aNetworkInfo,
+    NetworkStatsService.saveStats(aAppId, aIsInIsolatedMozBrowser, "", aNetworkInfo,
                                   aTimeStamp, aRxBytes, aTxBytes,
                                   aIsAccumulative, aCallback);
   },
 
   /*
    * Function called in the points of different system services
    * to pass the per-service stats to NetworkStatsService.
    */
--- a/dom/network/interfaces/nsINetworkStatsServiceProxy.idl
+++ b/dom/network/interfaces/nsINetworkStatsServiceProxy.idl
@@ -17,26 +17,31 @@ interface nsINetworkStatsServiceProxyCal
 };
 
 [scriptable, uuid(f4f3e901-e102-499d-9d37-dc9951f52df7)]
 interface nsINetworkStatsServiceProxy : nsISupports
 {
   /*
    * An interface used to record per-app traffic data.
    * @param aAppId app id
-   * @param aIsInBrowser true if the iframe element is mozbrowser
+   * @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 aNetworkInterface network
    * @param aTimeStamp time stamp
    * @param aRxBytes received data amount
    * @param aTxBytes transmitted data amount
    * @param aIsAccumulative is stats accumulative
    * @param aCallback an optional callback
    */
   void saveAppStats(in unsigned long aAppId,
-                    in boolean aIsInBrowser,
+                    in boolean aIsInIsolatedMozBrowser,
                     in nsINetworkInfo aNetworkInfo,
                     in unsigned long long aTimeStamp,
                     in unsigned long long aRxBytes,
                     in unsigned long long aTxBytes,
                     in boolean aIsAccumulative,
          [optional] in nsINetworkStatsServiceProxyCallback aCallback);
 
   /*
--- a/dom/requestsync/RequestSyncManager.js
+++ b/dom/requestsync/RequestSyncManager.js
@@ -53,37 +53,37 @@ RequestSyncManager.prototype = {
     });
   },
 
   registrations: function() {
     debug('registrations');
     return this.sendMessage("RequestSyncManager:Registrations", {});
   },
 
-  setPolicy: function(aTask, aOrigin, aManifestURL, aIsInBrowserElement,
+  setPolicy: function(aTask, aOrigin, aManifestURL, aIsInIsolatedMozBrowserElement,
                       aState, aOverwrittenMinInterval) {
     debug('setPolicy');
 
     return this.sendMessage("RequestSyncManager:SetPolicy",
       { task: aTask,
         origin: aOrigin,
         manifestURL: aManifestURL,
-        isInBrowserElement: aIsInBrowserElement,
+        isInBrowserElement: aIsInIsolatedMozBrowserElement,
         state: aState,
         overwrittenMinInterval: aOverwrittenMinInterval });
   },
 
-  runTask: function(aTask, aOrigin, aManifestURL, aIsInBrowserElement) {
+  runTask: function(aTask, aOrigin, aManifestURL, aIsInIsolatedMozBrowserElement) {
     debug('runTask');
 
     return this.sendMessage("RequestSyncManager:RunTask",
       { task: aTask,
         origin: aOrigin,
         manifestURL: aManifestURL,
-        isInBrowserElement: aIsInBrowserElement });
+        isInBrowserElement: aIsInIsolatedMozBrowserElement });
   },
 
   registrationsResult: function(aData) {
     debug("registrationsResult");
 
     let results = new this._window.Array();
     for (let i = 0; i < aData.length; ++i) {
       if (!("app" in aData[i])) {
--- a/extensions/cookie/test/channel_utils.js
+++ b/extensions/cookie/test/channel_utils.js
@@ -163,17 +163,17 @@ ChannelListener.prototype = {
 };
 
 /**
  * Class that implements nsILoadContext.  Use it as callbacks for channel when
  * test needs it.
  */
 function LoadContextCallback(appId, inIsolatedMozBrowser, isPrivate, isContent) {
   this.appId = appId;
-  this.isInBrowserElement = inIsolatedMozBrowser;
+  this.isInIsolatedMozBrowserElement = inIsolatedMozBrowser;
   this.usePrivateBrowsing = isPrivate;
   this.isContent = isContent;
   this.originAttributes = {
     appId: appId,
     inIsolatedMozBrowser: inIsolatedMozBrowser
   };
 }
 
--- a/netwerk/base/NetStatistics.h
+++ b/netwerk/base/NetStatistics.h
@@ -41,23 +41,23 @@ GetActiveNetworkInfo(nsCOMPtr<nsINetwork
   networkManager->GetActiveNetworkInfo(getter_AddRefs(aNetworkInfo));
 
   return NS_OK;
 }
 
 class SaveNetworkStatsEvent : public nsRunnable {
 public:
   SaveNetworkStatsEvent(uint32_t aAppId,
-                        bool aIsInBrowser,
+                        bool aIsInIsolatedMozBrowser,
                         nsMainThreadPtrHandle<nsINetworkInfo> &aActiveNetworkInfo,
                         uint64_t aCountRecv,
                         uint64_t aCountSent,
                         bool aIsAccumulative)
     : mAppId(aAppId),
-      mIsInBrowser(aIsInBrowser),
+      mIsInIsolatedMozBrowser(aIsInIsolatedMozBrowser),
       mActiveNetworkInfo(aActiveNetworkInfo),
       mCountRecv(aCountRecv),
       mCountSent(aCountSent),
       mIsAccumulative(aIsAccumulative)
   {
     MOZ_ASSERT(mAppId != NECKO_NO_APP_ID);
     MOZ_ASSERT(mActiveNetworkInfo);
   }
@@ -70,29 +70,29 @@ public:
     nsCOMPtr<nsINetworkStatsServiceProxy> mNetworkStatsServiceProxy =
       do_GetService("@mozilla.org/networkstatsServiceProxy;1", &rv);
     if (NS_FAILED(rv)) {
       return rv;
     }
 
     // save the network stats through NetworkStatsServiceProxy
     mNetworkStatsServiceProxy->SaveAppStats(mAppId,
-                                            mIsInBrowser,
+                                            mIsInIsolatedMozBrowser,
                                             mActiveNetworkInfo,
                                             PR_Now() / 1000,
                                             mCountRecv,
                                             mCountSent,
                                             mIsAccumulative,
                                             nullptr);
 
     return NS_OK;
   }
 private:
   uint32_t mAppId;
-  bool     mIsInBrowser;
+  bool     mIsInIsolatedMozBrowser;
   nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
   uint64_t mCountRecv;
   uint64_t mCountSent;
   bool mIsAccumulative;
 };
 
 } // namespace mozilla:net
 } // namespace mozilla
--- a/netwerk/base/PACGenerator.js
+++ b/netwerk/base/PACGenerator.js
@@ -102,17 +102,17 @@ PACGenerator.prototype = {
       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)" +
-             " && isInBrowser()) { return 'PROXY " + proxy + "'; } ";
+             " && isInIsolatedMozBrowser()) { return 'PROXY " + proxy + "'; } ";
     }
 
     // Rules for system proxy.
     let share;
     try {
       share = Services.prefs.getBoolPref("network.proxy.share_proxy_settings");
     } catch (ex) {}
 
--- a/netwerk/base/ProxyAutoConfig.cpp
+++ b/netwerk/base/ProxyAutoConfig.cpp
@@ -495,33 +495,34 @@ bool PACMyAppOrigin(JSContext *cx, unsig
   if (!GetRunning()) {
     NS_WARNING("PACMyAppOrigin without a running ProxyAutoConfig object");
     return false;
   }
 
   return GetRunning()->MyAppOrigin(args);
 }
 
-// IsInBrowser() javascript implementation
+// IsInIsolatedMozBrowser() javascript implementation
 static
-bool PACIsInBrowser(JSContext *cx, unsigned int argc, JS::Value *vp)
+bool PACIsInIsolatedMozBrowser(JSContext *cx, unsigned int argc, JS::Value *vp)
 {
   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
 
   if (NS_IsMainThread()) {
-    NS_WARNING("PACIsInBrowser on Main Thread. How did that happen?");
+    NS_WARNING("PACIsInIsolatedMozBrowser on Main Thread. How did that happen?");
     return false;
   }
 
   if (!GetRunning()) {
-    NS_WARNING("PACIsInBrowser without a running ProxyAutoConfig object");
+    NS_WARNING("PACIsInIsolatedMozBrowser without a running ProxyAutoConfig"
+               "object");
     return false;
   }
 
-  return GetRunning()->IsInBrowser(args);
+  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);
 
@@ -549,17 +550,17 @@ 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("isInBrowser", PACIsInBrowser, 0, 0),
+  JS_FS("isInIsolatedMozBrowser", PACIsInIsolatedMozBrowser, 0, 0),
   JS_FS("alert", PACProxyAlert, 1, 0),
   JS_FS_END
 };
 
 // JSRuntimeWrapper is a c++ object that manages the runtime and context
 // for the JS engine used on the PAC thread. It is initialized and destroyed
 // on the PAC thread.
 class JSRuntimeWrapper
@@ -631,17 +632,17 @@ private:
   }
 
   nsresult Init()
   {
     /*
      * Not setting this will cause JS_CHECK_RECURSION to report false
      * positives
      */
-    JS_SetNativeStackQuota(mRuntime, 128 * sizeof(size_t) * 1024); 
+    JS_SetNativeStackQuota(mRuntime, 128 * sizeof(size_t) * 1024);
 
     JS_SetErrorReporter(mRuntime, PACErrorReporter);
 
     mContext = JS_NewContext(mRuntime, 0);
     NS_ENSURE_TRUE(mContext, NS_ERROR_OUT_OF_MEMORY);
 
     JSAutoRequest ar(mContext);
 
@@ -759,17 +760,17 @@ ProxyAutoConfig::SetupJS()
   return NS_OK;
 }
 
 nsresult
 ProxyAutoConfig::GetProxyForURI(const nsCString &aTestURI,
                                 const nsCString &aTestHost,
                                 uint32_t aAppId,
                                 const nsString &aAppOrigin,
-                                bool aIsInBrowser,
+                                bool aIsInIsolatedMozBrowser,
                                 nsACString &result)
 {
   if (mJSNeedsSetup)
     SetupJS();
 
   if (!mJSRuntime || !mJSRuntime->IsOK())
     return NS_ERROR_NOT_AVAILABLE;
 
@@ -778,17 +779,17 @@ ProxyAutoConfig::GetProxyForURI(const ns
   JSAutoCompartment ac(cx, mJSRuntime->Global());
 
   // 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;
-  mRunningIsInBrowser = aIsInBrowser;
+  mRunningIsInIsolatedMozBrowser = aIsInIsolatedMozBrowser;
 
   nsresult rv = NS_ERROR_FAILURE;
   JS::RootedString uriString(cx, JS_NewStringCopyZ(cx, aTestURI.get()));
   JS::RootedString hostString(cx, JS_NewStringCopyZ(cx, aTestHost.get()));
 
   if (uriString && hostString) {
     JS::AutoValueArray<2> args(cx);
     args[0].setString(uriString);
@@ -860,21 +861,21 @@ ProxyAutoConfig::SrcAddress(const NetAdd
 
   PRNetAddr localName;
   if (PR_GetSockName(fd, &localName) != PR_SUCCESS) {
     PR_Close(fd);
     return false;
   }
 
   PR_Close(fd);
-  
+
   char dottedDecimal[128];
   if (PR_NetAddrToString(&localName, dottedDecimal, sizeof(dottedDecimal)) != PR_SUCCESS)
     return false;
-  
+
   localAddress.Assign(dottedDecimal);
 
   return true;
 }
 
 // hostName is run through a dns lookup and then a udp socket is connected
 // to the result. If that all works, the local IP address of the socket is
 // returned to the javascript caller and |*aResult| is set to true. Otherwise
@@ -942,17 +943,17 @@ ProxyAutoConfig::MyIPAddress(const JS::C
   // This is the google anycast dns address, but it doesn't matter if it
   // remains operable (as we don't contact it) as long as the address stays
   // in commonly routed IP address space.
   remoteDottedDecimal.AssignLiteral("8.8.8.8");
   if (!MyIPAddressTryHost(remoteDottedDecimal, 0, aArgs, &rvalAssigned) ||
       rvalAssigned) {
     return rvalAssigned;
   }
-  
+
   // finally, use the old algorithm based on the local hostname
   nsAutoCString hostName;
   nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
   // without multihomedDNS use such a short timeout that we are basically
   // just looking at the cache for raw dotted decimals
   uint32_t timeout = useMultihomedDNS ? kTimeout : 1;
   if (dns && NS_SUCCEEDED(dns->GetMyHostName(hostName)) &&
       PACResolveToString(hostName, localDottedDecimal, timeout)) {
@@ -1010,16 +1011,16 @@ ProxyAutoConfig::MyAppOrigin(const JS::C
     return false;
   }
 
   aArgs.rval().setString(origin);
   return true;
 }
 
 bool
-ProxyAutoConfig::IsInBrowser(const JS::CallArgs &aArgs)
+ProxyAutoConfig::IsInIsolatedMozBrowser(const JS::CallArgs &aArgs)
 {
-  aArgs.rval().setBoolean(mRunningIsInBrowser);
+  aArgs.rval().setBoolean(mRunningIsInIsolatedMozBrowser);
   return true;
 }
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/base/ProxyAutoConfig.h
+++ b/netwerk/base/ProxyAutoConfig.h
@@ -32,17 +32,17 @@ public:
   nsresult Init(const nsCString &aPACURI,
                 const nsCString &aPACScript);
   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     IsInBrowser(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 )
@@ -70,27 +70,31 @@ public:
    * @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 aIsInBrowser
-   *        True if the iframe has mozbrowser but has no mozapp attribute.
+   * @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 aIsInBrowser,
+                          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();
@@ -102,16 +106,16 @@ private:
   JSRuntimeWrapper *mJSRuntime;
   bool              mJSNeedsSetup;
   bool              mShutdown;
   nsCString         mPACScript;
   nsCString         mPACURI;
   nsCString         mRunningHost;
   uint32_t          mRunningAppId;
   nsString          mRunningAppOrigin;
-  bool              mRunningIsInBrowser;
+  bool              mRunningIsInIsolatedMozBrowser;
   nsCOMPtr<nsITimer> mTimer;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif  // ProxyAutoConfig_h__
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -554,31 +554,31 @@ NS_LoadGroupMatchesPrincipal(nsILoadGrou
 
     nsCOMPtr<nsILoadContext> loadContext;
     NS_QueryNotificationCallbacks(nullptr, aLoadGroup, NS_GET_IID(nsILoadContext),
                                   getter_AddRefs(loadContext));
     NS_ENSURE_TRUE(loadContext, false);
 
     // Verify load context appId and browser flag match the principal
     uint32_t contextAppId;
-    bool contextInBrowserElement;
+    bool contextInIsolatedBrowser;
     rv = loadContext->GetAppId(&contextAppId);
     NS_ENSURE_SUCCESS(rv, false);
-    rv = loadContext->GetIsInBrowserElement(&contextInBrowserElement);
+    rv = loadContext->GetIsInIsolatedMozBrowserElement(&contextInIsolatedBrowser);
     NS_ENSURE_SUCCESS(rv, false);
 
     uint32_t principalAppId;
     bool principalInIsolatedBrowser;
     rv = aPrincipal->GetAppId(&principalAppId);
     NS_ENSURE_SUCCESS(rv, false);
     rv = aPrincipal->GetIsInIsolatedMozBrowserElement(&principalInIsolatedBrowser);
     NS_ENSURE_SUCCESS(rv, false);
 
     return contextAppId == principalAppId &&
-           contextInBrowserElement == principalInIsolatedBrowser;
+           contextInIsolatedBrowser == principalInIsolatedBrowser;
 }
 
 nsresult
 NS_NewDownloader(nsIStreamListener   **result,
                  nsIDownloadObserver  *observer,
                  nsIFile              *downloadLocation /* = nullptr */)
 {
     nsresult rv;
@@ -1257,28 +1257,28 @@ NS_GetOriginAttributes(nsIChannel *aChan
     loadContext->GetOriginAttributes(doa);
     aAttributes.InheritFromDocShellToNecko(doa);
     return true;
 }
 
 bool
 NS_GetAppInfo(nsIChannel *aChannel,
               uint32_t *aAppID,
-              bool *aIsInBrowserElement)
+              bool *aIsInIsolatedMozBrowserElement)
 {
     nsCOMPtr<nsILoadContext> loadContext;
     NS_QueryNotificationCallbacks(aChannel, loadContext);
     if (!loadContext) {
         return false;
     }
 
     nsresult rv = loadContext->GetAppId(aAppID);
     NS_ENSURE_SUCCESS(rv, false);
 
-    rv = loadContext->GetIsInBrowserElement(aIsInBrowserElement);
+    rv = loadContext->GetIsInIsolatedMozBrowserElement(aIsInIsolatedMozBrowserElement);
     NS_ENSURE_SUCCESS(rv, false);
 
     return true;
 }
 
 bool
 NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport)
 {
--- a/netwerk/base/nsNetUtil.h
+++ b/netwerk/base/nsNetUtil.h
@@ -704,22 +704,22 @@ bool NS_HasBeenCrossOrigin(nsIChannel* a
 // Constants duplicated from nsIScriptSecurityManager so we avoid having necko
 // know about script security manager.
 #define NECKO_NO_APP_ID 0
 #define NECKO_UNKNOWN_APP_ID UINT32_MAX
 // special app id reserved for separating the safebrowsing cookie
 #define NECKO_SAFEBROWSING_APP_ID UINT32_MAX - 1
 
 /**
- * Gets AppId and isInBrowserElement from channel's nsILoadContext.
+ * Gets AppId and isInIsolatedMozBrowserElement from channel's nsILoadContext.
  * Returns false if error or channel's callbacks don't implement nsILoadContext.
  */
 bool NS_GetAppInfo(nsIChannel *aChannel,
                    uint32_t *aAppID,
-                   bool *aIsInBrowserElement);
+                   bool *aIsInIsolatedMozBrowserElement);
 
 /**
  *  Gets appId and browserOnly parameters from the TOPIC_WEB_APP_CLEAR_DATA
  *  nsIObserverService notification.  Used when clearing user data or
  *  uninstalling web apps.
  */
 nsresult NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
                                                 uint32_t *aAppID,
--- a/netwerk/base/nsPACMan.cpp
+++ b/netwerk/base/nsPACMan.cpp
@@ -232,22 +232,22 @@ private:
   bool                 mSetupPAC;
   nsCString            mSetupPACData;
   nsCString            mSetupPACURI;
 };
 
 //-----------------------------------------------------------------------------
 
 PendingPACQuery::PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
-                                 uint32_t appId, bool isInBrowser,
+                                 uint32_t appId, bool isInIsolatedMozBrowser,
                                  nsPACManCallback *callback,
                                  bool mainThreadResponse)
   : mPACMan(pacMan)
   , mAppId(appId)
-  , mIsInBrowser(isInBrowser)
+  , mIsInIsolatedMozBrowser(isInIsolatedMozBrowser)
   , mCallback(callback)
   , mOnMainThreadOnly(mainThreadResponse)
 {
   uri->GetAsciiSpec(mSpec);
   uri->GetAsciiHost(mHost);
   uri->GetScheme(mScheme);
   uri->GetPort(&mPort);
 
@@ -346,30 +346,31 @@ nsPACMan::Shutdown()
   PostCancelPendingQ(NS_ERROR_ABORT);
 
   RefPtr<WaitForThreadShutdown> runnable = new WaitForThreadShutdown(this);
   NS_DispatchToMainThread(runnable);
 }
 
 nsresult
 nsPACMan::AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
-                              bool isInBrowser, nsPACManCallback *callback,
+                              bool isInIsolatedMozBrowser,
+                              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)
     LoadPACFromURI(EmptyCString());
 
   RefPtr<PendingPACQuery> query =
-    new PendingPACQuery(this, uri, appId, isInBrowser, callback,
+    new PendingPACQuery(this, uri, appId, isInIsolatedMozBrowser, callback,
                         mainThreadResponse);
 
   if (IsPACURI(uri)) {
     // deal with this directly instead of queueing it
     query->Complete(NS_OK, EmptyCString());
     return NS_OK;
   }
 
@@ -615,17 +616,17 @@ nsPACMan::ProcessPending()
     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->mIsInBrowser,
+                                          query->mIsInIsolatedMozBrowser,
                                           pacString);
     query->Complete(status, pacString);
   }
 
   mInProgress = false;
   return true;
 }
 
@@ -718,17 +719,17 @@ nsPACMan::GetInterface(const nsIID &iid,
 }
 
 NS_IMETHODIMP
 nsPACMan::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel,
                                  uint32_t flags,
                                  nsIAsyncVerifyRedirectCallback *callback)
 {
   MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
-  
+
   nsresult rv = NS_OK;
   nsCOMPtr<nsIURI> pacURI;
   if (NS_FAILED((rv = newChannel->GetURI(getter_AddRefs(pacURI)))))
       return rv;
 
   rv = pacURI->GetSpec(mPACURIRedirectSpec);
   if (NS_FAILED(rv))
       return rv;
@@ -768,9 +769,8 @@ nsPACMan::Init(nsISystemProxySettings *s
     return rv;
 
   nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &nsPACMan::NamePACThread);
   // don't check return value as it is not a big deal for this to fail.
   mPACThread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
 
   return NS_OK;
 }
-
--- a/netwerk/base/nsPACMan.h
+++ b/netwerk/base/nsPACMan.h
@@ -50,36 +50,36 @@ public:
                                const nsCString &newPACURL) = 0;
 };
 
 class PendingPACQuery final : public nsRunnable,
                               public mozilla::LinkedListElement<PendingPACQuery>
 {
 public:
   PendingPACQuery(nsPACMan *pacMan, nsIURI *uri, uint32_t appId,
-                  bool isInBrowser, nsPACManCallback *callback,
+                  bool isInIsolatedMozBrowser, 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);     /* nsRunnable */
 
 private:
   nsPACMan                  *mPACMan;  // weak reference
 
 public:
   uint32_t                   mAppId;
-  bool                       mIsInBrowser;
+  bool                       mIsInIsolatedMozBrowser;
   nsString                   mAppOrigin;
 
 private:
   RefPtr<nsPACManCallback> mCallback;
   bool                       mOnMainThreadOnly;
 };
 
 /**
@@ -103,17 +103,17 @@ public:
    */
   void Shutdown();
 
   /**
    * 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.
--- a/netwerk/base/nsProtocolProxyService.cpp
+++ b/netwerk/base/nsProtocolProxyService.cpp
@@ -99,27 +99,27 @@ 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 aIsInBrowser,
+                          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)
-        , mIsInBrowser(aIsInBrowser)
+        , mIsInIsolatedMozBrowser(aIsInIsolatedMozBrowser)
         , mCallback(callback)
     {
         NS_ASSERTION(mCallback, "null callback");
     }
 
 private:
     ~nsAsyncResolveRequest()
     {
@@ -251,20 +251,20 @@ private:
             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,
-                                              mIsInBrowser, mResolveFlags,
+                                              mIsInIsolatedMozBrowser, mResolveFlags,
                                               mCallback);
                 rv = mPPS->mPACMan->AsyncGetProxyForURI(proxyURI, mAppId,
-                                                        mIsInBrowser,
+                                                        mIsInIsolatedMozBrowser,
                                                         newRequest,
                                                         true);
             }
 
             if (NS_FAILED(rv))
                 mCallback->OnProxyAvailable(this, mChannel, nullptr, rv);
 
             // do not call onproxyavailable() in SUCCESS case - the newRequest will
@@ -294,17 +294,17 @@ private:
     nsCString mPACURL;
     bool      mDispatched;
     uint32_t  mResolveFlags;
 
     nsProtocolProxyService            *mPPS;
     nsCOMPtr<nsIProtocolProxyService>  mXPComPPS;
     nsCOMPtr<nsIChannel>               mChannel;
     uint32_t                           mAppId;
-    bool                               mIsInBrowser;
+    bool                               mIsInIsolatedMozBrowser;
     nsCOMPtr<nsIProtocolProxyCallback> mCallback;
     nsCOMPtr<nsIProxyInfo>             mProxyInfo;
 };
 
 NS_IMPL_ISUPPORTS(nsAsyncResolveRequest, nsICancelable, nsIRunnable)
 
 //----------------------------------------------------------------------------
 
@@ -1256,37 +1256,37 @@ 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 isInBrowser = false;
-    NS_GetAppInfo(channel, &appId, &isInBrowser);
+    bool isInIsolatedMozBrowser = false;
+    NS_GetAppInfo(channel, &appId, &isInIsolatedMozBrowser);
 
     *result = nullptr;
     RefPtr<nsAsyncResolveRequest> ctx =
-        new nsAsyncResolveRequest(this, channel, appId, isInBrowser, flags,
-                                  callback);
+        new nsAsyncResolveRequest(this, channel, appId, isInIsolatedMozBrowser,
+                                  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, isInBrowser, info, flags,
+    rv = Resolve_Internal(channel, appId, isInIsolatedMozBrowser, 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);
@@ -1298,17 +1298,18 @@ 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, isInBrowser, ctx, true);
+    rv = mPACMan->AsyncGetProxyForURI(uri, appId, isInIsolatedMozBrowser, ctx,
+                                      true);
     if (NS_SUCCEEDED(rv))
         ctx.forget(result);
     return rv;
 }
 
 // nsIProtocolProxyService
 NS_IMETHODIMP
 nsProtocolProxyService::AsyncResolve2(nsIChannel *channel, uint32_t flags,
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -133,17 +133,17 @@ nsHttpTransaction::nsHttpTransaction()
     , mForTakeResponseHead(nullptr)
     , mResponseHeadTaken(false)
     , mSubmittedRatePacing(false)
     , mPassedRatePacing(false)
     , mSynchronousRatePaceRequest(false)
     , mCountRecv(0)
     , mCountSent(0)
     , mAppId(NECKO_NO_APP_ID)
-    , mIsInBrowser(false)
+    , mIsInIsolatedMozBrowser(false)
     , mClassOfService(0)
 {
     LOG(("Creating nsHttpTransaction @%p\n", this));
     gHttpHandler->GetMaxPipelineObjectSize(&mMaxPipelineObjectSize);
 
 #ifdef MOZ_VALGRIND
     memset(&mSelfAddr, 0, sizeof(NetAddr));
     memset(&mPeerAddr, 0, sizeof(NetAddr));
@@ -243,17 +243,17 @@ nsHttpTransaction::Init(uint32_t caps,
     } else {
         // there is no observer, so don't use it
         activityDistributorActive = false;
         mActivityDistributor = nullptr;
     }
     mChannel = do_QueryInterface(eventsink);
     nsCOMPtr<nsIChannel> channel = do_QueryInterface(eventsink);
     if (channel) {
-        NS_GetAppInfo(channel, &mAppId, &mIsInBrowser);
+        NS_GetAppInfo(channel, &mAppId, &mIsInIsolatedMozBrowser);
     }
 
 #ifdef MOZ_WIDGET_GONK
     if (mAppId != NECKO_NO_APP_ID) {
         nsCOMPtr<nsINetworkInfo> activeNetworkInfo;
         GetActiveNetworkInfo(activeNetworkInfo);
         mActiveNetworkInfo =
             new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo);
@@ -864,19 +864,19 @@ nsHttpTransaction::SaveNetworkStats(bool
     // only when the total amount exceeds the predefined
     // threshold.
     uint64_t totalBytes = mCountRecv + mCountSent;
     if (!enforce && totalBytes < NETWORK_STATS_THRESHOLD) {
         return NS_OK;
     }
 
     // Create the event to save the network statistics.
-    // the event is then dispathed to the main thread.
+    // the event is then dispatched to the main thread.
     RefPtr<nsRunnable> event =
-        new SaveNetworkStatsEvent(mAppId, mIsInBrowser, mActiveNetworkInfo,
+        new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowser, mActiveNetworkInfo,
                                   mCountRecv, mCountSent, false);
     NS_DispatchToMainThread(event);
 
     // Reset the counters after saving.
     mCountSent = 0;
     mCountRecv = 0;
 
     return NS_OK;
--- a/netwerk/protocol/http/nsHttpTransaction.h
+++ b/netwerk/protocol/http/nsHttpTransaction.h
@@ -412,17 +412,17 @@ private:
     bool mSynchronousRatePaceRequest;
     nsCOMPtr<nsICancelable> mTokenBucketCancel;
 
 // These members are used for network per-app metering (bug 746073)
 // Currently, they are only available on gonk.
     uint64_t                           mCountRecv;
     uint64_t                           mCountSent;
     uint32_t                           mAppId;
-    bool                               mIsInBrowser;
+    bool                               mIsInIsolatedMozBrowser;
 #ifdef MOZ_WIDGET_GONK
     nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
 #endif
     nsresult                           SaveNetworkStats(bool);
     void                               CountRecvBytes(uint64_t recvBytes)
     {
         mCountRecv += recvBytes;
         SaveNetworkStats(false);
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -1171,17 +1171,17 @@ WebSocketChannel::WebSocketChannel() :
   mCurrentOutSent(0),
   mDynamicOutputSize(0),
   mDynamicOutput(nullptr),
   mPrivateBrowsing(false),
   mConnectionLogService(nullptr),
   mCountRecv(0),
   mCountSent(0),
   mAppId(NECKO_NO_APP_ID),
-  mIsInBrowser(false)
+  mIsInIsolatedMozBrowser(false)
 {
   MOZ_ASSERT(NS_IsMainThread(), "not main thread");
 
   LOG(("WebSocketChannel::WebSocketChannel() %p\n", this));
 
   nsWSAdmissionManager::Init();
 
   mFramePtr = mBuffer = static_cast<uint8_t *>(moz_xmalloc(mBufferSize));
@@ -1383,17 +1383,17 @@ WebSocketChannel::BeginOpenInternal()
   nsCOMPtr<nsIChannel> localChannel = do_QueryInterface(mChannel, &rv);
   if (NS_FAILED(rv)) {
     LOG(("WebSocketChannel::BeginOpenInternal: cannot async open\n"));
     AbortSession(NS_ERROR_UNEXPECTED);
     return;
   }
 
   if (localChannel) {
-    NS_GetAppInfo(localChannel, &mAppId, &mIsInBrowser);
+    NS_GetAppInfo(localChannel, &mAppId, &mIsInIsolatedMozBrowser);
   }
 
 #ifdef MOZ_WIDGET_GONK
   if (mAppId != NECKO_NO_APP_ID) {
     nsCOMPtr<nsINetworkInfo> activeNetworkInfo;
     GetActiveNetworkInfo(activeNetworkInfo);
     mActiveNetworkInfo =
       new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo);
@@ -3904,19 +3904,19 @@ WebSocketChannel::SaveNetworkStats(bool 
   // only when the total amount exceeds the predefined
   // threshold.
   uint64_t totalBytes = countRecv + countSent;
   if (!enforce && totalBytes < NETWORK_STATS_THRESHOLD) {
     return NS_OK;
   }
 
   // Create the event to save the network statistics.
-  // the event is then dispathed to the main thread.
+  // the event is then dispatched to the main thread.
   RefPtr<nsRunnable> event =
-    new SaveNetworkStatsEvent(mAppId, mIsInBrowser, mActiveNetworkInfo,
+    new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowser, mActiveNetworkInfo,
                               countRecv, countSent, false);
   NS_DispatchToMainThread(event);
 
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
--- a/netwerk/protocol/websocket/WebSocketChannel.h
+++ b/netwerk/protocol/websocket/WebSocketChannel.h
@@ -295,17 +295,17 @@ private:
 
   nsCOMPtr<nsIDashboardEventNotifier> mConnectionLogService;
 
 // These members are used for network per-app metering (bug 855949)
 // Currently, they are only available on gonk.
   Atomic<uint64_t, Relaxed>       mCountRecv;
   Atomic<uint64_t, Relaxed>       mCountSent;
   uint32_t                        mAppId;
-  bool                            mIsInBrowser;
+  bool                            mIsInIsolatedMozBrowser;
 #ifdef MOZ_WIDGET_GONK
   nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
 #endif
   nsresult                        SaveNetworkStats(bool);
   void                            CountRecvBytes(uint64_t recvBytes)
   {
     mCountRecv += recvBytes;
     SaveNetworkStats(false);
--- a/netwerk/test/unit/head_channels.js
+++ b/netwerk/test/unit/head_channels.js
@@ -205,17 +205,17 @@ ChannelEventSink.prototype = {
 
 
 /**
  * Class that implements nsILoadContext.  Use it as callbacks for channel when
  * test needs it.
  */
 function LoadContextCallback(appId, inIsolatedMozBrowser, isPrivate, isContent) {
   this.appId = appId;
-  this.isInBrowserElement = inIsolatedMozBrowser;
+  this.isInIsolatedMozBrowserElement = inIsolatedMozBrowser;
   this.originAttributes = {
     appId: appId,
     inIsolatedMozBrowser: inIsolatedMozBrowser
   };
   this.usePrivateBrowsing = isPrivate;
   this.isContent = isContent;
 }
 
@@ -234,9 +234,8 @@ LoadContextCallback.prototype = {
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
   getInterface: function(iid) {
     if (iid.equals(Ci.nsILoadContext))
       return this;
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
 }
-
--- a/netwerk/test/unit/test_cache_jar.js
+++ b/netwerk/test/unit/test_cache_jar.js
@@ -19,17 +19,17 @@ function cached_handler(metadata, respon
   handlers_called++;
 }
 
 function makeChan(url, appId, inIsolatedMozBrowser) {
   var chan = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true})
                     .QueryInterface(Ci.nsIHttpChannel);
   chan.notificationCallbacks = {
     appId: appId,
-    isInBrowserElement: inIsolatedMozBrowser,
+    isInIsolatedMozBrowserElement: inIsolatedMozBrowser,
     originAttributes: {
       appId: appId,
       inIsolatedMozBrowser: inIsolatedMozBrowser,
     },
     QueryInterface: function(iid) {
       if (iid.equals(Ci.nsILoadContext))
         return this;
       throw Cr.NS_ERROR_NO_INTERFACE;
@@ -93,17 +93,17 @@ function run_test() {
   httpserv.start(-1);
   gTests = run_all_tests();
   gTests.next();
 }
 
 function doneFirstLoad(req, buffer, expected) {
   // Load it again, make sure it hits the cache
   var nc = req.notificationCallbacks.getInterface(Ci.nsILoadContext);
-  var chan = makeChan(URL, nc.appId, nc.isInBrowserElement);
+  var chan = makeChan(URL, nc.appId, nc.isInIsolatedMozBrowserElement);
   chan.asyncOpen2(new ChannelListener(doneSecondLoad, expected));
 }
 
 function doneSecondLoad(req, buffer, expected) {
   do_check_eq(handlers_called, expected);
   try {
     gTests.next();
   } catch (x) {
--- a/netwerk/test/unit/test_protocolproxyservice.js
+++ b/netwerk/test/unit/test_protocolproxyservice.js
@@ -563,17 +563,17 @@ function run_pac3_test() {
   prefs.setCharPref("network.proxy.autoconfig_url", pac);
   prefs.setBoolPref("network.proxy.proxy_over_tls", false);
 
   var req = pps.asyncResolve(channel, 0, new TestResolveCallback(null, run_pac4_test));
 }
 
 function run_pac4_test() {
   var appId = 10;
-  var isInBrowser = true;
+  var isInIsolatedMozBrowser = true;
   var appOrigin = "apps://browser.gaiamobile.com";
 
   // 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");
@@ -584,26 +584,26 @@ function run_pac4_test() {
   AppsUtils.getAppByLocalId = function(aAppId) {
     var app = { origin: appOrigin };
     return app;
   };
 
   var pac = 'data:text/plain,' +
             'function FindProxyForURL(url, host) {' +
             ' if (myAppId() == ' + appId +
-            ' && isInBrowser() == ' + isInBrowser +
+            ' && isInIsolatedMozBrowser() == ' + isInIsolatedMozBrowser +
             ' && myAppOrigin() == "' + appOrigin + '")' +
             '   return "PROXY foopy:8080; DIRECT";' +
             '}';
   var channel = NetUtil.newChannel({
     uri: "http://www.mozilla.org/",
     loadUsingSystemPrincipal: true
   });
   channel.notificationCallbacks =
-    AppsUtils.createLoadContext(appId, isInBrowser);
+    AppsUtils.createLoadContext(appId, isInIsolatedMozBrowser);
 
   // Configure PAC
   prefs.setIntPref("network.proxy.type", 2);
   prefs.setCharPref("network.proxy.autoconfig_url", pac);
 
   var req = pps.asyncResolve(channel, 0, new TestResolveCallback("http", finish_pac_test));
 }
 
@@ -740,17 +740,17 @@ function run_proxy_host_filters_test() {
 }
 
 function host_filters_1()
 {
   // Check the hosts that should be proxied
   uriStrUseProxyList = [ "http://www.mozilla.com/",
                              "http://mail.google.com/",
                              "http://somehost.domain.co.uk/",
-                             "http://somelocalhost/" ];  
+                             "http://somelocalhost/" ];
   check_host_filters(uriStrUseProxyList, false, host_filters_2);
 }
 
 function host_filters_2()
 {
   // Set no_proxies_on to include local hosts
   prefs.setCharPref("network.proxy.no_proxies_on", hostFilterList + ", <local>");
   do_check_eq(prefs.getCharPref("network.proxy.no_proxies_on"),
@@ -764,17 +764,17 @@ function host_filters_3()
 {
   check_host_filters(uriStrUseProxyList, false, host_filters_4);
 }
 
 function host_filters_4()
 {
   // Cleanup
   prefs.setCharPref("network.proxy.no_proxies_on", "");
-  do_check_eq(prefs.getCharPref("network.proxy.no_proxies_on"), "");  
+  do_check_eq(prefs.getCharPref("network.proxy.no_proxies_on"), "");
 
   run_myipaddress_test();
 }
 
 function run_myipaddress_test()
 {
   // This test makes sure myIpAddress() comes up with some valid
   // IP address other than localhost. The DUT must be configured with
@@ -806,17 +806,17 @@ function myipaddress_callback(pi)
   do_check_neq(pi, null);
   do_check_eq(pi.type, "http");
   do_check_eq(pi.port, 1234);
 
   // make sure we didn't return localhost
   do_check_neq(pi.host, null);
   do_check_neq(pi.host, "127.0.0.1");
   do_check_neq(pi.host, "::1");
-  
+
   run_myipaddress_test_2();
 }
 
 function run_myipaddress_test_2()
 {
   // test that myIPAddress() can be used outside of the scope of
   // FindProxyForURL(). bug 829646.
 
@@ -844,17 +844,17 @@ function myipaddress2_callback(pi)
   do_check_neq(pi, null);
   do_check_eq(pi.type, "http");
   do_check_eq(pi.port, 5678);
 
   // make sure we didn't return localhost
   do_check_neq(pi.host, null);
   do_check_neq(pi.host, "127.0.0.1");
   do_check_neq(pi.host, "::1");
-  
+
   run_failed_script_test();
 }
 
 function run_failed_script_test()
 {
   // test to make sure we go direct with invalid PAC
   var pac = 'data:text/plain,' +
             '\nfor(;\n';
--- a/netwerk/test/unit_ipc/child_app_offline.js
+++ b/netwerk/test/unit_ipc/child_app_offline.js
@@ -6,17 +6,17 @@ function inChildProcess() {
            .processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
 }
 
 function makeChan(url, appId, inIsolatedMozBrowser) {
   var chan = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true})
                     .QueryInterface(Ci.nsIHttpChannel);
   chan.notificationCallbacks = {
     appId: appId,
-    isInBrowserElement: inIsolatedMozBrowser,
+    isInIsolatedMozBrowserElement: inIsolatedMozBrowser,
     originAttributes: {
       appId: appId,
       inIsolatedMozBrowser: inIsolatedMozBrowser,
     },
     QueryInterface: function(iid) {
       if (iid.equals(Ci.nsILoadContext))
         return this;
       throw Cr.NS_ERROR_NO_INTERFACE;
--- a/uriloader/prefetch/OfflineCacheUpdateParent.cpp
+++ b/uriloader/prefetch/OfflineCacheUpdateParent.cpp
@@ -254,20 +254,20 @@ OfflineCacheUpdateParent::GetUseRemoteTa
 
 NS_IMETHODIMP
 OfflineCacheUpdateParent::SetRemoteTabs(bool aUseRemoteTabs)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-OfflineCacheUpdateParent::GetIsInBrowserElement(bool *aIsInBrowserElement)
+OfflineCacheUpdateParent::GetIsInIsolatedMozBrowserElement(bool *aIsInIsolatedMozBrowserElement)
 {
     NS_ENSURE_TRUE(mLoadingPrincipal, NS_ERROR_UNEXPECTED);
-    return mLoadingPrincipal->GetIsInIsolatedMozBrowserElement(aIsInBrowserElement);
+    return mLoadingPrincipal->GetIsInIsolatedMozBrowserElement(aIsInIsolatedMozBrowserElement);
 }
 
 NS_IMETHODIMP
 OfflineCacheUpdateParent::GetAppId(uint32_t *aAppId)
 {
     NS_ENSURE_TRUE(mLoadingPrincipal, NS_ERROR_UNEXPECTED);
     return mLoadingPrincipal->GetAppId(aAppId);
 }