зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 9 changesets (bug 838146) for suspected B2G Mn orange on a CLOSED TREE.
Backed out changeset 955a14e3c181 (bug 838146) Backed out changeset fddccc5fce6e (bug 838146) Backed out changeset 7cddfebc261c (bug 838146) Backed out changeset fd3a62dd3910 (bug 838146) Backed out changeset f06b420e0dfa (bug 838146) Backed out changeset e0c3d84965cf (bug 838146) Backed out changeset d3b135e58350 (bug 838146) Backed out changeset 1bc7f2167503 (bug 838146) Backed out changeset 483fbc6878a8 (bug 838146)
This commit is contained in:
Родитель
68d4cea5d2
Коммит
c618a3cb48
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -40,7 +40,6 @@ class nsIDOMMozConnection;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class Geolocation;
|
class Geolocation;
|
||||||
class systemMessageCallback;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +69,6 @@ class nsIDOMTelephony;
|
||||||
// Navigator: Script "navigator" object
|
// Navigator: Script "navigator" object
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
void NS_GetNavigatorAppName(nsAString& aAppName);
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
@ -82,15 +79,6 @@ class BatteryManager;
|
||||||
class DesktopNotificationCenter;
|
class DesktopNotificationCenter;
|
||||||
class SmsManager;
|
class SmsManager;
|
||||||
class MobileMessageManager;
|
class MobileMessageManager;
|
||||||
class MozIdleObserver;
|
|
||||||
#ifdef MOZ_GAMEPAD
|
|
||||||
class Gamepad;
|
|
||||||
#endif // MOZ_GAMEPAD
|
|
||||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
|
||||||
class MozDOMGetUserMediaSuccessCallback;
|
|
||||||
class MozDOMGetUserMediaErrorCallback;
|
|
||||||
class MozGetUserMediaDevicesSuccessCallback;
|
|
||||||
#endif // MOZ_MEDIA_NAVIGATOR
|
|
||||||
|
|
||||||
namespace icc {
|
namespace icc {
|
||||||
#ifdef MOZ_B2G_RIL
|
#ifdef MOZ_B2G_RIL
|
||||||
|
@ -204,7 +192,7 @@ public:
|
||||||
static void Init();
|
static void Init();
|
||||||
|
|
||||||
void Invalidate();
|
void Invalidate();
|
||||||
nsPIDOMWindow *GetWindow() const
|
nsPIDOMWindow *GetWindow()
|
||||||
{
|
{
|
||||||
return mWindow;
|
return mWindow;
|
||||||
}
|
}
|
||||||
|
@ -230,187 +218,8 @@ public:
|
||||||
|
|
||||||
NS_DECL_NSIDOMNAVIGATORCAMERA
|
NS_DECL_NSIDOMNAVIGATORCAMERA
|
||||||
|
|
||||||
// WebIDL API
|
|
||||||
void GetAppName(nsString& aAppName)
|
|
||||||
{
|
|
||||||
NS_GetNavigatorAppName(aAppName);
|
|
||||||
}
|
|
||||||
void GetAppVersion(nsString& aAppVersion, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
aRv = GetAppVersion(aAppVersion);
|
|
||||||
}
|
|
||||||
void GetPlatform(nsString& aPlatform, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
aRv = GetPlatform(aPlatform);
|
|
||||||
}
|
|
||||||
void GetUserAgent(nsString& aUserAgent, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
aRv = GetUserAgent(aUserAgent);
|
|
||||||
}
|
|
||||||
// The XPCOM GetProduct is OK
|
|
||||||
// The XPCOM GetLanguage is OK
|
|
||||||
bool OnLine();
|
|
||||||
void RegisterProtocolHandler(const nsAString& aScheme, const nsAString& aURL,
|
|
||||||
const nsAString& aTitle, ErrorResult& rv)
|
|
||||||
{
|
|
||||||
rv = RegisterProtocolHandler(aScheme, aURL, aTitle);
|
|
||||||
}
|
|
||||||
void RegisterContentHandler(const nsAString& aMIMEType, const nsAString& aURL,
|
|
||||||
const nsAString& aTitle, ErrorResult& rv)
|
|
||||||
{
|
|
||||||
rv = RegisterContentHandler(aMIMEType, aURL, aTitle);
|
|
||||||
}
|
|
||||||
nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv);
|
|
||||||
nsPluginArray* GetPlugins(ErrorResult& aRv);
|
|
||||||
// The XPCOM GetDoNotTrack is ok
|
|
||||||
Geolocation* GetGeolocation(ErrorResult& aRv);
|
|
||||||
battery::BatteryManager* GetBattery(ErrorResult& aRv);
|
|
||||||
void Vibrate(uint32_t aDuration, ErrorResult& aRv);
|
|
||||||
void Vibrate(const nsTArray<uint32_t>& aDuration, ErrorResult& aRv);
|
|
||||||
void GetAppCodeName(nsString& aAppCodeName, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
aRv = GetAppCodeName(aAppCodeName);
|
|
||||||
}
|
|
||||||
void GetOscpu(nsString& aOscpu, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
aRv = GetOscpu(aOscpu);
|
|
||||||
}
|
|
||||||
// The XPCOM GetVendor is OK
|
|
||||||
// The XPCOM GetVendorSub is OK
|
|
||||||
// The XPCOM GetProductSub is OK
|
|
||||||
bool CookieEnabled();
|
|
||||||
void GetBuildID(nsString& aBuildID, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
aRv = GetBuildID(aBuildID);
|
|
||||||
}
|
|
||||||
nsIDOMMozPowerManager* GetMozPower(ErrorResult& aRv);
|
|
||||||
bool JavaEnabled(ErrorResult& aRv);
|
|
||||||
bool TaintEnabled()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
void AddIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
|
|
||||||
void RemoveIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
|
|
||||||
already_AddRefed<nsIDOMMozWakeLock> RequestWakeLock(const nsAString &aTopic,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
nsDOMDeviceStorage* GetDeviceStorage(const nsAString& aType,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
void GetDeviceStorages(const nsAString& aType,
|
|
||||||
nsTArray<nsRefPtr<nsDOMDeviceStorage> >& aStores,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
DesktopNotificationCenter* GetMozNotification(ErrorResult& aRv);
|
|
||||||
bool MozIsLocallyAvailable(const nsAString& aURI, bool aWhenOffline,
|
|
||||||
ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
bool available = false;
|
|
||||||
aRv = MozIsLocallyAvailable(aURI, aWhenOffline, &available);
|
|
||||||
return available;
|
|
||||||
}
|
|
||||||
nsIDOMMozSmsManager* GetMozSms();
|
|
||||||
nsIDOMMozMobileMessageManager* GetMozMobileMessage();
|
|
||||||
nsIDOMMozConnection* GetMozConnection();
|
|
||||||
nsDOMCameraManager* GetMozCameras(ErrorResult& aRv);
|
|
||||||
void MozSetMessageHandler(const nsAString& aType,
|
|
||||||
systemMessageCallback* aCallback,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
bool MozHasPendingMessage(const nsAString& aType, ErrorResult& aRv);
|
|
||||||
#ifdef MOZ_B2G_RIL
|
|
||||||
nsIDOMTelephony* GetMozTelephony(ErrorResult& aRv);
|
|
||||||
nsIDOMMozMobileConnection* GetMozMobileConnection(ErrorResult& aRv);
|
|
||||||
nsIDOMMozCellBroadcast* GetMozCellBroadcast(ErrorResult& aRv);
|
|
||||||
nsIDOMMozVoicemail* GetMozVoicemail(ErrorResult& aRv);
|
|
||||||
nsIDOMMozIccManager* GetMozIccManager(ErrorResult& aRv);
|
|
||||||
#endif // MOZ_B2G_RIL
|
|
||||||
#ifdef MOZ_GAMEPAD
|
|
||||||
void GetGamepads(nsTArray<nsRefPtr<Gamepad> >& aGamepads, ErrorResult& aRv);
|
|
||||||
#endif // MOZ_GAMEPAD
|
|
||||||
#ifdef MOZ_B2G_BT
|
|
||||||
nsIDOMBluetoothManager* GetMozBluetooth(ErrorResult& aRv);
|
|
||||||
#endif // MOZ_B2G_BT
|
|
||||||
#ifdef MOZ_TIME_MANAGER
|
|
||||||
time::TimeManager* GetMozTime(ErrorResult& aRv);
|
|
||||||
#endif // MOZ_TIME_MANAGER
|
|
||||||
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
|
|
||||||
system::AudioChannelManager* GetMozAudioChannelManager(ErrorResult& aRv);
|
|
||||||
#endif // MOZ_AUDIO_CHANNEL_MANAGER
|
|
||||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
|
||||||
void MozGetUserMedia(nsIMediaStreamOptions* aParams,
|
|
||||||
MozDOMGetUserMediaSuccessCallback* aOnSuccess,
|
|
||||||
MozDOMGetUserMediaErrorCallback* aOnError,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
void MozGetUserMedia(nsIMediaStreamOptions* aParams,
|
|
||||||
nsIDOMGetUserMediaSuccessCallback* aOnSuccess,
|
|
||||||
nsIDOMGetUserMediaErrorCallback* aOnError,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
void MozGetUserMediaDevices(MozGetUserMediaDevicesSuccessCallback* aOnSuccess,
|
|
||||||
MozDOMGetUserMediaErrorCallback* aOnError,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
void MozGetUserMediaDevices(nsIGetUserMediaDevicesSuccessCallback* aOnSuccess,
|
|
||||||
nsIDOMGetUserMediaErrorCallback* aOnError,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
#endif // MOZ_MEDIA_NAVIGATOR
|
|
||||||
bool DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
|
|
||||||
JS::Handle<jsid> aId, unsigned aFlags,
|
|
||||||
JS::MutableHandle<JSObject*> aObjp);
|
|
||||||
|
|
||||||
// WebIDL helper methods
|
|
||||||
static bool HasBatterySupport(JSContext* /* unused*/, JSObject* /*unused */);
|
|
||||||
static bool HasPowerSupport(JSContext* /* unused */, JSObject* aGlobal);
|
|
||||||
static bool HasIdleSupport(JSContext* /* unused */, JSObject* aGlobal);
|
|
||||||
static bool HasWakeLockSupport(JSContext* /* unused*/, JSObject* /*unused */);
|
|
||||||
static bool HasDesktopNotificationSupport(JSContext* /* unused*/,
|
|
||||||
JSObject* /*unused */)
|
|
||||||
{
|
|
||||||
return HasDesktopNotificationSupport();
|
|
||||||
}
|
|
||||||
static bool HasSmsSupport(JSContext* /* unused */, JSObject* aGlobal);
|
|
||||||
static bool HasMobileMessageSupport(JSContext* /* unused */,
|
|
||||||
JSObject* aGlobal);
|
|
||||||
static bool HasCameraSupport(JSContext* /* unused */,
|
|
||||||
JSObject* aGlobal);
|
|
||||||
#ifdef MOZ_B2G_RIL
|
|
||||||
static bool HasTelephonySupport(JSContext* /* unused */,
|
|
||||||
JSObject* aGlobal);
|
|
||||||
static bool HasMobileConnectionSupport(JSContext* /* unused */,
|
|
||||||
JSObject* aGlobal);
|
|
||||||
static bool HasCellBroadcastSupport(JSContext* /* unused */,
|
|
||||||
JSObject* aGlobal);
|
|
||||||
static bool HasVoicemailSupport(JSContext* /* unused */,
|
|
||||||
JSObject* aGlobal);
|
|
||||||
static bool HasIccManagerSupport(JSContext* /* unused */,
|
|
||||||
JSObject* aGlobal);
|
|
||||||
#endif // MOZ_B2G_RIL
|
|
||||||
#ifdef MOZ_B2G_BT
|
|
||||||
static bool HasBluetoothSupport(JSContext* /* unused */, JSObject* aGlobal);
|
|
||||||
#endif // MOZ_B2G_BT
|
|
||||||
#ifdef MOZ_TIME_MANAGER
|
|
||||||
static bool HasTimeSupport(JSContext* /* unused */, JSObject* aGlobal);
|
|
||||||
#endif // MOZ_TIME_MANAGER
|
|
||||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
|
||||||
static bool HasUserMediaSupport(JSContext* /* unused */,
|
|
||||||
JSObject* /* unused */);
|
|
||||||
#endif // MOZ_MEDIA_NAVIGATOR
|
|
||||||
|
|
||||||
nsPIDOMWindow* GetParentObject() const
|
|
||||||
{
|
|
||||||
return GetWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext* cx,
|
|
||||||
JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool CheckPermission(const char* type);
|
bool CheckPermission(const char* type);
|
||||||
static bool CheckPermission(nsPIDOMWindow* aWindow, const char* aType);
|
|
||||||
static bool HasMobileMessageSupport(nsPIDOMWindow* aWindow);
|
|
||||||
// GetWindowFromGlobal returns the inner window for this global, if
|
|
||||||
// any, else null.
|
|
||||||
static already_AddRefed<nsPIDOMWindow> GetWindowFromGlobal(JSObject* aGlobal);
|
|
||||||
|
|
||||||
// Methods to common up the XPCOM and WebIDL implementations of
|
|
||||||
// Add/RemoveIdleObserver.
|
|
||||||
void AddIdleObserver(nsIIdleObserver& aIdleObserver);
|
|
||||||
void RemoveIdleObserver(nsIIdleObserver& aIdleObserver);
|
|
||||||
|
|
||||||
nsRefPtr<nsMimeTypeArray> mMimeTypes;
|
nsRefPtr<nsMimeTypeArray> mMimeTypes;
|
||||||
nsRefPtr<nsPluginArray> mPlugins;
|
nsRefPtr<nsPluginArray> mPlugins;
|
||||||
|
@ -449,5 +258,6 @@ private:
|
||||||
nsresult NS_GetNavigatorUserAgent(nsAString& aUserAgent);
|
nsresult NS_GetNavigatorUserAgent(nsAString& aUserAgent);
|
||||||
nsresult NS_GetNavigatorPlatform(nsAString& aPlatform);
|
nsresult NS_GetNavigatorPlatform(nsAString& aPlatform);
|
||||||
nsresult NS_GetNavigatorAppVersion(nsAString& aAppVersion);
|
nsresult NS_GetNavigatorAppVersion(nsAString& aAppVersion);
|
||||||
|
nsresult NS_GetNavigatorAppName(nsAString& aAppName);
|
||||||
|
|
||||||
#endif // mozilla_dom_Navigator_h
|
#endif // mozilla_dom_Navigator_h
|
||||||
|
|
|
@ -4660,15 +4660,101 @@ nsNavigatorSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
{
|
{
|
||||||
JS::Rooted<JSObject*> obj(cx, aObj);
|
JS::Rooted<JSObject*> obj(cx, aObj);
|
||||||
JS::Rooted<jsid> id(cx, aId);
|
JS::Rooted<jsid> id(cx, aId);
|
||||||
nsCOMPtr<nsIDOMNavigator> navigator = do_QueryWrappedNative(wrapper);
|
if (!JSID_IS_STRING(id)) {
|
||||||
if (!static_cast<Navigator*>(navigator.get())->
|
return NS_OK;
|
||||||
DoNewResolve(cx, obj, id, flags,
|
|
||||||
JS::MutableHandle<JSObject*>::fromMarkedLocation(objp))) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsScriptNameSpaceManager *nameSpaceManager =
|
||||||
|
nsJSRuntime::GetNameSpaceManager();
|
||||||
|
NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
|
||||||
|
|
||||||
|
nsDependentJSString name(id);
|
||||||
|
|
||||||
|
const nsGlobalNameStruct* name_struct =
|
||||||
|
nameSpaceManager->LookupNavigatorName(name);
|
||||||
|
if (!name_struct) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name_struct->mType == nsGlobalNameStruct::eTypeNewDOMBinding) {
|
||||||
|
mozilla::dom::ConstructNavigatorProperty construct = name_struct->mConstructNavigatorProperty;
|
||||||
|
MOZ_ASSERT(construct);
|
||||||
|
|
||||||
|
JS::Rooted<JSObject*> naviObj(cx, js::CheckedUnwrap(obj, /* stopAtOuter = */ false));
|
||||||
|
NS_ENSURE_TRUE(naviObj, NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
|
||||||
|
JS::Rooted<JSObject*> domObject(cx);
|
||||||
|
{
|
||||||
|
JSAutoCompartment ac(cx, naviObj);
|
||||||
|
|
||||||
|
// Check whether our constructor is enabled after we unwrap Xrays, since
|
||||||
|
// we don't want to define an interface on the Xray if it's disabled in
|
||||||
|
// the target global, even if it's enabled in the Xray's global.
|
||||||
|
if (name_struct->mConstructorEnabled &&
|
||||||
|
!(*name_struct->mConstructorEnabled)(cx, naviObj)) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
domObject = construct(cx, naviObj);
|
||||||
|
if (!domObject) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!JS_WrapObject(cx, domObject.address()) ||
|
||||||
|
!JS_DefinePropertyById(cx, obj, id,
|
||||||
|
JS::ObjectValue(*domObject),
|
||||||
|
nullptr, nullptr, JSPROP_ENUMERATE)) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*_retval = true;
|
||||||
|
*objp = obj;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ASSERTION(name_struct->mType == nsGlobalNameStruct::eTypeNavigatorProperty,
|
||||||
|
"unexpected type");
|
||||||
|
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupports> native(do_CreateInstance(name_struct->mCID, &rv));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
JS::Rooted<JS::Value> prop_val(cx, JS::UndefinedValue()); // Property value.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi(do_QueryInterface(native));
|
||||||
|
|
||||||
|
if (gpi) {
|
||||||
|
nsCOMPtr<nsIDOMNavigator> navigator = do_QueryWrappedNative(wrapper);
|
||||||
|
nsIDOMWindow *window = static_cast<Navigator*>(navigator.get())->GetWindow();
|
||||||
|
NS_ENSURE_TRUE(window, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
rv = gpi->Init(window, prop_val.address());
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JSVAL_IS_PRIMITIVE(prop_val) && !JSVAL_IS_NULL(prop_val)) {
|
||||||
|
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||||
|
rv = WrapNative(cx, obj, native, true, prop_val.address(),
|
||||||
|
getter_AddRefs(holder));
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!JS_WrapValue(cx, prop_val.address())) {
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSBool ok = ::JS_DefinePropertyById(cx, obj, id, prop_val,
|
||||||
|
JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
|
JSPROP_ENUMERATE);
|
||||||
|
|
||||||
*_retval = true;
|
*_retval = true;
|
||||||
return NS_OK;
|
*objp = obj;
|
||||||
|
|
||||||
|
return ok ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -1702,30 +1702,17 @@ addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
|
||||||
addExternalIface('LockedFile')
|
addExternalIface('LockedFile')
|
||||||
addExternalIface('MediaList')
|
addExternalIface('MediaList')
|
||||||
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
|
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
|
||||||
addExternalIface('MozBluetoothManager', nativeType='nsIDOMBluetoothManager')
|
|
||||||
addExternalIface('MozBoxObject', nativeType='nsIBoxObject')
|
addExternalIface('MozBoxObject', nativeType='nsIBoxObject')
|
||||||
addExternalIface('MozCellBroadcast')
|
|
||||||
addExternalIface('MozConnection', headerFile='nsIDOMConnection.h')
|
|
||||||
addExternalIface('MozControllers', nativeType='nsIControllers')
|
addExternalIface('MozControllers', nativeType='nsIControllers')
|
||||||
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
|
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
|
||||||
addExternalIface('MozIccManager', headerFile='nsIDOMIccManager.h')
|
|
||||||
addExternalIface('MozMediaStreamOptions', nativeType='nsIMediaStreamOptions',
|
|
||||||
headerFile='nsIDOMNavigatorUserMedia.h')
|
|
||||||
addExternalIface('MozMobileConnection', headerFile='nsIDOMMobileConnection.h')
|
|
||||||
addExternalIface('MozMobileMessageManager', headerFile='nsIDOMMobileMessageManager.h')
|
|
||||||
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
|
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
|
||||||
addExternalIface('MozPowerManager', headerFile='nsIDOMPowerManager.h')
|
|
||||||
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
|
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
|
||||||
notflattened=True)
|
notflattened=True)
|
||||||
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
|
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
|
||||||
addExternalIface('MozSmsManager', headerFile='nsIDOMSmsManager.h')
|
|
||||||
addExternalIface('MozTelephony', nativeType='nsIDOMTelephony')
|
|
||||||
addExternalIface('MozTreeBoxObject', nativeType='nsITreeBoxObject',
|
addExternalIface('MozTreeBoxObject', nativeType='nsITreeBoxObject',
|
||||||
notflattened=True)
|
notflattened=True)
|
||||||
addExternalIface('MozTreeColumn', nativeType='nsITreeColumn',
|
addExternalIface('MozTreeColumn', nativeType='nsITreeColumn',
|
||||||
headerFile='nsITreeColumns.h')
|
headerFile='nsITreeColumns.h')
|
||||||
addExternalIface('MozVoicemail')
|
|
||||||
addExternalIface('MozWakeLock', headerFile='nsIDOMWakeLock.h')
|
|
||||||
addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
|
addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
|
||||||
addExternalIface('nsIControllers', nativeType='nsIControllers')
|
addExternalIface('nsIControllers', nativeType='nsIControllers')
|
||||||
addExternalIface('nsIInputStreamCallback', nativeType='nsIInputStreamCallback',
|
addExternalIface('nsIInputStreamCallback', nativeType='nsIInputStreamCallback',
|
||||||
|
|
|
@ -3732,7 +3732,7 @@ def convertConstIDLValueToJSVal(value):
|
||||||
return "JSVAL_TRUE" if value.value else "JSVAL_FALSE"
|
return "JSVAL_TRUE" if value.value else "JSVAL_FALSE"
|
||||||
if tag in [IDLType.Tags.float, IDLType.Tags.double]:
|
if tag in [IDLType.Tags.float, IDLType.Tags.double]:
|
||||||
return "DOUBLE_TO_JSVAL(%s)" % (value.value)
|
return "DOUBLE_TO_JSVAL(%s)" % (value.value)
|
||||||
raise TypeError("Const value of unhandled type: %s" % value.type)
|
raise TypeError("Const value of unhandled type: " + value.type)
|
||||||
|
|
||||||
class CGArgumentConverter(CGThing):
|
class CGArgumentConverter(CGThing):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -22,7 +22,7 @@ include $(topsrcdir)/dom/dom-config.mk
|
||||||
include $(topsrcdir)/dom/webidl/WebIDL.mk
|
include $(topsrcdir)/dom/webidl/WebIDL.mk
|
||||||
|
|
||||||
binding_include_path := mozilla/dom
|
binding_include_path := mozilla/dom
|
||||||
all_webidl_files = $(webidl_files) $(generated_webidl_files) $(preprocessed_webidl_files)
|
all_webidl_files = $(webidl_files) $(generated_webidl_files)
|
||||||
# Set exported_binding_headers before adding the test IDL to the mix
|
# Set exported_binding_headers before adding the test IDL to the mix
|
||||||
exported_binding_headers := $(subst .webidl,Binding.h,$(all_webidl_files))
|
exported_binding_headers := $(subst .webidl,Binding.h,$(all_webidl_files))
|
||||||
# Set linked_binding_cpp_files before adding the test IDL to the mix
|
# Set linked_binding_cpp_files before adding the test IDL to the mix
|
||||||
|
@ -142,23 +142,6 @@ $(webidl_files): %: $(webidl_base)/%
|
||||||
$(test_webidl_files): %: $(srcdir)/test/%
|
$(test_webidl_files): %: $(srcdir)/test/%
|
||||||
$(INSTALL) $(IFLAGS1) $(srcdir)/test/$* .
|
$(INSTALL) $(IFLAGS1) $(srcdir)/test/$* .
|
||||||
|
|
||||||
# We can't easily use PP_TARGETS here because it insists on outputting targets
|
|
||||||
# that look like "$(CURDIR)/foo" whereas we want our target to just be "foo".
|
|
||||||
# Make sure to include $(GLOBAL_DEPS) so we pick up changes to what symbols are
|
|
||||||
# defined. Also make sure to remove $@ before writing to it, because otherwise
|
|
||||||
# if a file goes from non-preprocessed to preprocessed we can end up writing to
|
|
||||||
# a symlink, which will clobber files in the srcdir, which is bad.
|
|
||||||
$(preprocessed_webidl_files): %: $(webidl_base)/% $(GLOBAL_DEPS)
|
|
||||||
$(RM) $@
|
|
||||||
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) \
|
|
||||||
$(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(webidl_base)/$* -o $@
|
|
||||||
|
|
||||||
# Make is dumb and can get confused between "foo" and "$(CURDIR)/foo". Make
|
|
||||||
# sure that the latter depends on the former, since the latter gets used in .pp
|
|
||||||
# files.
|
|
||||||
all_webidl_files_absolute = $(addprefix $(CURDIR)/,$(all_webidl_files))
|
|
||||||
$(all_webidl_files_absolute): $(CURDIR)/%: %
|
|
||||||
|
|
||||||
$(binding_header_files): .BindingGen
|
$(binding_header_files): .BindingGen
|
||||||
|
|
||||||
$(binding_cpp_files): .BindingGen
|
$(binding_cpp_files): .BindingGen
|
||||||
|
|
|
@ -168,23 +168,30 @@ BluetoothManager::Create(nsPIDOMWindow* aWindow)
|
||||||
return manager.forget();
|
return manager.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
nsresult
|
||||||
bool
|
NS_NewBluetoothManager(nsPIDOMWindow* aWindow,
|
||||||
BluetoothManager::CheckPermission(nsPIDOMWindow* aWindow)
|
nsIDOMBluetoothManager** aBluetoothManager)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aWindow, "Null pointer!");
|
NS_ASSERTION(aWindow, "Null pointer!");
|
||||||
|
|
||||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||||
NS_ENSURE_TRUE(permMgr, false);
|
NS_ENSURE_TRUE(permMgr, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
uint32_t permission;
|
uint32_t permission;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
permMgr->TestPermissionFromWindow(aWindow, "bluetooth",
|
permMgr->TestPermissionFromWindow(aWindow, "bluetooth",
|
||||||
&permission);
|
&permission);
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return permission == nsIPermissionManager::ALLOW_ACTION;
|
nsRefPtr<BluetoothManager> bluetoothManager;
|
||||||
|
|
||||||
|
if (permission == nsIPermissionManager::ALLOW_ACTION) {
|
||||||
|
bluetoothManager = BluetoothManager::Create(aWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
bluetoothManager.forget(aBluetoothManager);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -29,10 +29,8 @@ public:
|
||||||
|
|
||||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
|
||||||
|
|
||||||
// Never returns null
|
|
||||||
static already_AddRefed<BluetoothManager>
|
static already_AddRefed<BluetoothManager>
|
||||||
Create(nsPIDOMWindow* aWindow);
|
Create(nsPIDOMWindow* aWindow);
|
||||||
static bool CheckPermission(nsPIDOMWindow* aWindow);
|
|
||||||
void Notify(const BluetoothSignal& aData);
|
void Notify(const BluetoothSignal& aData);
|
||||||
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue) MOZ_OVERRIDE;
|
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue) MOZ_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
|
@ -42,4 +40,7 @@ private:
|
||||||
|
|
||||||
END_BLUETOOTH_NAMESPACE
|
END_BLUETOOTH_NAMESPACE
|
||||||
|
|
||||||
|
nsresult NS_NewBluetoothManager(nsPIDOMWindow* aWindow,
|
||||||
|
nsIDOMBluetoothManager** aBluetoothManager);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -71,27 +71,21 @@ nsDOMCameraManager::~nsDOMCameraManager()
|
||||||
obs->RemoveObserver(this, "xpcom-shutdown");
|
obs->RemoveObserver(this, "xpcom-shutdown");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
// static creator
|
||||||
nsDOMCameraManager::CheckPermission(nsPIDOMWindow* aWindow)
|
already_AddRefed<nsDOMCameraManager>
|
||||||
|
nsDOMCameraManager::CheckPermissionAndCreateInstance(nsPIDOMWindow* aWindow)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||||
NS_ENSURE_TRUE(permMgr, false);
|
NS_ENSURE_TRUE(permMgr, nullptr);
|
||||||
|
|
||||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||||
permMgr->TestPermissionFromWindow(aWindow, "camera", &permission);
|
permMgr->TestPermissionFromWindow(aWindow, "camera", &permission);
|
||||||
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||||
NS_WARNING("No permission to access camera");
|
NS_WARNING("No permission to access camera");
|
||||||
return false;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static creator
|
|
||||||
already_AddRefed<nsDOMCameraManager>
|
|
||||||
nsDOMCameraManager::CreateInstance(nsPIDOMWindow* aWindow)
|
|
||||||
{
|
|
||||||
// Initialize the shared active window tracker
|
// Initialize the shared active window tracker
|
||||||
if (!sActiveWindowsInitialized) {
|
if (!sActiveWindowsInitialized) {
|
||||||
sActiveWindows.Init();
|
sActiveWindows.Init();
|
||||||
|
|
|
@ -45,9 +45,8 @@ public:
|
||||||
nsIObserver)
|
nsIObserver)
|
||||||
NS_DECL_NSIOBSERVER
|
NS_DECL_NSIOBSERVER
|
||||||
|
|
||||||
static bool CheckPermission(nsPIDOMWindow* aWindow);
|
|
||||||
static already_AddRefed<nsDOMCameraManager>
|
static already_AddRefed<nsDOMCameraManager>
|
||||||
CreateInstance(nsPIDOMWindow* aWindow);
|
CheckPermissionAndCreateInstance(nsPIDOMWindow* aWindow);
|
||||||
static bool IsWindowStillActive(uint64_t aWindowId);
|
static bool IsWindowStillActive(uint64_t aWindowId);
|
||||||
|
|
||||||
void Register(mozilla::nsDOMCameraControl* aDOMCameraControl);
|
void Register(mozilla::nsDOMCameraControl* aDOMCameraControl);
|
||||||
|
|
|
@ -1095,9 +1095,9 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow,
|
||||||
|
|
||||||
#ifdef MOZ_B2G_CAMERA
|
#ifdef MOZ_B2G_CAMERA
|
||||||
if (mCameraManager == nullptr) {
|
if (mCameraManager == nullptr) {
|
||||||
aPrivileged = nsDOMCameraManager::CheckPermission(aWindow);
|
mCameraManager = nsDOMCameraManager::CheckPermissionAndCreateInstance(aWindow);
|
||||||
if (aPrivileged) {
|
if (!mCameraManager) {
|
||||||
mCameraManager = nsDOMCameraManager::CreateInstance(aWindow);
|
aPrivileged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=802982
|
||||||
function boom()
|
function boom()
|
||||||
{
|
{
|
||||||
for (var j = 0; j < 100; ++j) {
|
for (var j = 0; j < 100; ++j) {
|
||||||
navigator.mozGetUserMedia({}, function(){}, function(){});
|
navigator.mozGetUserMedia({}, {}, {});
|
||||||
}
|
}
|
||||||
finish(); // we're not waiting for success/error callbacks here
|
finish(); // we're not waiting for success/error callbacks here
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,26 +26,26 @@ var exceptionTests = [
|
||||||
// Each test here verifies that a caller is required to have all
|
// Each test here verifies that a caller is required to have all
|
||||||
// three arguments in order to call mozGetUserMedia
|
// three arguments in order to call mozGetUserMedia
|
||||||
{ params: undefined,
|
{ params: undefined,
|
||||||
error: "Not enough arguments to Navigator.mozGetUserMedia.",
|
error: Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
|
||||||
message: "no arguments specified" },
|
message: "no arguments specified" },
|
||||||
{ params: [{video: true, fake: true}],
|
{ params: [{video: true, fake: true}],
|
||||||
error: "Not enough arguments to Navigator.mozGetUserMedia.",
|
error: Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
|
||||||
message: "one argument specified" },
|
message: "one argument specified" },
|
||||||
{ params: [{video: true, fake: true}, unexpectedCall],
|
{ params: [{video: true, fake: true}, unexpectedCall],
|
||||||
error: "Not enough arguments to Navigator.mozGetUserMedia.",
|
error: Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
|
||||||
message: "two arguments specified" },
|
message: "two arguments specified" },
|
||||||
|
|
||||||
// Each test here verifies that providing an incorret object
|
// Each test here verifies that providing an incorret object
|
||||||
// type to any mozGetUserMedia parameter should throw
|
// type to any mozGetUserMedia parameter should throw
|
||||||
// the correct exception specified
|
// the correct exception specified
|
||||||
{ params: [1, unexpectedCall, unexpectedCall],
|
{ params: [1, unexpectedCall, unexpectedCall],
|
||||||
error: "Argument 1 of Navigator.mozGetUserMedia is not an object.",
|
error: Cr.NS_ERROR_XPC_BAD_CONVERT_JS,
|
||||||
message: "wrong object type as first parameter" },
|
message: "wrong object type as first parameter" },
|
||||||
{ params: [{video: true, fake: true}, 1, unexpectedCall],
|
{ params: [{video: true, fake: true}, 1, unexpectedCall],
|
||||||
error: "Argument 2 of Navigator.mozGetUserMedia is not an object.",
|
error: Cr.NS_ERROR_XPC_BAD_CONVERT_JS,
|
||||||
message: "wrong object type as second parameter" },
|
message: "wrong object type as second parameter" },
|
||||||
{ params: [{video: true, fake: true}, unexpectedCall, 1],
|
{ params: [{video: true, fake: true}, unexpectedCall, 1],
|
||||||
error: "Argument 3 of Navigator.mozGetUserMedia is not an object.",
|
error: Cr.NS_ERROR_XPC_BAD_CONVERT_JS,
|
||||||
message: "wrong object type as third parameter" }
|
message: "wrong object type as third parameter" }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ runTest(function () {
|
||||||
try {
|
try {
|
||||||
navigator.mozGetUserMedia.apply(navigator, test.params);
|
navigator.mozGetUserMedia.apply(navigator, test.params);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception = (e.message === test.error);
|
exception = (e.result === test.error);
|
||||||
}
|
}
|
||||||
ok(exception, "Exception for " + test.message);
|
ok(exception, "Exception for " + test.message);
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,49 +54,41 @@ NS_IMPL_EVENT_HANDLER(SmsManager, failed)
|
||||||
NS_IMPL_EVENT_HANDLER(SmsManager, deliverysuccess)
|
NS_IMPL_EVENT_HANDLER(SmsManager, deliverysuccess)
|
||||||
NS_IMPL_EVENT_HANDLER(SmsManager, deliveryerror)
|
NS_IMPL_EVENT_HANDLER(SmsManager, deliveryerror)
|
||||||
|
|
||||||
/* static */
|
/* static */already_AddRefed<SmsManager>
|
||||||
bool
|
SmsManager::CreateInstanceIfAllowed(nsPIDOMWindow* aWindow)
|
||||||
SmsManager::CreationIsAllowed(nsPIDOMWindow* aWindow)
|
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aWindow, "Null pointer!");
|
NS_ASSERTION(aWindow, "Null pointer!");
|
||||||
|
|
||||||
#ifndef MOZ_WEBSMS_BACKEND
|
#ifndef MOZ_WEBSMS_BACKEND
|
||||||
return false;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// First of all, the general pref has to be turned on.
|
// First of all, the general pref has to be turned on.
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
Preferences::GetBool("dom.sms.enabled", &enabled);
|
Preferences::GetBool("dom.sms.enabled", &enabled);
|
||||||
NS_ENSURE_TRUE(enabled, false);
|
NS_ENSURE_TRUE(enabled, nullptr);
|
||||||
|
|
||||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||||
NS_ENSURE_TRUE(permMgr, false);
|
NS_ENSURE_TRUE(permMgr, nullptr);
|
||||||
|
|
||||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||||
permMgr->TestPermissionFromWindow(aWindow, "sms", &permission);
|
permMgr->TestPermissionFromWindow(aWindow, "sms", &permission);
|
||||||
|
|
||||||
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||||
return false;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the Sms Service:
|
// Check the Sms Service:
|
||||||
nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
|
nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
|
||||||
NS_ENSURE_TRUE(smsService, false);
|
NS_ENSURE_TRUE(smsService, nullptr);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
smsService->HasSupport(&result);
|
smsService->HasSupport(&result);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return false;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
already_AddRefed<SmsManager>
|
|
||||||
SmsManager::CreateInstance(nsPIDOMWindow* aWindow)
|
|
||||||
{
|
|
||||||
nsRefPtr<SmsManager> smsMgr = new SmsManager();
|
nsRefPtr<SmsManager> smsMgr = new SmsManager();
|
||||||
smsMgr->Init(aWindow);
|
smsMgr->Init(aWindow);
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,7 @@ public:
|
||||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
|
||||||
|
|
||||||
static already_AddRefed<SmsManager>
|
static already_AddRefed<SmsManager>
|
||||||
CreateInstance(nsPIDOMWindow *aWindow);
|
CreateInstanceIfAllowed(nsPIDOMWindow *aWindow);
|
||||||
|
|
||||||
static bool
|
|
||||||
CreationIsAllowed(nsPIDOMWindow *aWindow);
|
|
||||||
|
|
||||||
void Init(nsPIDOMWindow *aWindow);
|
void Init(nsPIDOMWindow *aWindow);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
|
@ -16,9 +16,8 @@
|
||||||
/** Test for WebSMS **/
|
/** Test for WebSMS **/
|
||||||
|
|
||||||
function checkSmsDisabled() {
|
function checkSmsDisabled() {
|
||||||
ok(!('mozSms' in frames[0].navigator), "navigator.mozSms should not exist");
|
ok('mozSms' in frames[0].navigator, "navigator.mozSms should exist");
|
||||||
ok(frames[0].navigator.mozSms === undefined,
|
is(frames[0].navigator.mozSms, null, "navigator.mozSms should return null");
|
||||||
"navigator.mozSms should return undefined");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkSmsEnabled() {
|
function checkSmsEnabled() {
|
||||||
|
|
|
@ -179,27 +179,23 @@ PowerManager::SetCpuSleepAllowed(bool aAllowed)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
already_AddRefed<PowerManager>
|
||||||
PowerManager::CheckPermission(nsPIDOMWindow* aWindow)
|
PowerManager::CheckPermissionAndCreateInstance(nsPIDOMWindow* aWindow)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||||
NS_ENSURE_TRUE(permMgr, false);
|
NS_ENSURE_TRUE(permMgr, nullptr);
|
||||||
|
|
||||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||||
permMgr->TestPermissionFromWindow(aWindow, "power", &permission);
|
permMgr->TestPermissionFromWindow(aWindow, "power", &permission);
|
||||||
|
|
||||||
return permission == nsIPermissionManager::ALLOW_ACTION;
|
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||||
}
|
return nullptr;
|
||||||
|
|
||||||
already_AddRefed<PowerManager>
|
|
||||||
PowerManager::CreateInstance(nsPIDOMWindow* aWindow)
|
|
||||||
{
|
|
||||||
nsRefPtr<PowerManager> powerManager = new PowerManager();
|
|
||||||
if (NS_FAILED(powerManager->Init(aWindow))) {
|
|
||||||
powerManager = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsRefPtr<PowerManager> powerManager = new PowerManager();
|
||||||
|
powerManager->Init(aWindow);
|
||||||
|
|
||||||
return powerManager.forget();
|
return powerManager.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,8 @@ public:
|
||||||
nsresult Init(nsIDOMWindow *aWindow);
|
nsresult Init(nsIDOMWindow *aWindow);
|
||||||
nsresult Shutdown();
|
nsresult Shutdown();
|
||||||
|
|
||||||
static bool CheckPermission(nsPIDOMWindow*);
|
static already_AddRefed<PowerManager>
|
||||||
|
CheckPermissionAndCreateInstance(nsPIDOMWindow*);
|
||||||
static already_AddRefed<PowerManager> CreateInstance(nsPIDOMWindow*);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -117,47 +117,29 @@ Telephony::~Telephony()
|
||||||
|
|
||||||
// static
|
// static
|
||||||
already_AddRefed<Telephony>
|
already_AddRefed<Telephony>
|
||||||
Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv)
|
Telephony::Create(nsPIDOMWindow* aOwner, nsITelephonyProvider* aProvider)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aOwner, "Null owner!");
|
NS_ASSERTION(aOwner, "Null owner!");
|
||||||
|
NS_ASSERTION(aProvider, "Null provider!");
|
||||||
nsCOMPtr<nsITelephonyProvider> ril =
|
|
||||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
|
||||||
if (!ril) {
|
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aOwner);
|
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aOwner);
|
||||||
if (!sgo) {
|
NS_ENSURE_TRUE(sgo, nullptr);
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptContext> scriptContext = sgo->GetContext();
|
nsCOMPtr<nsIScriptContext> scriptContext = sgo->GetContext();
|
||||||
if (!scriptContext) {
|
NS_ENSURE_TRUE(scriptContext, nullptr);
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsRefPtr<Telephony> telephony = new Telephony();
|
nsRefPtr<Telephony> telephony = new Telephony();
|
||||||
|
|
||||||
telephony->BindToOwner(aOwner);
|
telephony->BindToOwner(aOwner);
|
||||||
|
|
||||||
telephony->mProvider = ril;
|
telephony->mProvider = aProvider;
|
||||||
telephony->mListener = new Listener(telephony);
|
telephony->mListener = new Listener(telephony);
|
||||||
|
|
||||||
nsresult rv = ril->EnumerateCalls(telephony->mListener);
|
nsresult rv = aProvider->EnumerateCalls(telephony->mListener);
|
||||||
if (NS_FAILED(rv)) {
|
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||||
aRv.Throw(rv);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = ril->RegisterTelephonyMsg(telephony->mListener);
|
rv = aProvider->RegisterTelephonyMsg(telephony->mListener);
|
||||||
if (NS_FAILED(rv)) {
|
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||||
aRv.Throw(rv);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return telephony.forget();
|
return telephony.forget();
|
||||||
}
|
}
|
||||||
|
@ -592,24 +574,36 @@ Telephony::EnqueueEnumerationAck()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
nsresult
|
||||||
bool
|
NS_NewTelephony(nsPIDOMWindow* aWindow, nsIDOMTelephony** aTelephony)
|
||||||
Telephony::CheckPermission(nsPIDOMWindow* aWindow)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow && aWindow->IsInnerWindow());
|
NS_ASSERTION(aWindow, "Null pointer!");
|
||||||
|
|
||||||
|
nsPIDOMWindow* innerWindow = aWindow->IsInnerWindow() ?
|
||||||
|
aWindow :
|
||||||
|
aWindow->GetCurrentInnerWindow();
|
||||||
|
|
||||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||||
NS_ENSURE_TRUE(permMgr, false);
|
NS_ENSURE_TRUE(permMgr, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
uint32_t permission;
|
uint32_t permission;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
permMgr->TestPermissionFromWindow(aWindow, "telephony", &permission);
|
permMgr->TestPermissionFromWindow(aWindow, "telephony", &permission);
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||||
return false;
|
*aTelephony = nullptr;
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
nsCOMPtr<nsITelephonyProvider> ril =
|
||||||
|
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||||
|
NS_ENSURE_TRUE(ril, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
nsRefPtr<Telephony> telephony = Telephony::Create(innerWindow, ril);
|
||||||
|
NS_ENSURE_TRUE(telephony, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
telephony.forget(aTelephony);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
#define mozilla_dom_telephony_telephony_h__
|
#define mozilla_dom_telephony_telephony_h__
|
||||||
|
|
||||||
#include "TelephonyCommon.h"
|
#include "TelephonyCommon.h"
|
||||||
// Need to include TelephonyCall.h because we have inline methods that
|
|
||||||
// assume they see the definition of TelephonyCall.
|
|
||||||
#include "TelephonyCall.h"
|
|
||||||
|
|
||||||
#include "nsIDOMTelephony.h"
|
#include "nsIDOMTelephony.h"
|
||||||
#include "nsIDOMTelephonyCall.h"
|
#include "nsIDOMTelephonyCall.h"
|
||||||
|
@ -59,9 +56,7 @@ public:
|
||||||
nsDOMEventTargetHelper)
|
nsDOMEventTargetHelper)
|
||||||
|
|
||||||
static already_AddRefed<Telephony>
|
static already_AddRefed<Telephony>
|
||||||
Create(nsPIDOMWindow* aOwner, ErrorResult& aRv);
|
Create(nsPIDOMWindow* aOwner, nsITelephonyProvider* aProvider);
|
||||||
|
|
||||||
static bool CheckPermission(nsPIDOMWindow* aOwner);
|
|
||||||
|
|
||||||
nsISupports*
|
nsISupports*
|
||||||
ToISupports()
|
ToISupports()
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||||
|
/* vim: set ts=2 et sw=2 tw=40: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_telephony_telephonyfactory_h__
|
||||||
|
#define mozilla_dom_telephony_telephonyfactory_h__
|
||||||
|
|
||||||
|
#include "nsIDOMTelephony.h"
|
||||||
|
#include "nsPIDOMWindow.h"
|
||||||
|
|
||||||
|
// Implemented in Telephony.cpp.
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
NS_NewTelephony(nsPIDOMWindow* aWindow, nsIDOMTelephony** aTelephony);
|
||||||
|
|
||||||
|
#endif // mozilla_dom_telephony_telephonyfactory_h__
|
|
@ -17,28 +17,23 @@ var idleObserver = {
|
||||||
onactive: null
|
onactive: null
|
||||||
};
|
};
|
||||||
|
|
||||||
function doAddIdleObserver(obs) {
|
|
||||||
var i = document.createElement("iframe");
|
|
||||||
document.body.appendChild(i);
|
|
||||||
var added = false;
|
|
||||||
try {
|
|
||||||
i.contentWindow.navigator.addIdleObserver(obs);
|
|
||||||
added = true;
|
|
||||||
} catch (e) { }
|
|
||||||
i.remove();
|
|
||||||
return added;
|
|
||||||
}
|
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
// addIdleObserver checks whether time is > 0.
|
// addIdleObserver checks whether time is > 0.
|
||||||
this.idleObserver.time = 100;
|
this.idleObserver.time = 100;
|
||||||
|
|
||||||
var added = doAddIdleObserver(this.idleObserver, false);
|
var added = false;
|
||||||
|
try {
|
||||||
|
navigator.addIdleObserver(this.idleObserver);
|
||||||
|
added = true;
|
||||||
|
} catch (e) { }
|
||||||
ok(!added, "Should not be able to add idle observer without permission");
|
ok(!added, "Should not be able to add idle observer without permission");
|
||||||
|
|
||||||
SpecialPowers.addPermission("idle", true, document);
|
SpecialPowers.addPermission("idle", true, document);
|
||||||
|
added = false;
|
||||||
added = doAddIdleObserver(this.idleObserver, true);
|
try {
|
||||||
|
navigator.addIdleObserver(this.idleObserver);
|
||||||
|
added = true;
|
||||||
|
} catch (e) { }
|
||||||
ok(added, "Should be able to add idle observer with permission.");
|
ok(added, "Should be able to add idle observer with permission.");
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
|
|
@ -35,12 +35,12 @@ function expectSuccess(param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testFailures() {
|
function testFailures() {
|
||||||
expectSuccess(null);
|
expectFailure(null);
|
||||||
expectSuccess(undefined);
|
expectFailure(undefined);
|
||||||
expectFailure(-1);
|
expectFailure(-1);
|
||||||
expectSuccess('a');
|
expectFailure('a');
|
||||||
expectFailure([100, -1]);
|
expectFailure([100, -1]);
|
||||||
expectSuccess([100, 'a']);
|
expectFailure([100, 'a']);
|
||||||
|
|
||||||
var maxVibrateMs = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_ms');
|
var maxVibrateMs = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_ms');
|
||||||
var maxVibrateListLen = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_list_len');
|
var maxVibrateListLen = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_list_len');
|
||||||
|
|
|
@ -1,353 +0,0 @@
|
||||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* The origin of this IDL file is
|
|
||||||
* http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
|
|
||||||
* http://www.w3.org/TR/tracking-dnt/
|
|
||||||
* http://www.w3.org/TR/geolocation-API/#geolocation_interface
|
|
||||||
* http://www.w3.org/TR/battery-status/#navigatorbattery-interface
|
|
||||||
* http://www.w3.org/TR/vibration/#vibration-interface
|
|
||||||
* http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1
|
|
||||||
* https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
|
|
||||||
*
|
|
||||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
|
||||||
* Opera Software ASA. You are granted a license to use, reproduce
|
|
||||||
* and create derivative works of this document.
|
|
||||||
*/
|
|
||||||
|
|
||||||
interface MozPowerManager;
|
|
||||||
interface MozWakeLock;
|
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
|
|
||||||
[HeaderFile="Navigator.h", NeedNewResolve]
|
|
||||||
interface Navigator {
|
|
||||||
// objects implementing this interface also implement the interfaces given below
|
|
||||||
};
|
|
||||||
Navigator implements NavigatorID;
|
|
||||||
Navigator implements NavigatorLanguage;
|
|
||||||
Navigator implements NavigatorOnLine;
|
|
||||||
Navigator implements NavigatorContentUtils;
|
|
||||||
Navigator implements NavigatorStorageUtils;
|
|
||||||
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface NavigatorID {
|
|
||||||
readonly attribute DOMString appName;
|
|
||||||
[Throws]
|
|
||||||
readonly attribute DOMString appVersion;
|
|
||||||
[Throws]
|
|
||||||
readonly attribute DOMString platform;
|
|
||||||
[Throws]
|
|
||||||
readonly attribute DOMString userAgent;
|
|
||||||
|
|
||||||
// Spec has this as a const, but that's wrong because it should not
|
|
||||||
// be on the interface object.
|
|
||||||
//const DOMString product = "Gecko"; // for historical reasons
|
|
||||||
readonly attribute DOMString product;
|
|
||||||
};
|
|
||||||
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface NavigatorLanguage {
|
|
||||||
readonly attribute DOMString? language;
|
|
||||||
};
|
|
||||||
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface NavigatorOnLine {
|
|
||||||
readonly attribute boolean onLine;
|
|
||||||
};
|
|
||||||
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface NavigatorContentUtils {
|
|
||||||
// content handler registration
|
|
||||||
[Throws]
|
|
||||||
void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title);
|
|
||||||
[Throws]
|
|
||||||
void registerContentHandler(DOMString mimeType, DOMString url, DOMString title);
|
|
||||||
// NOT IMPLEMENTED
|
|
||||||
//DOMString isProtocolHandlerRegistered(DOMString scheme, DOMString url);
|
|
||||||
//DOMString isContentHandlerRegistered(DOMString mimeType, DOMString url);
|
|
||||||
//void unregisterProtocolHandler(DOMString scheme, DOMString url);
|
|
||||||
//void unregisterContentHandler(DOMString mimeType, DOMString url);
|
|
||||||
};
|
|
||||||
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface NavigatorStorageUtils {
|
|
||||||
// NOT IMPLEMENTED
|
|
||||||
//void yieldForStorageUpdates();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Things that definitely need to be in the spec and and are not for some
|
|
||||||
// reason. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22406
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws]
|
|
||||||
readonly attribute MimeTypeArray mimeTypes;
|
|
||||||
[Throws]
|
|
||||||
readonly attribute PluginArray plugins;
|
|
||||||
};
|
|
||||||
|
|
||||||
// http://www.w3.org/TR/tracking-dnt/ sort of
|
|
||||||
partial interface Navigator {
|
|
||||||
readonly attribute DOMString doNotTrack;
|
|
||||||
};
|
|
||||||
|
|
||||||
// http://www.w3.org/TR/geolocation-API/#geolocation_interface
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface NavigatorGeolocation {
|
|
||||||
// XXXbz This should perhaps be controleld by the "geo.enabled" pref, instead
|
|
||||||
// of checking it in the C++. Let's not for now to reduce risk.
|
|
||||||
// Also, we violate the spec as a result, since we can return null. See bug
|
|
||||||
// 884921.
|
|
||||||
[Throws]
|
|
||||||
readonly attribute Geolocation? geolocation;
|
|
||||||
};
|
|
||||||
Navigator implements NavigatorGeolocation;
|
|
||||||
|
|
||||||
// http://www.w3.org/TR/battery-status/#navigatorbattery-interface
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface NavigatorBattery {
|
|
||||||
// XXXbz Per spec this should be non-nullable, but we return null in
|
|
||||||
// torn-down windows. See bug 884925.
|
|
||||||
[Throws, Func="Navigator::HasBatterySupport"]
|
|
||||||
readonly attribute BatteryManager? battery;
|
|
||||||
};
|
|
||||||
Navigator implements NavigatorBattery;
|
|
||||||
|
|
||||||
// http://www.w3.org/TR/vibration/#vibration-interface
|
|
||||||
partial interface Navigator {
|
|
||||||
// We don't support sequences in unions yet
|
|
||||||
//boolean vibrate ((unsigned long or sequence<unsigned long>) pattern);
|
|
||||||
// XXXbz also, per spec we should be returning a boolean, and we just don't.
|
|
||||||
// See bug 884935.
|
|
||||||
[Throws]
|
|
||||||
void vibrate(unsigned long duration);
|
|
||||||
[Throws]
|
|
||||||
void vibrate(sequence<unsigned long> pattern);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Mozilla-specific extensions
|
|
||||||
|
|
||||||
callback interface MozIdleObserver {
|
|
||||||
// Time is in seconds and is read only when idle observers are added
|
|
||||||
// and removed.
|
|
||||||
readonly attribute unsigned long time;
|
|
||||||
void onidle();
|
|
||||||
void onactive();
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMNavigator
|
|
||||||
partial interface Navigator {
|
|
||||||
// WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
|
|
||||||
[Throws]
|
|
||||||
readonly attribute DOMString appCodeName;
|
|
||||||
[Throws]
|
|
||||||
readonly attribute DOMString oscpu;
|
|
||||||
// WebKit/Blink support this; Trident/Presto do not.
|
|
||||||
readonly attribute DOMString vendor;
|
|
||||||
// WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
|
|
||||||
readonly attribute DOMString vendorSub;
|
|
||||||
// WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
|
|
||||||
readonly attribute DOMString productSub;
|
|
||||||
// WebKit/Blink/Trident/Presto support this.
|
|
||||||
readonly attribute boolean cookieEnabled;
|
|
||||||
[Throws]
|
|
||||||
readonly attribute DOMString buildID;
|
|
||||||
[Throws, Func="Navigator::HasPowerSupport"]
|
|
||||||
readonly attribute MozPowerManager mozPower;
|
|
||||||
|
|
||||||
// WebKit/Blink/Trident/Presto support this.
|
|
||||||
[Throws]
|
|
||||||
boolean javaEnabled();
|
|
||||||
// Everyone but WebKit/Blink supports this. See bug 679971.
|
|
||||||
boolean taintEnabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Navigator requests to add an idle observer to the existing window.
|
|
||||||
*/
|
|
||||||
[Throws, Func="Navigator::HasIdleSupport"]
|
|
||||||
void addIdleObserver(MozIdleObserver aIdleObserver);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Navigator requests to remove an idle observer from the existing window.
|
|
||||||
*/
|
|
||||||
[Throws, Func="Navigator::HasIdleSupport"]
|
|
||||||
void removeIdleObserver(MozIdleObserver aIdleObserver);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Request a wake lock for a resource.
|
|
||||||
*
|
|
||||||
* A page holds a wake lock to request that a resource not be turned
|
|
||||||
* off (or otherwise made unavailable).
|
|
||||||
*
|
|
||||||
* The topic is the name of a resource that might be made unavailable for
|
|
||||||
* various reasons. For example, on a mobile device the power manager might
|
|
||||||
* decide to turn off the screen after a period of idle time to save power.
|
|
||||||
*
|
|
||||||
* The resource manager checks the lock state of a topic before turning off
|
|
||||||
* the associated resource. For example, a page could hold a lock on the
|
|
||||||
* "screen" topic to prevent the screensaver from appearing or the screen
|
|
||||||
* from turning off.
|
|
||||||
*
|
|
||||||
* The resource manager defines what each topic means and sets policy. For
|
|
||||||
* example, the resource manager might decide to ignore 'screen' wake locks
|
|
||||||
* held by pages which are not visible.
|
|
||||||
*
|
|
||||||
* One topic can be locked multiple times; it is considered released only when
|
|
||||||
* all locks on the topic have been released.
|
|
||||||
*
|
|
||||||
* The returned nsIDOMMozWakeLock object is a token of the lock. You can
|
|
||||||
* unlock the lock via the object's |unlock| method. The lock is released
|
|
||||||
* automatically when its associated window is unloaded.
|
|
||||||
*
|
|
||||||
* @param aTopic resource name
|
|
||||||
*/
|
|
||||||
[Throws, Func="Navigator::HasWakeLockSupport"]
|
|
||||||
MozWakeLock requestWakeLock(DOMString aTopic);
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMNavigatorDeviceStorage
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Pref="device.storage.enabled"]
|
|
||||||
DeviceStorage? getDeviceStorage(DOMString type);
|
|
||||||
[Throws, Pref="device.storage.enabled"]
|
|
||||||
sequence<DeviceStorage> getDeviceStorages(DOMString type);
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMNavigatorDesktopNotification
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasDesktopNotificationSupport"]
|
|
||||||
readonly attribute DesktopNotificationCenter mozNotification;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMClientInformation
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws]
|
|
||||||
boolean mozIsLocallyAvailable(DOMString uri, boolean whenOffline);
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMMozNavigatorSms
|
|
||||||
interface MozSmsManager;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Func="Navigator::HasSmsSupport"]
|
|
||||||
readonly attribute MozSmsManager? mozSms;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMMozNavigatorMobileMessage
|
|
||||||
interface MozMobileMessageManager;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Func="Navigator::HasMobileMessageSupport"]
|
|
||||||
readonly attribute MozMobileMessageManager? mozMobileMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMMozNavigatorNetwork
|
|
||||||
interface MozConnection;
|
|
||||||
partial interface Navigator {
|
|
||||||
readonly attribute MozConnection? mozConnection;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMNavigatorCamera
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasCameraSupport"]
|
|
||||||
readonly attribute CameraManager mozCameras;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIDOMNavigatorSystemMessages and sort of maybe
|
|
||||||
// http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1
|
|
||||||
callback systemMessageCallback = void (optional object message);
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Pref="dom.sysmsg.enabled"]
|
|
||||||
void mozSetMessageHandler (DOMString type, systemMessageCallback? callback);
|
|
||||||
[Throws, Pref="dom.sysmsg.enabled"]
|
|
||||||
boolean mozHasPendingMessage (DOMString type);
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef MOZ_B2G_RIL
|
|
||||||
interface MozTelephony;
|
|
||||||
// nsIDOMNavigatorTelephony
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasTelephonySupport"]
|
|
||||||
readonly attribute MozTelephony? mozTelephony;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIMozNavigatorMobileConnection
|
|
||||||
interface MozMobileConnection;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasMobileConnectionSupport"]
|
|
||||||
readonly attribute MozMobileConnection mozMobileConnection;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIMozNavigatorCellBroadcast
|
|
||||||
interface MozCellBroadcast;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasCellBroadcastSupport"]
|
|
||||||
readonly attribute MozCellBroadcast mozCellBroadcast;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIMozNavigatorVoicemail
|
|
||||||
interface MozVoicemail;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasVoicemailSupport"]
|
|
||||||
readonly attribute MozVoicemail mozVoicemail;
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsIMozNavigatorIccManager
|
|
||||||
interface MozIccManager;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasIccManagerSupport"]
|
|
||||||
readonly attribute MozIccManager? mozIccManager;
|
|
||||||
};
|
|
||||||
#endif // MOZ_B2G_RIL
|
|
||||||
|
|
||||||
#ifdef MOZ_GAMEPAD
|
|
||||||
// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Pref="dom.gamepad.enabled"]
|
|
||||||
sequence<Gamepad?> getGamepads();
|
|
||||||
};
|
|
||||||
#endif // MOZ_GAMEPAD
|
|
||||||
|
|
||||||
#ifdef MOZ_B2G_BT
|
|
||||||
// nsIDOMNavigatorBluetooth
|
|
||||||
interface MozBluetoothManager;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasBluetoothSupport"]
|
|
||||||
readonly attribute MozBluetoothManager mozBluetooth;
|
|
||||||
};
|
|
||||||
#endif // MOZ_B2G_BT
|
|
||||||
|
|
||||||
#ifdef MOZ_TIME_MANAGER
|
|
||||||
// nsIDOMMozNavigatorTime
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasTimeSupport"]
|
|
||||||
readonly attribute MozTimeManager mozTime;
|
|
||||||
};
|
|
||||||
#endif // MOZ_TIME_MANAGER
|
|
||||||
|
|
||||||
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
|
|
||||||
// nsIMozNavigatorAudioChannelManager
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws]
|
|
||||||
readonly attribute AudioChannelManager mozAudioChannelManager;
|
|
||||||
};
|
|
||||||
#endif // MOZ_AUDIO_CHANNEL_MANAGER
|
|
||||||
|
|
||||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
|
||||||
// nsIDOMNavigatorUserMedia
|
|
||||||
callback MozDOMGetUserMediaSuccessCallback = void (nsISupports? value);
|
|
||||||
callback MozDOMGetUserMediaErrorCallback = void (DOMString error);
|
|
||||||
interface MozMediaStreamOptions;
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, Func="Navigator::HasUserMediaSupport"]
|
|
||||||
void mozGetUserMedia(MozMediaStreamOptions? params,
|
|
||||||
MozDOMGetUserMediaSuccessCallback? onsuccess,
|
|
||||||
MozDOMGetUserMediaErrorCallback? onerror);
|
|
||||||
};
|
|
||||||
|
|
||||||
// nsINavigatorUserMedia
|
|
||||||
callback MozGetUserMediaDevicesSuccessCallback = void (nsIVariant? devices);
|
|
||||||
partial interface Navigator {
|
|
||||||
[Throws, ChromeOnly]
|
|
||||||
void mozGetUserMediaDevices(MozGetUserMediaDevicesSuccessCallback? onsuccess,
|
|
||||||
MozDOMGetUserMediaErrorCallback? onerror);
|
|
||||||
};
|
|
||||||
#endif // MOZ_MEDIA_NAVIGATOR
|
|
|
@ -8,10 +8,6 @@ generated_webidl_files = \
|
||||||
CSS2Properties.webidl \
|
CSS2Properties.webidl \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
preprocessed_webidl_files = \
|
|
||||||
Navigator.webidl \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
webidl_files = \
|
webidl_files = \
|
||||||
AnalyserNode.webidl \
|
AnalyserNode.webidl \
|
||||||
AnimationEvent.webidl \
|
AnimationEvent.webidl \
|
||||||
|
|
|
@ -1158,8 +1158,8 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!mNavigatorStringsLoaded) {
|
if (!mNavigatorStringsLoaded) {
|
||||||
NS_GetNavigatorAppName(mNavigatorStrings.mAppName);
|
if (NS_FAILED(NS_GetNavigatorAppName(mNavigatorStrings.mAppName)) ||
|
||||||
if (NS_FAILED(NS_GetNavigatorAppVersion(mNavigatorStrings.mAppVersion)) ||
|
NS_FAILED(NS_GetNavigatorAppVersion(mNavigatorStrings.mAppVersion)) ||
|
||||||
NS_FAILED(NS_GetNavigatorPlatform(mNavigatorStrings.mPlatform)) ||
|
NS_FAILED(NS_GetNavigatorPlatform(mNavigatorStrings.mPlatform)) ||
|
||||||
NS_FAILED(NS_GetNavigatorUserAgent(mNavigatorStrings.mUserAgent))) {
|
NS_FAILED(NS_GetNavigatorUserAgent(mNavigatorStrings.mUserAgent))) {
|
||||||
JS_ReportError(aCx, "Failed to load navigator strings!");
|
JS_ReportError(aCx, "Failed to load navigator strings!");
|
||||||
|
|
|
@ -35,8 +35,7 @@ Tests of DOM Worker Navigator
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
is(navigator[args.name], args.value,
|
is(navigator[args.name], args.value, "Mismatched navigator string!");
|
||||||
"Mismatched navigator string for " + args.name + "!");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
worker.onerror = function(event) {
|
worker.onerror = function(event) {
|
||||||
|
|
|
@ -221,17 +221,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=668855
|
||||||
|
|
||||||
let dummy_test_map = new WeakMap;
|
let dummy_test_map = new WeakMap;
|
||||||
|
|
||||||
let rule_fail = false;
|
let navi_fail = false;
|
||||||
let got_rule = false;
|
|
||||||
try {
|
try {
|
||||||
var rule = document.styleSheets[0].cssRules[0];
|
dummy_test_map.set(window.navigator, 1);
|
||||||
got_rule = true;
|
|
||||||
dummy_test_map.set(rule, 1);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rule_fail = true;
|
navi_fail = true;
|
||||||
}
|
}
|
||||||
ok(got_rule, "Got the CSS rule");
|
ok(navi_fail, "Using window.navigator as a weak map key should produce an exception because it can't be wrapper preserved.");
|
||||||
ok(rule_fail, "Using a CSS rule as a weak map key should produce an exception because it can't be wrapper preserved.");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="data:text/css,div {}">
|
|
||||||
<title>Test Cross-Compartment DOM WeakMaps</title>
|
<title>Test Cross-Compartment DOM WeakMaps</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -16,13 +16,13 @@ function setup() {
|
||||||
|
|
||||||
my_map.set(item, "success_string");
|
my_map.set(item, "success_string");
|
||||||
|
|
||||||
var rule_fail = false;
|
var navi_fail = false;
|
||||||
try {
|
try {
|
||||||
my_map.set(window.frames[0].document.styleSheets[0].cssRules[0], 1);
|
my_map.set(window.frames[0].navigator, 1);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rule_fail = true;
|
navi_fail = true;
|
||||||
}
|
}
|
||||||
ok(rule_fail, "Using rule as a weak map key across compartments should produce an exception because it can't be wrapper preserved.");
|
ok(navi_fail, "Using window.navigator as a weak map key across compartments should produce an exception because it can't be wrapper preserved.");
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTest() {
|
function runTest() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче