зеркало из https://github.com/mozilla/gecko-dev.git
Adding a new popup element.
This commit is contained in:
Родитель
c2981cef58
Коммит
0162350f8c
|
@ -2,6 +2,7 @@ nsIDOMXULCommandDispatcher.h
|
|||
nsIDOMXULDocument.h
|
||||
nsIDOMXULEditorElement.h
|
||||
nsIDOMXULElement.h
|
||||
nsIDOMXULPopupElement.h
|
||||
nsIDOMXULTreeElement.h
|
||||
nsIStreamLoadableDocument.h
|
||||
nsIXULContentSink.h
|
||||
|
|
|
@ -33,6 +33,7 @@ EXPORTS = \
|
|||
nsIDOMXULDocument.h \
|
||||
nsIDOMXULEditorElement.h \
|
||||
nsIDOMXULElement.h \
|
||||
nsIDOMXULPopupElement.h \
|
||||
nsIDOMXULTreeElement.h \
|
||||
nsIStreamLoadableDocument.h \
|
||||
nsIXULContentSink.h \
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
interface XULPopupElement : XULElement {
|
||||
/* IID: { 0x8fefe4a1, 0xd334, 0x11d3, \
|
||||
{0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27} } */
|
||||
|
||||
void openPopup(in Element element,
|
||||
in long xPos, in long yPos,
|
||||
in DOMString popupType, in DOMString anchorAlignment,
|
||||
in DOMString popupAlignment);
|
||||
|
||||
void closePopup();
|
||||
};
|
||||
|
|
@ -30,6 +30,7 @@ IDLSRCS = \
|
|||
XULCommandDispatcher.idl \
|
||||
XULTreeElement.idl \
|
||||
XULEditorElement.idl \
|
||||
XULPopupElement.idl \
|
||||
$(NULL)
|
||||
|
||||
XPCOM_DESTDIR=$(DEPTH)\rdf\content\public
|
||||
|
|
|
@ -32,6 +32,7 @@ EXPORTS = \
|
|||
nsIDOMXULDocument.h \
|
||||
nsIDOMXULEditorElement.h \
|
||||
nsIDOMXULElement.h \
|
||||
nsIDOMXULPopupElement.h \
|
||||
nsIDOMXULTreeElement.h \
|
||||
nsIXULContentSink.h \
|
||||
nsIXULContentUtils.h \
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMXULPopupElement_h__
|
||||
#define nsIDOMXULPopupElement_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
|
||||
class nsIDOMElement;
|
||||
|
||||
#define NS_IDOMXULPOPUPELEMENT_IID \
|
||||
{ 0x8fefe4a1, 0xd334, 0x11d3, \
|
||||
{0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27} }
|
||||
|
||||
class nsIDOMXULPopupElement : public nsIDOMXULElement {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULPOPUPELEMENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD OpenPopup(nsIDOMElement* aElement, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment)=0;
|
||||
|
||||
NS_IMETHOD ClosePopup()=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMXULPOPUPELEMENT \
|
||||
NS_IMETHOD OpenPopup(nsIDOMElement* aElement, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment); \
|
||||
NS_IMETHOD ClosePopup(); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMXULPOPUPELEMENT(_to) \
|
||||
NS_IMETHOD OpenPopup(nsIDOMElement* aElement, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment) { return _to OpenPopup(aElement, aXPos, aYPos, aPopupType, aAnchorAlignment, aPopupAlignment); } \
|
||||
NS_IMETHOD ClosePopup() { return _to ClosePopup(); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitXULPopupElementClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptXULPopupElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMXULPopupElement_h__
|
|
@ -36,6 +36,7 @@ CPPSRCS = \
|
|||
nsJSXULDocument.cpp \
|
||||
nsJSXULElement.cpp \
|
||||
nsJSXULCommandDispatcher.cpp \
|
||||
nsJSXUIPopupElement.cpp \
|
||||
nsJSXULTreeElement.cpp \
|
||||
nsJSXULEditorElement.cpp \
|
||||
nsRDFDOMNodeList.cpp \
|
||||
|
|
|
@ -42,6 +42,7 @@ CPP_OBJS=\
|
|||
.\$(OBJDIR)\nsXULPrototypeCache.obj \
|
||||
.\$(OBJDIR)\nsJSXULDocument.obj \
|
||||
.\$(OBJDIR)\nsJSXULElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULPopupElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULTreeElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULEditorElement.obj \
|
||||
.\$(OBJDIR)\nsRDFDOMNodeList.obj \
|
||||
|
|
|
@ -0,0 +1,407 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMPropEnums.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIXULPopupElementIID, NS_IDOMXULPOPUPELEMENT_IID);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// XULPopupElement Properties Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetXULPopupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULPopupElement *a = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// XULPopupElement Properties Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetXULPopupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULPopupElement *a = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULPopupElement finalizer
|
||||
//
|
||||
PR_STATIC_CALLBACK(void)
|
||||
FinalizeXULPopupElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsJSUtils::nsGenericFinalize(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULPopupElement enumerate
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
EnumerateXULPopupElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return nsJSUtils::nsGenericEnumerate(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULPopupElement resolve
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ResolveXULPopupElement(JSContext *cx, JSObject *obj, jsval id)
|
||||
{
|
||||
return nsJSUtils::nsGenericResolve(cx, obj, id);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method OpenPopup
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULPopupElementOpenPopup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULPopupElement *nativeThis = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIDOMElement> b0;
|
||||
PRInt32 b1;
|
||||
PRInt32 b2;
|
||||
nsAutoString b3;
|
||||
nsAutoString b4;
|
||||
nsAutoString b5;
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
PRBool ok;
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULPOPUPELEMENT_OPENPOPUP, PR_FALSE, &ok);
|
||||
if (!ok) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 6) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
||||
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)(void**)getter_AddRefs(b0),
|
||||
kIElementIID,
|
||||
"Element",
|
||||
cx,
|
||||
argv[0])) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR);
|
||||
}
|
||||
if (!JS_ValueToInt32(cx, argv[1], (int32 *)&b1)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (!JS_ValueToInt32(cx, argv[2], (int32 *)&b2)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
nsJSUtils::nsConvertJSValToString(b3, cx, argv[3]);
|
||||
nsJSUtils::nsConvertJSValToString(b4, cx, argv[4]);
|
||||
nsJSUtils::nsConvertJSValToString(b5, cx, argv[5]);
|
||||
|
||||
result = nativeThis->OpenPopup(b0, b1, b2, b3, b4, b5);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method ClosePopup
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULPopupElementClosePopup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULPopupElement *nativeThis = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsresult result = NS_OK;
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
PRBool ok;
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULPOPUPELEMENT_CLOSEPOPUP, PR_FALSE, &ok);
|
||||
if (!ok) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->ClosePopup();
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for XULPopupElement
|
||||
//
|
||||
JSClass XULPopupElementClass = {
|
||||
"XULPopupElement",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
GetXULPopupElementProperty,
|
||||
SetXULPopupElementProperty,
|
||||
EnumerateXULPopupElement,
|
||||
ResolveXULPopupElement,
|
||||
JS_ConvertStub,
|
||||
FinalizeXULPopupElement
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULPopupElement class properties
|
||||
//
|
||||
static JSPropertySpec XULPopupElementProperties[] =
|
||||
{
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULPopupElement class methods
|
||||
//
|
||||
static JSFunctionSpec XULPopupElementMethods[] =
|
||||
{
|
||||
{"openPopup", XULPopupElementOpenPopup, 6},
|
||||
{"closePopup", XULPopupElementClosePopup, 0},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULPopupElement constructor
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULPopupElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULPopupElement class initialization
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_InitXULPopupElementClass(nsIScriptContext *aContext, void **aPrototype)
|
||||
{
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
JSObject *proto = nsnull;
|
||||
JSObject *constructor = nsnull;
|
||||
JSObject *parent_proto = nsnull;
|
||||
JSObject *global = JS_GetGlobalObject(jscontext);
|
||||
jsval vp;
|
||||
|
||||
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULPopupElement", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp) ||
|
||||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
|
||||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp)) {
|
||||
|
||||
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
proto = JS_InitClass(jscontext, // context
|
||||
global, // global object
|
||||
parent_proto, // parent proto
|
||||
&XULPopupElementClass, // JSClass
|
||||
XULPopupElement, // JSNative ctor
|
||||
0, // ctor args
|
||||
XULPopupElementProperties, // proto props
|
||||
XULPopupElementMethods, // proto funcs
|
||||
nsnull, // ctor props (static)
|
||||
nsnull); // ctor funcs (static)
|
||||
if (nsnull == proto) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
|
||||
proto = JSVAL_TO_OBJECT(vp);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aPrototype) {
|
||||
*aPrototype = proto;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Method for creating a new XULPopupElement JavaScript object
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_NewScriptXULPopupElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULPopupElement");
|
||||
JSObject *proto;
|
||||
JSObject *parent;
|
||||
nsIScriptObjectOwner *owner;
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMXULPopupElement *aXULPopupElement;
|
||||
|
||||
if (nsnull == aParent) {
|
||||
parent = nsnull;
|
||||
}
|
||||
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
|
||||
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
|
||||
NS_RELEASE(owner);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_OK != NS_InitXULPopupElementClass(aContext, (void **)&proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = aSupports->QueryInterface(kIXULPopupElementIID, (void **)&aXULPopupElement);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// create a js object for this class
|
||||
*aReturn = JS_NewObject(jscontext, &XULPopupElementClass, proto, parent);
|
||||
if (nsnull != *aReturn) {
|
||||
// connect the native object to the js object
|
||||
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULPopupElement);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(aXULPopupElement);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
Загрузка…
Ссылка в новой задаче