Closed
Bug 1019551
Opened 11 years ago
Closed 7 years ago
Print preview fails if there's a 0-sized <canvas> element, due to failure case in CanvasRenderingContext2D::DrawImage()
Categories
(Core :: Printing: Output, defect)
Tracking
()
RESOLVED
FIXED
mozilla59
People
(Reporter: tomasz_smykowski, Assigned: jwatt)
References
(Blocks 1 open bug)
Details
(Keywords: regression)
Attachments
(6 files)
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0 (Beta/Release)
Build ID: 20140506152807
Steps to reproduce:
1. Open the html file attached.
2. Open Print Preview
3. Print preview flashes and closes
4. No way to display it.
Actual results:
Print preview is not displaying
Expected results:
Print preview should be displayed
I got the "There was an unexpected problem while printing." message in Fx30.
Component: Untriaged → Printing: Output
Product: Firefox → Core
Comment 2•11 years ago
|
||
I can reproduce. This happens because we fail at cloning one of the nodes. The node in particular is a canvas node, and we apparently fail because it's 0-sized.
Each of these reduced testcases will reproduce the bug for me:
data:text/html,<canvas width="0">
data:text/html,<canvas height="0">
32.0a1 (2014-05-29)
Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 7 → All
Hardware: x86 → All
Summary: Print preview stopped working from yesterday → Print preview fails if there's a 0-sized <canvas> element
Version: 29 Branch → Trunk
Comment 3•11 years ago
|
||
Specifically, we fail here in CanvasRenderingContext2D::DrawImage():
{
> 3283 if (image.IsHTMLCanvasElement()) {
> 3284 HTMLCanvasElement* canvas = &image.GetAsHTMLCanvasElement();
> 3285 element = canvas;
> 3286 nsIntSize size = canvas->GetSize();
> 3287 if (size.width == 0 || size.height == 0) {
> 3288 error.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
> 3289 return;
> 3290 }
http://mxr.mozilla.org/mozilla-central/source/content/canvas/src/CanvasRenderingContext2D.cpp?rev=57b0932e2f06#3283
...and that error gets propagated all the way up to nsPrintEngine.cpp, which fails the print [preview] operation and spawns an error dialog.
This return case was added back in http://hg.mozilla.org/mozilla-central/rev/a8171812fe05#l5.3587 (when this code looked slightly different).
roc or Bas, do you remember why this is a NS_ERROR_DOM_INVALID_STATE_ERR? (Perhaps we need to do something different when we're not actually drawing anything and/or when we're doing this as part of printing?)
I'll attach a backtrace for this line of code in a minute, FWIW.
Summary: Print preview fails if there's a 0-sized <canvas> element → Print preview fails if there's a 0-sized <canvas> element, due to failure case in CanvasRenderingContext2D::DrawImage()
Comment 4•11 years ago
|
||
Comment 5•11 years ago
|
||
Updated•11 years ago
|
Attachment #8433691 -
Attachment description: reduced testcase 1: zero-width canvas → reduced testcase 2: zero-width canvas
Comment 6•11 years ago
|
||
Updated•11 years ago
|
Attachment #8433695 -
Attachment description: backgrace of error → backtrace of error
Comment 7•11 years ago
|
||
(Perhaps HTMLCanvasElement::CopyInnerTo should have a version of the 0-size check from DrawImage(), and return without doing anything if we're 0-sized? But if we can handle this elegantly in DrawImage, that'd probably be better.)
What can i do to help fix this issue? It one month now when it's not working. And i need to print some things
Regression range:
good=2012-11-14
bad=2012-11-15
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=dd68409d7810&tochange=a761bfc192b5
Suspected:
Nicholas Cameron — Bug 800556; remove nsIDOMCanvasRenderingContext2D; r=Ms2ger,sr=bz
Comment 10•9 years ago
|
||
This bug still presents in Firefox 46.0.1
Code causing problem is
<div style="display: none;" ><canvas height="0" width="0"></canvas></div>
This is enough to make any page unprintable
Comment 11•9 years ago
|
||
| Assignee | ||
Comment 12•7 years ago
|
||
Assignee: nobody → jwatt
Attachment #8943815 -
Flags: review?(lsalzman)
| Assignee | ||
Updated•7 years ago
|
Flags: needinfo?(ncameron)
Updated•7 years ago
|
Attachment #8943815 -
Flags: review?(lsalzman) → review+
Comment 13•7 years ago
|
||
Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d8431cf09d20
Fix failure to print when pages contain zero sized <canvas>. r=lsalzman
Comment 14•7 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Updated•7 years ago
|
status-firefox58:
--- → wontfix
status-firefox-esr52:
--- → wontfix
Updated•7 years ago
|
QA Whiteboard: [good first verify]
Comment 15•7 years ago
|
||
I have reproduced this bug with Nightly 32.0a1 (2014-06-03) on Windows 10, 64 Bit!
This bug's fix is verified with latest Beta!
Build ID : 20180128191456
User Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
QA Whiteboard: [good first verify] → [good first verify] [bugday-20180124]
Comment 16•7 years ago
|
||
I have Reproduced this bug with Firefox Nightly 60.0a1 (2018-02-07) on Windows 7, (32bit)
Steps to Reproduce:
1)Downloaded the Desktop.rar attached file
2)Open the html file which is present in that Desktop.rar file
3)Click on File -> Print Preview
4)Print preview Flashed and Opened in the separate tab.
Actual Results:
Print Preview is displayed.
This Bug is Verified with Latest Beta too.
Status: Fixed & Verified
Firefoxversion:60.0a1
Build ID: 20180206100151
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0
OS: Windows_NT 6.1
[bugday-20180207]
| Assignee | ||
Comment 17•7 years ago
|
||
(In reply to Mohammed Adam from comment #16)
> I have Reproduced this bug with Firefox Nightly 60.0a1 (2018-02-07) on
> Windows 7, (32bit)
"Reproduced" would mean that the bug is still present (unfixed) in 60.0a1. Presumably you mean "tried to reproduce"?
Comment 18•7 years ago
|
||
(In reply to Jonathan Watt [:jwatt] (needinfo? me) from comment #17)
> (In reply to Mohammed Adam from comment #16)
> > I have Reproduced this bug with Firefox Nightly 60.0a1 (2018-02-07) on
> > Windows 7, (32bit)
>
> "Reproduced" would mean that the bug is still present (unfixed) in 60.0a1.
> Presumably you mean "tried to reproduce"?
Sorry, I have Tried to Reproduce & the bug is fixed in the latest Nightly and Beta version.
| Assignee | ||
Comment 19•7 years ago
|
||
Awesome. Thanks for checking and confirming!
You need to log in
before you can comment on or make changes to this bug.
Description
•