зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1731614 - Clarify error phrasing in NoSupportedMediaSourceError; r=ckerschb,dveditz
Differential Revision: https://phabricator.services.mozilla.com/D145576
This commit is contained in:
Родитель
9fee1bf9c5
Коммит
29fb0fb057
|
@ -2357,14 +2357,14 @@ void HTMLMediaElement::NoSupportedMediaSourceError(
|
|||
ShutdownDecoder();
|
||||
}
|
||||
|
||||
bool isThirdPartyLoad = false;
|
||||
bool isSameOriginLoad = false;
|
||||
nsresult rv = NS_ERROR_NOT_AVAILABLE;
|
||||
if (mSrcAttrTriggeringPrincipal && mLoadingSrc) {
|
||||
rv = mSrcAttrTriggeringPrincipal->IsThirdPartyURI(mLoadingSrc,
|
||||
&isThirdPartyLoad);
|
||||
rv = mSrcAttrTriggeringPrincipal->IsSameOrigin(mLoadingSrc,
|
||||
&isSameOriginLoad);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && isThirdPartyLoad) {
|
||||
if (NS_SUCCEEDED(rv) && !isSameOriginLoad) {
|
||||
// aErrorDetails can include sensitive details like MimeType or HTTP Status
|
||||
// Code. In case we're loading a 3rd party resource we should not leak this
|
||||
// and pass a Generic Error Message
|
||||
|
|
|
@ -24,11 +24,12 @@ add_task(function() {
|
|||
audioElement.onerror = function() {
|
||||
let err = this.error;
|
||||
let message = err.message;
|
||||
|
||||
info(`Got Audio Error -> ${message}`);
|
||||
ok(message.includes("404"), "Same-Origin Error Message may contain status data");
|
||||
ok(message.includes("404"), "Same-Origin Error Message should contain status data");
|
||||
resolve();
|
||||
};
|
||||
audioElement.src = "/media/test.mp3";
|
||||
audioElement.src = "http://mochi.test:8888/media/test.mp3";
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -41,7 +42,39 @@ add_task(function() {
|
|||
let message = err.message;
|
||||
|
||||
info(`Got Audio Error -> ${message}`);
|
||||
is(message,CONST_GENERIC_ERROR_MESSAGE, "Cross-Origin Error Message is only Generic");
|
||||
is(message, CONST_GENERIC_ERROR_MESSAGE, "Cross-Origin Same-Site Error Message should be generic");
|
||||
resolve();
|
||||
};
|
||||
audioElement.src = "http://mochi.test:9999/media/test.mp3";
|
||||
});
|
||||
});
|
||||
|
||||
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();
|
||||
};
|
||||
audioElement.src = "http://sub.mochi.test:8888/media/test.mp3";
|
||||
});
|
||||
});
|
||||
|
||||
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();
|
||||
};
|
||||
audioElement.src = "https://example.com/media/test.mp3";
|
||||
|
|
Загрузка…
Ссылка в новой задаче