Backed out changesets 41d0ad0271a6, 2bda66cf60fd, and dd1fc46d4d56 (bug 1118845) for B2G mochitest failures.

CLOSED TREE

--HG--
extra : amend_source : 19240e92f40420f384a7835383cbb2be75350ddc
This commit is contained in:
Ryan VanderMeulen 2015-01-08 21:50:19 -05:00
parent 1c5c3c52d9
commit 20c93a56ae
7 changed files with 12 additions and 46 deletions

View File

@ -11,7 +11,7 @@ namespace mozilla {
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase)
LoadContext::LoadContext(nsIPrincipal* aPrincipal)
: mTopFrameElement(nullptr)
, mNestedFrameId(0)
, mIsContent(true)
@ -24,15 +24,6 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
if (!aOptionalBase) {
return;
}
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
}
//-----------------------------------------------------------------------------

View File

@ -107,8 +107,7 @@ public:
// Constructor for creating a LoadContext with a given principal's appId and
// browser flag.
explicit LoadContext(nsIPrincipal* aPrincipal,
nsILoadContext* aOptionalBase = nullptr);
explicit LoadContext(nsIPrincipal* aPrincipal);
private:
~LoadContext() {}

View File

@ -2253,8 +2253,7 @@ RuntimeService::CreateSharedWorkerInternal(const GlobalObject& aGlobal,
WorkerPrivate::LoadInfo loadInfo;
nsresult rv = WorkerPrivate::GetLoadInfo(cx, window, nullptr, aScriptURL,
false, WorkerPrivate::ForceNewLoadGroup,
&loadInfo);
false, &loadInfo);
NS_ENSURE_SUCCESS(rv, rv);
return CreateSharedWorkerFromLoadInfo(cx, &loadInfo, aScriptURL, aName, aType,

View File

@ -3988,8 +3988,7 @@ WorkerPrivate::Constructor(JSContext* aCx,
stackLoadInfo.emplace();
nsresult rv = GetLoadInfo(aCx, nullptr, parent, aScriptURL,
aIsChromeWorker, InheritLoadGroup,
stackLoadInfo.ptr());
aIsChromeWorker, stackLoadInfo.ptr());
if (NS_FAILED(rv)) {
scriptloader::ReportLoadError(aCx, aScriptURL, rv, !parent);
aRv.Throw(rv);
@ -4044,9 +4043,7 @@ WorkerPrivate::Constructor(JSContext* aCx,
nsresult
WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow,
WorkerPrivate* aParent, const nsAString& aScriptURL,
bool aIsChromeWorker,
LoadGroupBehavior aLoadGroupBehavior,
LoadInfo* aLoadInfo)
bool aIsChromeWorker, LoadInfo* aLoadInfo)
{
using namespace mozilla::dom::workers::scriptloader;
using mozilla::dom::indexedDB::IDBFactory;
@ -4279,9 +4276,9 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow,
loadInfo.mReportCSPViolations = false;
}
if (!loadInfo.mLoadGroup || aLoadGroupBehavior == ForceNewLoadGroup) {
if (!loadInfo.mLoadGroup) {
rv = NS_NewLoadGroup(getter_AddRefs(loadInfo.mLoadGroup),
loadInfo.mPrincipal, loadInfo.mLoadGroup);
loadInfo.mPrincipal);
NS_ENSURE_SUCCESS(rv, rv);
}
MOZ_ASSERT(NS_LoadGroupMatchesPrincipal(loadInfo.mLoadGroup,

View File

@ -921,16 +921,10 @@ public:
static bool
WorkerAvailable(JSContext* /* unused */, JSObject* /* unused */);
enum LoadGroupBehavior
{
InheritLoadGroup,
ForceNewLoadGroup
};
static nsresult
GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow, WorkerPrivate* aParent,
const nsAString& aScriptURL, bool aIsChromeWorker,
LoadGroupBehavior aLoadGroupBehavior, LoadInfo* aLoadInfo);
LoadInfo* aLoadInfo);
WorkerDebugger*
Debugger() const

View File

@ -995,12 +995,9 @@ NS_NewLoadGroup(nsILoadGroup **result,
return rv;
}
// Create a new nsILoadGroup that will match the given principal. Also,
// if a base laod group is provided, populate the nsILoadContext of the
// new group with information from the existing context.
// Create a new nsILoadGroup that will match the given principal.
nsresult
NS_NewLoadGroup(nsILoadGroup** aResult, nsIPrincipal* aPrincipal,
nsILoadGroup* aOptionalBase = nullptr);
NS_NewLoadGroup(nsILoadGroup** aResult, nsIPrincipal* aPrincipal);
// Determine if the given loadGroup/principal pair will produce a principal
// with similar permissions when passed to NS_NewChannel(). This checks for

View File

@ -19,27 +19,16 @@ bool NS_IsValidHTTPToken(const nsACString& aToken)
}
nsresult
NS_NewLoadGroup(nsILoadGroup** aResult, nsIPrincipal* aPrincipal,
nsILoadGroup* aOptionalBase)
NS_NewLoadGroup(nsILoadGroup** aResult, nsIPrincipal* aPrincipal)
{
using mozilla::LoadContext;
nsresult rv;
nsCOMPtr<nsILoadContext> baseLoadContext;
if (aOptionalBase) {
nsCOMPtr<nsIInterfaceRequestor> cb;
rv = aOptionalBase->GetNotificationCallbacks(getter_AddRefs(cb));
NS_ENSURE_SUCCESS(rv, rv);
baseLoadContext = do_QueryInterface(cb);
}
nsCOMPtr<nsILoadGroup> group =
do_CreateInstance(NS_LOADGROUP_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<LoadContext> loadContext = new LoadContext(aPrincipal,
baseLoadContext);
nsRefPtr<LoadContext> loadContext = new LoadContext(aPrincipal);
rv = group->SetNotificationCallbacks(loadContext);
NS_ENSURE_SUCCESS(rv, rv);