Bug 1378207 - Handle sandboxes with XOW protos in WebExtensionChildActor. r=rpl

Sandbox can throw on property access if it does not have permission
to access its own proto, even if the caller compartment had.
This commit is contained in:
Gabor Krizsanits 2017-08-08 13:43:20 +02:00
Родитель 31faf6cf36
Коммит d624f6b97e
1 изменённых файлов: 10 добавлений и 0 удалений

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

@ -336,6 +336,16 @@ WebExtensionChildActor.prototype._shouldAddNewGlobalAsDebuggee = function (newGl
const global = unwrapDebuggerObjectGlobal(newGlobal);
if (global instanceof Ci.nsIDOMWindow) {
try {
global.document;
} catch (e) {
// The global might be a sandbox with a window object in its proto chain. If the
// window navigated away since the sandbox was created, it can throw a security
// exception during this property check as the sandbox no longer has access to
// its own proto.
return false;
}
// Filter out any global which contains a XUL document.
if (global.document instanceof Ci.nsIDOMXULDocument) {
return false;