Bug 1364977 - Do not remove obs_documentCreated observer in its notification processing to avoid a crash. r=IanN
Also change attachment handling to avoid hitting bug 468740 when the observer is only removed during close.
This commit is contained in:
Родитель
6fe0dc2a87
Коммит
3b9c200b9a
|
@ -1266,8 +1266,6 @@ var gMsgEditorCreationObserver =
|
||||||
updateComposeItems();
|
updateComposeItems();
|
||||||
else
|
else
|
||||||
gLastWindowToHaveFocus = null;
|
gLastWindowToHaveFocus = null;
|
||||||
|
|
||||||
commandManager.removeCommandObserver(this, "obs_documentCreated");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1340,6 +1338,8 @@ function ComposeUnload()
|
||||||
document.getElementById("msgcomposeWindow").dispatchEvent(
|
document.getElementById("msgcomposeWindow").dispatchEvent(
|
||||||
new Event("compose-window-unload", { bubbles: false, cancelable: false }));
|
new Event("compose-window-unload", { bubbles: false, cancelable: false }));
|
||||||
|
|
||||||
|
GetCurrentCommandManager().removeCommandObserver(gMsgEditorCreationObserver,
|
||||||
|
"obs_documentCreated");
|
||||||
UnloadCommandUpdateHandlers();
|
UnloadCommandUpdateHandlers();
|
||||||
|
|
||||||
// Stop InlineSpellCheckerUI so personal dictionary is saved
|
// Stop InlineSpellCheckerUI so personal dictionary is saved
|
||||||
|
@ -2476,36 +2476,91 @@ function AttachmentElementHasItems()
|
||||||
|
|
||||||
function OpenSelectedAttachment()
|
function OpenSelectedAttachment()
|
||||||
{
|
{
|
||||||
var bucket = GetMsgAttachmentElement();
|
let bucket = document.getElementById("attachmentBucket");
|
||||||
if (bucket.selectedItems.length == 1)
|
if (bucket.selectedItems.length == 1) {
|
||||||
{
|
let attachmentUrl = bucket.getSelectedItem(0).attachment.url;
|
||||||
var attachmentUrl = bucket.getSelectedItem(0).attachment.url;
|
|
||||||
|
|
||||||
var messagePrefix = /^mailbox-message:|^imap-message:|^news-message:/i;
|
let messagePrefix = /^mailbox-message:|^imap-message:|^news-message:/i;
|
||||||
if (messagePrefix.test(attachmentUrl))
|
if (messagePrefix.test(attachmentUrl)) {
|
||||||
{
|
// We must be dealing with a forwarded attachment, treat this special.
|
||||||
// we must be dealing with a forwarded attachment, treat this specially
|
let msgHdr = gMessenger.msgHdrFromURI(attachmentUrl);
|
||||||
var msgHdr = gMessenger.msgHdrFromURI(attachmentUrl);
|
if (msgHdr) {
|
||||||
if (msgHdr)
|
MailUtils.openMessageInNewWindow(msgHdr);
|
||||||
{
|
|
||||||
var folderUri = msgHdr.folder.folderURL;
|
|
||||||
window.openDialog("chrome://messenger/content/messageWindow.xul", "_blank", "all,chrome,dialog=no,status,toolbar",
|
|
||||||
attachmentUrl, folderUri, null);
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
// Turn the URL into a nsIURI object then open it.
|
||||||
{
|
let uri = Services.io.newURI(attachmentUrl);
|
||||||
var editorElement = GetCurrentEditorElement();
|
if (uri) {
|
||||||
if (editorElement) {
|
let channel = Services.io.newChannelFromURI2(uri,
|
||||||
const loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_IS_LINK;
|
null,
|
||||||
try {
|
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||||
editorElement.webNavigation.loadURI(attachmentUrl, loadFlags, null, null, null);
|
null,
|
||||||
} catch (e) {}
|
Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
||||||
|
Components.interfaces.nsIContentPolicy.TYPE_OTHER);
|
||||||
|
if (channel) {
|
||||||
|
let uriLoader = Components.classes["@mozilla.org/uriloader;1"].getService(Components.interfaces.nsIURILoader);
|
||||||
|
uriLoader.openURI(channel, true, new nsAttachmentOpener());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // if one attachment selected
|
} // if one attachment selected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nsAttachmentOpener()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
nsAttachmentOpener.prototype =
|
||||||
|
{
|
||||||
|
QueryInterface: function(iid)
|
||||||
|
{
|
||||||
|
if (iid.equals(Components.interfaces.nsIURIContentListener) ||
|
||||||
|
iid.equals(Components.interfaces.nsIInterfaceRequestor) ||
|
||||||
|
iid.equals(Components.interfaces.nsISupports)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
throw Components.results.NS_NOINTERFACE;
|
||||||
|
},
|
||||||
|
|
||||||
|
onStartURIOpen: function(uri)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
doContent: function(contentType, isContentPreferred, request, contentHandler)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
isPreferred: function(contentType, desiredContentType)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
getInterface: function(iid)
|
||||||
|
{
|
||||||
|
if (iid.equals(Components.interfaces.nsIDOMWindow)) {
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iid.equals(Components.interfaces.nsIDocShell)) {
|
||||||
|
return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
|
.QueryInterface(Components.interfaces.nsIDocShell);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.QueryInterface(iid);
|
||||||
|
},
|
||||||
|
|
||||||
|
loadCookie: null,
|
||||||
|
parentContentListener: null
|
||||||
|
}
|
||||||
|
|
||||||
function DetermineHTMLAction(convertible)
|
function DetermineHTMLAction(convertible)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче