diff --git a/b2g/components/test/mochitest/test_permission_deny.html b/b2g/components/test/mochitest/test_permission_deny.html index a91667f291e..29c35bdecd1 100644 --- a/b2g/components/test/mochitest/test_permission_deny.html +++ b/b2g/components/test/mochitest/test_permission_deny.html @@ -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 { diff --git a/browser/base/content/test/general/browser_devices_get_user_media.js b/browser/base/content/test/general/browser_devices_get_user_media.js index b98d5677776..5452dc7f5eb 100644 --- a/browser/base/content/test/general/browser_devices_get_user_media.js +++ b/browser/base/content/test/general/browser_devices_get_user_media.js @@ -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 = [ diff --git a/browser/base/content/test/general/browser_devices_get_user_media_about_urls.js b/browser/base/content/test/general/browser_devices_get_user_media_about_urls.js index ff1c4929db3..23b98ced4ab 100644 --- a/browser/base/content/test/general/browser_devices_get_user_media_about_urls.js +++ b/browser/base/content/test/general/browser_devices_get_user_media_about_urls.js @@ -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 = [ diff --git a/browser/base/content/test/general/browser_devices_get_user_media_in_frame.js b/browser/base/content/test/general/browser_devices_get_user_media_in_frame.js index 9266b4bf307..046f39f8183 100644 --- a/browser/base/content/test/general/browser_devices_get_user_media_in_frame.js +++ b/browser/base/content/test/general/browser_devices_get_user_media_in_frame.js @@ -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 = [ { diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index a87a507d4d2..d123c08c552 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -1869,7 +1869,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, (!privileged && !HostHasPermission(*docURI))) { nsRefPtr 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 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 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 msg(do_QueryInterface(aSubject)); diff --git a/dom/media/MediaPermissionGonk.cpp b/dom/media/MediaPermissionGonk.cpp index b54602c7b0b..75f95118e13 100644 --- a/dom/media/MediaPermissionGonk.cpp +++ b/dom/media/MediaPermissionGonk.cpp @@ -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; } diff --git a/dom/media/MediaStreamError.cpp b/dom/media/MediaStreamError.cpp index 44d45b25023..659d1231cd3 100644 --- a/dom/media/MediaStreamError.cpp +++ b/dom/media/MediaStreamError.cpp @@ -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)."); diff --git a/dom/media/tests/mochitest/test_getUserMedia_constraints.html b/dom/media/tests/mochitest/test_getUserMedia_constraints.html index eb1a39e7b20..1de5cc271a6 100644 --- a/dom/media/tests/mochitest/test_getUserMedia_constraints.html +++ b/dom/media/tests/mochitest/test_getUserMedia_constraints.html @@ -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", diff --git a/testing/web-platform/tests/mediacapture-streams/obtaining-local-multimedia-content/navigatorusermedia/deny.html b/testing/web-platform/tests/mediacapture-streams/obtaining-local-multimedia-content/navigatorusermedia/deny.html index 0cc3f93cf93..3c22591a9fe 100644 --- a/testing/web-platform/tests/mediacapture-streams/obtaining-local-multimedia-content/navigatorusermedia/deny.html +++ b/testing/web-platform/tests/mediacapture-streams/obtaining-local-multimedia-content/navigatorusermedia/deny.html @@ -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(); })); diff --git a/webapprt/test/chrome/browser_getUserMedia.js b/webapprt/test/chrome/browser_getUserMedia.js index 95cbe21e5f0..4e7b4d57305 100644 --- a/webapprt/test/chrome/browser_getUserMedia.js +++ b/webapprt/test/chrome/browser_getUserMedia.js @@ -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();