Backed out changeset 3a7830a019ac (bug 1218337) for breaking hazard builds

This commit is contained in:
Wes Kocher 2015-11-06 09:33:51 -08:00
parent c569ec2611
commit 353c7cb327
2 changed files with 2 additions and 24 deletions

View File

@ -116,11 +116,6 @@ this.PermissionsTable = { geolocation: {
privileged: DENY_ACTION, privileged: DENY_ACTION,
certified: ALLOW_ACTION certified: ALLOW_ACTION
}, },
"speech-recognition": {
app: DENY_ACTION,
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
telephony: { telephony: {
app: DENY_ACTION, app: DENY_ACTION,
privileged: DENY_ACTION, privileged: DENY_ACTION,

View File

@ -21,11 +21,8 @@
#include "endpointer.h" #include "endpointer.h"
#include "mozilla/dom/SpeechRecognitionEvent.h" #include "mozilla/dom/SpeechRecognitionEvent.h"
#include "nsContentUtils.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsIPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsQueryObject.h" #include "nsQueryObject.h"
@ -163,25 +160,11 @@ SpeechRecognition::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
bool bool
SpeechRecognition::IsAuthorized(JSContext* aCx, JSObject* aGlobal) SpeechRecognition::IsAuthorized(JSContext* aCx, JSObject* aGlobal)
{ {
nsresult rv; bool inPrivilegedApp = IsInPrivilegedApp(aCx, aGlobal);
nsCOMPtr<nsIPermissionManager> mgr = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
uint32_t speechRecognition = nsIPermissionManager::UNKNOWN_ACTION;
nsIPrincipal* principal = nsContentUtils::ObjectPrincipal(aGlobal);
rv = mgr->TestExactPermissionFromPrincipal(principal, "speech-recognition", &speechRecognition);
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
bool hasPermission = (speechRecognition == nsIPermissionManager::ALLOW_ACTION);
bool enableTests = Preferences::GetBool(TEST_PREFERENCE_ENABLE); bool enableTests = Preferences::GetBool(TEST_PREFERENCE_ENABLE);
bool enableRecognitionEnable = Preferences::GetBool(TEST_PREFERENCE_RECOGNITION_ENABLE); bool enableRecognitionEnable = Preferences::GetBool(TEST_PREFERENCE_RECOGNITION_ENABLE);
bool enableRecognitionForceEnable = Preferences::GetBool(TEST_PREFERENCE_RECOGNITION_FORCE_ENABLE); bool enableRecognitionForceEnable = Preferences::GetBool(TEST_PREFERENCE_RECOGNITION_FORCE_ENABLE);
return (hasPermission || enableRecognitionForceEnable || enableTests) && enableRecognitionEnable; return (inPrivilegedApp || enableRecognitionForceEnable || enableTests) && enableRecognitionEnable;
} }
already_AddRefed<SpeechRecognition> already_AddRefed<SpeechRecognition>