Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash when <img> fails to parse its src #12003

Merged
merged 4 commits into from Jul 5, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add test for ensuring a bad <img> src does not crash

  • Loading branch information
Manishearth committed Jul 5, 2016
commit c953b07108f20c5c2542bd20a9d156c4e3aafa8b
"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>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.