Bug 1813981 - [geckodriver] Don't disable Fission when moz:debuggerAddress is used. r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D168369
This commit is contained in:
Henrik Skupin 2023-01-31 19:25:17 +00:00
parent ff75c90392
commit 4ef6f23775
4 changed files with 13 additions and 56 deletions

View File

@ -48,7 +48,7 @@ export class CDPConnection extends WebSocketConnection {
Services.prefs.getIntPref("fission.webContentIsolationStrategy") !== 0 ||
Services.prefs.getBoolPref("fission.bfcacheInParent")
) {
lazy.logger.error(
lazy.logger.warn(
`Invalid browser preferences for CDP. Set "fission.webContentIsolationStrategy"` +
`to 0 and "fission.bfcacheInParent" to false before Firefox starts.`
);

View File

@ -544,16 +544,6 @@ impl FirefoxOptions {
}
}
// Force Fission disabled until the CDP implementation is compatible,
// and preference hasn't been already set
if has_debugger_address {
let has_fission_pref = rv.prefs.iter().find(|&x| x.0 == "fission.autostart");
if has_fission_pref.is_none() {
rv.prefs
.push(("fission.autostart".to_owned(), Pref::new(false)));
}
}
Ok(rv)
}
@ -1095,11 +1085,6 @@ mod tests {
} else {
panic!("CLI arguments for Firefox not found");
}
assert!(opts
.prefs
.iter()
.any(|pref| pref == &("fission.autostart".to_owned(), Pref::new(false))));
}
#[test]

View File

@ -2,6 +2,10 @@
disabled:
if os == 'win' and ccov: https://bugzilla.mozilla.org/show_bug.cgi?id=1677750
[test_debugger_address_true_fission_disabled[capabilities0\]]
[test_debugger_address_true_with_fission[capabilities0-enabled\]]
disabled:
if fission: (not supported due to Fission override)
if not fission: not supported
[test_debugger_address_true_with_fission[capabilities0-disabled\]]
disabled:
if fission: not supported

View File

@ -1,3 +1,5 @@
# META: timeout=long
import json
import pytest
@ -17,7 +19,8 @@ def test_debugger_address_false(session):
@pytest.mark.capabilities({"moz:debuggerAddress": True})
def test_debugger_address_true_fission_disabled(session):
@pytest.mark.parametrize("fission_enabled", [True, False], ids=["enabled", "disabled"])
def test_debugger_address_true_with_fission(session, fission_enabled):
debugger_address = session.capabilities.get("moz:debuggerAddress")
assert debugger_address is not None
@ -34,44 +37,9 @@ def test_debugger_address_true_fission_disabled(session):
data = json.loads(response.read())
assert session.capabilities["browserVersion"] in data["Browser"]
# Force disabling Fission until Remote Agent is compatible
# Ensure Fission is not disabled (bug 1813981)
with using_context(session, "chrome"):
assert (
session.execute_script("""return Services.appinfo.fissionAutostart""")
is False
)
@pytest.mark.capabilities(
{
"moz:debuggerAddress": True,
"moz:firefoxOptions": {
"prefs": {
"fission.autostart": True,
}
},
}
)
def test_debugger_address_true_fission_override(session):
debugger_address = session.capabilities.get("moz:debuggerAddress")
assert debugger_address is not None
host, port = debugger_address.split(":")
assert host == "127.0.0.1"
assert port.isnumeric()
# Fetch the browser version via the debugger address, `localhost` has
# to work as well.
for target_host in [host, "localhost"]:
print(f"Connecting to WebSocket via host {target_host}")
http = HTTPRequest(target_host, int(port))
with http.get("/json/version") as response:
data = json.loads(response.read())
assert session.capabilities["browserVersion"] in data["Browser"]
# Allow Fission to be enabled when setting the preference
with using_context(session, "chrome"):
assert (
session.execute_script("""return Services.appinfo.fissionAutostart""")
is True
is fission_enabled
)