Bug 1206982 - getUserMedia s/PermissionDeniedError/SecurityError/. r=jesup

This commit is contained in:
Jan-Ivar Bruaroey 2015-09-21 20:57:12 -04:00
parent a71fb37eb9
commit 7810914636
10 changed files with 17 additions and 19 deletions

View File

@ -43,7 +43,7 @@ function runNext() {
ok(false, 'unexpected success, permission request should be denied');
runNext();
}, function failure(err) {
is(err.name, 'PermissionDeniedError', 'expected permission denied');
is(err.name, 'SecurityError', 'expected permission denied');
runNext();
});
} else {

View File

@ -223,7 +223,7 @@ function* checkNotSharing() {
yield* assertWebRTCIndicatorStatus(null);
}
const permissionError = "error: PermissionDeniedError: The user did not grant permission for the operation.";
const permissionError = "error: SecurityError: The operation is insecure.";
var gTests = [

View File

@ -231,7 +231,7 @@ registerCleanupFunction(function() {
Services.prefs.setCharPref(PREF_LOOP_CSP, originalLoopCsp);
});
const permissionError = "error: PermissionDeniedError: The user did not grant permission for the operation.";
const permissionError = "error: SecurityError: The operation is insecure.";
var gTests = [

View File

@ -221,8 +221,6 @@ function getFrameGlobal(aFrameId) {
return content.wrappedJSObject.document.getElementById(aFrameId).contentWindow;
}
const permissionError = "error: PermissionDeniedError: The user did not grant permission for the operation.";
var gTests = [
{

View File

@ -1869,7 +1869,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow,
(!privileged && !HostHasPermission(*docURI))) {
nsRefPtr<MediaStreamError> error =
new MediaStreamError(aWindow,
NS_LITERAL_STRING("PermissionDeniedError"));
NS_LITERAL_STRING("SecurityError"));
onFailure->OnError(error);
return NS_OK;
}
@ -1945,7 +1945,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow,
if (!Preferences::GetBool("media.getusermedia.audiocapture.enabled")) {
nsRefPtr<MediaStreamError> error =
new MediaStreamError(aWindow,
NS_LITERAL_STRING("PermissionDeniedError"));
NS_LITERAL_STRING("SecurityError"));
onFailure->OnError(error);
return NS_OK;
}
@ -2005,7 +2005,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow,
if ((!IsOn(c.mAudio) || audioPerm == nsIPermissionManager::DENY_ACTION) &&
(!IsOn(c.mVideo) || videoPerm == nsIPermissionManager::DENY_ACTION)) {
nsRefPtr<MediaStreamError> error =
new MediaStreamError(aWindow, NS_LITERAL_STRING("PermissionDeniedError"));
new MediaStreamError(aWindow, NS_LITERAL_STRING("SecurityError"));
onFailure->OnError(error);
RemoveFromWindowList(windowID, listener);
return NS_OK;
@ -2631,7 +2631,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
array->Count(&len);
if (!len) {
// neither audio nor video were selected
task->Denied(NS_LITERAL_STRING("PermissionDeniedError"));
task->Denied(NS_LITERAL_STRING("SecurityError"));
return NS_OK;
}
bool videoFound = false, audioFound = false;
@ -2668,7 +2668,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
} else if (!strcmp(aTopic, "getUserMedia:response:deny")) {
nsString errorMessage(NS_LITERAL_STRING("PermissionDeniedError"));
nsString errorMessage(NS_LITERAL_STRING("SecurityError"));
if (aSubject) {
nsCOMPtr<nsISupportsString> msg(do_QueryInterface(aSubject));

View File

@ -230,7 +230,7 @@ MediaPermissionRequest::Cancel()
{
nsString callID;
mRequest->GetCallID(callID);
NotifyPermissionDeny(callID, NS_LITERAL_STRING("PermissionDeniedError"));
NotifyPermissionDeny(callID, NS_LITERAL_STRING("SecurityError"));
return NS_OK;
}

View File

@ -20,8 +20,8 @@ BaseMediaMgrError::BaseMediaMgrError(const nsAString& aName,
if (mMessage.IsEmpty()) {
if (mName.EqualsLiteral("NotFoundError")) {
mMessage.AssignLiteral("The object can not be found here.");
} else if (mName.EqualsLiteral("PermissionDeniedError")) {
mMessage.AssignLiteral("The user did not grant permission for the operation.");
} else if (mName.EqualsLiteral("SecurityError")) {
mMessage.AssignLiteral("The operation is insecure.");
} else if (mName.EqualsLiteral("SourceUnavailableError")) {
mMessage.AssignLiteral("The source of the MediaStream could not be "
"accessed due to a hardware error (e.g. lock from another process).");

View File

@ -29,16 +29,16 @@ var tests = [
error: null },
{ message: "full screensharing requires permission",
constraints: { video: { mediaSource: 'screen' } },
error: "PermissionDeniedError" },
error: "SecurityError" },
{ message: "application screensharing requires permission",
constraints: { video: { mediaSource: 'application' } },
error: "PermissionDeniedError" },
error: "SecurityError" },
{ message: "window screensharing requires permission",
constraints: { video: { mediaSource: 'window' } },
error: "PermissionDeniedError" },
error: "SecurityError" },
{ message: "browser screensharing requires permission",
constraints: { video: { mediaSource: 'browser' } },
error: "PermissionDeniedError" },
error: "SecurityError" },
{ message: "unknown mediaSource in video fails",
constraints: { video: { mediaSource: 'uncle' } },
error: "OverconstrainedError",

View File

@ -26,7 +26,7 @@ t.step(function() {
t.done();
}),
t.step_func(function (error) {
assert_equals(error.name, "PermissionDeniedError", "Permission denied error returned");
assert_equals(error.name, "SecurityError", "SecurityError returned");
assert_equals(error.constraintName, null, "constraintName attribute not set for permission denied");
t.done();
}));

View File

@ -27,7 +27,7 @@ function test() {
loadWebapp("getUserMedia.webapp", undefined, function onLoad() {
let msg = gAppBrowser.contentDocument.getElementById("msg");
mutObserver = new MutationObserver(function(mutations) {
is(msg.textContent, "PermissionDeniedError: The user did not grant permission for the operation.",
is(msg.textContent, "SecurityError: The operation is insecure.",
"getUserMedia permission denied.");
ok(getUserMediaDialogOpened, "Prompt shown.");
finish();