Bug 231474 - Safari 15 canvas drawImage API Error
Summary: Safari 15 canvas drawImage API Error
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P1 Blocker
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-09 01:28 PDT by kaelyn
Modified: 2021-10-11 09:24 PDT (History)
2 users (show)

See Also:


Attachments
render error on safari 15 (4.57 KB, image/png)
2021-10-09 01:28 PDT, kaelyn
no flags Details
Correct Rendering result on chrome (10.59 KB, image/png)
2021-10-09 01:28 PDT, kaelyn
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kaelyn 2021-10-09 01:28:18 PDT
Created attachment 440703 [details]
render error on safari 15

Version: 15.0(17612.1.15.1.14)
Description: 
1. Getting the canvas context.
2. Create an image dom element with long base64 string as its source.
3. Using drawImage API to render that image dom.
4. The canvas crash, it cannot render anything after using drawImage API!!!

Test code:
https://codepen.io/applekaelyn/pen/mdWgMGq
```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <img id="testImg"       width="100"
      height="100"
         src="data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiPgogIDxlbGxpcHNlIGN4PSIyNDAiIGN5PSIxMDAiIHJ4PSIyMjAiIHJ5PSIzMCIgc3R5bGU9ImZpbGw6cHVycGxlIiAvPgogIDxlbGxpcHNlIGN4PSIyMjAiIGN5PSI3MCIgcng9IjE5MCIgcnk9IjIwIiBzdHlsZT0iZmlsbDpsaW1lIiAvPgogIDxlbGxpcHNlIGN4PSIyMTAiIGN5PSI0NSIgcng9IjE3MCIgcnk9IjE1IiBzdHlsZT0iZmlsbDp5ZWxsb3ciIC8+Cjwvc3ZnPg=="></img>
    <canvas height="200" width="200" id="test"></canvas>
  </body>

</html>
```

```js
var ctx = document.getElementById("test").getContext("2d");
console.log("😄", ctx);
ctx.font = "12px serif";
ctx.fillText("Hello world", 50, 10);
var image = document.getElementById('testImg');
ctx.drawImage(image, 20, 20, 100, 100)

ctx.fillText("Hello world again!", 50, 200);
```
Comment 1 kaelyn 2021-10-09 01:28:59 PDT
Created attachment 440704 [details]
Correct Rendering result on chrome
Comment 2 Alexey Proskuryakov 2021-10-11 09:24:00 PDT
I cannot reproduce this with Safari 15.1 beta. Could you please verify with the beta, and reopen if this still happens?