diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 7cebebade0a..389cd87b064 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -423,6 +423,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 { diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 9d577adaebd..c8d994cd4db 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -12952,6 +12952,12 @@ {} ] ], + "mozilla/htmlimageelement.html": [ + [ + "/_mozilla/mozilla/htmlimageelement.html", + {} + ] + ], "mozilla/htmllabel-activation.html": [ [ "/_mozilla/mozilla/htmllabel-activation.html", @@ -25499,6 +25505,10 @@ "54fe6bbc1a7a35ceb14a3bf33f81ebed55beaf72", "testharness" ], + "mozilla/htmlimageelement.html": [ + "f1857a8f413f444b34464f0a3bc6b46af13c1a5a", + "testharness" + ], "mozilla/htmllabel-activation.html": [ "2013b49684d0b861415a2e766d5d260906b1f3fb", "testharness" diff --git a/tests/wpt/mozilla/tests/mozilla/htmlimageelement.html b/tests/wpt/mozilla/tests/mozilla/htmlimageelement.html new file mode 100644 index 00000000000..fe0cf3e83c5 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/htmlimageelement.html @@ -0,0 +1,18 @@ + + +