Closed Bug 1353439 Opened 3 years ago Closed 3 years ago

Print preview ignores zoom factor: Cc is not defined

Categories

(Core :: Printing: Output, defect)

53 Branch
Unspecified
All
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox53 --- fixed
firefox54 --- fixed
firefox55 --- fixed

People

(Reporter: bugZ, Assigned: frg)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0 SeaMonkey/2.52a1
Build ID: 20170403003416

Steps to reproduce:

Changing the zoom factor in printing is broken. It works correctly in the Feb 7 build and is broken since at least the Mar 18 build (probably broke somewhere in between).

1. Go to any page, e.g. https://www.seamonkey-project.org/dev/get-involved, or any email message
2. File->Print preview
3. In the preview window, change the zoom factor, such as to/from 60%/100% or whatever strikes your fancy


Actual results:

Nothing changes in the content window. The error console shows:
Error: Cc is not defined
Source File: chrome://global/content/printUtils.js
Line: 108


Expected results:

The content area should have shrunk/enlarged accordingly.

Note that I do have a minimum font-size set in prefs but disabling it had no effect.

This is a big paper-waster since it seems to be stuck on 100% or Shrink to fit where 60% is my default for printing. I have to print many business-related email messages and this becomes a real chore since it doesn't remember my printer options, either.
NOT reproducible with unzipped installer of  official  en-US SeaMonkey 2.52a1 (NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0 Build 20170311002651  (Default Classic Theme) on German WIN7 64bit

WIN10 related or appeared with latest builds? More investigation required.
OS: Unspecified → Windows 10
User agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0 SeaMonkey/2.51a1
Build identifier: 20170207004355

The above is the last build where the print zoom works correctly and the error console does not show the "Cc not defined" error.

Windows trunk builds don't happen every day, the next one after that is Feb 15, zoom is broken and the error console does show the error.

I got all my builds as zip files from https://ftp.mozilla.org/pub/seamonkey/nightly/2017/
I extracted the printUtils.js from both Feb 7 and Feb 15 builds and a function was added in the latter:

getDefaultPrinterName() {
    try {
      let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"]
                    .getService(Ci.nsIPrintSettingsService);

      return PSSVC.defaultPrinterName;
    } catch (e) {
      Components.utils.reportError(e);
    }

    return null;
  },

I can guess what the intent is, but it is what's failing. The Cc in the third line is undefined.
The function in comment #3 is there in all builds since Feb 15, and appears to be the cause of print zoom breakage. At least on Windows 10.
When I replaced printUtils.js in the build from Apr 3 with the file from the Feb 7 build, print zoom started working correctly again. So there you have it.
NOT reproducible  with unzipped installer of  unofficial  (by FRG)   en-US SeaMonkey 2.52a1 (NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0 Build 20170326124008  (Default Classic Theme) on German WIN7 64bit:

1. In browser open 
   <http://www.zeit.de/politik/ausland/polen-jaroslaw-kaczynski-regierung-blog>
2. Menu ˋFile  → Print Previewˊ
   » Page will be shown in Print Preview
3. Click [Print] and print with FreePDF
   » PDF document with scale 100% will be created
4.  Menu ˋFile  → Print Previewˊ for above mentioned URL
   » Page will be shown in Print Preview
5. Change Scale to 30%
   » Page will be shown in Print Preview with new scale
6. Click [Print] and print with FreePDF
  » PDF document with scale 30% will be created

a) WIN10 related?
b) FRG-Builds not affected?
c) Web page related
d) related to something else?
Well if my builds are not affected its just luck. I think I defined Cc somewhere in a private patch. Bug 1329216 added this and its clearly wrong here. Cc and Ci are undefined in the file and so global variables are used which are not defined by SeaMonkey. Everywhere else Components.classes and Components.interfaces is used in it.
Status: UNCONFIRMED → NEW
Depends on: 1329216
Ever confirmed: true
Component: General → Printing: Output
OS: Windows 10 → All
Product: SeaMonkey → Core
Version: SeaMonkey 2.52 Branch → 53 Branch
tedd - looks like this shouldn't have used the Cc abbreviation.
Flags: needinfo?(julian.r.hector)
Approval Request Comment
[Feature/Bug causing the regression]: 1329216
[User impact if declined]: Print preview problems in comm-central products and maybe even Firefox.
[Is this code covered by automated tests?]:
[Has the fix been verified in Nightly?]: yes tomorrow
[Needs manual test from QE? If yes, steps to reproduce]: 
[List of other uplifts needed for the feature/fix]: none
[Is the change risky?]: no
[Why is the change risky/not risky?]: trivial
[String changes made/needed]: none
Assignee: nobody → frgrahl
Status: NEW → ASSIGNED
Attachment #8854782 - Flags: review?(julian.r.hector)
Attachment #8854782 - Flags: approval-mozilla-beta?
Attachment #8854782 - Flags: approval-mozilla-aurora?
:bobowen, yes *facepalm*, couples lines above it even uses the correct one.
Flags: needinfo?(julian.r.hector)
Comment on attachment 8854782 [details] [diff] [review]
1353439-components.patch

It is a trivial patch, but I don't know if I am allowed to give r+.
Attachment #8854782 - Flags: review?(julian.r.hector) → review+
Happened to me numerous times when I forgot that Cc and Ci are not always available in Thunderbird and SeaMonkey code :)

Lets see how it works in 55 and would would be great if it can be put into 54 and 53 before merge day.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f44b0bd38130
Cc and Ci are not defined in printUtils.js so use Components full names. r=jhector
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f44b0bd38130
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Hi K Chayka,
Can you help check if this issue is fixed in the latest nightly?
Flags: needinfo?(bugZ)
User agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40a1
Build identifier: 20150915173014

It works like it oughta. Thanks!
Flags: needinfo?(bugZ)
Wait - I installed an old build in error. Give me a couple minutes and I'll get the right one.
User agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0 SeaMonkey/2.52a1
Build identifier: 20170406002917

Still broken - printUtils.js still has Cc in it:

getDefaultPrinterName() {
    try {
      let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"]
                    .getService(Ci.nsIPrintSettingsService);

      return PSSVC.defaultPrinterName;
    } catch (e) {
      Components.utils.reportError(e);
    }

    return null;
  },

This is the latest Win build, right?
Comment on attachment 8854782 [details] [diff] [review]
1353439-components.patch

Fix a printing preview regression and was verified. Beta53+ & Aurora54+.
Attachment #8854782 - Flags: approval-mozilla-beta?
Attachment #8854782 - Flags: approval-mozilla-beta+
Attachment #8854782 - Flags: approval-mozilla-aurora?
Attachment #8854782 - Flags: approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.