contain-facebook: Add-on for Facebook crashes the whole Firefox tab by opening a popup when Facebook Container is enabled

  • Facebook Container Version: 2.1.1
  • Operating System + Version: Mac OS Catalina (10.15.5)
  • Firefox Version: 77.0.1
  • Other installed Add-ons + Version + Enabled/Disabled-Status: I don’t think it’s actually relevant to list them here.

Actual behavior

My add-on for Facebook crashes the whole Firefox tab by trying to open a window on Facebook domain, the root cause is somewhere inside Facebook Container.

Expected behavior

It shouldn’t crash 😃 and doesn’t when Facebook Container is disabled and Firefox restarted afterwards (I don’t know why this happened, but it kept crashing as described until I restarted Firefox).

Steps to reproduce

  1. Load a minimal addon which reproduces the issue:

manifest.json:

{
  "manifest_version": 2,
  "name": "Crashed by Facebook Container",
  "version": "0.0.1",
  "content_scripts": [
    {
      "matches": ["*://*.facebook.com/*"],
      "js": ["content.js"]
    }
  ]
}

content.js

const windowOpener = document.createElement("button");

windowOpener.innerText = "Clicking this will crash current Facebook tab!";

windowOpener.onclick = () =>
  window.open("https://facebook.com", "_blank", "width=360, height=240"); // removing all parameters but url also doesn't fix the issue

document.body.insertBefore(windowOpener, document.body.firstChild);

// some styles, irrelevant
windowOpener.style.color = "red";
windowOpener.style.padding = "50px 0";
windowOpener.style.width = "100%";
windowOpener.style.height = "100px";
  1. Go to facebook.com, no need to be logged in.
  2. Click on the button added by the add-on.

Notes

My hunch is something weird goes on while trying to run separate Facebook context in the newly created popup window.

About this issue

Most upvoted comments

(1) it has nothing to do with Greasemonkey, that was just the initial way people found the problem (2) it is a compatibility issue between Facebook Container and Firefox. Any extension can instantly crash a containerized tab if FBC is installed (3) rarely have I seen a clearer initial presentation of a bug