Bug 1312690: Add some stupid microoptimizations. r=aswan

MozReview-Commit-ID: 4qoNuG2k0KS

--HG--
extra : rebase_source : fff22127b80bb8edc8578c2035d4689452ed4f6e
This commit is contained in:
Kris Maglione 2016-11-01 16:56:21 -07:00
Родитель 46cb76edfa
Коммит 92f05e0b16
2 изменённых файлов: 4 добавлений и 5 удалений

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

@ -215,11 +215,11 @@ Script.prototype = {
*/
tryInject(window, sandbox, shouldRun, when) {
if (shouldRun("document_start")) {
let {cssURLs} = this;
if (cssURLs.length > 0) {
let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let {cssURLs} = this;
if (cssURLs.length > 0) {
let method = this.remove_css ? winUtils.removeSheetUsingURIString : winUtils.loadSheetUsingURIString;
for (let url of cssURLs) {
runSafeSyncWithoutClone(method, url, winUtils.AUTHOR_SHEET);

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

@ -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({