Canvas clearRect doesn't work with large values for width/height
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr102 | --- | unaffected |
firefox112 | --- | wontfix |
firefox113 | --- | wontfix |
firefox114 | --- | fixed |
People
(Reporter: simonalling, Assigned: lsalzman)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0
Steps to reproduce:
https://jsfiddle.net/Alling/ehbjc4mo/15/
All my troubleshooting was done on my ThinkPad X1 Carbon 5th Gen with Ubuntu 20.04.1.
A friend of mine did not encounter this problem in Firefox 111 on Windows 11 (IIRC).
const context = document.querySelector("canvas").getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 300, 300);
const actions = [
clearing(100, 100),
clearing(Math.floor(Number.MAX_SAFE_INTEGER / 10000000), Number.MAX_SAFE_INTEGER),
clearing(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER),
clearing(1000, 1000),
];
actions.forEach((action, index) => {
setTimeout(action, (index + 1) * 1000);
});
function clearing(width, height) {
return () => {
document.body.appendChild(document.createElement("br"));
document.body.appendChild(document.createTextNode("Clearing " + width + " × " + height));
context.clearRect(0, 0, width, height);
};
}
Actual results:
Firefox 109
- 100 × 100 rectangle cleared – ✅ expected
- Entire canvas cleared – ✅ expected
- Entire canvas cleared (idempotently) – ✅ expected
- Entire canvas cleared (idempotently) – ✅ expected
Firefox 110–111
- 100 × 100 rectangle cleared – ✅ expected
- Weird stripes cleared – ❌ unexpected
- Nothing cleared – ❌ unexpected
- Entire canvas cleared – ✅ expected
Firefox 112
- 100 × 100 rectangle cleared – ✅ expected
- Weird stripes cleared – ❌ unexpected
- Nothing cleared – ❌ unexpected
- Nothing cleared – ❌ unexpected
Expected results:
- 100 × 100 rectangle cleared
- Entire canvas cleared
- Entire canvas cleared (idempotently)
- Entire canvas cleared (idempotently)
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 years ago
•
|
||
You should be able to use https://mozilla.github.io/mozregression/ to find more precise regression ranges.
(In reply to Robert Longson [:longsonr] from comment #2)
You should be able to use https://mozilla.github.io/mozregression/ to find more precise regression ranges.
Wow, what an amazing tool! I had no idea it existed, but it makes so much sense that it does, of course.
8:31.20 INFO: Running autoland build built on 2022-09-08 19:52:05.944000, revision 490f5f14
8:46.18 INFO: Launching /tmp/tmpk31xt7i2/firefox/firefox
8:46.18 INFO: Application command: /tmp/tmpk31xt7i2/firefox/firefox -profile /tmp/tmp89co4lrr.mozrunner
8:46.19 INFO: application_buildid: 20220906051025
8:46.19 INFO: application_changeset: 490f5f14eda710bdb43b7cd839e1967da6d434d9
8:46.19 INFO: application_name: Firefox
8:46.19 INFO: application_repository: https://hg.mozilla.org/integration/autoland
8:46.19 INFO: application_version: 106.0a1
Was this integration build good, bad, or broken? (type 'good', 'bad', 'skip', 'retry', 'back' or 'exit' and press Enter): bad
9:21.71 INFO: Narrowed integration regression window from [f8e8c960, ae28cb70] (3 builds) to [f8e8c960, 490f5f14] (2 builds) (~1 steps left)
9:21.71 INFO: No more integration revisions, bisection finished.
9:21.71 INFO: Last good revision: f8e8c96064386b2f3405adefc512f7fbc2808ff8
9:21.71 INFO: First bad revision: 490f5f14eda710bdb43b7cd839e1967da6d434d9
9:21.71 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=f8e8c96064386b2f3405adefc512f7fbc2808ff8&tochange=490f5f14eda710bdb43b7cd839e1967da6d434d9
So it turns out that, based on my bisection, the regression was introduced much earlier than Firefox 110 as I wrote in the bug report, but I still cannot reproduce the issue in Firefox 109.0.
I have zero experience with Mercurial and very limited C++ knowledge, so I think this is all I can contribute at the moment.
Updated•2 years ago
|
Updated•2 years ago
|
I cannot reproduce this issue at all on my main PC with an RTX 2060 Super and Ubuntu 20.04.4, regardless of Firefox version.
Assignee | ||
Comment 5•2 years ago
|
||
Updated•2 years ago
|
Comment 6•2 years ago
|
||
Set release status flags based on info from the regressing bug 1773280
Wow, a bug fix already?! Way to go, lsalzman! Were you able to reproduce the issue?
I have not been able to reproduce it in Windows 10 on the same laptop. (I have only tried with Firefox 109 and 112.)
Updated•2 years ago
|
Comment 9•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Comment 10•2 years ago
|
||
The patch landed in nightly and beta is affected.
:lsalzman, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox113
towontfix
.
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•2 years ago
|
Description
•