Unexpected color pixel data from getImageData

Description of the issue:

In a simple javascript implementation, using getImageDataon a small canvas provides unexpected color pixel data.

Steps to Reproduce (add as many as necessary):

  1. The following html file is run locally under Brave (for the actual result), and Chrome (for the expected result):
<!DOCTYPE html>
<html>
<head>
  <title>Test</title>
</head>
<body>
  <script>
    const s = 4;
    const canvas = document.createElement('canvas');
    canvas.width = s;
    canvas.height = s;
    const ctx = canvas.getContext('2d');

    ctx.fillStyle = 'red';
    ctx.fillRect(0,0,s,s);
    const red = ctx.getImageData(0,0,s,s);

    console.log('red');
    [...red.data].forEach((v, i) => console.log(`${i}, ${v}`));
  </script>
</body>
</html>

Actual Result (gifs and screenshots are welcome!):

The console output on Brave is as follows:

red
0, 255
1, 1
2, 0
3, 255
4, 255
5, 0
6, 0
7, 255
8, 255
9, 0
10, 0
11, 255
12, 255
13, 1
14, 0
15, 255
16, 255
17, 1
18, 0
19, 255
20, 255
21, 1
22, 0
23, 255
24, 255
25, 0
26, 0
27, 255
28, 255
29, 0
30, 0
31, 255
32, 255
33, 1
34, 0
35, 255
36, 255
37, 0
38, 0
39, 255
40, 255
41, 1
42, 0
43, 255
44, 255
45, 1
46, 0
47, 255
48, 255
49, 0
50, 0
51, 255
52, 255
53, 1
54, 0
55, 255
56, 255
57, 1
58, 0
59, 255
60, 255
61, 1
62, 0
63, 255

Expected result:

The console output on Chrome is as follows:

red
0, 255
1, 0
2, 0
3, 255
4, 255
5, 0
6, 0
7, 255
8, 255
9, 0
10, 0
11, 255
12, 255
13, 0
14, 0
15, 255
16, 255
17, 0
18, 0
19, 255
20, 255
21, 0
22, 0
23, 255
24, 255
25, 0
26, 0
27, 255
28, 255
29, 0
30, 0
31, 255
32, 255
33, 0
34, 0
35, 255
36, 255
37, 0
38, 0
39, 255
40, 255
41, 0
42, 0
43, 255
44, 255
45, 0
46, 0
47, 255
48, 255
49, 0
50, 0
51, 255
52, 255
53, 0
54, 0
55, 255
56, 255
57, 0
58, 0
59, 255
60, 255
61, 0
62, 0
63, 255

Reproduces how often:

The error to the green color component seems to reproduced every time, and in the same pattern.

Operating System and Brave Version(See the About Brave page in the main menu):

Windows 7 64-bit, “Version 1.8.96 Chromium: 81.0.4044.138 (Official Build) (64-bit)”
Also, the version of Chrome used as comparison: “Version 81.0.4044.138 (Official Build) (64-bit)”

Additional Information:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.