adding domwindow barproperty object

This commit is contained in:
danm%netscape.com 1999-06-09 18:59:04 +00:00
Родитель b6a07d5d31
Коммит 65be2563be
12 изменённых файлов: 725 добавлений и 2 удалений

Двоичные данные
dom/macbuild/dom.mcp

Двоичный файл не отображается.

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

@ -26,3 +26,4 @@ nsIDOMMimeType.h
nsIDOMMimeTypeArray.h
nsIDOMPlugin.h
nsIDOMPluginArray.h
nsIDOMBarProp.h

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

@ -35,6 +35,7 @@ EXPORTS = \
nsIDOMMimeTypeArray.h \
nsIDOMPlugin.h \
nsIDOMPluginArray.h \
nsIDOMBarProp.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))

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

@ -22,7 +22,7 @@ DEFINES=-D_IMPL_NS_DOM
EXPORTS=nsIDOMWindow.h nsIDOMNavigator.h nsIDOMLocation.h \
nsIDOMWindowCollection.h nsIDOMScreen.h nsIDOMHistory.h \
nsIDOMMimeType.h nsIDOMMimeTypeArray.h \
nsIDOMPlugin.h nsIDOMPluginArray.h
nsIDOMPlugin.h nsIDOMPluginArray.h nsIDOMBarProp.h
MODULE=dom

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

@ -0,0 +1,56 @@
/* -*- 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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMBarProp_h__
#define nsIDOMBarProp_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#define NS_IDOMBARPROP_IID \
{ 0x9eb2c150, 0x1d56, 0x11d3, \
{ 0x82, 0x21, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf } }
class nsIDOMBarProp : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMBARPROP_IID; return iid; }
NS_IMETHOD GetVisible(PRBool* aVisible)=0;
NS_IMETHOD SetVisible(PRBool aVisible)=0;
};
#define NS_DECL_IDOMBARPROP \
NS_IMETHOD GetVisible(PRBool* aVisible); \
NS_IMETHOD SetVisible(PRBool aVisible); \
#define NS_FORWARD_IDOMBARPROP(_to) \
NS_IMETHOD GetVisible(PRBool* aVisible) { return _to GetVisible(aVisible); } \
NS_IMETHOD SetVisible(PRBool aVisible) { return _to SetVisible(aVisible); } \
extern "C" NS_DOM nsresult NS_InitBarPropClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptBarProp(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMBarProp_h__

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

@ -0,0 +1,6 @@
interface BarProp {
/* IID: { 0x9eb2c150, 0x1d56, 0x11d3, \
{ 0x82, 0x21, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf } } */
attribute boolean visible;
};

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

@ -21,7 +21,7 @@ IGNORE_MANIFEST=1
MODULE=raptor
IDLSRCS= Navigator.idl Location.idl WindowCollection.idl Screen.idl History.idl \
PluginArray.idl MimeTypeArray.idl Plugin.idl MimeType.idl
BarProp.idl PluginArray.idl MimeTypeArray.idl Plugin.idl MimeType.idl
GLOBAL_IDLSRC= Window.idl

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

@ -31,6 +31,8 @@ REQUIRES = xpcom raptor dom js netlib
DEFINES += -D_IMPL_NS_DOM
CPPSRCS = \
nsBarProps.cpp \
nsJSBarProp.cpp \
nsJSEnvironment.cpp \
nsJSWindow.cpp \
nsJSNavigator.cpp \

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

@ -23,6 +23,8 @@ LIBRARY_NAME=jsdombase_s
DEFINES=-D_IMPL_NS_DOM -DWIN32_LEAN_AND_MEAN
CPPSRCS = \
nsBarProps.cpp \
nsJSBarProp.cpp \
nsJSEnvironment.cpp \
nsJSWindow.cpp \
nsJSNavigator.cpp \
@ -52,6 +54,8 @@ MODULE=raptor
REQUIRES=xpcom raptor js netlib
CPP_OBJS= \
.\$(OBJDIR)\nsBarProps.obj \
.\$(OBJDIR)\nsJSBarProp.obj \
.\$(OBJDIR)\nsJSEnvironment.obj \
.\$(OBJDIR)\nsJSWindow.obj \
.\$(OBJDIR)\nsGlobalWindow.obj \

217
dom/src/base/nsBarProps.cpp Normal file
Просмотреть файл

