Bug 1572414 - Fix hasNativeConsoleAPI when dealing with Sandboxes. r=yulia.

When the console parent actor is a ContentProcessTargetActor, we don't have
a reference to a `nsIDOMWindow`, but only to a Sandbox.
The code in `hasNativeConsoleAPI` would then silently fail when trying to
access `window.wrappedJSObject`, and keep `isNative` as `false`.
For now, we work around this by always returning true if we don't have
access to a `nsIDOMWindow`.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-08-20 08:29:07 +00:00
Родитель df1ed9b01a
Коммит 4707300839
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -415,8 +415,8 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
},
hasNativeConsoleAPI: function(window) {
if (isWorker) {
// Can't use XPCNativeWrapper as a way to check for console API in workers
if (isWorker || !(window instanceof Ci.nsIDOMWindow)) {
// We can only use XPCNativeWrapper on non-worker nsIDOMWindow.
return true;
}