Skip to content

Commit

Permalink
Bug 1746154 - [cdp] Add error message and documentation about the req…
Browse files Browse the repository at this point in the history
…uired fission preferences r=webdriver-reviewers,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D134328
  • Loading branch information
juliandescottes committed Jan 31, 2022
1 parent 5c16e42 commit 4da968b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
14 changes: 14 additions & 0 deletions remote/cdp/CDPConnection.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 14 additions & 0 deletions remote/doc/cdp/RequiredPreferences.md
Original file line number Diff line number Diff line change
@@ -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).
6 changes: 5 additions & 1 deletion remote/doc/cdp/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ 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

Usage.md
Architecture.md
PuppeteerVendor.md

RequiredPreferences.md

0 comments on commit 4da968b

Please sign in to comment.