Bug 1583117 - Markup view is blank if an error is thrown gathering event listeners r=pbro

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Ratcliffe 2019-10-14 12:23:13 +00:00
parent 1135caa402
commit 785947850f

View File

@ -304,15 +304,22 @@ class MainEventCollector {
}
isChromeHandler(handler) {
const handlerPrincipal = Cu.getObjectPrincipal(handler);
try {
const handlerPrincipal = Cu.getObjectPrincipal(handler);
// Chrome codebase may register listeners on the page from a frame script or
// JSM <video> tags may also report internal listeners, but they won't be
// coming from the system principal. Instead, they will be using an expanded
// principal.
return (
handlerPrincipal.isSystemPrincipal || handlerPrincipal.isExpandedPrincipal
);
// Chrome codebase may register listeners on the page from a frame script or
// JSM <video> tags may also report internal listeners, but they won't be
// coming from the system principal. Instead, they will be using an expanded
// principal.
return (
handlerPrincipal.isSystemPrincipal ||
handlerPrincipal.isExpandedPrincipal
);
} catch (e) {
// Anything from a dead object to a CSP error can leave us here so let's
// return false so that we can fail gracefully.
return false;
}
}
}