closing print preview window in TB produces "useless expression" warning

RESOLVED FIXED in Firefox 59

Status

()

Toolkit
Printing
--
minor
RESOLVED FIXED
2 years ago
5 months ago

People

(Reporter: aceman, Assigned: aceman)

Tracking

Trunk
mozilla59
Points:
---

Firefox Tracking Flags

(firefox48 affected, firefox59 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

2 years ago
Closing print preview window (of a message) in Thunderbird produces "useless expression" warning:

Warning: TypeError: useless expression
Source File: chrome://messenger/content/msgPrintEngine.xul
Line: 1
Source Code:
null

The line seems wrong, the error could possibly be in
mailnews/base/content/msgPrintEngine.js
(Assignee)

Updated

5 months ago
Component: Printing → Printing
Product: MailNews Core → Toolkit
(Assignee)

Comment 1

5 months ago
Created attachment 8942434 [details] [diff] [review]
1265174.patch

arai has found that the error really occurs at printUtils.js line 709, which is: document.documentElement.setAttribute("onclose", this._closeHandlerPP);

The msgPrintEngine.xul file has no 'onclose' attribute on the 'window' element defined.
Therefore this._closeHandlerPP can be null (https://dxr.mozilla.org/comm-release/rev/ca38c18d63f9dd59c93179cf3c43ddee58793f1e/mozilla/toolkit/components/printing/content/printUtils.js#679) so setting onclose to null at exit seems useless.

The patch makes the code at line 709 being the inverse of 679, i.e. if there was no "onclose" attribute at the start, remove it now, do not set it to null or empty.

This fixes the warning for me. Thanks arai!
Attachment #8942434 - Flags: review?(bugs)
Attachment #8942434 - Flags: feedback?(arai.unmht)
Comment on attachment 8942434 [details] [diff] [review]
1265174.patch

Review of attachment 8942434 [details] [diff] [review]:
-----------------------------------------------------------------

looks good.
thanks!
Attachment #8942434 - Flags: feedback?(arai.unmht) → feedback+

Comment 3

5 months ago
Comment on attachment 8942434 [details] [diff] [review]
1265174.patch

Looks like the file isn't consistent with if's {} usage.
Per coding style there should be {} always with if and else, so please add those.
Attachment #8942434 - Flags: review?(bugs) → review+
(Assignee)

Comment 4

5 months ago
Created attachment 8942455 [details] [diff] [review]
1265174.patch v1.1

Sure, thanks.
Assignee: nobody → acelists
Status: NEW → ASSIGNED
Attachment #8942455 - Flags: review+
(Assignee)

Updated

5 months ago
Keywords: checkin-needed
OS: Linux → All
Hardware: x86 → All
(Assignee)

Updated

5 months ago
Attachment #8942434 - Attachment is obsolete: true

Comment 5

5 months ago
Pushed by ncsoregi@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/78776e9bdba1
do not restore "onclose" attribute to null value in print preview window, when there was none at the start. r=smaug
Keywords: checkin-needed

Comment 6

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/78776e9bdba1
Status: ASSIGNED → RESOLVED
Last Resolved: 5 months ago
status-firefox59: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.