From 5704a90cf003cc322cc715fa15e979d43899d29a Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 5 Aug 2016 22:43:10 -0400 Subject: [PATCH] improve performance issue reported at https://bugzilla.mozilla.org/show_bug.cgi?id=1232354 --- platform/firefox/frameModule.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index bcdadbe5f..d01309a7d 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -236,14 +236,11 @@ var contentObserver = { return this.ACCEPT; } - let isTopLevel = context === context.top; - let parentFrameId; - if ( isTopLevel ) { - parentFrameId = -1; - } else if ( context.parent === context.top ) { - parentFrameId = 0; - } else { - parentFrameId = this.getFrameId(context.parent); + // https://bugzilla.mozilla.org/show_bug.cgi?id=1232354 + // For top-level resources, no need to send information to the + // main process. + if ( context === context.top ) { + return this.ACCEPT; } let messageManager = getMessageManager(context); @@ -252,8 +249,8 @@ var contentObserver = { } let details = { - frameId: isTopLevel ? 0 : this.getFrameId(context), - parentFrameId: parentFrameId, + frameId: this.getFrameId(context), + parentFrameId: context.parent === context.top ? 0 : this.getFrameId(context.parent), rawtype: type, tabId: '', url: location.spec