mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add test for ensuring a bad <img> src does not crash
This commit is contained in:
parent
fe5ff70284
commit
c953b07108
2 changed files with 27 additions and 0 deletions
|
@ -36276,6 +36276,12 @@
|
|||
"path": "html/semantics/document-metadata/the-link-element/document-without-browsing-context.html",
|
||||
"url": "/html/semantics/document-metadata/the-link-element/document-without-browsing-context.html"
|
||||
}
|
||||
],
|
||||
"html/semantics/embedded-content/the-img-element/invalid-src.html": [
|
||||
{
|
||||
"path": "html/semantics/embedded-content/the-img-element/invalid-src.html",
|
||||
"url": "/html/semantics/embedded-content/the-img-element/invalid-src.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Loading a non-parsing URL as an image should silently fail; triggering appropriate events</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<img id=myimg />
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var img = document.getElementById("myimg");
|
||||
img.src = "http://also a broken url";
|
||||
var errorevent = false;
|
||||
|
||||
// The errors should be queued in the event loop, so they should only trigger
|
||||
// after this block of code finishes, not during the img.src setter itself
|
||||
img.addEventListener('error', t.step_func(function(){errorevent = true;}));
|
||||
img.addEventListener('loadend', t.step_func_done(function() {
|
||||
assert_true(errorevent, "error event fired");
|
||||
}));
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue