зеркало из https://github.com/mozilla/gecko-dev.git
Bug 893004 part 1. Remove Navigator classinfo. r=smaug
This commit is contained in:
Родитель
fde331f15a
Коммит
3a7b4a0d28
|
@ -39,7 +39,6 @@
|
|||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "Connection.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#ifdef MOZ_B2G_RIL
|
||||
|
@ -158,7 +157,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Navigator)
|
|||
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMozNavigatorAudioChannelManager)
|
||||
#endif
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Navigator)
|
||||
|
|
|
@ -134,7 +134,6 @@
|
|||
#include "nsIDOMApplicationRegistry.h"
|
||||
|
||||
// includes needed for the prototype chain interfaces
|
||||
#include "nsIDOMNavigator.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMLinkStyle.h"
|
||||
|
@ -161,10 +160,6 @@
|
|||
#include "nsIControllers.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsIBoxObject.h"
|
||||
#ifdef MOZ_GAMEPAD
|
||||
#include "nsINavigatorGamepads.h"
|
||||
#include "mozilla/dom/GamepadService.h"
|
||||
#endif
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsITreeSelection.h"
|
||||
#include "nsITreeContentView.h"
|
||||
|
@ -190,21 +185,11 @@
|
|||
// Geolocation
|
||||
#include "nsIDOMGeoPositionCoords.h"
|
||||
|
||||
// User media
|
||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
||||
#include "nsIDOMNavigatorUserMedia.h"
|
||||
#endif
|
||||
|
||||
// Workers
|
||||
#include "mozilla/dom/workers/Workers.h"
|
||||
|
||||
#include "nsDOMFile.h"
|
||||
|
||||
#include "nsIDOMNavigatorDesktopNotification.h"
|
||||
#include "nsIDOMNavigatorDeviceStorage.h"
|
||||
#include "nsIDOMNavigatorGeolocation.h"
|
||||
#include "Navigator.h"
|
||||
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsIMessageManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
@ -262,7 +247,6 @@ using mozilla::dom::workers::ResolveWorkerClasses;
|
|||
#include "BluetoothDevice.h"
|
||||
#endif
|
||||
|
||||
#include "nsIDOMNavigatorSystemMessages.h"
|
||||
#include "DOMCameraManager.h"
|
||||
#include "DOMCameraControl.h"
|
||||
#include "DOMCameraCapabilities.h"
|
||||
|
@ -437,10 +421,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
nsIXPCScriptable::WANT_ADDPROPERTY) &
|
||||
~nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE))
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(Navigator, nsNavigatorSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE |
|
||||
nsIXPCScriptable::WANT_NEWRESOLVE)
|
||||
NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH,
|
||||
ARRAY_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE)
|
||||
|
@ -777,7 +757,6 @@ jsid nsDOMClassInfo::sScrollMaxY_id = JSID_VOID;
|
|||
jsid nsDOMClassInfo::sItem_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sNamedItem_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sEnumerate_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sNavigator_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sTop_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sDocument_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sFrames_id = JSID_VOID;
|
||||
|
@ -969,7 +948,6 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
|
|||
SET_JSID_TO_STRING(sItem_id, cx, "item");
|
||||
SET_JSID_TO_STRING(sNamedItem_id, cx, "namedItem");
|
||||
SET_JSID_TO_STRING(sEnumerate_id, cx, "enumerateProperties");
|
||||
SET_JSID_TO_STRING(sNavigator_id, cx, "navigator");
|
||||
SET_JSID_TO_STRING(sTop_id, cx, "top");
|
||||
SET_JSID_TO_STRING(sDocument_id, cx, "document");
|
||||
SET_JSID_TO_STRING(sFrames_id, cx, "frames");
|
||||
|
@ -1260,51 +1238,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Navigator, nsIDOMNavigator)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigator)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorDeviceStorage)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorGeolocation)
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMNavigatorDesktopNotification,
|
||||
Navigator::HasDesktopNotificationSupport())
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMClientInformation)
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsINavigatorBattery,
|
||||
battery::BatteryManager::HasSupport())
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorSms)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorMobileMessage)
|
||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsINavigatorUserMedia)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorUserMedia)
|
||||
#endif
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorTelephony)
|
||||
#endif
|
||||
#ifdef MOZ_GAMEPAD
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsINavigatorGamepads,
|
||||
GamepadService::IsAPIEnabled())
|
||||
#endif
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMMozNavigatorNetwork,
|
||||
network::IsAPIEnabled())
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorMobileConnection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorCellBroadcast)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorVoicemail)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorIccManager)
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorBluetooth)
|
||||
#endif
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorCamera)
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMNavigatorSystemMessages,
|
||||
Activity::PrefEnabled())
|
||||
#ifdef MOZ_TIME_MANAGER
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorTime)
|
||||
#endif
|
||||
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorAudioChannelManager)
|
||||
#endif
|
||||
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(History, nsIDOMHistory)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -2374,7 +2307,6 @@ nsDOMClassInfo::ShutDown()
|
|||
sScrollMaxY_id = JSID_VOID;
|
||||
sItem_id = JSID_VOID;
|
||||
sEnumerate_id = JSID_VOID;
|
||||
sNavigator_id = JSID_VOID;
|
||||
sTop_id = JSID_VOID;
|
||||
sDocument_id = JSID_VOID;
|
||||
sFrames_id = JSID_VOID;
|
||||
|
@ -4415,30 +4347,6 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
if (sNavigator_id == id) {
|
||||
nsCOMPtr<nsIDOMNavigator> navigator;
|
||||
rv = win->GetNavigator(getter_AddRefs(navigator));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
rv = WrapNative(cx, obj, navigator, &NS_GET_IID(nsIDOMNavigator), true,
|
||||
v.address(), getter_AddRefs(holder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Hold on to the navigator object as a global property so we
|
||||
// don't need to worry about losing expando properties etc.
|
||||
if (!::JS_DefinePropertyById(cx, obj, id, v,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_READONLY | JSPROP_PERMANENT |
|
||||
JSPROP_ENUMERATE)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*objp = obj;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (sDocument_id == id) {
|
||||
nsCOMPtr<nsIDocument> document = win->GetDoc();
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
|
@ -4650,63 +4558,6 @@ nsLocationSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// DOM Navigator helper
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavigatorSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *aObj, jsid aId, uint32_t flags,
|
||||
JSObject **objp, bool *_retval)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, aObj);
|
||||
JS::Rooted<jsid> id(cx, aId);
|
||||
nsCOMPtr<nsIDOMNavigator> navigator = do_QueryWrappedNative(wrapper);
|
||||
JS::Rooted<JS::Value> value(cx, JS::UndefinedValue());
|
||||
if (!static_cast<Navigator*>(navigator.get())->DoNewResolve(cx, obj, id,
|
||||
&value)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!value.isUndefined()) {
|
||||
if (!JS_DefinePropertyById(cx, obj, id, value, JS_PropertyStub,
|
||||
JS_StrictPropertyStub, JSPROP_ENUMERATE)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*objp = obj;
|
||||
}
|
||||
|
||||
*_retval = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsNavigatorSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
// window.navigator can hold expandos and thus we need to only ever
|
||||
// create one wrapper per navigator object so that expandos are
|
||||
// visible independently of who's looking it up.
|
||||
*parentObj = globalObj;
|
||||
|
||||
nsCOMPtr<nsIDOMNavigator> safeNav(do_QueryInterface(nativeObj));
|
||||
if (!safeNav) {
|
||||
// Oops, this wasn't really a navigator object. This can happen if someone
|
||||
// tries to use our scriptable helper as a real object and tries to wrap
|
||||
// it, see bug 319296.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Navigator *nav = static_cast<Navigator*>(safeNav.get());
|
||||
nsGlobalWindow *win = static_cast<nsGlobalWindow*>(nav->GetWindow());
|
||||
if (!win) {
|
||||
NS_WARNING("Refusing to create a navigator in the wrong scope");
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
return SetParentToWindow(win, parentObj);
|
||||
}
|
||||
|
||||
// EventTarget helper
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -211,7 +211,6 @@ public:
|
|||
static jsid sItem_id;
|
||||
static jsid sNamedItem_id;
|
||||
static jsid sEnumerate_id;
|
||||
static jsid sNavigator_id;
|
||||
static jsid sTop_id;
|
||||
static jsid sDocument_id;
|
||||
static jsid sFrames_id;
|
||||
|
@ -379,32 +378,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
// Navigator scriptable helper
|
||||
|
||||
class nsNavigatorSH : public nsDOMGenericSH
|
||||
{
|
||||
protected:
|
||||
nsNavigatorSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsNavigatorSH()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
|
||||
NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t flags,
|
||||
JSObject **objp, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsNavigatorSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
// Generic array scriptable helper
|
||||
|
||||
class nsGenericArraySH : public nsDOMClassInfo
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
DOMCI_CLASS(Window)
|
||||
DOMCI_CLASS(Location)
|
||||
DOMCI_CLASS(Navigator)
|
||||
DOMCI_CLASS(History)
|
||||
DOMCI_CLASS(DOMPrototype)
|
||||
DOMCI_CLASS(DOMConstructor)
|
||||
|
|
Загрузка…
Ссылка в новой задаче