Bug 1850587 - Adjust expectations for the tests to account for isolation strategy in Fission r=nika

Differential Revision: https://phabricator.services.mozilla.com/D187073
This commit is contained in:
owlishDeveloper 2023-09-06 19:29:14 +00:00
parent b89b4b32b2
commit 30f829cb6e
3 changed files with 27 additions and 7 deletions

View File

@ -16,8 +16,12 @@ function go() {
let frame = document.createElement("iframe");
frame.onload = () => {
let win = frame.contentWindow;
is(SpecialPowers.Cu.isRemoteProxy(win), SpecialPowers.useRemoteSubframes,
"win is a remote proxy if Fission is enabled");
// The processes will be remote only with isolateEverything strategy
const expected = SpecialPowers.effectiveIsolationStrategy() == SpecialPowers.ISOLATION_STRATEGY.IsolateEverything;
is(SpecialPowers.Cu.isRemoteProxy(win), expected,
"win is a remote proxy if Fission is enabled and strategy is isolateEverything");
let o = {};
Object.setPrototypeOf(o, win);
is(Object.getPrototypeOf(o), win, "should have expected proto");

View File

@ -41,11 +41,13 @@ add_task(async function() {
"frames[0].location is not a remote proxy"
);
const { useRemoteSubframes } = SpecialPowers;
is(Cu.isRemoteProxy(frames[1]), useRemoteSubframes,
"frames[1] is a remote proxy if Fission is enabled");
is(Cu.isRemoteProxy(frames[1].location), useRemoteSubframes,
"frames[1].location is a remote proxy if Fission is enabled");
// The processes will be remote only with isolateEverything strategy
const expected = SpecialPowers.effectiveIsolationStrategy() == SpecialPowers.ISOLATION_STRATEGY.IsolateEverything;
is(Cu.isRemoteProxy(frames[1]), expected,
"frames[1] is a remote proxy if Fission is enabled and strategy is isolateEverything");
is(Cu.isRemoteProxy(frames[1].location), expected,
"frames[1].location is a remote proxy if Fission is enabled and strategy is isolateEverything");
});
</script>

View File

@ -1437,6 +1437,20 @@ export class SpecialPowersChild extends JSWindowActorChild {
return this.docShell.nsILoadContext.useRemoteSubframes;
}
ISOLATION_STRATEGY = {
IsolateNothing: 0,
IsolateEverything: 1,
IsolateHighValue: 2,
};
effectiveIsolationStrategy() {
// If remote subframes are disabled, we always use the IsolateNothing strategy.
if (!this.useRemoteSubframes) {
return this.ISOLATION_STRATEGY.IsolateNothing;
}
return this.getIntPref("fission.webContentIsolationStrategy");
}
addSystemEventListener(target, type, listener, useCapture) {
Services.els.addSystemEventListener(target, type, listener, useCapture);
}