javascript strict warnings in mailWindowOverlay.js, printing.js, and printPreviewBindings.xml

RESOLVED FIXED

Status

()

--
minor
RESOLVED FIXED
16 years ago
6 years ago

People

(Reporter: bugzilla, Unassigned)

Tracking

(Blocks: 1 bug)

Trunk
x86
Windows XP
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [See comment 12])

Attachments

(3 obsolete attachments)

(Reporter)

Description

16 years ago
If you right click in an empty message pane and select print preview

Warning: assignment to undeclared variable gPrintSettingsAreGlobal
Source File: chrome://communicator/content/printing.js
Line: 65

Warning: assignment to undeclared variable gSavePrintSettings
Source File: chrome://communicator/content/printing.js
Line: 66

Error: uriArray has no properties
Source File: chrome://messenger/content/msgPrintEngine.js
Line: 260

20030128
please don't cc me on random ui bugs

Updated

16 years ago
Priority: -- → P3
Target Milestone: --- → Future

Comment 2

16 years ago
I have a patch that fixes the warnings, but I could not reproduce the error. How
do I get an empty message pane that I can right-click in?

Comment 3

16 years ago
Created attachment 118889 [details] [diff] [review]
(Av1) fix

I figured out how to get an empty message pane: first select a message, then
select another folder. This patch fixes the original warnings and error, plus
an additional warning that appeared after fixing those. With this patch,
selecting Print Preview on an empty message pane leads to no warnings or
errors, and selecting Print Preview on a non-empty message pane still works.

Selecting Print Preview on an empty message pane will now just briefly display
a Print Preview dialog and do nothing else. Probably the Print Preview item in
the context menu should be disabled in the case of an empty message pane.

Updated

16 years ago
Attachment #118889 - Flags: review?(rods)

Updated

16 years ago
Attachment #118889 - Flags: review?(rods) → review?(neil)

Comment 4

16 years ago
Yeah, that menuitem should be disabled unless a message is loaded.
I thought that there was already a bug for that, but I can't find it.
If there is, then this bug is invalid/duplicate/whatever.

Comment 5

16 years ago
It looks like bug 173074 is that bug. But this bug still is not invalid, because
three warnings are produced when selecting Print Preview on a non-empty message
pane. Changing summary to reflect warnings now produced.
Summary: javascript strict warnings and errors in printing.js and msgPrintEngine.js → javascript strict warnings in mailWindowOverlay.js and printPreviewBindings.xml

Updated

16 years ago
Attachment #118889 - Attachment is obsolete: true
Attachment #118889 - Flags: review?(neil.parkwaycc.co.uk)

Comment 6

16 years ago
Strange, I get six warnings :-)

Updated

15 years ago
Summary: javascript strict warnings in mailWindowOverlay.js and printPreviewBindings.xml → javascript strict warnings in mailWindowOverlay.js, printing.js, and printPreviewBindings.xml

Comment 7

15 years ago
Created attachment 129641 [details] [diff] [review]
(Av2) Fix for four warnings

This patch fixes the four warnings I currently get. If anyone can reproduce
more warnings, please list the steps and the warnings.

Comment 8

15 years ago
Created attachment 130212 [details] [diff] [review]
(Av2b) Fix for five warnings

With this patch and the reviewed patch for bug 173074, I cannot generate any
warnings or errors with Print Preview in MailNews.
Attachment #129641 - Attachment is obsolete: true

Updated

15 years ago
Attachment #130212 - Flags: review?(neil.parkwaycc.co.uk)

Comment 9

15 years ago
Comment on attachment 130212 [details] [diff] [review]
(Av2b) Fix for five warnings

>@@ -399,7 +396,7 @@
>           var webBrowserPrint;  
>           var domWin;  
>           try {
>-            var ifreq = _content.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
>+            ifreq = _content.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
>             domWin = ifreq.QueryInterface(Components.interfaces.nsIDOMWindow);
>           } catch (e) {
>             // Pressing cancel is expressed as an NS_ERROR_ABORT return value,
Now unfortunately this code is a waste of time, as domWin == content  :-)
Had this code been necessary, the correct fix would have been to remove the var
ifreq; at line 398.

>@@ -39,6 +39,8 @@
>  * ***** END LICENSE BLOCK ***** */
> 
> var gPrintSettings = null;
>+var gPrintSettingsAreGlobal = null;
>+var gSavePrintSettings = null;
These are booleans. Find out whether they should default to true or false.

>@@ -40,6 +40,7 @@
> var gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
> var gPrintSettings = null;
> var gWindowReuse  = 0;
>+var printEngineWindow;
This variable is assigned to but never used... definitely no point making it a
global.
Attachment #130212 - Flags: review?(neil.parkwaycc.co.uk) → review-
Attachment #118889 - Attachment description: fix → (Av1) fix
Attachment #129641 - Attachment description: Fix for four warnings → (Av2) Fix for four warnings
Comment on attachment 130212 [details] [diff] [review]
(Av2b) Fix for five warnings


<printPreviewBindings.xml>
and
<printing.js>
were fixed in bug 228529...

<mailWindowOverlay.js>
Which fix is needed for |printEngineWindow|, variable declaration (and what use
?) or removal ?
Attachment #130212 - Attachment description: Fix for five warnings → (Av2b) Fix for five warnings
Attachment #130212 - Attachment is obsolete: true
Depends on: 228529

Comment 11

13 years ago
I don't see the console messages.
Fixed?
(In reply to comment #11)
> Fixed?

No:

[Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.9a1) Gecko/20050904 SeaMonkey/1.1a]
(nightly) (W98SE)

Try it on a message without body;
Note that the (strict) warning displays only the first time in the "session".

{{
Warning: assignment to undeclared variable printEngineWindow
Source File: chrome://messenger/content/mailWindowOverlay.js
Line: 1576
}}

Same code at
http://lxr.mozilla.org/mozilla/source/mail/base/content/mailWindowOverlay.js#1596

Variable removal seems appropriate.

David:
Would you r+sr a patch that would do just this ?
Assignee: rods → printing
Severity: normal → minor
Component: Printing → Print Preview
Priority: P3 → --
Summary: javascript strict warnings in mailWindowOverlay.js, printing.js, and printPreviewBindings.xml → javascript strict warnings in mailWindowOverlay.js, and printPreviewBindings.xml
Whiteboard: [See comment 12]
Target Milestone: Future → ---
Summary: javascript strict warnings in mailWindowOverlay.js, and printPreviewBindings.xml → javascript strict warnings in mailWindowOverlay.js, printing.js, and printPreviewBindings.xml

Updated

11 years ago
Blocks: 296661
Assignee: printing → nobody
QA Contact: sujay → printing

Comment 13

6 years ago
Bug 462681 fixed the "assignment to undeclared variable printEngineWindow" issue.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.