Bug 1533105. Re-enable compartment sharing for content windows. r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D22364

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-03-06 20:39:40 +00:00
Родитель 924d521c85
Коммит 91c38ae2e8
3 изменённых файлов: 4 добавлений и 8 удалений

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

@ -1778,7 +1778,6 @@ struct MOZ_STACK_CLASS CompartmentFinderState {
JS::Compartment* compartment;
};
#if 0 /* Temporarily disabled; will reenable in bug 1533105 */
static JS::CompartmentIterResult FindSameOriginCompartment(
JSContext* aCx, void* aData, JS::Compartment* aCompartment) {
auto* data = static_cast<CompartmentFinderState*>(aData);
@ -1803,7 +1802,6 @@ static JS::CompartmentIterResult FindSameOriginCompartment(
data->compartment = aCompartment;
return JS::CompartmentIterResult::Stop;
}
#endif
static JS::RealmCreationOptions& SelectZone(
JSContext* aCx, nsIPrincipal* aPrincipal, nsGlobalWindowInner* aNewInner,
@ -1824,7 +1822,6 @@ static JS::RealmCreationOptions& SelectZone(
// If we have a top-level window, use its zone.
if (top && top->GetGlobalJSObject()) {
#if 0 /* Temporarily disabled; will reenable in bug 1533105 */
JS::Zone* zone = JS::GetObjectZone(top->GetGlobalJSObject());
// Now try to find an existing compartment that's same-origin
// with our principal.
@ -1833,7 +1830,6 @@ static JS::RealmCreationOptions& SelectZone(
if (data.compartment) {
return aOptions.setExistingCompartment(data.compartment);
}
#endif
return aOptions.setNewCompartmentInExistingZone(top->GetGlobalJSObject());
}
}

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

@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1530608
// Test 1: same-origin iframe.
function testFrame1() {
var frameWin = document.getElementById("frame1").contentWindow;
todo(isSameCompartment(window, frameWin),
ok(isSameCompartment(window, frameWin),
"Same-origin iframe must be same-compartment");
finishIfDone();
}
@ -48,7 +48,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1530608
// Now load a same-origin page in this iframe.
frame.onload = function() {
todo(isSameCompartment(window, frame.contentWindow),
ok(isSameCompartment(window, frame.contentWindow),
"Frame must be same-compartment now");
finishIfDone();
};
@ -59,7 +59,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1530608
addLoadEvent(function() {
var frame = document.createElement("iframe");
document.body.appendChild(frame);
todo(isSameCompartment(window, frame.contentWindow),
ok(isSameCompartment(window, frame.contentWindow),
"Newly created iframe must be same-compartment");
finishIfDone();
});

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

@ -30,7 +30,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1530608
ok(!isSameCompartment(window, frame.contentWindow),
"Cross-origin iframe must be cross-compartment");
todo(isSameCompartment(window, innerWin),
ok(isSameCompartment(window, innerWin),
"Same-origin inner iframe must be same-compartment");
SimpleTest.finish();