Bug 1562349 Comment 6 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(I typed this comment for bug 1544011, but this bug was filed earlier, so I'll paste here.)

This crash is triggered in `Document::GetFailedCertSecurityInfo` at https://searchfox.org/mozilla-central/rev/b3fd653bc6078b3be4a8d06db39eddc5714755da/dom/base/Document.cpp#1650 (which was added in bug 1555438).

The code expects to be run from a content process (it attempts to dereference the `ContentChild` singleton), but that is not the case, because the remote discopane is loaded in the main process. That should eventually go away (bug 1544011).

To prevent this crash from happening, a `XRE_IsContentProcess()` check needs to be added.

Minimal reproduction (based on [the original part of browser_discovery.js that triggered the crash in bug 1544011](https://searchfox.org/mozilla-central/rev/b3fd653bc6078b3be4a8d06db39eddc5714755da/toolkit/mozapps/extensions/test/browser/browser_discovery.js#594-605)): replace `toolkit/mozapps/extensions/test/browser/browser_discovery.js` with the following:
```
// mach test toolkit/mozapps/extensions/test/browser/browser_discovery.js

async function test() {
  waitForExplicitFinish();
  await SpecialPowers.pushPrefEnv({
    set: [
      ["extensions.htmlaboutaddons.discover.enabled", false],
      ["extensions.webservice.discoverURL", "https://nocert.example.com/"],
      ["extensions.ui.lastCategory", "addons://discover/"],
    ],
  });
  let win = await open_manager();
  await close_manager(win);
  ok(true, "succeeded?");
  finish();
}
```
(I typed this comment for bug 1565187, but this bug was filed earlier, so I'll paste here.)

This crash is triggered in `Document::GetFailedCertSecurityInfo` at https://searchfox.org/mozilla-central/rev/b3fd653bc6078b3be4a8d06db39eddc5714755da/dom/base/Document.cpp#1650 (which was added in bug 1555438).

The code expects to be run from a content process (it attempts to dereference the `ContentChild` singleton), but that is not the case, because the remote discopane is loaded in the main process. That should eventually go away (bug 1544011).

To prevent this crash from happening, a `XRE_IsContentProcess()` check needs to be added.

Minimal reproduction (based on [the original part of browser_discovery.js that triggered the crash in bug 1565187](https://searchfox.org/mozilla-central/rev/b3fd653bc6078b3be4a8d06db39eddc5714755da/toolkit/mozapps/extensions/test/browser/browser_discovery.js#594-605)): replace `toolkit/mozapps/extensions/test/browser/browser_discovery.js` with the following:
```
// mach test toolkit/mozapps/extensions/test/browser/browser_discovery.js

async function test() {
  waitForExplicitFinish();
  await SpecialPowers.pushPrefEnv({
    set: [
      ["extensions.htmlaboutaddons.discover.enabled", false],
      ["extensions.webservice.discoverURL", "https://nocert.example.com/"],
      ["extensions.ui.lastCategory", "addons://discover/"],
    ],
  });
  let win = await open_manager();
  await close_manager(win);
  ok(true, "succeeded?");
  finish();
}
```

Back to Bug 1562349 Comment 6