From 5e941052ed4ff86349452b9fc14e26b01534593a Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Sun, 1 Aug 2010 23:59:26 +0100 Subject: [PATCH] Bug 580868 charsetOverlay should not cause XBL bindings to attach when it's not safe r+a=gavin --- toolkit/content/charsetOverlay.js | 42 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/toolkit/content/charsetOverlay.js b/toolkit/content/charsetOverlay.js index 8b286d1430b..b9a08231729 100644 --- a/toolkit/content/charsetOverlay.js +++ b/toolkit/content/charsetOverlay.js @@ -245,28 +245,34 @@ function mailCharsetLoadListener (event) } } -var wintype = document.documentElement.getAttribute('windowtype'); -if (window && (wintype == "navigator:browser")) +function InitCharsetMenu() { - var contentArea = window.document.getElementById("appcontent"); - if (contentArea) - contentArea.addEventListener("pageshow", charsetLoadListener, true); -} -else -{ - var arrayOfStrings = wintype.split(":"); - if (window && arrayOfStrings[0] == "mail") + removeEventListener("load", InitCharsetMenu, true); + + var wintype = document.documentElement.getAttribute('windowtype'); + if (window && (wintype == "navigator:browser")) { - var messageContent = window.document.getElementById("messagepane"); - if (messageContent) - messageContent.addEventListener("pageshow", mailCharsetLoadListener, true); + var contentArea = window.document.getElementById("appcontent"); + if (contentArea) + contentArea.addEventListener("pageshow", charsetLoadListener, true); } else - if (window && arrayOfStrings[0] == "composer") { - contentArea = window.document.getElementById("appcontent"); - if (contentArea) - contentArea.addEventListener("pageshow", composercharsetLoadListener, true); + var arrayOfStrings = wintype.split(":"); + if (window && arrayOfStrings[0] == "mail") + { + var messageContent = window.document.getElementById("messagepane"); + if (messageContent) + messageContent.addEventListener("pageshow", mailCharsetLoadListener, true); + } + else + if (window && arrayOfStrings[0] == "composer") + { + contentArea = window.document.getElementById("appcontent"); + if (contentArea) + contentArea.addEventListener("pageshow", composercharsetLoadListener, true); + } } - } + +addEventListener("load", InitCharsetMenu, true);