@ -0,0 +1,217 @@
/* -*- 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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nscore.h"
#include "nsBarProps.h"
#include "nsIBrowserWindow.h"
#include "nsIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIDOMBarPropIID, NS_IDOMBARPROP_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
//
// Basic (virtual) BarProp class implementation
//
BarPropImpl::BarPropImpl() {
NS_INIT_REFCNT();
mBrowser = nsnull;
mScriptObject = nsnull;
}
BarPropImpl::~BarPropImpl() {
}
NS_IMPL_ADDREF(BarPropImpl)
NS_IMPL_RELEASE(BarPropImpl)
nsresult
BarPropImpl::QueryInterface(const nsIID& aIID,
void** aInstancePtrResult) {
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIScriptObjectOwnerIID)) {
*aInstancePtrResult = (void*) ((nsIScriptObjectOwner*)this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIDOMBarPropIID)) {
*aInstancePtrResult = (void*) ((nsIDOMBarProp*)this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtrResult = (void*)(nsISupports*)(nsIScriptObjectOwner*)this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMETHODIMP
BarPropImpl::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject) {
NS_PRECONDITION(nsnull != aScriptObject, "null arg");
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
res = NS_NewScriptBarProp(aContext, (nsIDOMBarProp *) this, (nsIDOMWindow *) global, &mScriptObject);
NS_IF_RELEASE(global);
}
*aScriptObject = mScriptObject;
return res;
}
NS_IMETHODIMP
BarPropImpl::SetScriptObject(void *aScriptObject) {
mScriptObject = aScriptObject;
return NS_OK;
}
NS_IMETHODIMP_(void)
BarPropImpl::SetBrowserWindow(nsIBrowserWindow *aBrowser) {
mBrowser = aBrowser;
}
//
// MenubarProp class implementation
//
MenubarPropImpl::MenubarPropImpl() {
}
MenubarPropImpl::~MenubarPropImpl() {
}
NS_IMETHODIMP
MenubarPropImpl::GetVisible(PRBool *aVisible) {
if (mBrowser)
return mBrowser->IsMenuBarVisible(aVisible);
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
MenubarPropImpl::SetVisible(PRBool aVisible) {
if (mBrowser)
return mBrowser->ShowMenuBar(aVisible);
return NS_ERROR_FAILURE;
}
//
// ToolbarProp class implementation
//
ToolbarPropImpl::ToolbarPropImpl() {
}
ToolbarPropImpl::~ToolbarPropImpl() {
}
NS_IMETHODIMP
ToolbarPropImpl::GetVisible(PRBool *aVisible) {
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
ToolbarPropImpl::SetVisible(PRBool aVisible) {
return NS_ERROR_FAILURE;
}
//
// LocationbarProp class implementation
//
LocationbarPropImpl::LocationbarPropImpl() {
}
LocationbarPropImpl::~LocationbarPropImpl() {
}
NS_IMETHODIMP
LocationbarPropImpl::GetVisible(PRBool *aVisible) {
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
LocationbarPropImpl::SetVisible(PRBool aVisible) {
return NS_ERROR_FAILURE;
}
//
// PersonalbarProp class implementation
//
PersonalbarPropImpl::PersonalbarPropImpl() {
}
PersonalbarPropImpl::~PersonalbarPropImpl() {
}
NS_IMETHODIMP
PersonalbarPropImpl::GetVisible(PRBool *aVisible) {
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
PersonalbarPropImpl::SetVisible(PRBool aVisible) {
return NS_ERROR_FAILURE;
}
//
// StatusbarProp class implementation
//
StatusbarPropImpl::StatusbarPropImpl() {
}
StatusbarPropImpl::~StatusbarPropImpl() {
}
NS_IMETHODIMP
StatusbarPropImpl::GetVisible(PRBool *aVisible) {
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
StatusbarPropImpl::SetVisible(PRBool aVisible) {
return NS_ERROR_FAILURE;
}
//
// ScrollbarsProp class implementation
//
ScrollbarsPropImpl::ScrollbarsPropImpl() {
}
ScrollbarsPropImpl::~ScrollbarsPropImpl() {
}
NS_IMETHODIMP
ScrollbarsPropImpl::GetVisible(PRBool *aVisible) {
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
ScrollbarsPropImpl::SetVisible(PRBool aVisible) {
return NS_ERROR_FAILURE;
}

116
dom/src/base/nsBarProps.h Normal file
Просмотреть файл

@ -0,0 +1,116 @@
/* -*- 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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* BarProps are the collection of little properties of DOM windows whose
only property of their own is "visible". They describe the window
chrome which can be made visible or not through JavaScript by setting
the appropriate property (window.menubar.visible)
*/
#ifndef nsBarProps_h___
#define nsBarProps_h___
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMBarProp.h"
class nsIBrowserWindow;
// Script "BarProp" object
class BarPropImpl : public nsIScriptObjectOwner, public nsIDOMBarProp {
public:
BarPropImpl();
virtual ~BarPropImpl();
NS_DECL_ISUPPORTS
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void *aScriptObject);
NS_IMETHOD_(void) SetBrowserWindow(nsIBrowserWindow *aBrowser);
NS_IMETHOD GetVisible(PRBool *aVisible) = 0;
NS_IMETHOD SetVisible(PRBool aVisible) = 0;
protected:
nsIBrowserWindow* mBrowser;
void *mScriptObject;
};
// Script "menubar" object
class MenubarPropImpl : public BarPropImpl {
public:
MenubarPropImpl();
virtual ~MenubarPropImpl();
NS_IMETHOD GetVisible(PRBool *aVisible);
NS_IMETHOD SetVisible(PRBool aVisible);
};
// Script "toolbar" object
class ToolbarPropImpl : public BarPropImpl {
public:
ToolbarPropImpl();
virtual ~ToolbarPropImpl();
NS_IMETHOD GetVisible(PRBool *aVisible);
NS_IMETHOD SetVisible(PRBool aVisible);
};
// Script "locationbar" object
class LocationbarPropImpl : public BarPropImpl {
public:
LocationbarPropImpl();
virtual ~LocationbarPropImpl();
NS_IMETHOD GetVisible(PRBool *aVisible);
NS_IMETHOD SetVisible(PRBool aVisible);
};
// Script "personalbar" object
class PersonalbarPropImpl : public BarPropImpl {
public:
PersonalbarPropImpl();
virtual ~PersonalbarPropImpl();
NS_IMETHOD GetVisible(PRBool *aVisible);
NS_IMETHOD SetVisible(PRBool aVisible);
};
// Script "statusbar" object
class StatusbarPropImpl : public BarPropImpl {
public:
StatusbarPropImpl();
virtual ~StatusbarPropImpl();
NS_IMETHOD GetVisible(PRBool *aVisible);
NS_IMETHOD SetVisible(PRBool aVisible);
};
// Script "scrollbars" object
class ScrollbarsPropImpl : public BarPropImpl {
public:
ScrollbarsPropImpl();
virtual ~ScrollbarsPropImpl();
NS_IMETHOD GetVisible(PRBool *aVisible);
NS_IMETHOD SetVisible(PRBool aVisible);
};
#endif /* nsBarProps_h___ */

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

@ -0,0 +1,320 @@
/* -*- 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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIDOMBarProp.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(kIBarPropIID, NS_IDOMBARPROP_IID);
NS_DEF_PTR(nsIDOMBarProp);
//
// BarProp property ids
//
enum BarProp_slots {
BARPROP_VISIBLE = -1
};
/***********************************************************************/
//
// BarProp Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetBarPropProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMBarProp *a = (nsIDOMBarProp*)JS_GetPrivate(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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case BARPROP_VISIBLE:
{
secMan->CheckScriptAccess(scriptCX, obj, "barprop.visible", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
PRBool prop;
if (NS_OK == a->GetVisible(&prop)) {
*vp = BOOLEAN_TO_JSVAL(prop);
}
else {
return JS_FALSE;
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
NS_RELEASE(secMan);
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
/***********************************************************************/
//
// BarProp Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetBarPropProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMBarProp *a = (nsIDOMBarProp*)JS_GetPrivate(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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case BARPROP_VISIBLE:
{
secMan->CheckScriptAccess(scriptCX, obj, "barprop.visible", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
PRBool prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
return JS_FALSE;
}
a->SetVisible(prop);
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
NS_RELEASE(secMan);
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
//
// BarProp finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeBarProp(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// BarProp enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateBarProp(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// BarProp resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveBarProp(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for BarProp
//
JSClass BarPropClass = {
"BarProp",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetBarPropProperty,
SetBarPropProperty,
EnumerateBarProp,
ResolveBarProp,
JS_ConvertStub,
FinalizeBarProp
};
//
// BarProp class properties
//
static JSPropertySpec BarPropProperties[] =
{
{"visible", BARPROP_VISIBLE, JSPROP_ENUMERATE},
{0}
};
//
// BarProp class methods
//
static JSFunctionSpec BarPropMethods[] =
{
{0}
};
//
// BarProp constructor
//
PR_STATIC_CALLBACK(JSBool)
BarProp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// BarProp class initialization
//
extern "C" NS_DOM nsresult NS_InitBarPropClass(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, "BarProp", &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)) {
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&BarPropClass, // JSClass
BarProp, // JSNative ctor
0, // ctor args
BarPropProperties, // proto props
BarPropMethods, // 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 BarProp JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptBarProp(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptBarProp");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMBarProp *aBarProp;
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_InitBarPropClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIBarPropIID, (void **)&aBarProp);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &BarPropClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aBarProp);
}
else {
NS_RELEASE(aBarProp);
return NS_ERROR_FAILURE;
}
return NS_OK;
}