mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
(from Waterfox Classic) Refactor addonId access in BasePrincipal and related files
This commit is contained in:
parent
ef314d225f
commit
203d58a5cd
6 changed files with 26 additions and 13 deletions
|
|
@ -1390,8 +1390,8 @@ TabActor.prototype = {
|
|||
.outerWindowID;
|
||||
}
|
||||
|
||||
// Collect the addonID from the document origin attributes.
|
||||
let addonID = window.document.nodePrincipal.originAttributes.addonId;
|
||||
// Collect the addonID from the document principal.
|
||||
let addonID = window.document.nodePrincipal.addonId;
|
||||
|
||||
return {
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -309,7 +309,15 @@ WebExtensionActor.prototype._shouldAddNewGlobalAsDebuggee = function (newGlobal)
|
|||
const global = unwrapDebuggerObjectGlobal(newGlobal);
|
||||
|
||||
if (global instanceof Ci.nsIDOMWindow) {
|
||||
return global.document.nodePrincipal.originAttributes.addonId == this.id;
|
||||
try {
|
||||
global.document;
|
||||
} catch (e) {
|
||||
// Sandboxes can expose a window in their prototype chain without
|
||||
// having permission to access their own proto after navigation.
|
||||
return false;
|
||||
}
|
||||
|
||||
return global.document.nodePrincipal.addonId == this.id;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue