From 45a200f9a21072e26df37b80aed4ccd3eb7cbf10 Mon Sep 17 00:00:00 2001 From: Mike de Boer Date: Tue, 9 Feb 2016 15:16:22 +0100 Subject: [PATCH] Bug 1229195: explicitly link 'content' to the frame script global scope to prevent out-of-scope errors. r=Standard8 --- browser/base/content/social-content.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/browser/base/content/social-content.js b/browser/base/content/social-content.js index 011aec0cfe32..bea71cb7c43e 100644 --- a/browser/base/content/social-content.js +++ b/browser/base/content/social-content.js @@ -11,6 +11,11 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); +// Tie `content` to this frame scripts' global scope explicitly. If we don't, then +// `content` might be out of eval's scope and GC'ed before this script is done. +// See bug 1229195 for empirical proof. +var gContent = content; + // social frames are always treated as app tabs docShell.isAppTab = true; @@ -25,8 +30,8 @@ addEventListener("DOMTitleChanged", function(e) { sendAsyncMessage("DOMTitleChanged", { title: e.target.title }); - gDOMTitleChangedByUs = false; } + gDOMTitleChangedByUs = false; }); // Error handling class used to listen for network errors in the social frames