Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: http3 OR http2
- Manifest: dom/security/test/general/mochitest.toml
<!DOCTYPE html>
<html>
<!--
-->
<head>
<meta charset="utf-8">
<title>Test for Cross-origin resouce status leak via MediaError</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/ChromeTask.js"></script>
<audio autoplay id="audio"></audio>
<script type="application/javascript">
var CONST_GENERIC_ERROR_MESSAGE = "Failed to open media";
add_task(function() {
return new Promise((resolve) => {
let audioElement = document.getElementById("audio");
audioElement.onerror = function() {
let err = this.error;
let message = err.message;
info(`Got Audio Error -> ${message}`);
ok(message.includes("404"), "Same-Origin Error Message should contain status data");
resolve();
};
});
});
add_task(function() {
return new Promise((resolve) => {
let audioElement = document.getElementById("audio");
audioElement.onerror = function() {
let err = this.error;
let message = err.message;
info(`Got Audio Error -> ${message}`);
is(message, CONST_GENERIC_ERROR_MESSAGE, "Cross-Origin Same-Site Error Message should be generic");
resolve();
};
});
});
add_task(function() {
return new Promise((resolve) => {
let audioElement = document.getElementById("audio");
audioElement.onerror = function() {
let err = this.error;
let message = err.message;
info(`Got Audio Error -> ${message}`);
is(message, CONST_GENERIC_ERROR_MESSAGE, "Cross-Origin Same-Site Error Message should be generic");
resolve();
};
});
});
add_task(function() {
return new Promise((resolve) => {
let audioElement = document.getElementById("audio");
audioElement.onerror = function() {
let err = this.error;
let message = err.message;
info(`Got Audio Error -> ${message}`);
is(message, CONST_GENERIC_ERROR_MESSAGE, "Cross-Origin Error Message should be generic");
resolve();
};
});
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1450853">Mozilla Bug 1450853</a>
<iframe width="0" height="0"></iframe>
</body>
</html>