Open Bug 1534566 Opened 6 years ago Updated 3 years ago

Canvase throw an exception while set font

Categories

(Core :: Graphics: Canvas2D, defect, P3)

1.9.1 Branch
defect

Tracking

()

People

(Reporter: youngmushroom, Unassigned)

References

Details

Attachments

(1 file)

4.80 KB, application/x-zip-compressed
Details
Attached file canvas.zip

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0

Steps to reproduce:

1, create index.html with the followings
<div style="display:none;">
<iframe src="./iframe.html"></iframe>
</div>
2, create iframe.html with the followings:
<canvas id="tutorial" width="0" height="0"></canvas>
<script src="./index.js">
</script>

Actual results:

"ctx.font = xxx" will throw an exception.
NS_ERROR_FAILURE:

Expected results:

no exception and font changed

Component: Untriaged → Canvas: 2D
Product: Firefox → Core
Blocks: 436904
Version: 65 Branch → 1.9.1 Branch

I did not see an error thrown in Chrome. We throw because:

https://searchfox.org/mozilla-central/rev/2c912888e3b7ae4baf161d98d7a01434f31830aa/dom/canvas/CanvasRenderingContext2D.h#395

mCanvasElement's mPresShell is null, so we bail with an error. I'm guessing this is because the iframe didn't trigger a reflow to create the shell since it has no contents to display.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: