Skip to content

Commit

Permalink
Bug 1804140 - Enable SHIP by default on desktop, whether or not Fissi…
Browse files Browse the repository at this point in the history
…on is disabled. r=smaug,jgraham,webdriver-reviewers,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D172278
  • Loading branch information
petervanderbeken committed Apr 18, 2023
1 parent a68cfa1 commit 635046a
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 29 deletions.
4 changes: 2 additions & 2 deletions docshell/base/nsDocShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ class nsDocShell final : public nsDocLoader,
already_AddRefed<nsIInputStream> GetPostDataFromCurrentEntry() const;
mozilla::Maybe<uint32_t> GetCacheKeyFromCurrentEntry() const;

// Loading and/or active entries are only set when pref
// fission.sessionHistoryInParent is on.
// Loading and/or active entries are only set when session history
// in the parent is on.
bool FillLoadStateFromCurrentEntry(nsDocShellLoadState& aLoadState);

static bool ShouldAddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel);
Expand Down
52 changes: 41 additions & 11 deletions dom/tests/mochitest/chrome/window_focus.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@

<script type="application/javascript"><![CDATA[

const { BrowserTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/BrowserTestUtils.sys.mjs"
);
const { ContentTask } = ChromeUtils.import(
"resource://testing-common/ContentTask.jsm"
);

var fm = Cc["@mozilla.org/focus-manager;1"].
getService(Ci.nsIFocusManager);

Expand Down Expand Up @@ -1506,18 +1513,41 @@ function doFrameSwitchingTests()

function doFrameHistoryTests()
{
var t20 = getById("t20");
t20.focus();

gChildWindow.addEventListener("focus",
function(event) {
if (event.target == t20) {
is(fm.focusedElement, t20, "focus restored after history back"); done();
let frame = $("childframe");
frame.setAttribute("maychangeremoteness", "true");
let loaded = BrowserTestUtils.browserLoaded(frame, true);
let firstLocation = "https://example.org/chrome/dom/tests/mochitest/chrome/child_focus_frame.html";
frame.src = firstLocation;
loaded.then(() => {
return ContentTask.spawn(frame, {}, () => {
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
let t20 = content.document.getElementById("t20");
t20.focus();
let goneBack = new Promise(resolve => {
content.addEventListener("pageshow", ({ persisted }) => {
resolve({ location: content.location.href, persisted });
}, { once: true });
});
// make sure that loading a new page and then going back maintains the focus
content.location = "data:text/html,<script>window.onload=function() {setTimeout(function () { history.back() }, 0);}</script>";
return goneBack;
});
}).then(({ location, persisted }) => {
is(location, firstLocation, "should go back to the right page");
ok(persisted, "test relies on BFCache");
return ContentTask.spawn(frame, {}, () => {
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
let t20 = content.document.getElementById("t20");
return fm.focusedElement === t20;
});
}).then((focusCorrect) => {
if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
todo(focusCorrect, "focus restored after history back");
} else {
ok(focusCorrect, "focus restored after history back");
}
}, true);

// make sure that loading a new page and then going back maintains the focus
gChildWindow.location = "data:text/html,<script>window.onload=function() {setTimeout(function () { history.back() }, 0);}</script>";
done();
});
}

function addFrameSwitchingListeners(frame)
Expand Down
6 changes: 5 additions & 1 deletion gfx/tests/mochitest/test_acceleration.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
var webrenderWindows = 0;
var layerManagerLog = [];
while (windows.hasMoreElements()) {
windowutils = windows.getNext().windowUtils;
try {
windowutils = windows.getNext().windowUtils;
} catch (e) {
todo(false, "Bug X - don't expose BFCached pages through window enumerator");
}
try {
var layerManager = windowutils.layerManagerType;
if (layerManager != "Basic" && layerManager != "WebRender (Software)") {
Expand Down
8 changes: 4 additions & 4 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5136,11 +5136,11 @@
value: true
mirror: always

# Store the session history in the parent process, and access it over IPC
# from the child processes.
- name: fission.sessionHistoryInParent
# Disable storing the session history in the parent process, and accessing it
# over IPC from the child processes.
- name: fission.disableSessionHistoryInParent
type: bool
value: false
value: @IS_ANDROID@
mirror: once
do_not_use_directly: true

Expand Down
1 change: 0 additions & 1 deletion remote/cdp/test/browser/runtime/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ https_first_disabled = true
[browser_exceptionThrown.js]
https_first_disabled = true
[browser_executionContextEvents.js]
skip-if = !fission # TODO: Remove when SHIP is enabled for non-Fission (bug 1736121)
[browser_getProperties.js]
[browser_remoteObjects.js]
5 changes: 4 additions & 1 deletion testing/mochitest/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3320,7 +3320,10 @@ def runTests(self, options):
# overridden with --setpref).
"serviceworker_e10s": True,
"sessionHistoryInParent": not options.disable_fission
or self.extraPrefs.get("fission.sessionHistoryInParent", False),
or not self.extraPrefs.get(
"fission.disableSessionHistoryInParent",
mozinfo.info["os"] == "android",
),
"socketprocess_e10s": self.extraPrefs.get(
"network.process.enabled", False
),
Expand Down
9 changes: 7 additions & 2 deletions testing/web-platform/meta/webdriver/tests/back/back.py.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[back.py]
expected:
if (os == "win") and not debug and (processor == "x86_64"): [OK, TIMEOUT]
[test_cross_origin[capabilities0\]]
expected:
if (os == "win") and not debug and (processor == "x86_64") and fission: [OK, TIMEOUT]
if (os == "linux") and not fission: FAIL
if (os == "win") and not fission: FAIL
if (os == "mac") and not fission: FAIL
PASS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[forward.py]
[test_cross_origin[capabilities0\]]
expected:
if (os == "linux") and not fission: FAIL
if (os == "win") and not fission: FAIL
if (os == "mac") and not fission: FAIL
PASS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[navigate.py]
[test_cross_origin[capabilities0\]]
expected:
if (os == "linux") and not fission: FAIL
if (os == "win") and not fission: FAIL
if (os == "mac") and not fission: FAIL
PASS
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def get_bool_pref(pref):
"headless": kwargs.get("headless", False) or "MOZ_HEADLESS" in os.environ,
"fission": not kwargs.get("disable_fission"),
"sessionHistoryInParent": (not kwargs.get("disable_fission") or
get_bool_pref("fission.sessionHistoryInParent")),
not get_bool_pref("fission.disableSessionHistoryInParent")),
"swgl": get_bool_pref("gfx.webrender.software")}

rv.update(run_info_browser_version(**kwargs))
Expand Down
6 changes: 3 additions & 3 deletions testing/xpcshell/runxpcshelltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,9 @@ def updateMozinfo(self, prefs, options):
self.mozInfo = fixedInfo

self.mozInfo["fission"] = prefs.get("fission.autostart", True)
self.mozInfo["sessionHistoryInParent"] = self.mozInfo["fission"] or prefs.get(
"fission.sessionHistoryInParent", False
)
self.mozInfo["sessionHistoryInParent"] = self.mozInfo[
"fission"
] or not prefs.get("fission.disableSessionHistoryInParent", False)

self.mozInfo["serviceworker_e10s"] = True

Expand Down
4 changes: 2 additions & 2 deletions toolkit/xre/nsAppRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,8 @@ namespace mozilla {

bool SessionHistoryInParent() {
return FissionAutostart() ||
StaticPrefs::
fission_sessionHistoryInParent_AtStartup_DoNotUseDirectly();
!StaticPrefs::
fission_disableSessionHistoryInParent_AtStartup_DoNotUseDirectly();
}

bool BFCacheInParent() {
Expand Down
3 changes: 2 additions & 1 deletion xpcom/system/nsIXULRuntime.idl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ bool FissionAutostart();
// Returns whether or not we are currently enrolled in the fission experiment.
bool FissionExperimentEnrolled();

// Returns true if fission.sessionHistoryInParent or FissionAutostart() is true.
// Returns true if FissionAutostart() is true or
// fission.disableSessionHistoryInParent is false.
bool SessionHistoryInParent();

// Returns true if SessionHistoryInParent() returns true and
Expand Down

0 comments on commit 635046a

Please sign in to comment.