mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
script: check if the canvas is paintable before measuring text (#38664)
The `Canvas2dMsg::MeasureText` is dropped inside `send_canvas_2d_msg` if the canvas is not paintable, leading to a panic on the receiving end. Checking the paint-ability before sending the message prevents this panic, and if the canvas is not pain-table, a default text metrics is used. Testing: Manual testing of the minimal test case in the associated issue, and crash test added. Fixes: https://github.com/servo/servo/issues/36845 --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
cf866d12b4
commit
be5e7a982b
3 changed files with 29 additions and 8 deletions
9
tests/wpt/meta/MANIFEST.json
vendored
9
tests/wpt/meta/MANIFEST.json
vendored
|
@ -8083,7 +8083,14 @@
|
|||
{}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"text-metrics-for-unpaintable-crash.html": [
|
||||
"5acecfd691acec60a155c1ec1ab571e0a8efb471",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
]
|
||||
},
|
||||
"dom": {
|
||||
"elements": {
|
||||
|
|
6
tests/wpt/tests/html/canvas/text-metrics-for-unpaintable-crash.html
vendored
Normal file
6
tests/wpt/tests/html/canvas/text-metrics-for-unpaintable-crash.html
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- https://github.com/servo/servo/issues/36845 -->
|
||||
<canvas id="canvas" height="0"></canvas>
|
||||
<script>
|
||||
canvas.getContext("2d").measureText("1");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue