Bug 1313901 - Remove some duplicated code in nsFrameLoader, r=qdot

This commit is contained in:
Andrea Marchesini
2016-10-31 19:03:12 +01:00
parent 90ed056135
commit 04a133c67b
2 changed files with 5 additions and 15 deletions

View File

@@ -3461,6 +3461,7 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
nsCOMPtr<mozIApplication> containingApp = GetContainingApp();
DocShellOriginAttributes attrs;
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
nsresult rv;
nsCString signedPkgOrigin;
if (!aPackageId.IsEmpty()) {
@@ -3472,11 +3473,11 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
// Get the AppId from ownApp
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
if (ownApp) {
nsresult rv = ownApp->GetLocalId(&appId);
rv = ownApp->GetLocalId(&appId);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(appId != nsIScriptSecurityManager::NO_APP_ID);
} else if (containingApp) {
nsresult rv = containingApp->GetLocalId(&appId);
rv = containingApp->GetLocalId(&appId);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(appId != nsIScriptSecurityManager::NO_APP_ID);
}
@@ -3487,18 +3488,8 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
// set the userContextId on the attrs before we pass them into
// the tab context
nsAutoString userContextIdStr;
if (mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::usercontextid)) {
mOwnerContent->GetAttr(kNameSpaceID_None,
nsGkAtoms::usercontextid,
userContextIdStr);
}
if (!userContextIdStr.IsEmpty()) {
nsresult err;
uint32_t userContextId = userContextIdStr.ToInteger(&err);
NS_ENSURE_SUCCESS(err, err);
attrs.mUserContextId = userContextId;
}
rv = PopulateUserContextIdFromAttribute(attrs);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString presentationURLStr;
mOwnerContent->GetAttr(kNameSpaceID_None,