merge b2g-inbound to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2014-04-02 15:57:57 +02:00
Родитель f46dcca453 88074929af
Коммит 9a0a6ba74f
18 изменённых файлов: 278 добавлений и 30 удалений

Просмотреть файл

@ -19,12 +19,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="12408eb142739c7de87ab7ee0d0d2854d5c298f3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>

Просмотреть файл

@ -17,9 +17,9 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>

Просмотреть файл

@ -15,10 +15,10 @@
<project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>

Просмотреть файл

@ -19,12 +19,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="12408eb142739c7de87ab7ee0d0d2854d5c298f3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "672459abdd64f9ac4b13685ee53680167f473617",
"revision": "c23b496987e1e356c1cf7cc848c69511f6db041a",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -17,11 +17,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

Просмотреть файл

@ -15,11 +15,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

Просмотреть файл

@ -19,11 +19,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

Просмотреть файл

@ -17,11 +17,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->

Просмотреть файл

@ -17,9 +17,9 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>

Просмотреть файл

@ -17,11 +17,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6274b3645b3d41df4aa5a55398b5d106edf1c528"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04d96dd43e2c5c673a0c73b5a65faeb115c2065f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="a425b5eaf4949ab17a1670442fc2b17a82c84a74"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="70b698c2e8d1764a1e27527a102df6452e405b9a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->

Просмотреть файл

@ -39,7 +39,7 @@ this.PermissionsTable = { geolocation: {
},
camera: {
app: DENY_ACTION,
privileged: DENY_ACTION,
privileged: PROMPT_ACTION,
certified: ALLOW_ACTION
},
alarms: {

Просмотреть файл

@ -754,7 +754,15 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
}
mCMER = atCommandValues[3].EqualsLiteral("1");
mSlcConnected = mCMER;
/**
* SLC is connected once the "indicator status update" is enabled by
* AT+CMER command. See 4.2.1 in Bluetooth hands-free profile 1.6
* for more details.
*/
if (mCMER) {
mSlcConnected = true;
}
// If we get internal request for SCO connection,
// setup SCO after Service Level Connection established.

Просмотреть файл

@ -7,6 +7,7 @@
#include "jsapi.h"
#include "nsPIDOMWindow.h"
#include "mozilla/Services.h"
#include "nsContentPermissionHelper.h"
#include "nsObserverService.h"
#include "nsIPermissionManager.h"
#include "DOMCameraControl.h"
@ -14,6 +15,9 @@
#include "CameraCommon.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/CameraManagerBinding.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/TabChild.h"
#include "PCOMContentPermissionRequestChild.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -50,6 +54,7 @@ WindowTable* nsDOMCameraManager::sActiveWindows = nullptr;
nsDOMCameraManager::nsDOMCameraManager(nsPIDOMWindow* aWindow)
: mWindowId(aWindow->WindowID())
, mPermission(nsIPermissionManager::DENY_ACTION)
, mWindow(aWindow)
{
/* member initializers and constructor code */
@ -80,7 +85,8 @@ nsDOMCameraManager::CheckPermission(nsPIDOMWindow* aWindow)
uint32_t permission = nsIPermissionManager::DENY_ACTION;
permMgr->TestPermissionFromWindow(aWindow, "camera", &permission);
if (permission != nsIPermissionManager::ALLOW_ACTION) {
if (permission != nsIPermissionManager::ALLOW_ACTION &&
permission != nsIPermissionManager::PROMPT_ACTION) {
return false;
}
@ -105,11 +111,190 @@ nsDOMCameraManager::CreateInstance(nsPIDOMWindow* aWindow)
return cameraManager.forget();
}
class CameraPermissionRequest : public nsIContentPermissionRequest
, public PCOMContentPermissionRequestChild
, public nsIRunnable
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
NS_DECL_NSIRUNNABLE
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(CameraPermissionRequest,
nsIContentPermissionRequest)
CameraPermissionRequest(nsIPrincipal* aPrincipal,
nsPIDOMWindow* aWindow,
nsRefPtr<nsDOMCameraManager> aManager,
uint32_t aCameraId,
const CameraConfiguration& aInitialConfig,
nsRefPtr<GetCameraCallback> aOnSuccess,
nsRefPtr<CameraErrorCallback> aOnError)
: mPrincipal(aPrincipal)
, mWindow(aWindow)
, mCameraManager(aManager)
, mCameraId(aCameraId)
, mInitialConfig(aInitialConfig)
, mOnSuccess(aOnSuccess)
, mOnError(aOnError)
{
}
virtual ~CameraPermissionRequest()
{
}
bool Recv__delete__(const bool& aAllow,
const InfallibleTArray<PermissionChoice>& choices);
void IPDLRelease()
{
Release();
}
protected:
nsresult DispatchCallback(uint32_t aPermission);
void CallAllow();
void CallCancel();
nsCOMPtr<nsIPrincipal> mPrincipal;
nsCOMPtr<nsPIDOMWindow> mWindow;
nsRefPtr<nsDOMCameraManager> mCameraManager;
uint32_t mCameraId;
CameraConfiguration mInitialConfig;
nsRefPtr<GetCameraCallback> mOnSuccess;
nsRefPtr<CameraErrorCallback> mOnError;
};
NS_IMPL_CYCLE_COLLECTION_3(CameraPermissionRequest, mWindow, mOnSuccess, mOnError)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CameraPermissionRequest)
NS_INTERFACE_MAP_ENTRY(nsIContentPermissionRequest)
NS_INTERFACE_MAP_ENTRY(nsIRunnable)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentPermissionRequest)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(CameraPermissionRequest)
NS_IMPL_CYCLE_COLLECTING_RELEASE(CameraPermissionRequest)
NS_IMETHODIMP
CameraPermissionRequest::Run()
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
TabChild* child = TabChild::GetFrom(mWindow->GetDocShell());
if (!child) {
return NS_ERROR_NOT_AVAILABLE;
}
// Retain a reference so the object isn't deleted without IPDL's knowledge.
// Corresponding release occurs in DeallocPContentPermissionRequest.
AddRef();
nsTArray<PermissionRequest> permArray;
nsTArray<nsString> emptyOptions;
permArray.AppendElement(PermissionRequest(
NS_LITERAL_CSTRING("camera"),
NS_LITERAL_CSTRING("unused"),
emptyOptions));
child->SendPContentPermissionRequestConstructor(this, permArray,
IPC::Principal(mPrincipal));
Sendprompt();
return NS_OK;
}
nsCOMPtr<nsIContentPermissionPrompt> prompt =
do_GetService(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
if (prompt) {
prompt->Prompt(this);
}
return NS_OK;
}
bool
CameraPermissionRequest::Recv__delete__(const bool& aAllow,
const InfallibleTArray<PermissionChoice>& choices)
{
if (aAllow) {
Allow(JS::UndefinedHandleValue);
} else {
Cancel();
}
return true;
}
NS_IMETHODIMP
CameraPermissionRequest::GetPrincipal(nsIPrincipal** aRequestingPrincipal)
{
NS_ADDREF(*aRequestingPrincipal = mPrincipal);
return NS_OK;
}
NS_IMETHODIMP
CameraPermissionRequest::GetWindow(nsIDOMWindow** aRequestingWindow)
{
NS_ADDREF(*aRequestingWindow = mWindow);
return NS_OK;
}
NS_IMETHODIMP
CameraPermissionRequest::GetElement(nsIDOMElement** aElement)
{
*aElement = nullptr;
return NS_OK;
}
NS_IMETHODIMP
CameraPermissionRequest::Cancel()
{
return DispatchCallback(nsIPermissionManager::DENY_ACTION);
}
NS_IMETHODIMP
CameraPermissionRequest::Allow(JS::HandleValue aChoices)
{
MOZ_ASSERT(aChoices.isUndefined());
return DispatchCallback(nsIPermissionManager::ALLOW_ACTION);
}
nsresult
CameraPermissionRequest::DispatchCallback(uint32_t aPermission)
{
nsCOMPtr<nsIRunnable> callbackRunnable;
if (aPermission == nsIPermissionManager::ALLOW_ACTION) {
callbackRunnable = NS_NewRunnableMethod(this, &CameraPermissionRequest::CallAllow);
} else {
callbackRunnable = NS_NewRunnableMethod(this, &CameraPermissionRequest::CallCancel);
}
return NS_DispatchToMainThread(callbackRunnable);
}
void
CameraPermissionRequest::CallAllow()
{
mCameraManager->PermissionAllowed(mCameraId, mInitialConfig, mOnSuccess, mOnError);
}
void
CameraPermissionRequest::CallCancel()
{
mCameraManager->PermissionCancelled(mCameraId, mInitialConfig, mOnSuccess, mOnError);
}
NS_IMETHODIMP
CameraPermissionRequest::GetTypes(nsIArray** aTypes)
{
nsTArray<nsString> emptyOptions;
return CreatePermissionArray(NS_LITERAL_CSTRING("camera"),
NS_LITERAL_CSTRING("unused"),
emptyOptions,
aTypes);
}
void
nsDOMCameraManager::GetCamera(const nsAString& aCamera,
const CameraConfiguration& aInitialConfig,
GetCameraCallback& aOnSuccess,
const Optional<OwningNonNull<CameraErrorCallback> >& aOnError,
const OptionalNonNullCameraErrorCallback& aOnError,
ErrorResult& aRv)
{
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
@ -124,14 +309,56 @@ nsDOMCameraManager::GetCamera(const nsAString& aCamera,
errorCallback = &aOnError.Value();
}
if (mPermission == nsIPermissionManager::ALLOW_ACTION) {
PermissionAllowed(cameraId, aInitialConfig, &aOnSuccess, errorCallback);
return;
}
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(mWindow);
if (!sop) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
nsCOMPtr<nsIRunnable> permissionRequest =
new CameraPermissionRequest(principal, mWindow, this, cameraId, aInitialConfig,
&aOnSuccess, errorCallback);
NS_DispatchToMainThread(permissionRequest);
}
void
nsDOMCameraManager::PermissionAllowed(uint32_t aCameraId,
const CameraConfiguration& aInitialConfig,
GetCameraCallback* aOnSuccess,
CameraErrorCallback* aOnError)
{
mPermission = nsIPermissionManager::ALLOW_ACTION;
// Creating this object will trigger the aOnSuccess callback
// (or the aOnError one, if it fails).
nsRefPtr<nsDOMCameraControl> cameraControl =
new nsDOMCameraControl(cameraId, aInitialConfig, &aOnSuccess, errorCallback, mWindow);
new nsDOMCameraControl(aCameraId, aInitialConfig, aOnSuccess, aOnError, mWindow);
Register(cameraControl);
}
void
nsDOMCameraManager::PermissionCancelled(uint32_t aCameraId,
const CameraConfiguration& aInitialConfig,
GetCameraCallback* aOnSuccess,
CameraErrorCallback* aOnError)
{
mPermission = nsIPermissionManager::DENY_ACTION;
if (aOnError) {
ErrorResult ignored;
aOnError->Call(NS_LITERAL_STRING("Permission denied."), ignored);
}
}
void
nsDOMCameraManager::Register(nsDOMCameraControl* aDOMCameraControl)
{

Просмотреть файл

@ -32,6 +32,8 @@ namespace mozilla {
typedef nsTArray<nsRefPtr<mozilla::nsDOMCameraControl> > CameraControls;
typedef nsClassHashtable<nsUint64HashKey, CameraControls> WindowTable;
typedef mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraErrorCallback>>
OptionalNonNullCameraErrorCallback;
class nsDOMCameraManager MOZ_FINAL
: public nsIObserver
@ -52,11 +54,21 @@ public:
void Register(mozilla::nsDOMCameraControl* aDOMCameraControl);
void OnNavigation(uint64_t aWindowId);
void PermissionAllowed(uint32_t aCameraId,
const mozilla::dom::CameraConfiguration& aOptions,
mozilla::dom::GetCameraCallback* aOnSuccess,
mozilla::dom::CameraErrorCallback* aOnError);
void PermissionCancelled(uint32_t aCameraId,
const mozilla::dom::CameraConfiguration& aOptions,
mozilla::dom::GetCameraCallback* aOnSuccess,
mozilla::dom::CameraErrorCallback* aOnError);
// WebIDL
void GetCamera(const nsAString& aCamera,
const mozilla::dom::CameraConfiguration& aOptions,
mozilla::dom::GetCameraCallback& aOnSuccess,
const mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraErrorCallback> >& aOnError,
const OptionalNonNullCameraErrorCallback& aOnError,
mozilla::ErrorResult& aRv);
void GetListOfCameras(nsTArray<nsString>& aList, mozilla::ErrorResult& aRv);
@ -77,6 +89,7 @@ private:
protected:
uint64_t mWindowId;
uint32_t mPermission;
nsCOMPtr<nsPIDOMWindow> mWindow;
/**
* 'sActiveWindows' is only ever accessed while in the Main Thread,

Просмотреть файл

@ -2584,7 +2584,7 @@ WifiWorker.prototype = {
if (count++ >= 3) {
timer = null;
this.wantScanResults.splice(this.wantScanResults.indexOf(waitForScanCallback), 1);
self.wantScanResults.splice(self.wantScanResults.indexOf(waitForScanCallback), 1);
callback.onfailure();
return;
}

Просмотреть файл

@ -35,7 +35,7 @@ random-if(d2d) == dynamic-2.html dynamic-2-ref.html
!= 229764-1.html 229764-ref.html
== 229764-2.html 229764-ref.html
== 329069-1.html 329069-1-ref.html
fails-if(B2G) == 329069-2.html 329069-2-ref.html
== 329069-2.html 329069-2-ref.html
== 329069-3.html 329069-3-ref.html
== 329069-4.html 329069-4-ref.html
fails-if(!cocoaWidget) == 329069-5.html 329069-5-ref.html # bug 603710

Просмотреть файл

@ -109,7 +109,7 @@ HTTP(..) == variation-selector-unsupported-1.html variation-selector-unsupported
== wordbreak-1.html wordbreak-1-ref.html
== wordbreak-2.html wordbreak-2-ref.html
== wordbreak-3.html wordbreak-3-ref.html
fails-if(B2G) skip-if((Android&&AndroidVersion==17)||(B2G&&browserIsRemote)) == wordbreak-4a.html wordbreak-4a-ref.html
skip-if((Android&&AndroidVersion==17)||(B2G&&browserIsRemote)) == wordbreak-4a.html wordbreak-4a-ref.html
== wordbreak-4b.html wordbreak-4b-ref.html
== wordbreak-5.html wordbreak-5-ref.html
== wordbreak-6.html wordbreak-6-ref.html