From fb1a877d2eb6e5f40a986adf59f516bdc49e857a Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Thu, 26 Oct 2006 04:14:09 +0000 Subject: [PATCH] Bug358121 --> nsIMsgMailNewsUrl.folder can throw a JS exception when opening .eml files. This causes things like the phishing detector to not work. sr=bienvenu --- mail/base/content/mailWindowOverlay.js | 8 +++++++- mail/base/content/phishingDetector.js | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mail/base/content/mailWindowOverlay.js b/mail/base/content/mailWindowOverlay.js index 19972f1a7802..4afbf57d6709 100644 --- a/mail/base/content/mailWindowOverlay.js +++ b/mail/base/content/mailWindowOverlay.js @@ -2539,7 +2539,13 @@ function OnMsgLoaded(aUrl) if (!aUrl) return; - var folder = aUrl.folder; + // nsIMsgMailNewsUrl.folder throws an error when opening .eml files. + var folder; + try { + folder = aUrl.folder; + } + catch (ex) {} + var msgURI = GetLoadedMessage(); var msgHdr = null; diff --git a/mail/base/content/phishingDetector.js b/mail/base/content/phishingDetector.js index abaf5433c46e..dc410e5d01aa 100644 --- a/mail/base/content/phishingDetector.js +++ b/mail/base/content/phishingDetector.js @@ -57,8 +57,14 @@ function isMsgEmailScam(aUrl) return isEmailScam; // Ignore nntp and RSS messages - var folder = aUrl.folder; - if (folder.server.type == 'nntp' || folder.server.type == 'rss') + // nsIMsgMailNewsUrl.folder can throw an error, especially if we are opening + // a .eml message. + var folder; + try { + folder = aUrl.folder; + } catch (ex) {} + + if (folder && (folder.server.type == 'nntp' || folder.server.type == 'rss')) return isEmailScam; // loop through all of the link nodes in the message's DOM, looking for phishing URLs...