mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Avoid panics for empty or multibyte image usemap
This commit is contained in:
parent
c83ac31e71
commit
ee310fdc2a
3 changed files with 33 additions and 0 deletions
|
@ -422,6 +422,11 @@ impl HTMLImageElement {
|
|||
};
|
||||
|
||||
let value = usemap_attr.value();
|
||||
|
||||
if value.len() == 0 || !value.is_char_boundary(1) {
|
||||
return None
|
||||
}
|
||||
|
||||
let (first, last) = value.split_at(1);
|
||||
|
||||
if first != "#" || last.len() == 0 {
|
||||
|
|
|
@ -12884,6 +12884,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/htmlimageelement.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/htmlimageelement.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/htmllabel-activation.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/htmllabel-activation.html",
|
||||
|
@ -25381,6 +25387,10 @@
|
|||
"54fe6bbc1a7a35ceb14a3bf33f81ebed55beaf72",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/htmlimageelement.html": [
|
||||
"f1857a8f413f444b34464f0a3bc6b46af13c1a5a",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/htmllabel-activation.html": [
|
||||
"2013b49684d0b861415a2e766d5d260906b1f3fb",
|
||||
"testharness"
|
||||
|
|
18
tests/wpt/mozilla/tests/mozilla/htmlimageelement.html
Normal file
18
tests/wpt/mozilla/tests/mozilla/htmlimageelement.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLImageElement usemap special cases</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<img id="empty" usemap>
|
||||
<img id="multibyte" usemap=💩>
|
||||
<script>
|
||||
test(function () {
|
||||
document.querySelector("#empty").dispatchEvent(new Event("click"));
|
||||
assert_true(true);
|
||||
}, "Do not panic on empty usemap");
|
||||
|
||||
test(function () {
|
||||
document.querySelector("#multibyte").dispatchEvent(new Event("click"));
|
||||
assert_true(true);
|
||||
}, "Do not panic on multibyte usemap");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue