Bug 1563997: Handle webcompat Components stub in MozillaFileLogger.js. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D37938

--HG--
extra : rebase_source : dc1827f5a28dce10881d01461e7ff2a9889d1b65
This commit is contained in:
Kris Maglione 2019-07-12 14:32:57 -07:00
parent dc7ff541ae
commit df821804ae

View File

@ -18,7 +18,14 @@ function importJSM(jsm) {
return SpecialPowers.wrap(obj);
}
let CC = (typeof Components === "object"
// When running in release builds, we get a fake Components object in
// web contexts, so we need to check that the Components object is sane,
// too, not just that it exists.
let haveComponents =
typeof Components === "object" &&
typeof Components.Constructor === "function";
let CC = (haveComponents
? Components
: SpecialPowers.wrap(SpecialPowers.Components)).Constructor;