Bug 1746154 - [cdp] Add error message and documentation about the required fission preferences r=webdriver-reviewers,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D134328
This commit is contained in:
Julian Descottes 2022-01-31 12:34:40 +00:00
parent 5c16e42779
commit 4da968b463
3 changed files with 33 additions and 1 deletions

View File

@ -11,6 +11,8 @@ const { XPCOMUtils } = ChromeUtils.import(
);
XPCOMUtils.defineLazyModuleGetters(this, {
Services: "resource://gre/modules/Services.jsm",
Log: "chrome://remote/content/shared/Log.jsm",
truncate: "chrome://remote/content/shared/Format.jsm",
UnknownMethodError: "chrome://remote/content/cdp/Error.jsm",
@ -44,6 +46,18 @@ class CDPConnection extends WebSocketConnection {
* The session to register.
*/
registerSession(session) {
// CDP is not compatible with Fission by default, check the appropriate
// preferences are set to ensure compatibility.
if (
Services.prefs.getIntPref("fission.webContentIsolationStrategy") !== 0 ||
Services.prefs.getBoolPref("fission.bfcacheInParent")
) {
logger.error(
`Invalid browser preferences for CDP. Set "fission.webContentIsolationStrategy"` +
`to 0 and "fission.bfcacheInParent" to false before Firefox starts.`
);
}
if (!session.id) {
if (this.defaultSession) {
throw new Error(

View File

@ -0,0 +1,14 @@
Required Preferences for Fission
================================
Fission (site isolation for Firefox) introduced some architectural changes that are incompatible with our CDP implementation. To keep using CDP for Firefox, make sure the following preferences are set in the profile before starting Firefox with `--remote-debugging-port`:
* `fission.bfcacheInParent` should be set to `false`.
* `fission.webContentIsolationStrategy` should be set to `0`.
Without those preferences, expect issues related to navigation in several domains (Page, Runtime, ...).
Third party tools relying on CDP such as Puppeteer ensure that those preferences are correctly set before starting Firefox.
The work to lift those restrictions is tracked in [Bug 1732263](https://bugzilla.mozilla.org/show_bug.cgi?id=1732263) and [Bug 1706353](https://bugzilla.mozilla.org/show_bug.cgi?id=1706353).

View File

@ -12,7 +12,11 @@ It complements the existing Firefox Developer Tools :ref:`Remote Debugging
Protocol <Remote Debugging Protocol>` (RDP) by implementing a subset of the
`Chrome DevTools Protocol`_ (CDP).
To use Firefox remote protocol with Fission, CDP client authors should read the
`Required Preferences`_ page.
.. _Chrome DevTools Protocol: https://chromedevtools.github.io/devtools-protocol/
.. _Required Preferences: /remote/cdp/RequiredPreferences.html
.. toctree::
:maxdepth: 1
@ -20,4 +24,4 @@ Protocol <Remote Debugging Protocol>` (RDP) by implementing a subset of the
Usage.md
Architecture.md
PuppeteerVendor.md
RequiredPreferences.md