From 5074f64f87d6d211c49319a048204c60dd7e5d65 Mon Sep 17 00:00:00 2001 From: Jorg K Date: Tue, 10 Jan 2017 09:01:32 +0100 Subject: [PATCH] Bug 1329455 - Bug 1319409 follow-up: fix JS error. r=aceman a=jorgk --- mail/components/addrbook/content/addressbook.js | 6 +++--- mailnews/base/content/msgPrintEngine.js | 3 +++ suite/mailnews/addrbook/addressbook.js | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mail/components/addrbook/content/addressbook.js b/mail/components/addrbook/content/addressbook.js index 2e0ead4106..5a75a8030e 100644 --- a/mail/components/addrbook/content/addressbook.js +++ b/mail/components/addrbook/content/addressbook.js @@ -347,7 +347,7 @@ function AbPrintCardInternal(doPrintPreview, msgType) statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance(); statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback); - let selectionArray = new Array(numSelected); + let selectionArray = []; for (let i = 0; i < numSelected; i++) { let card = selectedItems[i]; @@ -360,8 +360,8 @@ function AbPrintCardInternal(doPrintPreview, msgType) printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul", "", "chrome,dialog=no,all", - totalCard, selectionArray, statusFeedback, - doPrintPreview, msgType); + selectionArray.length, selectionArray, + statusFeedback, doPrintPreview, msgType); return; } diff --git a/mailnews/base/content/msgPrintEngine.js b/mailnews/base/content/msgPrintEngine.js index 60043aec21..4dc01ca6d7 100644 --- a/mailnews/base/content/msgPrintEngine.js +++ b/mailnews/base/content/msgPrintEngine.js @@ -112,6 +112,9 @@ var gStartupPPObserver = function ReplaceWithSelection() { + if (!printOpener.content) + return; + var selection = printOpener.content.getSelection(); if ( selection != "" ) { diff --git a/suite/mailnews/addrbook/addressbook.js b/suite/mailnews/addrbook/addressbook.js index 30f7bdd5cc..67fa7cf1ad 100644 --- a/suite/mailnews/addrbook/addressbook.js +++ b/suite/mailnews/addrbook/addressbook.js @@ -197,7 +197,7 @@ function AbPrintCardInternal(doPrintPreview, msgType) statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance(); statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback); - let selectionArray = new Array(numSelected); + let selectionArray = []; for (let i = 0; i < numSelected; i++) { let card = selectedItems[i]; @@ -210,8 +210,8 @@ function AbPrintCardInternal(doPrintPreview, msgType) printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul", "", "chrome,dialog=no,all", - totalCard, selectionArray, statusFeedback, - doPrintPreview, msgType); + selectionArray.length, selectionArray, + statusFeedback, doPrintPreview, msgType); return; }