Bug 1315302 - Remove signedPkg from origin attributes r=baku

MozReview-Commit-ID: L1xvRgeO6De

--HG--
extra : rebase_source : dee943054af499b6e3f0aca2801fa9414f5567be
This commit is contained in:
Valentin Gosu 2016-11-06 16:15:36 +01:00
Родитель 5715dbdd0e
Коммит 656872593e
18 изменённых файлов: 3 добавлений и 355 удалений

Просмотреть файл

@ -106,7 +106,6 @@ const SESSION_DATA_OA = `
"addonId": "",
"appId": 0,
"inIsolatedMozBrowser": false,
"signedPkg": "",
"userContextId": 0
}
}]

Просмотреть файл

@ -43,11 +43,6 @@ PrincipalOriginAttributes::InheritFromDocShellToDoc(const DocShellOriginAttribut
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
// TODO:
// Bug 1225349 - PrincipalOriginAttributes should inherit mSignedPkg
// accordingly by URI
mSignedPkg = aAttrs.mSignedPkg;
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
}
@ -60,7 +55,6 @@ PrincipalOriginAttributes::InheritFromNecko(const NeckoOriginAttributes& aAttrs)
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
mSignedPkg = aAttrs.mSignedPkg;
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
@ -82,11 +76,6 @@ DocShellOriginAttributes::InheritFromDocToChildDocShell(const PrincipalOriginAtt
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
// TODO:
// Bug 1225353 - DocShell/NeckoOriginAttributes should inherit
// mSignedPkg accordingly by mSignedPkgInBrowser
mSignedPkg = aAttrs.mSignedPkg;
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
}
@ -100,10 +89,6 @@ NeckoOriginAttributes::InheritFromDocToNecko(const PrincipalOriginAttributes& aA
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
// TODO:
// Bug 1225353 - DocShell/NeckoOriginAttributes should inherit
// mSignedPkg accordingly by mSignedPkgInBrowser
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
}
@ -119,10 +104,6 @@ NeckoOriginAttributes::InheritFromDocShellToNecko(const DocShellOriginAttributes
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
// TODO:
// Bug 1225353 - DocShell/NeckoOriginAttributes should inherit
// mSignedPkg accordingly by mSignedPkgInBrowser
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
bool isFirstPartyEnabled = IsFirstPartyEnabled();
@ -183,10 +164,6 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
params->Set(NS_LITERAL_STRING("userContextId"), value);
}
if (!mSignedPkg.IsEmpty()) {
MOZ_RELEASE_ASSERT(mSignedPkg.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
params->Set(NS_LITERAL_STRING("signedPkg"), mSignedPkg);
}
if (mPrivateBrowsingId) {
value.Truncate();
@ -269,12 +246,6 @@ public:
return true;
}
if (aName.EqualsLiteral("signedPkg")) {
MOZ_RELEASE_ASSERT(mOriginAttributes->mSignedPkg.IsEmpty());
mOriginAttributes->mSignedPkg.Assign(aValue);
return true;
}
if (aName.EqualsLiteral("privateBrowsingId")) {
nsresult rv;
int64_t val = aValue.ToInteger64(&rv);
@ -349,7 +320,6 @@ OriginAttributes::SetFromGenericAttributes(const GenericOriginAttributes& aAttrs
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
mAddonId = aAttrs.mAddonId;
mUserContextId = aAttrs.mUserContextId;
mSignedPkg = aAttrs.mSignedPkg;
mPrivateBrowsingId = aAttrs.mPrivateBrowsingId;
mFirstPartyDomain = aAttrs.mFirstPartyDomain;
}

Просмотреть файл

@ -36,7 +36,6 @@ public:
mInIsolatedMozBrowser == aOther.mInIsolatedMozBrowser &&
mAddonId == aOther.mAddonId &&
mUserContextId == aOther.mUserContextId &&
mSignedPkg == aOther.mSignedPkg &&
mPrivateBrowsingId == aOther.mPrivateBrowsingId &&
mFirstPartyDomain == aOther.mFirstPartyDomain;
}
@ -191,10 +190,6 @@ public:
return false;
}
if (mSignedPkg.WasPassed() && mSignedPkg.Value() != aAttrs.mSignedPkg) {
return false;
}
if (mPrivateBrowsingId.WasPassed() && mPrivateBrowsingId.Value() != aAttrs.mPrivateBrowsingId) {
return false;
}
@ -229,11 +224,6 @@ public:
return false;
}
if (mSignedPkg.WasPassed() && aOther.mSignedPkg.WasPassed() &&
mSignedPkg.Value() != aOther.mSignedPkg.Value()) {
return false;
}
if (mPrivateBrowsingId.WasPassed() && aOther.mPrivateBrowsingId.WasPassed() &&
mPrivateBrowsingId.Value() != aOther.mPrivateBrowsingId.Value()) {
return false;

Просмотреть файл

@ -49,7 +49,6 @@ function printAttrs(name, attrs) {
"\tuserContextId: " + attrs.userContextId + ",\n" +
"\tinIsolatedMozBrowser: " + attrs.inIsolatedMozBrowser + ",\n" +
"\taddonId: '" + attrs.addonId + "',\n" +
"\tsignedPkg: '" + attrs.signedPkg + "',\n" +
"\tprivateBrowsingId: '" + attrs.privateBrowsingId + "',\n" +
"\tfirstPartyDomain: '" + attrs.firstPartyDomain + "'\n}");
}
@ -63,7 +62,6 @@ function checkValues(attrs, values) {
do_check_eq(attrs.userContextId, values.userContextId || 0);
do_check_eq(attrs.inIsolatedMozBrowser, values.inIsolatedMozBrowser || false);
do_check_eq(attrs.addonId, values.addonId || '');
do_check_eq(attrs.signedPkg, values.signedPkg || '');
do_check_eq(attrs.privateBrowsingId, values.privateBrowsingId || '');
do_check_eq(attrs.firstPartyDomain, values.firstPartyDomain || '');
}
@ -171,19 +169,6 @@ function run_test() {
checkOriginAttributes(nullPrin_userContextApp, {appId: 24, userContextId: 42}, '^appId=24&userContextId=42');
do_check_eq(exampleOrg_userContextApp.origin, 'http://example.org^appId=24&userContextId=42');
// Just signedPkg
var exampleOrg_signedPkg = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatever'});
checkOriginAttributes(exampleOrg_signedPkg, { signedPkg: 'whatever' }, '^signedPkg=whatever');
do_check_eq(exampleOrg_signedPkg.origin, 'http://example.org^signedPkg=whatever');
// signedPkg and browser
var exampleOrg_signedPkg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatever', inIsolatedMozBrowser: true});
checkOriginAttributes(exampleOrg_signedPkg_browser, { signedPkg: 'whatever', inIsolatedMozBrowser: true }, '^inBrowser=1&signedPkg=whatever');
do_check_eq(exampleOrg_signedPkg_browser.origin, 'http://example.org^inBrowser=1&signedPkg=whatever');
// Just signedPkg (but different value from 'exampleOrg_signedPkg_app')
var exampleOrg_signedPkg_another = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatup'});
checkSandboxOriginAttributes(null, {});
checkSandboxOriginAttributes('http://example.org', {});
checkSandboxOriginAttributes('http://example.org', {}, {originAttributes: {}});
@ -191,22 +176,6 @@ function run_test() {
checkSandboxOriginAttributes(['http://example.org'], {});
checkSandboxOriginAttributes(['http://example.org'], {}, {originAttributes: {}});
checkSandboxOriginAttributes(['http://example.org'], {appId: 42}, {originAttributes: {appId: 42}});
checkSandboxOriginAttributes([exampleOrg_signedPkg, 'http://example.org'], {signedPkg: 'whatever'});
checkSandboxOriginAttributes(['http://example.org', exampleOrg_signedPkg], {signedPkg: 'whatever'});
checkSandboxOriginAttributes(['http://example.org', exampleOrg_app, exampleOrg_signedPkg], {signedPkg: 'whatever'}, {originAttributes: {signedPkg: 'whatever'}});
checkSandboxOriginAttributes(['http://example.org', exampleOrg_signedPkg, exampleOrg_app], {signedPkg: 'whatever'}, {originAttributes: {signedPkg: 'whatever'}});
checkSandboxOriginAttributes([exampleOrg_app, exampleOrg_signedPkg, 'http://example.org'], {signedPkg: 'whatever'}, {originAttributes: {signedPkg: 'whatever'}});
checkSandboxOriginAttributes([exampleOrg_app, 'http://example.org', exampleOrg_signedPkg], {signedPkg: 'whatever'}, {originAttributes: {signedPkg: 'whatever'}});
checkSandboxOriginAttributes([exampleOrg_signedPkg, exampleOrg_app, 'http://example.org'], {signedPkg: 'whatever'}, {originAttributes: {signedPkg: 'whatever'}});
checkSandboxOriginAttributes([exampleOrg_signedPkg, 'http://example.org', exampleOrg_app], {signedPkg: 'whatever'}, {originAttributes: {signedPkg: 'whatever'}});
checkThrows(() => Cu.Sandbox([exampleOrg_app, exampleOrg_signedPkg]));
checkThrows(() => Cu.Sandbox([exampleOrg_signedPkg, exampleOrg_app]));
checkThrows(() => Cu.Sandbox(['http://example.org', exampleOrg_app, exampleOrg_signedPkg]));
checkThrows(() => Cu.Sandbox(['http://example.org', exampleOrg_signedPkg, exampleOrg_app]));
checkThrows(() => Cu.Sandbox([exampleOrg_app, exampleOrg_signedPkg, 'http://example.org']));
checkThrows(() => Cu.Sandbox([exampleOrg_app, 'http://example.org', exampleOrg_signedPkg]));
checkThrows(() => Cu.Sandbox([exampleOrg_signedPkg, exampleOrg_app, 'http://example.org']));
checkThrows(() => Cu.Sandbox([exampleOrg_signedPkg, 'http://example.org', exampleOrg_app]));
// Check that all of the above are cross-origin.
checkCrossOrigin(exampleOrg_app, exampleOrg);
@ -222,9 +191,6 @@ function run_test() {
checkCrossOrigin(exampleOrg_userContextAddon, exampleOrg);
checkCrossOrigin(exampleOrg_userContext, exampleOrg_userContextAddon);
checkCrossOrigin(exampleOrg_userContext, exampleOrg_userContextApp);
checkCrossOrigin(exampleOrg_signedPkg, exampleOrg);
checkCrossOrigin(exampleOrg_signedPkg, exampleOrg_signedPkg_browser);
checkCrossOrigin(exampleOrg_signedPkg, exampleOrg_signedPkg_another);
// Check Principal kinds.
function checkKind(prin, kind) {
@ -255,7 +221,6 @@ function run_test() {
[ "^addonId=fooBar", {addonId: "fooBar"} ],
[ "^inBrowser=1", {inIsolatedMozBrowser: true} ],
[ "^firstPartyDomain=example.org", {firstPartyDomain: "example.org"} ],
[ "^signedPkg=bazQux", {signedPkg: "bazQux"} ],
[ "^appId=3&inBrowser=1&userContextId=6",
{appId: 3, userContextId: 6, inIsolatedMozBrowser: true} ] ];

Просмотреть файл

@ -658,7 +658,6 @@ stubPackets.set("console.log('foobar', 'test')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -692,7 +691,6 @@ stubPackets.set("console.log(undefined)", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -724,7 +722,6 @@ stubPackets.set("console.warn('danger, will robinson!')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -758,7 +755,6 @@ stubPackets.set("console.log(NaN)", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -792,7 +788,6 @@ stubPackets.set("console.log(null)", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -824,7 +819,6 @@ stubPackets.set("console.log('鼬')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -854,7 +848,6 @@ stubPackets.set("console.clear()", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -889,7 +882,6 @@ stubPackets.set("console.count('bar')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -942,7 +934,6 @@ stubPackets.set("console.assert(false, {message: 'foobar'})", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -983,7 +974,6 @@ stubPackets.set("console.log('hello \nfrom \rthe \"string world!')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1015,7 +1005,6 @@ stubPackets.set("console.log('úṇĩçödê țĕșť')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1059,7 +1048,6 @@ stubPackets.set("console.dirxml(window)", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1089,7 +1077,6 @@ stubPackets.set("console.trace()", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1144,7 +1131,6 @@ stubPackets.set("console.time('bar')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1179,7 +1165,6 @@ stubPackets.set("console.timeEnd('bar')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1214,7 +1199,6 @@ stubPackets.set("console.table('bar')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1263,7 +1247,6 @@ stubPackets.set("console.table(['a', 'b', 'c'])", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1295,7 +1278,6 @@ stubPackets.set("console.group('bar')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1327,7 +1309,6 @@ stubPackets.set("console.groupEnd('bar')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1359,7 +1340,6 @@ stubPackets.set("console.groupCollapsed('foo')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1391,7 +1371,6 @@ stubPackets.set("console.groupEnd('foo')", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1421,7 +1400,6 @@ stubPackets.set("console.group()", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1451,7 +1429,6 @@ stubPackets.set("console.groupEnd()", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,
@ -1484,7 +1461,6 @@ stubPackets.set("console.log(%cfoobar)", {
"firstPartyDomain": "",
"inIsolatedMozBrowser": false,
"privateBrowsingId": 0,
"signedPkg": "",
"userContextId": 0
},
"private": false,

Просмотреть файл

@ -178,7 +178,6 @@ ChromeUtils::IsOriginAttributesEqual(dom::GlobalObject& aGlobal,
return aA.mAddonId == aB.mAddonId &&
aA.mAppId == aB.mAppId &&
aA.mInIsolatedMozBrowser == aB.mInIsolatedMozBrowser &&
aA.mSignedPkg == aB.mSignedPkg &&
aA.mUserContextId == aB.mUserContextId &&
aA.mPrivateBrowsingId == aB.mPrivateBrowsingId;
}
@ -189,7 +188,6 @@ ChromeUtils::IsOriginAttributesEqualIgnoringAddonId(const dom::OriginAttributesD
{
return aA.mAppId == aB.mAppId &&
aA.mInIsolatedMozBrowser == aB.mInIsolatedMozBrowser &&
aA.mSignedPkg == aB.mSignedPkg &&
aA.mUserContextId == aB.mUserContextId &&
aA.mPrivateBrowsingId == aB.mPrivateBrowsingId;
}

Просмотреть файл

@ -328,30 +328,6 @@ nsFrameLoader::LoadURI(nsIURI* aURI)
return rv;
}
NS_IMETHODIMP
nsFrameLoader::SwitchProcessAndLoadURI(nsIURI* aURI, const nsACString& aPackageId)
{
RefPtr<TabParent> tp = nullptr;
MutableTabContext context;
nsresult rv = GetNewTabContext(&context, aURI, aPackageId);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<Element> ownerElement = mOwnerContent;
tp = ContentParent::CreateBrowserOrApp(context, ownerElement, nullptr);
if (!tp) {
return NS_ERROR_FAILURE;
}
mRemoteBrowserShown = false;
rv = SwapRemoteBrowser(tp);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
LoadURI(aURI);
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::SetIsPrerendered()
{
@ -3093,52 +3069,6 @@ nsFrameLoader::SetRemoteBrowser(nsITabParent* aTabParent)
ShowRemoteFrame(ScreenIntSize(0, 0));
}
nsresult
nsFrameLoader::SwapRemoteBrowser(nsITabParent* aTabParent)
{
RefPtr<TabParent> newParent = TabParent::GetFrom(aTabParent);
if (!newParent || !mRemoteBrowser) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
if (!IsRemoteFrame()) {
NS_WARNING("Switching from in-process to out-of-process is not supported.");
return NS_ERROR_NOT_IMPLEMENTED;
}
if (!OwnerIsMozBrowserOrAppFrame()) {
NS_WARNING("Switching process for non-mozbrowser/app frame is not supported.");
return NS_ERROR_NOT_IMPLEMENTED;
}
if (newParent == mRemoteBrowser) {
return NS_OK;
}
MaybeUpdatePrimaryTabParent(eTabParentRemoved);
mRemoteBrowser->CacheFrameLoader(nullptr);
mRemoteBrowser->SetOwnerElement(nullptr);
mRemoteBrowser->Detach();
mRemoteBrowser->Destroy();
mRemoteBrowser = newParent;
mRemoteBrowser->Attach(this);
mChildID = mRemoteBrowser->Manager()->ChildID();
MaybeUpdatePrimaryTabParent(eTabParentChanged);
// Force the new remote frame manager to load pending scripts
mMessageManager->LoadPendingScripts();
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"remote-browser-swapped", nullptr);
}
if (!mRemoteBrowserShown) {
ShowRemoteFrame(ScreenIntSize(0, 0));
}
return NS_OK;
}
void
nsFrameLoader::SetDetachedSubdocFrame(nsIFrame* aDetachedFrame,
nsIDocument* aContainerDoc)
@ -3462,8 +3392,7 @@ nsFrameLoader::MaybeUpdatePrimaryTabParent(TabParentChange aChange)
nsresult
nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
nsIURI* aURI,
const nsACString& aPackageId)
nsIURI* aURI)
{
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
nsCOMPtr<mozIApplication> containingApp = GetContainingApp();
@ -3471,13 +3400,6 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
nsresult rv;
nsCString signedPkgOrigin;
if (!aPackageId.IsEmpty()) {
// Only when aPackageId is not empty would signed package origin
// be meaningful.
nsPrincipal::GetOriginForURI(aURI, signedPkgOrigin);
}
// Get the AppId from ownApp
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
if (ownApp) {
@ -3491,9 +3413,6 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
}
attrs.mAppId = appId;
// Populate packageId to signedPkg.
attrs.mSignedPkg = NS_ConvertUTF8toUTF16(aPackageId);
// set the userContextId on the attrs before we pass them into
// the tab context
rv = PopulateUserContextIdFromAttribute(attrs);
@ -3532,7 +3451,6 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
showAccelerators,
showFocusRings,
attrs,
signedPkgOrigin,
presentationURLStr);
NS_ENSURE_STATE(tabContextUpdated);

Просмотреть файл

@ -190,8 +190,6 @@ public:
*/
void SetRemoteBrowser(nsITabParent* aTabParent);
nsresult SwapRemoteBrowser(nsITabParent* aTabParent);
/**
* Stashes a detached nsIFrame on the frame loader. We do this when we're
* destroying the nsSubDocumentFrame. If the nsSubdocumentFrame is
@ -327,8 +325,7 @@ private:
void DestroyBrowserFrameScripts();
nsresult GetNewTabContext(mozilla::dom::MutableTabContext* aTabContext,
nsIURI* aURI = nullptr,
const nsACString& aPackageId = EmptyCString());
nsIURI* aURI = nullptr);
enum TabParentChange {
eTabParentRemoved,

Просмотреть файл

@ -54,15 +54,6 @@ interface nsIFrameLoader : nsISupports
*/
void loadURI(in nsIURI aURI);
/**
* Loads the specified URI in this frame but using a different process.
* Behaves identically to loadURI, except that this method only works
* with remote frame. For a signed package, we need to specifiy the
* package identifier.
* Throws an exception with non-remote frames.
*/
void switchProcessAndLoadURI(in nsIURI aURI, in ACString aPackageId);
/**
* Puts the frameloader in prerendering mode.
*/

Просмотреть файл

@ -651,8 +651,6 @@ skip-if = toolkit == 'android' || e10s # showmodaldialog
[test_fileapi.html]
[test_fileapi_slice.html]
skip-if = (toolkit == 'android') # Android: Bug 775227
[test_frameLoader_switchProcess.html]
skip-if = e10s || os != 'linux' || buildapp != 'browser' # Already tests multiprocess
[test_getAttribute_after_createAttribute.html]
[test_getElementById.html]
[test_getTranslationNodes.html]

Просмотреть файл

@ -1,75 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test frameLoader SwitchProcessAndLoadURI</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script type="application/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
var Ci = SpecialPowers.Ci;
var Cc = SpecialPowers.Cc;
function expectProcessCreated() {
return new Promise((resolve, reject) => {
var topic = "process-priority-manager:TEST-ONLY:process-created";
function observer() {
SpecialPowers.removeObserver(observer, topic);
ok(true, "Expect process created");
resolve();
}
SpecialPowers.addObserver(observer, topic, /* weak = */ false);
});
}
function switchProcessAndLoadURI(iframe, url) {
var fl = SpecialPowers.wrap(iframe)
.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader;
var uri = SpecialPowers.Services.io.newURI(url, null, null);
fl.switchProcessAndLoadURI(uri, "");
}
function runTest() {
ok(true, "Run Test");
var iframe = document.createElement("iframe");
iframe.setAttribute("mozbrowser", "true");
iframe.setAttribute("remote", "true");
iframe.setAttribute("src", "http://example.org");
expectProcessCreated()
.then(() => new Promise(next => {
iframe.addEventListener("mozbrowserloadend", function loadend(e) {
iframe.removeEventListener("mozbrowserloadend", loadend);
ok(true, "Got mozbrowserloadend");
expectProcessCreated().then(next);
switchProcessAndLoadURI(iframe, "data:text/html,%3Cscript%3Ealert(true)%3C/script%3E");
});
}))
.then(() => new Promise(next => {
iframe.addEventListener("mozbrowsershowmodalprompt", function prompt(e) {
iframe.removeEventListener("mozbrowsershowmodalprompt", prompt);
ok(true, "Browser API still works after process switch");
next();
});
}))
.then(SimpleTest.finish);
document.body.appendChild(iframe);
}
SpecialPowers.pushPrefEnv(
{ "set": [["dom.ipc.processPriorityManager.testMode", true],
["dom.ipc.processPriorityManager.enabled", true],
["dom.ipc.tabs.disabled", false],
["dom.ipc.processCount", 3],
["dom.mozBrowserFramesEnabled", true]] },
() => SpecialPowers.pushPermissions([
{ "type": "browser", "allow": 1, "context": document }
], runTest));
</script>
</body>
</html>

Просмотреть файл

@ -42,11 +42,6 @@ struct FrameIPCTabContext
// The ID of the app containing this app/browser frame, if applicable.
uint32_t frameOwnerAppId;
// The origin without originAttribute suffix for a signed package.
// This value would be empty if the TabContext doesn't own a signed
// package.
nsCString signedPkgOriginNoSuffix;
// Whether this is a mozbrowser frame. <iframe mozbrowser mozapp> and
// <xul:browser> are not considered to be mozbrowser frames.
bool isMozBrowserElement;

Просмотреть файл

@ -177,8 +177,7 @@ TabContext::UpdateTabContextAfterSwap(const TabContext& aContext)
// must match for the change to be accepted.
if (aContext.OwnAppId() != OwnAppId() ||
aContext.mContainingAppId != mContainingAppId ||
aContext.mOriginAttributes != mOriginAttributes ||
aContext.mSignedPkgOriginNoSuffix != mSignedPkgOriginNoSuffix) {
aContext.mOriginAttributes != mOriginAttributes) {
return false;
}
@ -192,12 +191,6 @@ TabContext::OriginAttributesRef() const
return mOriginAttributes;
}
const nsACString&
TabContext::SignedPkgOriginNoSuffix() const
{
return mSignedPkgOriginNoSuffix;
}
const nsAString&
TabContext::PresentationURL() const
{
@ -224,7 +217,6 @@ TabContext::SetTabContext(bool aIsMozBrowserElement,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const DocShellOriginAttributes& aOriginAttributes,
const nsACString& aSignedPkgOriginNoSuffix,
const nsAString& aPresentationURL)
{
NS_ENSURE_FALSE(mInitialized, false);
@ -257,7 +249,6 @@ TabContext::SetTabContext(bool aIsMozBrowserElement,
mContainingAppId = containingAppId;
mOwnApp = aOwnApp;
mContainingApp = aAppFrameOwnerApp;
mSignedPkgOriginNoSuffix = aSignedPkgOriginNoSuffix;
mPresentationURL = aPresentationURL;
mShowAccelerators = aShowAccelerators;
mShowFocusRings = aShowFocusRings;
@ -269,7 +260,6 @@ TabContext::AsIPCTabContext() const
{
return IPCTabContext(FrameIPCTabContext(mOriginAttributes,
mContainingAppId,
mSignedPkgOriginNoSuffix,
mIsMozBrowserElement,
mIsPrerendered,
mPresentationURL,
@ -296,7 +286,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
bool isPrerendered = false;
uint32_t containingAppId = NO_APP_ID;
DocShellOriginAttributes originAttributes;
nsAutoCString signedPkgOriginNoSuffix;
nsAutoString presentationURL;
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
@ -360,7 +349,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
isMozBrowserElement = ipcContext.isMozBrowserElement();
isPrerendered = ipcContext.isPrerendered();
containingAppId = ipcContext.frameOwnerAppId();
signedPkgOriginNoSuffix = ipcContext.signedPkgOriginNoSuffix();
presentationURL = ipcContext.presentationURL();
showAccelerators = ipcContext.showAccelerators();
showFocusRings = ipcContext.showFocusRings();
@ -414,7 +402,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
showAccelerators,
showFocusRings,
originAttributes,
signedPkgOriginNoSuffix,
presentationURL);
if (!rv) {
mInvalidReason = "Couldn't initialize TabContext.";

Просмотреть файл

@ -126,12 +126,6 @@ public:
*/
const DocShellOriginAttributes& OriginAttributesRef() const;
/**
* Returns the origin associated with the tab (w/o suffix) if this tab owns
* a signed packaged content.
*/
const nsACString& SignedPkgOriginNoSuffix() const;
/**
* Returns the presentation URL associated with the tab if this tab is
* created for presented content
@ -177,7 +171,6 @@ protected:
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const DocShellOriginAttributes& aOriginAttributes,
const nsACString& aSignedPkgOriginNoSuffix,
const nsAString& aPresentationURL);
/**
@ -233,14 +226,6 @@ private:
*/
DocShellOriginAttributes mOriginAttributes;
/**
* The signed package origin without suffix. Since the signed packaged
* web content is always loaded in a separate process, it makes sense
* that we store this immutable value in TabContext. If the TabContext
* doesn't own a signed package, this value would be empty.
*/
nsCString mSignedPkgOriginNoSuffix;
/**
* The requested presentation URL.
*/
@ -274,7 +259,6 @@ public:
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const DocShellOriginAttributes& aOriginAttributes,
const nsACString& aSignedPkgOriginNoSuffix = EmptyCString(),
const nsAString& aPresentationURL = EmptyString())
{
return TabContext::SetTabContext(aIsMozBrowserElement,
@ -284,7 +268,6 @@ public:
aShowAccelerators,
aShowFocusRings,
aOriginAttributes,
aSignedPkgOriginNoSuffix,
aPresentationURL);
}
};

Просмотреть файл

@ -151,7 +151,6 @@ TabParent::TabParent(nsIContentParent* aManager,
, mDocShellIsActive(false)
, mMarkedDestroying(false)
, mIsDestroyed(false)
, mIsDetached(true)
, mChromeFlags(aChromeFlags)
, mDragValid(false)
, mInitedByParent(false)
@ -408,35 +407,6 @@ TabParent::Destroy()
mMarkedDestroying = true;
}
void
TabParent::Detach()
{
if (mIsDetached) {
return;
}
RemoveWindowListeners();
if (RenderFrameParent* frame = GetRenderFrame()) {
RemoveTabParentFromTable(frame->GetLayersId());
}
mIsDetached = true;
}
void
TabParent::Attach(nsFrameLoader* aFrameLoader)
{
MOZ_ASSERT(mIsDetached);
if (!mIsDetached) {
return;
}
Element* ownerElement = aFrameLoader->GetOwnerContent();
SetOwnerElement(ownerElement);
if (RenderFrameParent* frame = GetRenderFrame()) {
AddTabParentToTable(frame->GetLayersId(), this);
frame->OwnerContentChanged(ownerElement);
}
mIsDetached = false;
}
bool
TabParent::RecvEnsureLayersConnected()
{

Просмотреть файл

@ -152,10 +152,6 @@ public:
void Destroy();
void Detach();
void Attach(nsFrameLoader* aFrameLoader);
void RemoveWindowListeners();
void AddWindowListeners();
@ -681,8 +677,6 @@ private:
bool mMarkedDestroying;
// When true, the TabParent is invalid and we should not send IPC messages anymore.
bool mIsDestroyed;
// When true, the TabParent is detached from the frame loader.
bool mIsDetached;
uint32_t mChromeFlags;

Просмотреть файл

@ -79,7 +79,6 @@ dictionary OriginAttributesDictionary {
unsigned long userContextId = 0;
boolean inIsolatedMozBrowser = false;
DOMString addonId = "";
DOMString signedPkg = "";
unsigned long privateBrowsingId = 0;
DOMString firstPartyDomain = "";
};
@ -88,7 +87,6 @@ dictionary OriginAttributesPatternDictionary {
unsigned long userContextId;
boolean inIsolatedMozBrowser;
DOMString addonId;
DOMString signedPkg;
unsigned long privateBrowsingId;
DOMString firstPartyDomain;
};

Просмотреть файл

@ -191,11 +191,6 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
continue;
}
if (!aSerialized.mOriginAttributes.mSignedPkg.IsEmpty() &&
aSerialized.mOriginAttributes.mSignedPkg != tabContext.OriginAttributesRef().mSignedPkg) {
debugString.Append("s,");
continue;
}
if (aSerialized.mOriginAttributes.mUserContextId != tabContext.OriginAttributesRef().mUserContextId) {
debugString.Append("(");
debugString.AppendInt(aSerialized.mOriginAttributes.mUserContextId);
@ -207,7 +202,6 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
aAttrs = DocShellOriginAttributes();
aAttrs.mAppId = appId;
aAttrs.mInIsolatedMozBrowser = inBrowserElement;
aAttrs.mSignedPkg = aSerialized.mOriginAttributes.mSignedPkg;
aAttrs.mUserContextId = aSerialized.mOriginAttributes.mUserContextId;
aAttrs.mPrivateBrowsingId = aSerialized.mOriginAttributes.mPrivateBrowsingId;
aAttrs.mFirstPartyDomain = aSerialized.mOriginAttributes.mFirstPartyDomain;