Removed the nsIDOMWindow::GetXPConnectObject, AddXPConnectObject, and RemoveXPConnectObject methods. This feature can be done through properties or through nsPIDOMWindow::GetXPConnectObject.

This commit is contained in:
tbogard%aol.net 2000-03-31 06:59:30 +00:00
Родитель 1013de80e8
Коммит 092d752c7a
6 изменённых файлов: 0 добавлений и 181 удалений

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

@ -37,7 +37,6 @@ class nsIDOMHistory;
class nsIDOMWindowCollection;
class nsIDOMEvent;
class nsISidebar;
class nsISupports;
class nsIDOMWindow;
class nsIControllers;
@ -200,12 +199,6 @@ public:
NS_IMETHOD Escape(const nsString& aStr, nsString& aReturn)=0;
NS_IMETHOD Unescape(const nsString& aStr, nsString& aReturn)=0;
NS_IMETHOD AddXPConnectObject(const nsString& aId, nsISupports* aXPConnectObj)=0;
NS_IMETHOD RemoveXPConnectObject(const nsString& aId)=0;
NS_IMETHOD GetXPConnectObject(const nsString& aId, nsISupports** aReturn)=0;
};
@ -292,9 +285,6 @@ public:
NS_IMETHOD UpdateCommands(const nsString& aAction); \
NS_IMETHOD Escape(const nsString& aStr, nsString& aReturn); \
NS_IMETHOD Unescape(const nsString& aStr, nsString& aReturn); \
NS_IMETHOD AddXPConnectObject(const nsString& aId, nsISupports* aXPConnectObj); \
NS_IMETHOD RemoveXPConnectObject(const nsString& aId); \
NS_IMETHOD GetXPConnectObject(const nsString& aId, nsISupports** aReturn); \
@ -381,9 +371,6 @@ public:
NS_IMETHOD UpdateCommands(const nsString& aAction) { return _to UpdateCommands(aAction); } \
NS_IMETHOD Escape(const nsString& aStr, nsString& aReturn) { return _to Escape(aStr, aReturn); } \
NS_IMETHOD Unescape(const nsString& aStr, nsString& aReturn) { return _to Unescape(aStr, aReturn); } \
NS_IMETHOD AddXPConnectObject(const nsString& aId, nsISupports* aXPConnectObj) { return _to AddXPConnectObject(aId, aXPConnectObj); } \
NS_IMETHOD RemoveXPConnectObject(const nsString& aId) { return _to RemoveXPConnectObject(aId); } \
NS_IMETHOD GetXPConnectObject(const nsString& aId, nsISupports** aReturn) { return _to GetXPConnectObject(aId, aReturn); } \
extern nsresult NS_InitWindowClass(nsIScriptContext *aContext, nsIScriptGlobalObject *aGlobal);

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

