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
This commit is contained in:
J. Ryan Stinnett 2016-02-17 20:55:57 -06:00
parent 9c1253b6c8
commit 8bb8ba83be
31 changed files with 129 additions and 109 deletions

View File

@ -34,7 +34,7 @@ nsILoadContext::GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs)
aAttrs = attrs;
return true;
}
namespace mozilla {
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
@ -172,13 +172,13 @@ LoadContext::SetRemoteTabs(bool aUseRemoteTabs)
}
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;
}

View File

@ -3500,7 +3500,8 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
return false;
}
if (targetDS->GetIsInBrowserElement() != accessingDS->GetIsInBrowserElement() ||
if (targetDS->GetIsInIsolatedMozBrowserElement() !=
accessingDS->GetIsInIsolatedMozBrowserElement() ||
targetDS->GetAppId() != accessingDS->GetAppId()) {
return false;
}
@ -13938,9 +13939,9 @@ nsDocShell::GetInheritedFrameType()
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetIsInBrowserElement(bool* aIsInBrowserElement)
nsDocShell::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
{
*aIsInBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser);
*aIsInIsolatedMozBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser);
return NS_OK;
}

View File

@ -780,16 +780,21 @@ interface nsIDocShell : nsIDocShellTreeItem
[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

View File

@ -116,9 +116,13 @@ interface nsILoadContext : nsISupports
[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

View File

@ -156,7 +156,7 @@ this.AppsUtils = {
associatedWindow: null,
topWindow : null,
appId: aAppId,
isInBrowserElement: aInIsolatedMozBrowser,
isInIsolatedMozBrowserElement: aInIsolatedMozBrowser,
originAttributes: {
appId: aAppId,
inIsolatedMozBrowser: aInIsolatedMozBrowser

View File

@ -3536,7 +3536,7 @@ this.DOMApplicationRegistry = {
// nsILoadContext
appId: aOldApp.installerAppId,
isInBrowserElement: aOldApp.installerIsBrowser,
isInIsolatedMozBrowserElement: aOldApp.installerIsBrowser,
originAttributes: {
appId: aOldApp.installerAppId,
inIsolatedMozBrowser: aOldApp.installerIsBrowser

View File

@ -62,7 +62,7 @@ function runTests() {
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}

View File

@ -3103,7 +3103,7 @@ public:
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

View File

@ -738,9 +738,9 @@ this.NetworkStatsService = {
/*
* 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) {
@ -761,7 +761,7 @@ this.NetworkStatsService = {
}
let stats = { appId: aAppId,
isInBrowser: aIsInBrowser,
isInBrowser: aIsInIsolatedMozBrowser,
serviceType: aServiceType,
networkId: this._networks[netId].network.id,
networkType: this._networks[netId].network.type,

View File

@ -29,7 +29,7 @@ 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) {
@ -40,7 +40,7 @@ NetworkStatsServiceProxy.prototype = {
}
if (DEBUG) {
debug("saveAppStats: " + aAppId + " " + aIsInBrowser + " " +
debug("saveAppStats: " + aAppId + " " + aIsInIsolatedMozBrowser + " " +
aNetworkInfo.type + " " + aTimeStamp + " " +
aRxBytes + " " + aTxBytes + " " + aIsAccumulative);
}
@ -49,7 +49,7 @@ NetworkStatsServiceProxy.prototype = {
aCallback = aCallback.notify;
}
NetworkStatsService.saveStats(aAppId, aIsInBrowser, "", aNetworkInfo,
NetworkStatsService.saveStats(aAppId, aIsInIsolatedMozBrowser, "", aNetworkInfo,
aTimeStamp, aRxBytes, aTxBytes,
aIsAccumulative, aCallback);
},

View File

@ -22,7 +22,12 @@ 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
@ -31,7 +36,7 @@ interface nsINetworkStatsServiceProxy : nsISupports
* @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,

View File

@ -58,7 +58,7 @@ RequestSyncManager.prototype = {
return this.sendMessage("RequestSyncManager:Registrations", {});
},
setPolicy: function(aTask, aOrigin, aManifestURL, aIsInBrowserElement,
setPolicy: function(aTask, aOrigin, aManifestURL, aIsInIsolatedMozBrowserElement,
aState, aOverwrittenMinInterval) {
debug('setPolicy');
@ -66,19 +66,19 @@ RequestSyncManager.prototype = {
{ 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) {

View File

@ -168,7 +168,7 @@ ChannelListener.prototype = {
*/
function LoadContextCallback(appId, inIsolatedMozBrowser, isPrivate, isContent) {
this.appId = appId;
this.isInBrowserElement = inIsolatedMozBrowser;
this.isInIsolatedMozBrowserElement = inIsolatedMozBrowser;
this.usePrivateBrowsing = isPrivate;
this.isContent = isContent;
this.originAttributes = {

View File

@ -46,13 +46,13 @@ GetActiveNetworkInfo(nsCOMPtr<nsINetworkInfo> &aNetworkInfo)
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),
@ -75,7 +75,7 @@ public:
// save the network stats through NetworkStatsServiceProxy
mNetworkStatsServiceProxy->SaveAppStats(mAppId,
mIsInBrowser,
mIsInIsolatedMozBrowser,
mActiveNetworkInfo,
PR_Now() / 1000,
mCountRecv,
@ -87,7 +87,7 @@ public:
}
private:
uint32_t mAppId;
bool mIsInBrowser;
bool mIsInIsolatedMozBrowser;
nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
uint64_t mCountRecv;
uint64_t mCountSent;

View File

@ -107,7 +107,7 @@ PACGenerator.prototype = {
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.

View File

@ -500,23 +500,24 @@ bool PACMyAppOrigin(JSContext *cx, unsigned int argc, JS::Value *vp)
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
@ -554,7 +555,7 @@ static const JSFunctionSpec PACGlobalFunctions[] = {
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
};
@ -636,7 +637,7 @@ private:
* 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);
@ -764,7 +765,7 @@ ProxyAutoConfig::GetProxyForURI(const nsCString &aTestURI,
const nsCString &aTestHost,
uint32_t aAppId,
const nsString &aAppOrigin,
bool aIsInBrowser,
bool aIsInIsolatedMozBrowser,
nsACString &result)
{
if (mJSNeedsSetup)
@ -783,7 +784,7 @@ ProxyAutoConfig::GetProxyForURI(const nsCString &aTestURI,
mRunningHost = aTestHost;
mRunningAppId = aAppId;
mRunningAppOrigin = aAppOrigin;
mRunningIsInBrowser = aIsInBrowser;
mRunningIsInIsolatedMozBrowser = aIsInIsolatedMozBrowser;
nsresult rv = NS_ERROR_FAILURE;
JS::RootedString uriString(cx, JS_NewStringCopyZ(cx, aTestURI.get()));
@ -865,11 +866,11 @@ ProxyAutoConfig::SrcAddress(const NetAddr *remoteAddress, nsCString &localAddres
}
PR_Close(fd);
char dottedDecimal[128];
if (PR_NetAddrToString(&localName, dottedDecimal, sizeof(dottedDecimal)) != PR_SUCCESS)
return false;
localAddress.Assign(dottedDecimal);
return true;
@ -947,7 +948,7 @@ ProxyAutoConfig::MyIPAddress(const JS::CallArgs &aArgs)
rvalAssigned) {
return rvalAssigned;
}
// finally, use the old algorithm based on the local hostname
nsAutoCString hostName;
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
@ -1015,9 +1016,9 @@ ProxyAutoConfig::MyAppOrigin(const JS::CallArgs &aArgs)
}
bool
ProxyAutoConfig::IsInBrowser(const JS::CallArgs &aArgs)
ProxyAutoConfig::IsInIsolatedMozBrowser(const JS::CallArgs &aArgs)
{
aArgs.rval().setBoolean(mRunningIsInBrowser);
aArgs.rval().setBoolean(mRunningIsInIsolatedMozBrowser);
return true;
}

View File

@ -37,7 +37,7 @@ public:
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);
@ -75,8 +75,12 @@ public:
* 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.
@ -85,7 +89,7 @@ public:
const nsCString &aTestHost,
uint32_t aAppId,
const nsString &aAppOrigin,
bool aIsInBrowser,
bool aIsInIsolatedMozBrowser,
nsACString &result);
private:
@ -107,7 +111,7 @@ private:
nsCString mRunningHost;
uint32_t mRunningAppId;
nsString mRunningAppOrigin;
bool mRunningIsInBrowser;
bool mRunningIsInIsolatedMozBrowser;
nsCOMPtr<nsITimer> mTimer;
};

View File

@ -559,10 +559,10 @@ NS_LoadGroupMatchesPrincipal(nsILoadGroup *aLoadGroup,
// 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;
@ -573,7 +573,7 @@ NS_LoadGroupMatchesPrincipal(nsILoadGroup *aLoadGroup,
NS_ENSURE_SUCCESS(rv, false);
return contextAppId == principalAppId &&
contextInBrowserElement == principalInIsolatedBrowser;
contextInIsolatedBrowser == principalInIsolatedBrowser;
}
nsresult
@ -1262,7 +1262,7 @@ NS_GetOriginAttributes(nsIChannel *aChannel,
bool
NS_GetAppInfo(nsIChannel *aChannel,
uint32_t *aAppID,
bool *aIsInBrowserElement)
bool *aIsInIsolatedMozBrowserElement)
{
nsCOMPtr<nsILoadContext> loadContext;
NS_QueryNotificationCallbacks(aChannel, loadContext);
@ -1273,7 +1273,7 @@ NS_GetAppInfo(nsIChannel *aChannel,
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;

View File

@ -709,12 +709,12 @@ bool NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport = false);
#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

View File

@ -237,12 +237,12 @@ private:
//-----------------------------------------------------------------------------
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)
{
@ -351,7 +351,8 @@ nsPACMan::Shutdown()
nsresult
nsPACMan::AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
bool isInBrowser, nsPACManCallback *callback,
bool isInIsolatedMozBrowser,
nsPACManCallback *callback,
bool mainThreadResponse)
{
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
@ -364,7 +365,7 @@ nsPACMan::AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
LoadPACFromURI(EmptyCString());
RefPtr<PendingPACQuery> query =
new PendingPACQuery(this, uri, appId, isInBrowser, callback,
new PendingPACQuery(this, uri, appId, isInIsolatedMozBrowser, callback,
mainThreadResponse);
if (IsPACURI(uri)) {
@ -620,7 +621,7 @@ nsPACMan::ProcessPending()
if (!completed) {
nsresult status = mPAC.GetProxyForURI(query->mSpec, query->mHost,
query->mAppId, query->mAppOrigin,
query->mIsInBrowser,
query->mIsInIsolatedMozBrowser,
pacString);
query->Complete(status, pacString);
}
@ -723,7 +724,7 @@ nsPACMan::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel,
nsIAsyncVerifyRedirectCallback *callback)
{
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
nsresult rv = NS_OK;
nsCOMPtr<nsIURI> pacURI;
if (NS_FAILED((rv = newChannel->GetURI(getter_AddRefs(pacURI)))))
@ -773,4 +774,3 @@ nsPACMan::Init(nsISystemProxySettings *systemProxySettings)
return NS_OK;
}

View File

@ -55,9 +55,9 @@ class PendingPACQuery final : public nsRunnable,
{
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);
@ -74,7 +74,7 @@ private:
public:
uint32_t mAppId;
bool mIsInBrowser;
bool mIsInIsolatedMozBrowser;
nsString mAppOrigin;
private:
@ -108,7 +108,7 @@ public:
* 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

View File

@ -104,7 +104,7 @@ 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)
@ -114,7 +114,7 @@ public:
, mXPComPPS(pps)
, mChannel(channel)
, mAppId(aAppId)
, mIsInBrowser(aIsInBrowser)
, mIsInIsolatedMozBrowser(aIsInIsolatedMozBrowser)
, mCallback(callback)
{
NS_ASSERTION(mCallback, "null callback");
@ -256,10 +256,10 @@ private:
// 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);
}
@ -299,7 +299,7 @@ private:
nsCOMPtr<nsIProtocolProxyService> mXPComPPS;
nsCOMPtr<nsIChannel> mChannel;
uint32_t mAppId;
bool mIsInBrowser;
bool mIsInIsolatedMozBrowser;
nsCOMPtr<nsIProtocolProxyCallback> mCallback;
nsCOMPtr<nsIProxyInfo> mProxyInfo;
};
@ -1261,13 +1261,13 @@ nsProtocolProxyService::AsyncResolveInternal(nsIChannel *channel, uint32_t flags
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);
@ -1281,7 +1281,7 @@ nsProtocolProxyService::AsyncResolveInternal(nsIChannel *channel, uint32_t flags
// 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;
@ -1303,7 +1303,8 @@ nsProtocolProxyService::AsyncResolveInternal(nsIChannel *channel, uint32_t flags
// 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;

View File

@ -138,7 +138,7 @@ nsHttpTransaction::nsHttpTransaction()
, mCountRecv(0)
, mCountSent(0)
, mAppId(NECKO_NO_APP_ID)
, mIsInBrowser(false)
, mIsInIsolatedMozBrowser(false)
, mClassOfService(0)
{
LOG(("Creating nsHttpTransaction @%p\n", this));
@ -248,7 +248,7 @@ nsHttpTransaction::Init(uint32_t caps,
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
@ -869,9 +869,9 @@ nsHttpTransaction::SaveNetworkStats(bool enforce)
}
// 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);

View File

@ -417,7 +417,7 @@ private:
uint64_t mCountRecv;
uint64_t mCountSent;
uint32_t mAppId;
bool mIsInBrowser;
bool mIsInIsolatedMozBrowser;
#ifdef MOZ_WIDGET_GONK
nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
#endif

View File

@ -1176,7 +1176,7 @@ WebSocketChannel::WebSocketChannel() :
mCountRecv(0),
mCountSent(0),
mAppId(NECKO_NO_APP_ID),
mIsInBrowser(false)
mIsInIsolatedMozBrowser(false)
{
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
@ -1388,7 +1388,7 @@ WebSocketChannel::BeginOpenInternal()
}
if (localChannel) {
NS_GetAppInfo(localChannel, &mAppId, &mIsInBrowser);
NS_GetAppInfo(localChannel, &mAppId, &mIsInIsolatedMozBrowser);
}
#ifdef MOZ_WIDGET_GONK
@ -3909,9 +3909,9 @@ WebSocketChannel::SaveNetworkStats(bool enforce)
}
// 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);

View File

@ -300,7 +300,7 @@ private:
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

View File

@ -210,7 +210,7 @@ ChannelEventSink.prototype = {
*/
function LoadContextCallback(appId, inIsolatedMozBrowser, isPrivate, isContent) {
this.appId = appId;
this.isInBrowserElement = inIsolatedMozBrowser;
this.isInIsolatedMozBrowserElement = inIsolatedMozBrowser;
this.originAttributes = {
appId: appId,
inIsolatedMozBrowser: inIsolatedMozBrowser
@ -239,4 +239,3 @@ LoadContextCallback.prototype = {
throw Cr.NS_ERROR_NO_INTERFACE;
},
}

View File

@ -24,7 +24,7 @@ function makeChan(url, appId, inIsolatedMozBrowser) {
.QueryInterface(Ci.nsIHttpChannel);
chan.notificationCallbacks = {
appId: appId,
isInBrowserElement: inIsolatedMozBrowser,
isInIsolatedMozBrowserElement: inIsolatedMozBrowser,
originAttributes: {
appId: appId,
inIsolatedMozBrowser: inIsolatedMozBrowser,
@ -98,7 +98,7 @@ function run_test() {
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));
}

View File

@ -568,7 +568,7 @@ function run_pac3_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
@ -589,7 +589,7 @@ function run_pac4_test() {
var pac = 'data:text/plain,' +
'function FindProxyForURL(url, host) {' +
' if (myAppId() == ' + appId +
' && isInBrowser() == ' + isInBrowser +
' && isInIsolatedMozBrowser() == ' + isInIsolatedMozBrowser +
' && myAppOrigin() == "' + appOrigin + '")' +
' return "PROXY foopy:8080; DIRECT";' +
'}';
@ -598,7 +598,7 @@ function run_pac4_test() {
loadUsingSystemPrincipal: true
});
channel.notificationCallbacks =
AppsUtils.createLoadContext(appId, isInBrowser);
AppsUtils.createLoadContext(appId, isInIsolatedMozBrowser);
// Configure PAC
prefs.setIntPref("network.proxy.type", 2);
@ -745,7 +745,7 @@ function host_filters_1()
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);
}
@ -769,7 +769,7 @@ 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();
}
@ -811,7 +811,7 @@ function myipaddress_callback(pi)
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();
}
@ -849,7 +849,7 @@ function myipaddress2_callback(pi)
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();
}

View File

@ -11,7 +11,7 @@ function makeChan(url, appId, inIsolatedMozBrowser) {
.QueryInterface(Ci.nsIHttpChannel);
chan.notificationCallbacks = {
appId: appId,
isInBrowserElement: inIsolatedMozBrowser,
isInIsolatedMozBrowserElement: inIsolatedMozBrowser,
originAttributes: {
appId: appId,
inIsolatedMozBrowser: inIsolatedMozBrowser,

View File

@ -259,10 +259,10 @@ OfflineCacheUpdateParent::SetRemoteTabs(bool aUseRemoteTabs)
}
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