diff --git a/toolkit/components/extensions/ExtensionContent.jsm b/toolkit/components/extensions/ExtensionContent.jsm index 026b099c84a5..d16ce6166dc3 100644 --- a/toolkit/components/extensions/ExtensionContent.jsm +++ b/toolkit/components/extensions/ExtensionContent.jsm @@ -215,11 +215,11 @@ Script.prototype = { */ tryInject(window, sandbox, shouldRun, when) { if (shouldRun("document_start")) { - let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - let {cssURLs} = this; if (cssURLs.length > 0) { + let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + let method = this.remove_css ? winUtils.removeSheetUsingURIString : winUtils.loadSheetUsingURIString; for (let url of cssURLs) { runSafeSyncWithoutClone(method, url, winUtils.AUTHOR_SHEET); diff --git a/toolkit/components/extensions/ExtensionManagement.jsm b/toolkit/components/extensions/ExtensionManagement.jsm index dca162f4e355..324c5b71b933 100644 --- a/toolkit/components/extensions/ExtensionManagement.jsm +++ b/toolkit/components/extensions/ExtensionManagement.jsm @@ -239,8 +239,7 @@ var Service = { // extensionURIToAddonID, which ensures that we don't inject our // API into webAccessibleResources or remote web pages. function getAddonIdForWindow(window) { - let principal = window.document.nodePrincipal; - return principal.originAttributes.addonId; + return Cu.getObjectPrincipal(window).originAttributes.addonId; } const API_LEVELS = Object.freeze({