@ -78,10 +78,6 @@
DOMString escape(in DOMString str);
DOMString unescape(in DOMString str);
void addXPConnectObject(in DOMString id, in xpidl nsISupports XPConnectObj);
void removeXPConnectObject(in DOMString id);
xpidl nsISupports getXPConnectObject(in DOMString id);
};
interface EventTarget {

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

@ -840,7 +840,6 @@ enum nsDOMProp {
NS_DOM_PROP_UIEVENT_DETAIL,
NS_DOM_PROP_UIEVENT_INITUIEVENT,
NS_DOM_PROP_UIEVENT_VIEW,
NS_DOM_PROP_WINDOW_ADDXPCONNECTOBJECT,
NS_DOM_PROP_WINDOW_ALERT,
NS_DOM_PROP_WINDOW_BACK,
NS_DOM_PROP_WINDOW_BLUR,
@ -863,7 +862,6 @@ enum nsDOMProp {
NS_DOM_PROP_WINDOW_FORWARD,
NS_DOM_PROP_WINDOW_FRAMES,
NS_DOM_PROP_WINDOW_GETATTENTION,
NS_DOM_PROP_WINDOW_GETXPCONNECTOBJECT,
NS_DOM_PROP_WINDOW_HISTORY,
NS_DOM_PROP_WINDOW_HOME,
NS_DOM_PROP_WINDOW_INNERHEIGHT,
@ -886,7 +884,6 @@ enum nsDOMProp {
NS_DOM_PROP_WINDOW_PRINT,
NS_DOM_PROP_WINDOW_PROMPT,
NS_DOM_PROP_WINDOW_RELEASEEVENTS,
NS_DOM_PROP_WINDOW_REMOVEXPCONNECTOBJECT,
NS_DOM_PROP_WINDOW_RESIZEBY,
NS_DOM_PROP_WINDOW_RESIZETO,
NS_DOM_PROP_WINDOW_ROUTEEVENT,

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

@ -839,7 +839,6 @@
"uievent.detail", \
"uievent.inituievent", \
"uievent.view", \
"window.addxpconnectobject", \
"window.alert", \
"window.back", \
"window.blur", \
@ -862,7 +861,6 @@
"window.forward", \
"window.frames", \
"window.getattention", \
"window.getxpconnectobject", \
"window.history", \
"window.home", \
"window.innerheight", \
@ -885,7 +883,6 @@
"window.print", \
"window.prompt", \
"window.releaseevents", \
"window.removexpconnectobject", \
"window.resizeby", \
"window.resizeto", \
"window.routeevent", \

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

@ -1754,26 +1754,6 @@ NS_IMETHODIMP GlobalWindowImpl::Unescape(const nsString& aStr, nsString& aReturn
return NS_OK;
}
NS_IMETHODIMP GlobalWindowImpl::AddXPConnectObject(const nsString& aId,
nsISupports* aXPConnectObj)
{
NS_ERROR("XXX: Someone Still Calling the deprecated nsIDOMWindow AddXPConnectObject\r\n");
return SetXPConnectObject(aId.GetUnicode(), aXPConnectObj);
}
NS_IMETHODIMP GlobalWindowImpl::RemoveXPConnectObject(const nsString& aId)
{
NS_ERROR("XXX: Someone Still Calling the deprecated nsIDOMWindow RemoveXPConnectObject\r\n");
return SetXPConnectObject(aId.GetUnicode(), nsnull);
}
NS_IMETHODIMP GlobalWindowImpl::GetXPConnectObject(const nsString& aId,
nsISupports** aXPConnectObj)
{
NS_ERROR("XXX: Someone Still Calling the deprecated nsIDOMWindow GetXPConnectObject\r\n");
return GetXPConnectObject(aId.GetUnicode(), aXPConnectObj);
}
//*****************************************************************************
// GlobalWindowImpl::nsIJSScriptObject
//*****************************************************************************
@ -2180,9 +2160,6 @@ NS_IMETHODIMP GlobalWindowImpl::GetLocation(nsIDOMLocation** aLocation)
return NS_OK;
}
// NS_IMETHODIMP GlobalWindowImpl::GetDocShell(nsIDocShell** aDocShell)
// Implemented by nsIScriptGlobalObject
NS_IMETHODIMP GlobalWindowImpl::SetXPConnectObject(const PRUnichar* aProperty,
nsISupports* aXPConnectObj)
{

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

@ -45,7 +45,6 @@
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsISidebar.h"
#include "nsISupports.h"
#include "nsIDOMWindow.h"
#include "nsIControllers.h"
@ -64,7 +63,6 @@ static NS_DEFINE_IID(kIWindowCollectionIID, NS_IDOMWINDOWCOLLECTION_IID);
static NS_DEFINE_IID(kIEventIID, NS_IDOMEVENT_IID);
static NS_DEFINE_IID(kIEventTargetIID, NS_IDOMEVENTTARGET_IID);
static NS_DEFINE_IID(kISidebarIID, NS_ISIDEBAR_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIWindowIID, NS_IDOMWINDOW_IID);
static NS_DEFINE_IID(kIControllersIID, NS_ICONTROLLERS_IID);
@ -2358,136 +2356,6 @@ WindowUnescape(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
}
//
// Native method AddXPConnectObject
//
PR_STATIC_CALLBACK(JSBool)
WindowAddXPConnectObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMWindow *nativeThis = (nsIDOMWindow*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
nsAutoString b0;
nsCOMPtr<nsISupports> b1;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_ADDXPCONNECTOBJECT, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
if (argc < 2) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
}
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
if (JS_FALSE == nsJSUtils::nsConvertJSValToXPCObject(getter_AddRefs(b1),
kISupportsIID, cx, argv[1])) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_XPC_OBJECT_ERR);
}
result = nativeThis->AddXPConnectObject(b0, b1);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
*rval = JSVAL_VOID;
}
return JS_TRUE;
}
//
// Native method RemoveXPConnectObject
//
PR_STATIC_CALLBACK(JSBool)
WindowRemoveXPConnectObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMWindow *nativeThis = (nsIDOMWindow*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
nsAutoString b0;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_REMOVEXPCONNECTOBJECT, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
if (argc < 1) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
}
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
result = nativeThis->RemoveXPConnectObject(b0);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
*rval = JSVAL_VOID;
}
return JS_TRUE;
}
//
// Native method GetXPConnectObject
//
PR_STATIC_CALLBACK(JSBool)
WindowGetXPConnectObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMWindow *nativeThis = (nsIDOMWindow*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
nsISupports* nativeRet;
nsAutoString b0;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_GETXPCONNECTOBJECT, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
if (argc < 1) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
}
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
result = nativeThis->GetXPConnectObject(b0, &nativeRet);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
// n.b., this will release nativeRet
nsJSUtils::nsConvertXPCObjectToJSVal(nativeRet, NS_GET_IID(nsISupports), cx, obj, rval);
}
return JS_TRUE;
}
//
// Native method AddEventListener
//
@ -2705,9 +2573,6 @@ static JSFunctionSpec WindowMethods[] =
{"updateCommands", WindowUpdateCommands, 1},
{"escape", WindowEscape, 1},
{"unescape", WindowUnescape, 1},
{"addXPConnectObject", WindowAddXPConnectObject, 2},
{"removeXPConnectObject", WindowRemoveXPConnectObject, 1},
{"getXPConnectObject", WindowGetXPConnectObject, 1},
{"addEventListener", EventTargetAddEventListener, 3},
{"removeEventListener", EventTargetRemoveEventListener, 3},
{0}