Compare commits
2 Commits
tags/arele
...
M15-patch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53866ece4f | ||
|
|
350be55313 |
105
mozilla/java/dom/jni/javaDOMGlobals.h
Normal file
105
mozilla/java/dom/jni/javaDOMGlobals.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
The contents of this file are subject to the Mozilla 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/MPL/
|
||||
|
||||
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 Sun Microsystems,
|
||||
Inc. Portions created by Sun are
|
||||
Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __JavaDOMGlobals_h__
|
||||
#define __JavaDOMGlobals_h__
|
||||
|
||||
#include "jni.h"
|
||||
#include "prclist.h"
|
||||
#include "nsError.h"
|
||||
|
||||
#ifdef ERROR
|
||||
#undef ERROR
|
||||
#endif
|
||||
|
||||
class nsISupports;
|
||||
class nsIDOMNode;
|
||||
struct PRLogModuleInfo;
|
||||
struct PRLock;
|
||||
|
||||
class JavaDOMGlobals {
|
||||
|
||||
public:
|
||||
static jclass attrClass;
|
||||
static jclass cDataSectionClass;
|
||||
static jclass commentClass;
|
||||
static jclass documentClass;
|
||||
static jclass documentFragmentClass;
|
||||
static jclass documentTypeClass;
|
||||
static jclass domImplementationClass;
|
||||
static jclass elementClass;
|
||||
static jclass entityClass;
|
||||
static jclass entityReferenceClass;
|
||||
static jclass namedNodeMapClass;
|
||||
static jclass nodeClass;
|
||||
static jclass nodeListClass;
|
||||
static jclass notationClass;
|
||||
static jclass processingInstructionClass;
|
||||
static jclass textClass;
|
||||
|
||||
static jfieldID nodePtrFID;
|
||||
static jfieldID nodeListPtrFID;
|
||||
static jfieldID domImplementationPtrFID;
|
||||
|
||||
static jfieldID nodeTypeAttributeFID;
|
||||
static jfieldID nodeTypeCDataSectionFID;
|
||||
static jfieldID nodeTypeCommentFID;
|
||||
static jfieldID nodeTypeDocumentFragmentFID;
|
||||
static jfieldID nodeTypeDocumentFID;
|
||||
static jfieldID nodeTypeDocumentTypeFID;
|
||||
static jfieldID nodeTypeElementFID;
|
||||
static jfieldID nodeTypeEntityFID;
|
||||
static jfieldID nodeTypeEntityReferenceFID;
|
||||
static jfieldID nodeTypeNotationFID;
|
||||
static jfieldID nodeTypeProcessingInstructionFID;
|
||||
static jfieldID nodeTypeTextFID;
|
||||
|
||||
static jclass domExceptionClass;
|
||||
static jmethodID domExceptionInitMID;
|
||||
static jclass runtimeExceptionClass;
|
||||
static jmethodID runtimeExceptionInitMID;
|
||||
|
||||
static const char* const DOM_EXCEPTION_MESSAGE[];
|
||||
|
||||
typedef enum ExceptionType { EXCEPTION_RUNTIME,
|
||||
EXCEPTION_DOM } ExceptionType;
|
||||
|
||||
static PRLogModuleInfo* log;
|
||||
static PRCList garbage;
|
||||
static PRLock* garbageLock;
|
||||
|
||||
static PRInt32 javaMaxInt;
|
||||
|
||||
static void Initialize(JNIEnv *env);
|
||||
static void Destroy(JNIEnv *env);
|
||||
static jobject CreateNodeSubtype(JNIEnv *env,
|
||||
nsIDOMNode *node);
|
||||
|
||||
static void AddToGarbage(nsISupports* domObject);
|
||||
static void TakeOutGarbage();
|
||||
|
||||
static void ThrowException(JNIEnv *env,
|
||||
const char * message = NULL,
|
||||
nsresult rv = NS_OK,
|
||||
ExceptionType exceptionType = EXCEPTION_RUNTIME);
|
||||
};
|
||||
|
||||
#endif /* __JavaDOMGlobals_h__ */
|
||||
@@ -1,12 +0,0 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef _ATL_STATIC_REGISTRY
|
||||
#include <statreg.h>
|
||||
#include <statreg.cpp>
|
||||
#endif
|
||||
|
||||
#include <atlimpl.cpp>
|
||||
@@ -1,28 +0,0 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#if !defined(AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED_)
|
||||
#define AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define STRICT
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
|
||||
#include <atlbase.h>
|
||||
//You may derive a class from CComModule and use it if you want to override
|
||||
//something, but do not change the name of _Module
|
||||
extern CComModule _Module;
|
||||
#include <atlcom.h>
|
||||
#include <comdef.h>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED)
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef XPCDispUtilities_h
|
||||
#define XPCDispUtilities_h
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
HRESULT XPCCreateInstance(const CLSID & clsid, const IID & iid, T ** result)
|
||||
{
|
||||
return CoCreateInstance(clsid, 0, CLSCTX_ALL, iid, reinterpret_cast<void**>(result));
|
||||
}
|
||||
|
||||
DISPID GetIDsOfNames(IDispatch * pIDispatch , CComBSTR const & name)
|
||||
{
|
||||
DISPID dispid;
|
||||
OLECHAR * pName = name;
|
||||
HRESULT hresult = pIDispatch->GetIDsOfNames(
|
||||
IID_NULL,
|
||||
&pName,
|
||||
1,
|
||||
LOCALE_SYSTEM_DEFAULT,
|
||||
&dispid);
|
||||
if (!SUCCEEDED(hresult))
|
||||
{
|
||||
dispid = 0;
|
||||
}
|
||||
return dispid;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,86 +0,0 @@
|
||||
// XPCIDispatchTest.cpp : Implementation of DLL Exports.
|
||||
|
||||
|
||||
// Note: Proxy/Stub Information
|
||||
// To build a separate proxy/stub DLL,
|
||||
// run nmake -f IDispatchTestps.mk in the project directory.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
#include <initguid.h>
|
||||
#include "XPCIDispatchTest.h"
|
||||
|
||||
#include "XPCIDispatchTest_i.c"
|
||||
#include "nsXPCDispTestMethods.h"
|
||||
#include "nsXPCDispSimple.h"
|
||||
#include "nsXPCDispTestNoIDispatch.h"
|
||||
#include "nsXPCDispTestProperties.h"
|
||||
#include "nsXPCDispTestArrays.h"
|
||||
#include "nsXPCDispTestScriptOn.h"
|
||||
#include "nsXPCDispTestScriptOff.h"
|
||||
#include "nsXPCDispTestWrappedJS.h"
|
||||
|
||||
CComModule _Module;
|
||||
|
||||
BEGIN_OBJECT_MAP(ObjectMap)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestMethods, nsXPCDispTestMethods)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispSimple, nsXPCDispSimple)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestNoIDispatch, nsXPCDispTestNoIDispatch)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestProperties, nsXPCDispTestProperties)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestArrays, nsXPCDispTestArrays)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOn, nsXPCDispTestScriptOn)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOff, nsXPCDispTestScriptOff)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestWrappedJS, nsXPCDispTestWrappedJS)
|
||||
END_OBJECT_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DLL Entry Point
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
_Module.Init(ObjectMap, hInstance, &LIBID_IDispatchTestLib);
|
||||
DisableThreadLibraryCalls(hInstance);
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
_Module.Term();
|
||||
return TRUE; // ok
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Used to determine whether the DLL can be unloaded by OLE
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Returns a class factory to create an object of the requested type
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
||||
{
|
||||
return _Module.GetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllRegisterServer - Adds entries to the system registry
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
// registers object, typelib and all interfaces in typelib
|
||||
return _Module.RegisterServer(TRUE);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllUnregisterServer - Removes entries from the system registry
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
return _Module.UnregisterServer(TRUE);
|
||||
}
|
||||
|
||||
|
||||
#include "nsXPCDispTestWrappedJS.h"
|
||||
@@ -1,9 +0,0 @@
|
||||
; XPCIDispatchTest.def : Declares the module parameters.
|
||||
|
||||
LIBRARY "XPCIDispatchTest.DLL"
|
||||
|
||||
EXPORTS
|
||||
DllCanUnloadNow @1 PRIVATE
|
||||
DllGetClassObject @2 PRIVATE
|
||||
DllRegisterServer @3 PRIVATE
|
||||
DllUnregisterServer @4 PRIVATE
|
||||
@@ -1,318 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="XPCIDispatchTest" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=XPCIDispatchTest - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "XPCIDispatchTest.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "XPCIDispatchTest.mak" CFG="XPCIDispatchTest - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "XPCIDispatchTest - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "XPCIDispatchTest - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "XPCIDispatchTest - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\Debug
|
||||
TargetPath=.\Debug\XPCIDispatchTest.dll
|
||||
InputPath=.\Debug\XPCIDispatchTest.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "XPCIDispatchTest - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "XPCIDispatchTest___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "XPCIDispatchTest___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\Release
|
||||
TargetPath=.\Release\XPCIDispatchTest.dll
|
||||
InputPath=.\Release\XPCIDispatchTest.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "XPCIDispatchTest - Win32 Debug"
|
||||
# Name "XPCIDispatchTest - Win32 Release"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispSimple.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestArrays.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestMethods.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoIDispatch.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestProperties.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOff.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestWrappedJS.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.idl
|
||||
# ADD MTL /tlb ".\XPCIDispatchTest.tlb" /h "XPCIDispatchTest.h" /iid "XPCIDispatchTest_i.c" /Oicf
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispSimple.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestArrays.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestMethods.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoIDispatch.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestProperties.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOff.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestWrappedJS.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCDispUtilities.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispSimple.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestArrays.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestMethods.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoIDispatch.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoScript.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestProperties.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOff.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOn.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestWrappedJS.rgs
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "JS Files"
|
||||
|
||||
# PROP Default_Filter "js"
|
||||
# Begin Group "WrappedCOM"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "Arrays"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\Arrays\XPCIDispatchArrayTests.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Attributes"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\Attributes\XPCIDispatchAttributeTests.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "General"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\General\XPCIDispatchInstantiations.js
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\General\XPCStress.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Methods"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\Methods\XPCIDispatchMethodTests.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\shell.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "WrappedJS"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "General (WJS)"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedJS\General\XPCIDispatchTestWrappedJS.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedJS\shell.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,29 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "XPCIDispatchTest"=.\XPCIDispatchTest.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -1,454 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// XPCIDispatchTest.idl : IDL source for XPCIDispatchTest.dll
|
||||
//
|
||||
|
||||
// This file will be processed by the MIDL tool to
|
||||
// produce the type library (XPCIDispatchTest.tlb) and marshalling code.
|
||||
|
||||
import "oaidl.idl";
|
||||
import "ocidl.idl";
|
||||
import "objsafe.idl";
|
||||
|
||||
[
|
||||
uuid(83A51226-F49D-488A-8F78-75BB2F927F4C),
|
||||
version(1.0),
|
||||
helpstring("XPCIDispatchTest 1.0 Type Library")
|
||||
]
|
||||
library IDispatchTestLib
|
||||
{
|
||||
importlib("stdole32.tlb");
|
||||
importlib("stdole2.tlb");
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(0de5dbae-1d78-45cb-91a2-24516fef2837),
|
||||
dual,
|
||||
helpstring("nsIXPCDispSimple interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispSimple : IDispatch
|
||||
{
|
||||
[id(1), helpstring("Simple method returning the name of the class")]
|
||||
HRESULT ClassName([out]BSTR * name);
|
||||
[propget, id(2), helpstring("Simple number property")]
|
||||
HRESULT Number([out, retval]long * result);
|
||||
[propput, id(2), helpstring("Simple number property")]
|
||||
HRESULT Number([in]long result);
|
||||
}
|
||||
[
|
||||
uuid(9F39237C-D179-4260-8EF3-4B6D4D7D5570),
|
||||
helpstring("nsXPCDispSimple Class")
|
||||
]
|
||||
coclass nsXPCDispSimple
|
||||
{
|
||||
[default] interface nsIXPCDispSimple;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(47bf6c99-a30c-4105-8af6-de76dcfdd6dd),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestMethods interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestMethods : IDispatch
|
||||
{
|
||||
/* Return values test */
|
||||
[id(1), helpstring("method with no parameters")]
|
||||
HRESULT NoParameters();
|
||||
[id(2), helpstring("method that returns a string")]
|
||||
HRESULT ReturnBSTR([out, retval]BSTR * result);
|
||||
[id(3), helpstring("method that returns a 32 bit signed integer")]
|
||||
HRESULT ReturnI4([out, retval]int * result);
|
||||
[id(4), helpstring("method that returns an 8 bit unsigned integer")]
|
||||
HRESULT ReturnUI1([out, retval]unsigned char * result);
|
||||
[id(5), helpstring("method that returns a 16 bit signed integer")]
|
||||
HRESULT ReturnI2([out, retval]short * result);
|
||||
[id(6), helpstring("method that returns a 32 bit floating point number")]
|
||||
HRESULT ReturnR4([out, retval]float * result);
|
||||
[id(7), helpstring("method that returns a 64 bit floating point number")]
|
||||
HRESULT ReturnR8([out, retval]double * result);
|
||||
[id(8), helpstring("method that returns a boolean")]
|
||||
HRESULT ReturnBool([out, retval]VARIANT_BOOL * result);
|
||||
[id(9), helpstring("method that returns an IDispatch pointer")]
|
||||
HRESULT ReturnIDispatch([out, retval]IDispatch ** result);
|
||||
[id(10), helpstring("method that returns an error")]
|
||||
HRESULT ReturnError([out, retval]SCODE * result);
|
||||
[id(12), helpstring("method that returns a date")]
|
||||
HRESULT ReturnDate([out, retval]DATE * result);
|
||||
[id(13), helpstring("method that returns an IUnknown")]
|
||||
HRESULT ReturnIUnknown([out, retval]IUnknown ** result);
|
||||
[id(14), helpstring("method that returns a signed 8 bit integer")]
|
||||
HRESULT ReturnI1([out, retval]char * result);
|
||||
[id(15), helpstring("method that returns an unsigned 16 bit integer")]
|
||||
HRESULT ReturnUI2([out, retval]unsigned short * result);
|
||||
[id(16), helpstring("method that returns an unsigned 32 bit integer")]
|
||||
HRESULT ReturnUI4([out, retval]unsigned long * result);
|
||||
[id(17), helpstring("method that returns an integer")]
|
||||
HRESULT ReturnInt([out, retval]int * result);
|
||||
[id(18), helpstring("method that returns an unsigned integer")]
|
||||
HRESULT ReturnUInt([out, retval]unsigned int * result);
|
||||
|
||||
/* Single input parameter tests */
|
||||
[id(19), helpstring("method that takes a string")]
|
||||
HRESULT TakesBSTR([in]BSTR result);
|
||||
[id(20), helpstring("method that takes a 32 bit signed integer")]
|
||||
HRESULT TakesI4([in]int result);
|
||||
[id(21), helpstring("method that takes an 8 bit unsigned integer")]
|
||||
HRESULT TakesUI1([in]unsigned char result);
|
||||
[id(22), helpstring("method that takes a 16 bit signed integer")]
|
||||
HRESULT TakesI2([in]short result);
|
||||
[id(23), helpstring("method that takes a 32 bit floating point number")]
|
||||
HRESULT TakesR4([in]float result);
|
||||
[id(24), helpstring("method that takes a 64 bit floating point number")]
|
||||
HRESULT TakesR8([in]double result);
|
||||
[id(25), helpstring("method that takes a boolean")]
|
||||
HRESULT TakesBool([in]VARIANT_BOOL result);
|
||||
[id(26), helpstring("method that takes an IDispatch pointer")]
|
||||
HRESULT TakesIDispatch([in]IDispatch * result);
|
||||
[id(27), helpstring("method that takes an error")]
|
||||
HRESULT TakesError([in]SCODE result);
|
||||
[id(29), helpstring("method that takes a date")]
|
||||
HRESULT TakesDate([in]DATE result);
|
||||
[id(30), helpstring("method that takes an IUnknown")]
|
||||
HRESULT TakesIUnknown([in]IUnknown * result);
|
||||
[id(31), helpstring("method that takes a signed 8 bit integer")]
|
||||
HRESULT TakesI1([in]char result);
|
||||
[id(32), helpstring("method that takes an unsigned 16 bit integer")]
|
||||
HRESULT TakesUI2([in]unsigned short result);
|
||||
[id(33), helpstring("method that takes an unsigned 32 bit integer")]
|
||||
HRESULT TakesUI4([in]unsigned long result);
|
||||
[id(34), helpstring("method that takes an integer")]
|
||||
HRESULT TakesInt([in]int result);
|
||||
[id(35), helpstring("method that takes an unsigned integer")]
|
||||
HRESULT TakesUInt([in]unsigned int result);
|
||||
|
||||
/* output parameter tests */
|
||||
[id(36), helpstring("method that outputs a string")]
|
||||
HRESULT OutputsBSTR([out]BSTR * result);
|
||||
[id(37), helpstring("method that outputs a 32 bit signed integer")]
|
||||
HRESULT OutputsI4([out]long * result);
|
||||
[id(38), helpstring("method that outputs an 8 bit unsigned integer")]
|
||||
HRESULT OutputsUI1([out]unsigned char * result);
|
||||
[id(39), helpstring("method that outputs a 16 bit signed integer")]
|
||||
HRESULT OutputsI2([out]short * result);
|
||||
[id(40), helpstring("method that outputs a 32 bit floating point number")]
|
||||
HRESULT OutputsR4([out]float * result);
|
||||
[id(41), helpstring("method that outputs a 64 bit floating point number")]
|
||||
HRESULT OutputsR8([out]double * result);
|
||||
[id(42), helpstring("method that outputs a boolean")]
|
||||
HRESULT OutputsBool([out]VARIANT_BOOL * result);
|
||||
[id(43), helpstring("method that outputs an IDispatch pointer")]
|
||||
HRESULT OutputsIDispatch([out]IDispatch ** result);
|
||||
[id(44), helpstring("method that outputs an error")]
|
||||
HRESULT OutputsError([out]SCODE * result);
|
||||
[id(46), helpstring("method that outputs a date")]
|
||||
HRESULT OutputsDate([out]DATE * result);
|
||||
[id(47), helpstring("method that outputs an IUnknown")]
|
||||
HRESULT OutputsIUnknown([out]IUnknown ** result);
|
||||
[id(48), helpstring("method that outputs a signed 8 bit integer")]
|
||||
HRESULT OutputsI1([out]char * result);
|
||||
[id(49), helpstring("method that outputs an unsigned 16 bit integer")]
|
||||
HRESULT OutputsUI2([out]unsigned short * result);
|
||||
[id(50), helpstring("method that outputs an unsigned 32 bit integer")]
|
||||
HRESULT OutputsUI4([out]unsigned long * result);
|
||||
|
||||
/* in/outparameter tests */
|
||||
[id(53), helpstring("method that in/outs a string")]
|
||||
HRESULT InOutsBSTR([in, out]BSTR * result);
|
||||
[id(54), helpstring("method that in/outs a 32 bit signed integer")]
|
||||
HRESULT InOutsI4([in, out]long * result);
|
||||
[id(55), helpstring("method that in/outs an 8 bit unsigned integer")]
|
||||
HRESULT InOutsUI1([in, out]unsigned char * result);
|
||||
[id(56), helpstring("method that in/outs a 16 bit signed integer")]
|
||||
HRESULT InOutsI2([in, out]short * result);
|
||||
[id(57), helpstring("method that in/outs a 32 bit floating point number")]
|
||||
HRESULT InOutsR4([in, out]float * result);
|
||||
[id(58), helpstring("method that in/outs a 64 bit floating point number")]
|
||||
HRESULT InOutsR8([in, out]double * result);
|
||||
[id(59), helpstring("method that in/outs a boolean")]
|
||||
HRESULT InOutsBool([in, out]VARIANT_BOOL * result);
|
||||
[id(60), helpstring("method that in/outs an IDispatch pointer")]
|
||||
HRESULT InOutsIDispatch([in, out]IDispatch ** result);
|
||||
[id(61), helpstring("method that in/outs an error")]
|
||||
HRESULT InOutsError([in, out]SCODE * result);
|
||||
[id(63), helpstring("method that in/outs a date")]
|
||||
HRESULT InOutsDate([in, out]DATE * result);
|
||||
[id(64), helpstring("method that in/outs an IUnknown")]
|
||||
HRESULT InOutsIUnknown([in, out]IUnknown ** result);
|
||||
[id(65), helpstring("method that in/outs a signed 8 bit integer")]
|
||||
HRESULT InOutsI1([in, out]char * result);
|
||||
[id(66), helpstring("method that in/outs an unsigned 16 bit integer")]
|
||||
HRESULT InOutsUI2([in, out]unsigned short * result);
|
||||
[id(67), helpstring("method that in/outs an unsigned 32 bit integer")]
|
||||
HRESULT InOutsUI4([in, out]unsigned long * result);
|
||||
|
||||
/* input and return tests*/
|
||||
[id(70), helpstring("method that takes an long and returns it")]
|
||||
HRESULT OneParameterWithReturn([in]long input, [out,retval]long* result);
|
||||
[id(71), helpstring("method that takes a string and returns it")]
|
||||
HRESULT StringInputAndReturn([in]BSTR str, [out, retval]BSTR* result);
|
||||
[id(72), helpstring("method that takes an IDispatch and returns it")]
|
||||
HRESULT IDispatchInputAndReturn([in]IDispatch* input, [out,retval]IDispatch** result);
|
||||
|
||||
/* Multiple parameters */
|
||||
[id(73), helpstring("method that takes two parameters")]
|
||||
HRESULT TwoParameters([in]long one, [in]long two);
|
||||
[id(74), helpstring("method that takes 12 input parameters")]
|
||||
HRESULT TwelveInParameters([in]long one, [in]long two, [in]long three,
|
||||
[in]long four, [in]long five, [in]long six,
|
||||
[in]long seven, [in]long eight,
|
||||
[in]long nine, [in]long ten,
|
||||
[in]long eleven, [in]long twelve);
|
||||
[id(75), helpstring("method that takes 12 out parameters")]
|
||||
HRESULT TwelveOutParameters([out]long *one, [out]long *two,
|
||||
[out]long *three, [out]long *four,
|
||||
[out]long *five, [out]long *six,
|
||||
[out]long *seven, [out]long *eight,
|
||||
[out]long *nine, [out]long *ten,
|
||||
[out]long *eleven, [out]long *twelve);
|
||||
[id(76), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveStrings([in]BSTR one, [in]BSTR two, [in]BSTR three,
|
||||
[in]BSTR four, [in]BSTR five, [in]BSTR six,
|
||||
[in]BSTR seven, [in]BSTR eight, [in]BSTR nine,
|
||||
[in]BSTR ten, [in]BSTR eleven, [in]BSTR twelve);
|
||||
[id(77), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveOutStrings([out]BSTR* one, [out]BSTR* two,
|
||||
[out]BSTR* three, [out]BSTR* four,
|
||||
[out]BSTR* five, [out]BSTR* six,
|
||||
[out]BSTR* seven, [out]BSTR* eight,
|
||||
[out]BSTR* nine, [out]BSTR* ten,
|
||||
[out]BSTR* eleven, [out]BSTR* twelve);
|
||||
[id(78), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveIDispatch([in]IDispatch* one, [in]IDispatch* two,
|
||||
[in]IDispatch* three, [in]IDispatch* four,
|
||||
[in]IDispatch* five, [in]IDispatch* six,
|
||||
[in]IDispatch* seven, [in]IDispatch* eight,
|
||||
[in]IDispatch* nine, [in]IDispatch* ten,
|
||||
[in]IDispatch* eleven,
|
||||
[in]IDispatch* twelve);
|
||||
[id(79), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveOutIDispatch([out]IDispatch** one,
|
||||
[out]IDispatch** two,
|
||||
[out]IDispatch** three,
|
||||
[out]IDispatch** four,
|
||||
[out]IDispatch** five,
|
||||
[out]IDispatch** six,
|
||||
[out]IDispatch** seven,
|
||||
[out]IDispatch** eight,
|
||||
[out]IDispatch** nine,
|
||||
[out]IDispatch** ten,
|
||||
[out]IDispatch** eleven,
|
||||
[out]IDispatch** twelve);
|
||||
[id(80), helpstring("method that generates an error")]
|
||||
HRESULT CreateError();
|
||||
}
|
||||
[
|
||||
uuid(745D1149-9F46-418C-B176-71EAA98974BA),
|
||||
helpstring("nsXPCDispTestMethods Class")
|
||||
]
|
||||
coclass nsXPCDispTestMethods
|
||||
{
|
||||
[default] interface nsIXPCDispTestMethods;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(f876c083-ae00-4b78-93b8-8305980f0864),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestArrays interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestArrays : IDispatch
|
||||
{
|
||||
[id(1), helpstring("returns a SAFEARRAY")]
|
||||
HRESULT ReturnSafeArray([out, retval]SAFEARRAY(VARIANT)* result);
|
||||
[id(2), helpstring("returns a SAFEARRAY")]
|
||||
HRESULT ReturnSafeArrayBSTR([out, retval]SAFEARRAY(VARIANT)* result);
|
||||
[id(3), helpstring("returns a SAFEARRAY")]
|
||||
HRESULT ReturnSafeArrayIDispatch([out, retval]SAFEARRAY(VARIANT)* result);
|
||||
[id(4), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT TakesSafeArray([in]SAFEARRAY(VARIANT) array);
|
||||
[id(5), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT TakesSafeArrayBSTR([in]SAFEARRAY(VARIANT) array);
|
||||
[id(6), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT TakesSafeArrayIDispatch([in]SAFEARRAY(VARIANT) array);
|
||||
[id(7), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT InOutSafeArray([in, out]SAFEARRAY(VARIANT) * array);
|
||||
[id(8), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT InOutSafeArrayBSTR([in, out]SAFEARRAY(VARIANT) * array);
|
||||
[id(9), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT InOutSafeArrayIDispatch([in, out]SAFEARRAY(VARIANT) * array);
|
||||
}
|
||||
[
|
||||
uuid(AB085C43-C619-48C8-B68C-C495BDE12DFB),
|
||||
helpstring("nsXPCDispTestArrays Class")
|
||||
]
|
||||
coclass nsXPCDispTestArrays
|
||||
{
|
||||
[default] interface nsIXPCDispTestArrays;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(9782107f-14cc-40b2-b0cd-988d81a46e9e),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestNoIDispatch interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestNoIDispatch : IUnknown
|
||||
{
|
||||
}
|
||||
[
|
||||
uuid(7414404F-A4CC-4E3C-9B32-BB20CB22F541),
|
||||
helpstring("nsXPCDispTestNoIDispatch Class")
|
||||
]
|
||||
coclass nsXPCDispTestNoIDispatch
|
||||
{
|
||||
[default] interface nsIXPCDispTestNoIDispatch;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(7830CACE-5019-489D-8B69-029E70CF39B7),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestProperties Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestProperties : IDispatch
|
||||
{
|
||||
[propget, id(1), helpstring("property Short")] HRESULT Short([out, retval] short *pVal);
|
||||
[propput, id(1), helpstring("property Short")] HRESULT Short([in] short newVal);
|
||||
[propget, id(2), helpstring("property Long")] HRESULT Long([out, retval] long *pVal);
|
||||
[propput, id(2), helpstring("property Long")] HRESULT Long([in] long newVal);
|
||||
[propget, id(3), helpstring("property Float")] HRESULT Float([out, retval] float *pVal);
|
||||
[propput, id(3), helpstring("property Float")] HRESULT Float([in] float newVal);
|
||||
[propget, id(4), helpstring("property Double")] HRESULT Double([out, retval] double *pVal);
|
||||
[propput, id(4), helpstring("property Double")] HRESULT Double([in] double newVal);
|
||||
[propget, id(5), helpstring("property Currency")] HRESULT Currency([out, retval] CURRENCY *pVal);
|
||||
[propput, id(5), helpstring("property Currency")] HRESULT Currency([in] CURRENCY newVal);
|
||||
[propget, id(6), helpstring("property Date")] HRESULT Date([out, retval] DATE *pVal);
|
||||
[propput, id(6), helpstring("property Date")] HRESULT Date([in] DATE newVal);
|
||||
[propget, id(7), helpstring("property String")] HRESULT String([out, retval] BSTR *pVal);
|
||||
[propput, id(7), helpstring("property String")] HRESULT String([in] BSTR newVal);
|
||||
[propget, id(8), helpstring("property DispatchPtr")] HRESULT DispatchPtr([out, retval] IDispatch* *pVal);
|
||||
[propput, id(8), helpstring("property DispatchPtr")] HRESULT DispatchPtr([in] IDispatch* newVal);
|
||||
[propget, id(9), helpstring("property SCode")] HRESULT SCode([out, retval] SCODE *pVal);
|
||||
[propput, id(9), helpstring("property SCode")] HRESULT SCode([in] SCODE newVal);
|
||||
[propget, id(10), helpstring("property Boolean")] HRESULT Boolean([out, retval] BOOL *pVal);
|
||||
[propput, id(10), helpstring("property Boolean")] HRESULT Boolean([in] BOOL newVal);
|
||||
[propget, id(11), helpstring("property Variant")] HRESULT Variant([out, retval] VARIANT *pVal);
|
||||
[propput, id(11), helpstring("property Variant")] HRESULT Variant([in] VARIANT newVal);
|
||||
[propget, id(12), helpstring("property COMPtr")] HRESULT COMPtr([out, retval] IUnknown* *pVal);
|
||||
[propput, id(12), helpstring("property COMPtr")] HRESULT COMPtr([in] IUnknown* newVal);
|
||||
[propget, id(13), helpstring("property Char")] HRESULT Char([out, retval] unsigned char *pVal);
|
||||
[propput, id(13), helpstring("property Char")] HRESULT Char([in] unsigned char newVal);
|
||||
[propget, id(14), helpstring("property ParameterizedProperty")] HRESULT ParameterizedProperty([in]long aIndex, [out, retval] long *pVal);
|
||||
[propput, id(14), helpstring("property ParameterizedProperty")] HRESULT ParameterizedProperty([in]long aIndex, [in] long newVal);
|
||||
[propget, id(15), helpstring("property ParameterizedPropertyCount")] HRESULT ParameterizedPropertyCount([out, retval] long *pVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(0797788A-CB08-4995-BD45-7BF8C468DE21),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestScriptOn Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestScriptOn : IDispatch
|
||||
{
|
||||
};
|
||||
|
||||
[
|
||||
uuid(2A06373F-3E61-4882-A3D7-A104F70B09ED),
|
||||
helpstring("nsXPCDispTestScriptOn Class")
|
||||
]
|
||||
coclass nsXPCDispTestScriptOn
|
||||
{
|
||||
[default] interface nsIXPCDispTestScriptOn;
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(EE6F9DB5-890F-422D-B9DC-9C5AB5A1D654),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestScriptOff Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestScriptOff : IDispatch
|
||||
{
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(D84352CA-1A01-4E72-9072-77AFA669B3AD),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestWrappedJS Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestWrappedJS : IDispatch
|
||||
{
|
||||
[id(1), helpstring("method TestParamTypes")] HRESULT TestParamTypes([in] IDispatch * obj, [out, retval]BSTR * errMsg);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(EAEE6BB2-C005-4B91-BCA7-6613236F6F69),
|
||||
helpstring("nsXPCDispTestWrappedJS Class")
|
||||
]
|
||||
coclass nsXPCDispTestWrappedJS
|
||||
{
|
||||
[default] interface nsIXPCDispTestWrappedJS;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(959CD122-9826-4757-BA09-DE327D55F9E7),
|
||||
helpstring("nsXPCDispTestScriptOff Class")
|
||||
]
|
||||
coclass nsXPCDispTestScriptOff
|
||||
{
|
||||
[default] interface nsIXPCDispTestScriptOff;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(D8B4265B-1768-4CA9-A285-7CCAEEB51C74),
|
||||
helpstring("nsXPCDispTestProperties Class")
|
||||
]
|
||||
coclass nsXPCDispTestProperties
|
||||
{
|
||||
[default] interface nsIXPCDispTestProperties;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
@@ -1,145 +0,0 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"1 TYPELIB ""XPCIDispatchTest.tlb""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "XPCIDispatchTest Module\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||
VALUE "InternalName", "XPCIDispatchTest\0"
|
||||
VALUE "LegalCopyright", "Copyright 2002\0"
|
||||
VALUE "OriginalFilename", "XPCIDispatchTest.DLL\0"
|
||||
VALUE "ProductName", "XPCIDispatchTest Module\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1\0"
|
||||
VALUE "OLESelfRegister", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// REGISTRY
|
||||
//
|
||||
|
||||
IDR_nsXPCDispTestMethods REGISTRY DISCARDABLE "nsXPCDispTestMethods.rgs"
|
||||
IDR_nsXPCDispSimple REGISTRY DISCARDABLE "nsXPCDispSimple.rgs"
|
||||
IDR_nsXPCDispTestNoIDispatch REGISTRY DISCARDABLE "nsXPCDispTestNoIDispatch.rgs"
|
||||
IDR_nsXPCDispTestProperties REGISTRY DISCARDABLE "nsXPCDispTestProperties.rgs"
|
||||
IDR_nsXPCDispTestArrays REGISTRY DISCARDABLE "nsXPCDispTestArrays.rgs"
|
||||
IDR_nsXPCDispTestScriptOn REGISTRY DISCARDABLE "nsXPCDispTestScriptOn.rgs"
|
||||
IDR_nsXPCDispTestScriptOff REGISTRY DISCARDABLE "nsXPCDispTestScriptOff.rgs"
|
||||
IDR_nsXPCDispTestWrappedJS REGISTRY DISCARDABLE "nsXPCDispTestWrappedJS.rgs"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_PROJNAME "XPCIDispatchTest"
|
||||
IDS_NSXPCDISPTTESTMETHODS_DESC "nsXPCDisptTestMethods Class"
|
||||
IDS_NSXPCDISPTESTMETHODS_DESC "nsXPCDispTestMethods Class"
|
||||
IDS_NSXPCDISPSIMPLE_DESC "nsXPCDispSimple Class"
|
||||
IDS_NSXPCDISPTESTNOIDISPATCH_DESC "nsXPCDispTestNoIDispatch Class"
|
||||
IDS_NSXPCDISPTESTNOSCRIPT_DESC "nsXPCDispTestNoScript Class"
|
||||
IDS_NSXPCDISPTESTPROPERTIES_DESC "nsXPCDispTestProperties Class"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_NSXPCDISPTESTARRAYS_DESC "nsXPCDispTestArrays Class"
|
||||
IDS_NSXPCDISPTESTSCRIPTON_DESC "nsXPCDispTestScriptOn Class"
|
||||
IDS_NSXPCDISPTESTSCRIPTOFF_DESC "nsXPCDispTestScriptOff Class"
|
||||
IDS_NSXPCDISPTESTWRAPPEDJS_DESC "nsXPCDispTestWrappedJS Class"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
1 TYPELIB "XPCIDispatchTest.tlb"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
// nsXPCDispSimple.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispSimple.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispSimple::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispSimple,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispSimple::ClassName(BSTR * name)
|
||||
{
|
||||
if (name == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR x("nsXPCDispSimple");
|
||||
*name = x.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispSimple::get_Number(LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = mNumber;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispSimple::put_Number(LONG result)
|
||||
{
|
||||
mNumber = result;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// nsXPCDispSimple.h: Definition of the nsXPCDispSimple class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_)
|
||||
#define AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispSimple
|
||||
|
||||
class nsXPCDispSimple :
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispSimple,&CLSID_nsXPCDispSimple>,
|
||||
public IDispatchImpl<nsIXPCDispSimple, &IID_nsIXPCDispSimple, &LIBID_IDispatchTestLib>
|
||||
{
|
||||
public:
|
||||
nsXPCDispSimple() : mNumber(5) {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispSimple)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispSimple)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispSimple)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispSimple)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispSimple)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispSimple
|
||||
public:
|
||||
// nsIXPCDispSimple
|
||||
STDMETHOD(ClassName)(BSTR * name);
|
||||
STDMETHOD(get_Number)(LONG * result);
|
||||
STDMETHOD(put_Number)(LONG result);
|
||||
template <class T>
|
||||
static HRESULT CreateInstance(T ** result)
|
||||
{
|
||||
return CoCreateInstance(CLSID_nsXPCDispSimple, 0, CLSCTX_ALL,
|
||||
__uuidof(T),
|
||||
reinterpret_cast<void**>(result));
|
||||
}
|
||||
private:
|
||||
long mNumber;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispSimple.1 = s 'nsXPCDispSimple Class'
|
||||
{
|
||||
CLSID = s '{9F39237C-D179-4260-8EF3-4B6D4D7D5570}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispSimple = s 'nsXPCDispSimple Class'
|
||||
{
|
||||
CLSID = s '{9F39237C-D179-4260-8EF3-4B6D4D7D5570}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {9F39237C-D179-4260-8EF3-4B6D4D7D5570} = s 'nsXPCDispSimple Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispSimple.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispSimple'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
// nsXPCDispTestArrays.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestArrays.h"
|
||||
|
||||
unsigned int zero = 0;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestArrays,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::ReturnSafeArray(LPSAFEARRAY * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = SafeArrayCreateVector(VT_I4, 0, 3);
|
||||
for (long index = 0; index < 3; ++index)
|
||||
{
|
||||
SafeArrayPutElement(*result, &index, &index);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::ReturnSafeArrayBSTR(LPSAFEARRAY * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = SafeArrayCreateVector(VT_BSTR, 0, 3);
|
||||
for (long index = 0; index < 3; ++index)
|
||||
{
|
||||
_variant_t var(index);
|
||||
HRESULT hr = VariantChangeType(&var, &var, VARIANT_ALPHABOOL, VT_BSTR);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
SafeArrayPutElement(*result, &index, var.bstrVal);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::ReturnSafeArrayIDispatch(LPSAFEARRAY * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = SafeArrayCreateVector(VT_DISPATCH, 0, 3);
|
||||
for (long index = 0; index < 3; ++index)
|
||||
{
|
||||
CComPtr<nsIXPCDispSimple> ptr;
|
||||
ptr.CoCreateInstance(CLSID_nsXPCDispSimple);
|
||||
SafeArrayPutElement(*result, &index, ptr.p);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define RETURN_IF_FAIL(x) hr = x; if (FAILED(hr)) return hr;
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::TakesSafeArray(LPSAFEARRAY array)
|
||||
{
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(array, 1, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(array, 1, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
_variant_t value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value));
|
||||
if (value != _variant_t(index))
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::TakesSafeArrayBSTR(LPSAFEARRAY array)
|
||||
{
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(array, 1, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(array, 1, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
_variant_t value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value));
|
||||
_variant_t test(index);
|
||||
if (_bstr_t(value) != _bstr_t(test))
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::TakesSafeArrayIDispatch(LPSAFEARRAY array)
|
||||
{
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
_variant_t value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value));
|
||||
// We need to do more here, but this is good enough for now
|
||||
if (!value.pdispVal)
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::InOutSafeArray(LPSAFEARRAY * array)
|
||||
{
|
||||
if (array == NULL)
|
||||
return E_POINTER;
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
LPSAFEARRAY newArray = SafeArrayCreateVector(VT_I4, lbound, ubound);
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
long value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value));
|
||||
if (value != index)
|
||||
return E_FAIL;
|
||||
value += 42;
|
||||
RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, &value));
|
||||
}
|
||||
SafeArrayDestroy(*array);
|
||||
*array = newArray;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::InOutSafeArrayBSTR(LPSAFEARRAY * array)
|
||||
{
|
||||
if (array == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
LPSAFEARRAY newArray = SafeArrayCreateVector(VT_BSTR, lbound, ubound);
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
BSTR value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value));
|
||||
_bstr_t newValue(value, TRUE);
|
||||
newValue += L"Appended";
|
||||
RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, newValue.copy()));
|
||||
}
|
||||
SafeArrayDestroy(*array);
|
||||
*array = newArray;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::InOutSafeArrayIDispatch(LPSAFEARRAY * array)
|
||||
{
|
||||
if (array == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
LPSAFEARRAY newArray = SafeArrayCreateVector(VT_DISPATCH, lbound, ubound);
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
IDispatch* value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value));
|
||||
RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, &value));
|
||||
}
|
||||
SafeArrayDestroy(*array);
|
||||
*array = newArray;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
// nsXPCDispTestArrays.h: Definition of the nsXPCDispTestArrays class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestArrays
|
||||
|
||||
class nsXPCDispTestArrays :
|
||||
public IDispatchImpl<nsIXPCDispTestArrays, &IID_nsIXPCDispTestArrays, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestArrays,&CLSID_nsXPCDispTestArrays>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestArrays() {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestArrays)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestArrays)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestArrays)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestArrays)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestArrays)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestArrays
|
||||
public:
|
||||
// nsIXPCDispTestArrays
|
||||
STDMETHOD(ReturnSafeArray)(LPSAFEARRAY * result);
|
||||
STDMETHOD(ReturnSafeArrayBSTR)(LPSAFEARRAY * result);
|
||||
STDMETHOD(ReturnSafeArrayIDispatch)(LPSAFEARRAY * result);
|
||||
STDMETHOD(TakesSafeArray)(LPSAFEARRAY array);
|
||||
STDMETHOD(TakesSafeArrayBSTR)(LPSAFEARRAY array);
|
||||
STDMETHOD(TakesSafeArrayIDispatch)(LPSAFEARRAY array);
|
||||
STDMETHOD(InOutSafeArray)(LPSAFEARRAY * array);
|
||||
STDMETHOD(InOutSafeArrayBSTR)(LPSAFEARRAY * array);
|
||||
STDMETHOD(InOutSafeArrayIDispatch)(LPSAFEARRAY * array);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestArrays.1 = s 'nsXPCDispTestArrays Class'
|
||||
{
|
||||
CLSID = s '{AB085C43-C619-48C8-B68C-C495BDE12DFB}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestArrays = s 'nsXPCDispTestArrays Class'
|
||||
{
|
||||
CLSID = s '{AB085C43-C619-48C8-B68C-C495BDE12DFB}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {AB085C43-C619-48C8-B68C-C495BDE12DFB} = s 'nsXPCDispTestArrays Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestArrays.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestArrays'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,699 +0,0 @@
|
||||
// nsXPCDispTestMethods.cpp : Implementation of CIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestMethods.h"
|
||||
#include "XPCDispUtilities.h"
|
||||
#include "nsXPCDispSimple.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestMethods,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::NoParameters()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnBSTR(BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
CComBSTR x("Boo");
|
||||
*result = x.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnI4(INT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUI1(BYTE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnI2(SHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnR4(FLOAT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999.1f;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnR8(DOUBLE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999999999.99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnBool(VARIANT_BOOL * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = VARIANT_TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnIDispatch(IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
return nsXPCDispSimple::CreateInstance(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnError(SCODE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnDate(DATE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR dateStr(L"5/2/02");
|
||||
return VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT,
|
||||
LOCALE_NOUSEROVERRIDE, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnIUnknown(IUnknown * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
return XPCCreateInstance<IUnknown>(CLSID_nsXPCDispTestNoIDispatch, IID_IUnknown, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnI1(unsigned char * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = 120;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUI2(USHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUI4(ULONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 3000000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnInt(INT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = -999999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUInt(UINT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = 3000000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesBSTR(BSTR result)
|
||||
{
|
||||
CComBSTR str(result);
|
||||
static CComBSTR test(L"TakesBSTR");
|
||||
return str == test ? S_OK: E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesI4(INT result)
|
||||
{
|
||||
return result == 999999 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUI1(BYTE result)
|
||||
{
|
||||
return result == 42 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesI2(SHORT result)
|
||||
{
|
||||
return result == 32000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesR4(FLOAT result)
|
||||
{
|
||||
// Hopefully we won't run into any precision/rounding issues
|
||||
return result == 99999.99f ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesR8(DOUBLE result)
|
||||
{
|
||||
// Hopefully we won't run into any precision/rounding issues
|
||||
return result == 999999999.99 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesBool(VARIANT_BOOL result)
|
||||
{
|
||||
return result ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
inline
|
||||
HRESULT GetProperty(IDispatch *pDisp, const CComBSTR & name, CComVariant& output)
|
||||
{
|
||||
DISPID dispid = GetIDsOfNames(pDisp, name);
|
||||
DISPPARAMS dispParams;
|
||||
dispParams.cArgs = 0;
|
||||
dispParams.cNamedArgs = 0;
|
||||
dispParams.rgdispidNamedArgs = 0;
|
||||
dispParams.rgvarg = 0;
|
||||
return pDisp->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,DISPATCH_PROPERTYGET, &dispParams, &output, 0, 0);
|
||||
}
|
||||
|
||||
inline
|
||||
HRESULT PutProperty(IDispatch *pDisp, const CComBSTR & name, const CComVariant& input)
|
||||
{
|
||||
DISPPARAMS dispParams;
|
||||
DISPID did = DISPID_PROPERTYPUT;
|
||||
dispParams.cArgs = 1;
|
||||
CComVariant var(input);
|
||||
dispParams.rgvarg = &var;
|
||||
dispParams.cNamedArgs = 1;
|
||||
dispParams.rgdispidNamedArgs = &did;
|
||||
CComVariant result;
|
||||
DISPID dispID = GetIDsOfNames(pDisp, name);
|
||||
return pDisp->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
||||
DISPATCH_PROPERTYPUT, &dispParams, &result,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
HRESULT VerifynsXPCDispSimple(IDispatch * result)
|
||||
{
|
||||
CComVariant property;
|
||||
HRESULT hResult = GetProperty(result, L"Number", property);
|
||||
CComVariant test((long)5);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
if (property != test)
|
||||
return E_FAIL;
|
||||
return PutProperty(result, L"Number", 76);
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesIDispatch(IDispatch * result)
|
||||
{
|
||||
return VerifynsXPCDispSimple(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesError(SCODE result)
|
||||
{
|
||||
return result == E_FAIL ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesDate(DATE result)
|
||||
{
|
||||
CComBSTR dateStr(L"5/2/02");
|
||||
DATE myDate;
|
||||
HRESULT hResult = VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT,
|
||||
LOCALE_NOUSEROVERRIDE, &myDate);
|
||||
if (SUCCEEDED(hResult))
|
||||
return myDate == result ? S_OK : E_FAIL;
|
||||
else
|
||||
return hResult;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesIUnknown(IUnknown * result)
|
||||
{
|
||||
CComPtr<IUnknown> ptr(result);
|
||||
ULONG before = result->AddRef();
|
||||
ULONG after = result->Release();
|
||||
CComQIPtr<nsIXPCDispTestNoIDispatch> noIDispatch(ptr);
|
||||
return before - 1 == after ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesI1(unsigned char result)
|
||||
{
|
||||
return result == 42 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUI2(USHORT result)
|
||||
{
|
||||
return result == 50000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUI4(ULONG result)
|
||||
{
|
||||
return result == 0xF0000000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesInt(INT result)
|
||||
{
|
||||
return result == -10000000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUInt(UINT result)
|
||||
{
|
||||
return result == 0xE0000000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsBSTR(BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
CComBSTR x("Boo");
|
||||
*result = x.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsI4(LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsUI1(BYTE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsI2(SHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsR4(FLOAT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 999999.1f;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsR8(DOUBLE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999999999.99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsBool(VARIANT_BOOL * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = VARIANT_TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsIDispatch(IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
return nsXPCDispSimple::CreateInstance(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsError(SCODE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsDate(DATE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR dateStr(L"5/2/02");
|
||||
return VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT,
|
||||
LOCALE_NOUSEROVERRIDE, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsIUnknown(IUnknown * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
return XPCCreateInstance<IUnknown>(CLSID_nsXPCDispTestNoIDispatch, IID_IUnknown, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsI1(unsigned char * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = L'x';
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsUI2(USHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsUI4(ULONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 3000000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsBSTR(BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR str(*result);
|
||||
str += L"Appended";
|
||||
SysFreeString(*result);
|
||||
*result = str.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsI4(LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result -= 4000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsUI1(BYTE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result -= 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsI2(SHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 10000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsR4(FLOAT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 5.05f;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsR8(DOUBLE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 50000000.00000005;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsBool(VARIANT_BOOL * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = !*result;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsIDispatch(IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComPtr<nsIXPCDispSimple> ptr;
|
||||
ptr.CoCreateInstance(CLSID_nsXPCDispSimple);
|
||||
CComPtr<IDispatch> incoming(*result);
|
||||
CComVariant value;
|
||||
HRESULT hResult = GetProperty(incoming, L"Number", value);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
if (value.lVal != 10)
|
||||
return E_FAIL;
|
||||
hResult = ptr->put_Number(value.lVal + 5);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
|
||||
*result = ptr.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsError(SCODE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 1;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsDate(DATE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
ULONG days;
|
||||
HRESULT hResult = VarUI4FromDate(*result, &days);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
|
||||
return VarDateFromUI4(days + 1, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsIUnknown(IUnknown * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
CComPtr<IUnknown> ptr(*result);
|
||||
ULONG before = (*result)->AddRef();
|
||||
ULONG after = (*result)->Release();
|
||||
if (before - 1 != after)
|
||||
return E_FAIL;
|
||||
return nsXPCDispSimple::CreateInstance(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsI1(unsigned char * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
++*result;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsUI2(USHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsUI4(ULONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result -= 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OneParameterWithReturn(LONG input,
|
||||
LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = input + 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::StringInputAndReturn(BSTR str,
|
||||
BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR input(str);
|
||||
input += L"Appended";
|
||||
*result = input.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::IDispatchInputAndReturn(IDispatch * input, IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
HRESULT hResult = VerifynsXPCDispSimple(input);
|
||||
|
||||
hResult = XPCCreateInstance<IDispatch>(CLSID_nsXPCDispSimple, IID_IDispatch, result);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
CComVariant variant;
|
||||
hResult = GetProperty(input, L"Number", variant);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
return PutProperty(*result, L"Number", variant.lVal + 5);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwoParameters(LONG one, LONG two)
|
||||
{
|
||||
return one + 1 == two ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveInParameters(LONG one, LONG two,
|
||||
LONG three, LONG four,
|
||||
LONG five, LONG six,
|
||||
LONG seven, LONG eight,
|
||||
LONG nine, LONG ten,
|
||||
LONG eleven, LONG twelve)
|
||||
{
|
||||
return one + two + three + four + five + six + seven + eight + nine +
|
||||
ten + eleven + twelve == 78 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveOutParameters(LONG * one, LONG * two,
|
||||
LONG * three,
|
||||
LONG * four,
|
||||
LONG * five, LONG * six,
|
||||
LONG * seven,
|
||||
LONG * eight,
|
||||
LONG * nine, LONG * ten,
|
||||
LONG * eleven,
|
||||
LONG * twelve)
|
||||
{
|
||||
if (one == 0 || two == 0 || three == 0 || four == 0 ||
|
||||
five == 0 || six == 0 || seven == 0 || eight == 0 ||
|
||||
nine == 0 || ten == 0 || eleven == 0 || twelve == 0)
|
||||
return E_POINTER;
|
||||
|
||||
*one = 1;
|
||||
*two = 2;
|
||||
*three = 3;
|
||||
*four = 4;
|
||||
*five = 5;
|
||||
*six = 6;
|
||||
*seven = 7;
|
||||
*eight = 8;
|
||||
*nine = 9;
|
||||
*ten = 10;
|
||||
*eleven = 11;
|
||||
*twelve = 12;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline
|
||||
boolean Equals(BSTR left, const char * str)
|
||||
{
|
||||
return CComBSTR(left) == str;
|
||||
}
|
||||
#define TESTPARAM(val) Equals(val, #val)
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveStrings(BSTR one, BSTR two, BSTR three, BSTR four, BSTR five, BSTR six, BSTR seven, BSTR eight, BSTR nine, BSTR ten, BSTR eleven, BSTR twelve)
|
||||
{
|
||||
return TESTPARAM(one) && TESTPARAM(two) && TESTPARAM(three) &&
|
||||
TESTPARAM(four) && TESTPARAM(five) && TESTPARAM(six) &&
|
||||
TESTPARAM(seven) && TESTPARAM(eight) && TESTPARAM(nine) &&
|
||||
TESTPARAM(ten) && TESTPARAM(eleven) && TESTPARAM(twelve) ?
|
||||
S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
#define ASSIGNPARAM(val) \
|
||||
if (val == 0) \
|
||||
return E_POINTER; \
|
||||
*val = CComBSTR(#val).Detach()
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveOutStrings(BSTR * one, BSTR * two, BSTR * three, BSTR * four, BSTR * five, BSTR * six, BSTR * seven, BSTR * eight, BSTR * nine, BSTR * ten, BSTR * eleven, BSTR * twelve)
|
||||
{
|
||||
ASSIGNPARAM(one);
|
||||
ASSIGNPARAM(two);
|
||||
ASSIGNPARAM(three);
|
||||
ASSIGNPARAM(four);
|
||||
ASSIGNPARAM(five);
|
||||
ASSIGNPARAM(six);
|
||||
ASSIGNPARAM(seven);
|
||||
ASSIGNPARAM(eight);
|
||||
ASSIGNPARAM(nine);
|
||||
ASSIGNPARAM(ten);
|
||||
ASSIGNPARAM(eleven);
|
||||
ASSIGNPARAM(twelve);
|
||||
return S_OK;
|
||||
}
|
||||
#define VERIFYSIMPLE(param) \
|
||||
hResult = VerifynsXPCDispSimple(param); \
|
||||
if (FAILED(hResult)) \
|
||||
return hResult
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveIDispatch(IDispatch * one,
|
||||
IDispatch * two,
|
||||
IDispatch * three,
|
||||
IDispatch * four,
|
||||
IDispatch * five,
|
||||
IDispatch * six,
|
||||
IDispatch * seven,
|
||||
IDispatch * eight,
|
||||
IDispatch * nine,
|
||||
IDispatch * ten,
|
||||
IDispatch * eleven,
|
||||
IDispatch * twelve)
|
||||
{
|
||||
HRESULT hResult;
|
||||
VERIFYSIMPLE(one);
|
||||
VERIFYSIMPLE(two);
|
||||
VERIFYSIMPLE(three);
|
||||
VERIFYSIMPLE(four);
|
||||
VERIFYSIMPLE(five);
|
||||
VERIFYSIMPLE(six);
|
||||
VERIFYSIMPLE(seven);
|
||||
VERIFYSIMPLE(eight);
|
||||
VERIFYSIMPLE(nine);
|
||||
VERIFYSIMPLE(ten);
|
||||
VERIFYSIMPLE(eleven);
|
||||
VERIFYSIMPLE(twelve);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define ASSIGNSIMPLE(param) \
|
||||
if (param == 0) \
|
||||
return E_POINTER; \
|
||||
hResult = nsXPCDispSimple::CreateInstance(param); \
|
||||
if (FAILED(hResult)) \
|
||||
return hResult; \
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveOutIDispatch(IDispatch * * one,
|
||||
IDispatch * * two,
|
||||
IDispatch * * three,
|
||||
IDispatch * * four,
|
||||
IDispatch * * five,
|
||||
IDispatch * * six,
|
||||
IDispatch * * seven,
|
||||
IDispatch * * eight,
|
||||
IDispatch * * nine,
|
||||
IDispatch * * ten,
|
||||
IDispatch * * eleven,
|
||||
IDispatch * * twelve){
|
||||
HRESULT hResult;
|
||||
ASSIGNSIMPLE(one);
|
||||
ASSIGNSIMPLE(two);
|
||||
ASSIGNSIMPLE(three);
|
||||
ASSIGNSIMPLE(four);
|
||||
ASSIGNSIMPLE(five);
|
||||
ASSIGNSIMPLE(six);
|
||||
ASSIGNSIMPLE(seven);
|
||||
ASSIGNSIMPLE(eight);
|
||||
ASSIGNSIMPLE(nine);
|
||||
ASSIGNSIMPLE(ten);
|
||||
ASSIGNSIMPLE(eleven);
|
||||
ASSIGNSIMPLE(twelve);
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::CreateError()
|
||||
{
|
||||
CComBSTR someText(L"CreateError Test");
|
||||
ICreateErrorInfo * pCreateError;
|
||||
IErrorInfo * pError;
|
||||
HRESULT result = CreateErrorInfo(&pCreateError);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = pCreateError->QueryInterface(&pError);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = pCreateError->SetDescription(someText);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = pCreateError->SetGUID(IID_nsIXPCDispTestMethods);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
CComBSTR source(L"XPCIDispatchTest.nsXPCDispTestMethods.1");
|
||||
result = pCreateError->SetSource(source);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = SetErrorInfo(0, pError);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
pError->Release();
|
||||
pCreateError->Release();
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
// nsXPCDispTestMethods.h: Definition of the nsXPCDispTestMethods class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "XPCIDispatchTest.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestMethods
|
||||
|
||||
class nsXPCDispTestMethods :
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestMethods,&CLSID_nsXPCDispTestMethods>,
|
||||
public IDispatchImpl<nsIXPCDispTestMethods, &IID_nsIXPCDispTestMethods, &LIBID_IDispatchTestLib>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestMethods() {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestMethods)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestMethods)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestMethods)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestMethods)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestMethods)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestMethods
|
||||
public:
|
||||
// nsIXPCDispTestMethod
|
||||
STDMETHOD(NoParameters)();
|
||||
STDMETHOD(ReturnBSTR)(BSTR * result);
|
||||
STDMETHOD(ReturnI4)(INT * result);
|
||||
STDMETHOD(ReturnUI1)(BYTE * result);
|
||||
STDMETHOD(ReturnI2)(SHORT * result);
|
||||
STDMETHOD(ReturnR4)(FLOAT * result);
|
||||
STDMETHOD(ReturnR8)(DOUBLE * result);
|
||||
STDMETHOD(ReturnBool)(VARIANT_BOOL * result);
|
||||
STDMETHOD(ReturnIDispatch)(IDispatch * * result);
|
||||
STDMETHOD(ReturnError)(SCODE * result);
|
||||
STDMETHOD(ReturnDate)(DATE * result);
|
||||
STDMETHOD(ReturnIUnknown)(IUnknown * * result);
|
||||
STDMETHOD(ReturnI1)(unsigned char * result);
|
||||
STDMETHOD(ReturnUI2)(USHORT * result);
|
||||
STDMETHOD(ReturnUI4)(ULONG * result);
|
||||
STDMETHOD(ReturnInt)(INT * result);
|
||||
STDMETHOD(ReturnUInt)(UINT * result);
|
||||
STDMETHOD(TakesBSTR)(BSTR result);
|
||||
STDMETHOD(TakesI4)(INT result);
|
||||
STDMETHOD(TakesUI1)(BYTE result);
|
||||
STDMETHOD(TakesI2)(SHORT result);
|
||||
STDMETHOD(TakesR4)(FLOAT result);
|
||||
STDMETHOD(TakesR8)(DOUBLE result);
|
||||
STDMETHOD(TakesBool)(VARIANT_BOOL result);
|
||||
STDMETHOD(TakesIDispatch)(IDispatch * result);
|
||||
STDMETHOD(TakesError)(SCODE result);
|
||||
STDMETHOD(TakesDate)(DATE result);
|
||||
STDMETHOD(TakesIUnknown)(IUnknown * result);
|
||||
STDMETHOD(TakesI1)(unsigned char result);
|
||||
STDMETHOD(TakesUI2)(USHORT result);
|
||||
STDMETHOD(TakesUI4)(ULONG result);
|
||||
STDMETHOD(TakesInt)(INT result);
|
||||
STDMETHOD(TakesUInt)(UINT result);
|
||||
STDMETHOD(OutputsBSTR)(BSTR * result);
|
||||
STDMETHOD(OutputsI4)(LONG * result);
|
||||
STDMETHOD(OutputsUI1)(BYTE * result);
|
||||
STDMETHOD(OutputsI2)(SHORT * result);
|
||||
STDMETHOD(OutputsR4)(FLOAT * result);
|
||||
STDMETHOD(OutputsR8)(DOUBLE * result);
|
||||
STDMETHOD(OutputsBool)(VARIANT_BOOL * result);
|
||||
STDMETHOD(OutputsIDispatch)(IDispatch * * result);
|
||||
STDMETHOD(OutputsError)(SCODE * result);
|
||||
STDMETHOD(OutputsDate)(DATE * result);
|
||||
STDMETHOD(OutputsIUnknown)(IUnknown * * result);
|
||||
STDMETHOD(OutputsI1)(unsigned char * result);
|
||||
STDMETHOD(OutputsUI2)(USHORT * result);
|
||||
STDMETHOD(OutputsUI4)(ULONG * result);
|
||||
STDMETHOD(InOutsBSTR)(BSTR * result);
|
||||
STDMETHOD(InOutsI4)(LONG * result);
|
||||
STDMETHOD(InOutsUI1)(BYTE * result);
|
||||
STDMETHOD(InOutsI2)(SHORT * result);
|
||||
STDMETHOD(InOutsR4)(FLOAT * result);
|
||||
STDMETHOD(InOutsR8)(DOUBLE * result);
|
||||
STDMETHOD(InOutsBool)(VARIANT_BOOL * result);
|
||||
STDMETHOD(InOutsIDispatch)(IDispatch * * result);
|
||||
STDMETHOD(InOutsError)(SCODE * result);
|
||||
STDMETHOD(InOutsDate)(DATE * result);
|
||||
STDMETHOD(InOutsIUnknown)(IUnknown * * result);
|
||||
STDMETHOD(InOutsI1)(unsigned char * result);
|
||||
STDMETHOD(InOutsUI2)(USHORT * result);
|
||||
STDMETHOD(InOutsUI4)(ULONG * result);
|
||||
STDMETHOD(OneParameterWithReturn)(LONG input, LONG * result);
|
||||
STDMETHOD(StringInputAndReturn)(BSTR str, BSTR * result);
|
||||
STDMETHOD(IDispatchInputAndReturn)(IDispatch * input, IDispatch** result);
|
||||
STDMETHOD(TwoParameters)(LONG one, LONG two);
|
||||
STDMETHOD(TwelveInParameters)(LONG one, LONG two, LONG three, LONG four,
|
||||
LONG five, LONG six, LONG seven, LONG eight,
|
||||
LONG nine, LONG ten, LONG eleven,
|
||||
LONG twelve);
|
||||
STDMETHOD(TwelveOutParameters)(LONG * one, LONG * two, LONG * three,
|
||||
LONG * four, LONG * five, LONG * six,
|
||||
LONG * seven, LONG * eight, LONG * nine,
|
||||
LONG * ten, LONG * eleven, LONG * twelve);
|
||||
STDMETHOD(TwelveStrings)(BSTR one, BSTR two, BSTR three, BSTR four,
|
||||
BSTR five, BSTR six, BSTR seven, BSTR eight,
|
||||
BSTR nine, BSTR ten, BSTR eleven, BSTR twelve);
|
||||
STDMETHOD(TwelveOutStrings)(BSTR * one, BSTR * two, BSTR * three,
|
||||
BSTR * four, BSTR * five, BSTR * six,
|
||||
BSTR * seven, BSTR * eight, BSTR * nine,
|
||||
BSTR * ten, BSTR * eleven, BSTR * twelve);
|
||||
STDMETHOD(TwelveIDispatch)(IDispatch * one, IDispatch * two,
|
||||
IDispatch * three, IDispatch * four,
|
||||
IDispatch * five, IDispatch * six,
|
||||
IDispatch * seven, IDispatch * eight,
|
||||
IDispatch * nine, IDispatch * ten,
|
||||
IDispatch * eleven, IDispatch * twelve);
|
||||
STDMETHOD(TwelveOutIDispatch)(IDispatch * * one, IDispatch * * two,
|
||||
IDispatch * * three, IDispatch * * four,
|
||||
IDispatch * * five, IDispatch * * six,
|
||||
IDispatch * * seven, IDispatch * * eight,
|
||||
IDispatch * * nine, IDispatch * * ten,
|
||||
IDispatch * * eleven, IDispatch * * twelve);
|
||||
STDMETHOD(CreateError)();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestMethods.1 = s 'nsXPCDispTestMethods Class'
|
||||
{
|
||||
CLSID = s '{745D1149-9F46-418C-B176-71EAA98974BA}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestMethods = s 'nsXPCDispTestMethods Class'
|
||||
{
|
||||
CLSID = s '{745D1149-9F46-418C-B176-71EAA98974BA}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {745D1149-9F46-418C-B176-71EAA98974BA} = s 'nsXPCDispTestMethods Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestMethods.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestMethods'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// nsXPCDispTestNoIDispatch.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestNoIDispatch.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestNoIDispatch::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestNoIDispatch,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// nsXPCDispTestNoIDispatch.h: Definition of the nsXPCDispTestNoIDispatch class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTNOIDISPATCH_H__E4B74F67_BA6B_4654_8674_E60E487129F7__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTNOIDISPATCH_H__E4B74F67_BA6B_4654_8674_E60E487129F7__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestNoIDispatch
|
||||
|
||||
class nsXPCDispTestNoIDispatch :
|
||||
public nsIXPCDispTestNoIDispatch,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestNoIDispatch,&CLSID_nsXPCDispTestNoIDispatch>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestNoIDispatch() {}
|
||||
BEGIN_COM_MAP(nsXPCDispTestNoIDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestNoIDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
//DECLARE_NOT_AGGREGATABLE(nsXPCDispTestNoIDispatch)
|
||||
// Remove the comment from the line above if you don't want your object to
|
||||
// support aggregation.
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestNoIDispatch)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestNoIDispatch
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTNOIDISPATCH_H__E4B74F67_BA6B_4654_8674_E60E487129F7__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestNoIDispatch.1 = s 'nsXPCDispTestNoIDispatch Class'
|
||||
{
|
||||
CLSID = s '{7414404F-A4CC-4E3C-9B32-BB20CB22F541}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestNoIDispatch = s 'nsXPCDispTestNoIDispatch Class'
|
||||
{
|
||||
CLSID = s '{7414404F-A4CC-4E3C-9B32-BB20CB22F541}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {7414404F-A4CC-4E3C-9B32-BB20CB22F541} = s 'nsXPCDispTestNoIDispatch Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestNoIDispatch.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestNoIDispatch'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,256 +0,0 @@
|
||||
// nsXPCDispTestProperties.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestProperties.h"
|
||||
|
||||
const long PARAMETERIZED_PROPERTY_COUNT = 5;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestProperties,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
nsXPCDispTestProperties::nsXPCDispTestProperties() :
|
||||
mChar('a'),
|
||||
mBOOL(FALSE),
|
||||
mSCode(0),
|
||||
mDATE(0),
|
||||
mDouble(0.0),
|
||||
mFloat(0.0f),
|
||||
mLong(0),
|
||||
mShort(0),
|
||||
mParameterizedProperty(new long[PARAMETERIZED_PROPERTY_COUNT])
|
||||
{
|
||||
mCURRENCY.int64 = 0;
|
||||
CComBSTR string("Initial value");
|
||||
mBSTR = string.Detach();
|
||||
for (long index = 0; index < PARAMETERIZED_PROPERTY_COUNT; ++index)
|
||||
mParameterizedProperty[index] = index + 1;
|
||||
}
|
||||
|
||||
nsXPCDispTestProperties::~nsXPCDispTestProperties()
|
||||
{
|
||||
delete [] mParameterizedProperty;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Short(short *pVal)
|
||||
{
|
||||
*pVal = mShort;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Short(short newVal)
|
||||
{
|
||||
mShort = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Long(long *pVal)
|
||||
{
|
||||
*pVal = mLong;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Long(long newVal)
|
||||
{
|
||||
mLong = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Float(float *pVal)
|
||||
{
|
||||
*pVal = mFloat;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Float(float newVal)
|
||||
{
|
||||
mFloat = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Double(double *pVal)
|
||||
{
|
||||
*pVal = mDouble;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Double(double newVal)
|
||||
{
|
||||
mDouble = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Currency(CURRENCY *pVal)
|
||||
{
|
||||
*pVal = mCURRENCY;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Currency(CURRENCY newVal)
|
||||
{
|
||||
mCURRENCY = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Date(DATE *pVal)
|
||||
{
|
||||
*pVal = mDATE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Date(DATE newVal)
|
||||
{
|
||||
mDATE = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_String(BSTR *pVal)
|
||||
{
|
||||
*pVal = mBSTR.Copy();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_String(BSTR newVal)
|
||||
{
|
||||
mBSTR = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_DispatchPtr(IDispatch **pVal)
|
||||
{
|
||||
mIDispatch.CopyTo(pVal);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_DispatchPtr(IDispatch *newVal)
|
||||
{
|
||||
mIDispatch = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_SCode(SCODE *pVal)
|
||||
{
|
||||
*pVal = mSCode;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_SCode(SCODE newVal)
|
||||
{
|
||||
mSCode = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Boolean(BOOL *pVal)
|
||||
{
|
||||
*pVal = mBOOL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Boolean(BOOL newVal)
|
||||
{
|
||||
mBOOL = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Variant(VARIANT *pVal)
|
||||
{
|
||||
::VariantCopy(pVal, &mVariant);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Variant(VARIANT newVal)
|
||||
{
|
||||
mVariant = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_COMPtr(IUnknown **pVal)
|
||||
{
|
||||
mIUnknown.CopyTo(pVal);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_COMPtr(IUnknown *newVal)
|
||||
{
|
||||
mIUnknown = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Char(unsigned char *pVal)
|
||||
{
|
||||
*pVal = mChar;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Char(unsigned char newVal)
|
||||
{
|
||||
mChar = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedProperty(long aIndex, long *pVal)
|
||||
{
|
||||
if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
|
||||
return E_FAIL;
|
||||
|
||||
*pVal = mParameterizedProperty[aIndex];
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_ParameterizedProperty(long aIndex, long newVal)
|
||||
{
|
||||
if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
|
||||
return E_FAIL;
|
||||
|
||||
mParameterizedProperty[aIndex] = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedPropertyCount(long *pVal)
|
||||
{
|
||||
*pVal = PARAMETERIZED_PROPERTY_COUNT;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// nsXPCDispTestProperties.h: Definition of the nsXPCDispTestProperties class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestProperties
|
||||
|
||||
class nsXPCDispTestProperties :
|
||||
public IDispatchImpl<nsIXPCDispTestProperties, &IID_nsIXPCDispTestProperties, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestProperties,&CLSID_nsXPCDispTestProperties>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestProperties();
|
||||
virtual ~nsXPCDispTestProperties();
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestProperties)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestProperties)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestProperties)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestProperties)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestProperties)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestProperties
|
||||
public:
|
||||
STDMETHOD(get_ParameterizedPropertyCount)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(get_ParameterizedProperty)(/*[in]*/long aIndex, /*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_ParameterizedProperty)(/*[in]*/long aIndex, /*[in]*/ long newVal);
|
||||
STDMETHOD(get_Char)(/*[out, retval]*/ unsigned char *pVal);
|
||||
STDMETHOD(put_Char)(/*[in]*/ unsigned char newVal);
|
||||
STDMETHOD(get_COMPtr)(/*[out, retval]*/ IUnknown* *pVal);
|
||||
STDMETHOD(put_COMPtr)(/*[in]*/ IUnknown* newVal);
|
||||
STDMETHOD(get_Variant)(/*[out, retval]*/ VARIANT *pVal);
|
||||
STDMETHOD(put_Variant)(/*[in]*/ VARIANT newVal);
|
||||
STDMETHOD(get_Boolean)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_Boolean)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_SCode)(/*[out, retval]*/ SCODE *pVal);
|
||||
STDMETHOD(put_SCode)(/*[in]*/ SCODE newVal);
|
||||
STDMETHOD(get_DispatchPtr)(/*[out, retval]*/ IDispatch* *pVal);
|
||||
STDMETHOD(put_DispatchPtr)(/*[in]*/ IDispatch* newVal);
|
||||
STDMETHOD(get_String)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_String)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(get_Date)(/*[out, retval]*/ DATE *pVal);
|
||||
STDMETHOD(put_Date)(/*[in]*/ DATE newVal);
|
||||
STDMETHOD(get_Currency)(/*[out, retval]*/ CURRENCY *pVal);
|
||||
STDMETHOD(put_Currency)(/*[in]*/ CURRENCY newVal);
|
||||
STDMETHOD(get_Double)(/*[out, retval]*/ double *pVal);
|
||||
STDMETHOD(put_Double)(/*[in]*/ double newVal);
|
||||
STDMETHOD(get_Float)(/*[out, retval]*/ float *pVal);
|
||||
STDMETHOD(put_Float)(/*[in]*/ float newVal);
|
||||
STDMETHOD(get_Long)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Long)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Short)(/*[out, retval]*/ short *pVal);
|
||||
STDMETHOD(put_Short)(/*[in]*/ short newVal);
|
||||
private:
|
||||
unsigned char mChar;
|
||||
CComPtr<IUnknown> mIUnknown;
|
||||
CComVariant mVariant;
|
||||
BOOL mBOOL;
|
||||
SCODE mSCode;
|
||||
CComPtr<IDispatch> mIDispatch;
|
||||
CComBSTR mBSTR;
|
||||
DATE mDATE;
|
||||
CURRENCY mCURRENCY;
|
||||
double mDouble;
|
||||
float mFloat;
|
||||
long mLong;
|
||||
short mShort;
|
||||
long * mParameterizedProperty;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestProperties.1 = s 'nsXPCDispTestProperties Class'
|
||||
{
|
||||
CLSID = s '{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestProperties = s 'nsXPCDispTestProperties Class'
|
||||
{
|
||||
CLSID = s '{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {D8B4265B-1768-4CA9-A285-7CCAEEB51C74} = s 'nsXPCDispTestProperties Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestProperties.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestProperties'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// nsXPCDispTestScriptOff.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestScriptOff.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestScriptOff::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestScriptOff,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// nsXPCDispTestScriptOff.h: Definition of the nsXPCDispTestScriptOff class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTSCRIPTOFF_H__EEC88DE0_F502_4893_9918_4E435DBC9815__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTSCRIPTOFF_H__EEC88DE0_F502_4893_9918_4E435DBC9815__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include <ATLCTL.H>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestScriptOff
|
||||
|
||||
class nsXPCDispTestScriptOff :
|
||||
public IDispatchImpl<nsIXPCDispTestScriptOff, &IID_nsIXPCDispTestScriptOff, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestScriptOff,&CLSID_nsXPCDispTestScriptOff>,
|
||||
public IObjectSafetyImpl<nsXPCDispTestScriptOff, 0>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestScriptOff() {}
|
||||
BEGIN_COM_MAP(nsXPCDispTestScriptOff)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestScriptOff)
|
||||
COM_INTERFACE_ENTRY(IObjectSafety)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestScriptOff)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestScriptOff)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestScriptOff
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTSCRIPTOFF_H__EEC88DE0_F502_4893_9918_4E435DBC9815__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOff.1 = s 'nsXPCDispTestScriptOff Class'
|
||||
{
|
||||
CLSID = s '{959CD122-9826-4757-BA09-DE327D55F9E7}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOff = s 'nsXPCDispTestScriptOff Class'
|
||||
{
|
||||
CLSID = s '{959CD122-9826-4757-BA09-DE327D55F9E7}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {959CD122-9826-4757-BA09-DE327D55F9E7} = s 'nsXPCDispTestScriptOff Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOff.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOff'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// nsXPCDispTestScriptOn.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestScriptOn.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestScriptOn::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestScriptOn,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
nsXPCDispTestScriptOn::nsXPCDispTestScriptOn()
|
||||
{
|
||||
m_dwCurrentSafety = INTERFACESAFE_FOR_UNTRUSTED_CALLER |
|
||||
INTERFACESAFE_FOR_UNTRUSTED_DATA;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
// nsXPCDispTestScriptOn.h: Definition of the nsXPCDispTestScriptOn class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTSCRIPTON_H__C037D462_C403_48FF_A02F_6C36544F0833__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTSCRIPTON_H__C037D462_C403_48FF_A02F_6C36544F0833__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include <ATLCTL.H>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestScriptOn
|
||||
|
||||
class nsXPCDispTestScriptOn :
|
||||
public IDispatchImpl<nsIXPCDispTestScriptOn, &IID_nsIXPCDispTestScriptOn, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestScriptOn,&CLSID_nsXPCDispTestScriptOn>,
|
||||
public IObjectSafetyImpl<nsXPCDispTestScriptOn,
|
||||
INTERFACESAFE_FOR_UNTRUSTED_CALLER |
|
||||
INTERFACESAFE_FOR_UNTRUSTED_DATA>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestScriptOn();
|
||||
BEGIN_COM_MAP(nsXPCDispTestScriptOn)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestScriptOn)
|
||||
COM_INTERFACE_ENTRY(IObjectSafety)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestScriptOn)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestScriptOn)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestScriptOn
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTSCRIPTON_H__C037D462_C403_48FF_A02F_6C36544F0833__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOn.1 = s 'nsXPCDispTestScriptOn Class'
|
||||
{
|
||||
CLSID = s '{2A06373F-3E61-4882-A3D7-A104F70B09ED}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOn = s 'nsXPCDispTestScriptOn Class'
|
||||
{
|
||||
CLSID = s '{2A06373F-3E61-4882-A3D7-A104F70B09ED}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {2A06373F-3E61-4882-A3D7-A104F70B09ED} = s 'nsXPCDispTestScriptOn Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOn.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOn'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
// nsXPCDispTestWrappedJS.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestWrappedJS.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestWrappedJS::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestWrappedJS,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
struct TestData
|
||||
{
|
||||
typedef bool (*CompFunc)(const _variant_t & left, const _variant_t & right);
|
||||
TestData(const char * name, const _variant_t & value, CompFunc cf) :
|
||||
mName(name), mValue(value), mCompFunc(cf) {}
|
||||
const char * mName;
|
||||
_variant_t mValue;
|
||||
CompFunc mCompFunc;
|
||||
|
||||
};
|
||||
|
||||
bool CompareVariant(const _variant_t & left, const _variant_t & right)
|
||||
{
|
||||
return left == right;
|
||||
}
|
||||
|
||||
// These should be a template but VC++6 is brain dead in this area
|
||||
#define CompareFunction(type) \
|
||||
bool CompareVariant##type(const _variant_t & left, const _variant_t & right) \
|
||||
{ \
|
||||
return static_cast<type>(left) == static_cast<type>(right); \
|
||||
}
|
||||
|
||||
CompareFunction(long);
|
||||
CompareFunction(float);
|
||||
CompareFunction(double);
|
||||
CompareFunction(_bstr_t);
|
||||
|
||||
DISPID GetIDsOfNames(IDispatch * pIDispatch , char const * i_Method)
|
||||
{
|
||||
DISPID dispid;
|
||||
CComBSTR method(i_Method);
|
||||
OLECHAR * pMethod = method;
|
||||
HRESULT hresult = pIDispatch->GetIDsOfNames(
|
||||
IID_NULL,
|
||||
&pMethod,
|
||||
1,
|
||||
LOCALE_SYSTEM_DEFAULT,
|
||||
&dispid);
|
||||
if (!SUCCEEDED(hresult))
|
||||
{
|
||||
dispid = 0;
|
||||
}
|
||||
return dispid;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
inline
|
||||
_bstr_t ConvertVariantFromBSTR(_variant_t & variant)
|
||||
{
|
||||
VARIANT temp = variant;
|
||||
if (SUCCEEDED(VariantChangeType(&temp, &temp, 0, VT_BSTR)))
|
||||
{
|
||||
variant.Attach(temp);
|
||||
return static_cast<_bstr_t>(variant);
|
||||
}
|
||||
return "**Type Conversion failed";
|
||||
}
|
||||
|
||||
std::string DispInvoke(IDispatch * obj, const TestData & testData)
|
||||
{
|
||||
// Perform a put on the property
|
||||
ITypeInfo * pTypeInfo;
|
||||
obj->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &pTypeInfo);
|
||||
DISPID dispID = ::GetIDsOfNames(obj, testData.mName);
|
||||
DISPPARAMS dispParams;
|
||||
dispParams.cArgs = 1;
|
||||
dispParams.rgvarg = const_cast<VARIANT*>(&reinterpret_cast<const VARIANT&>(testData.mValue));
|
||||
dispParams.cNamedArgs = 1;
|
||||
DISPID propPut = DISPID_PROPERTYPUT;
|
||||
dispParams.rgdispidNamedArgs = &propPut;
|
||||
_variant_t result1;
|
||||
HRESULT hResult = obj->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dispParams, &result1, 0, 0);
|
||||
if (FAILED(hResult))
|
||||
{
|
||||
std::ostringstream msg;
|
||||
msg << "IDispatch::Invoke on " << testData.mName << " failed to set property with result " << hResult;
|
||||
return msg.str();
|
||||
}
|
||||
dispParams.cArgs = 1;
|
||||
dispParams.rgvarg = const_cast<VARIANT*>(&reinterpret_cast<const VARIANT&>(testData.mValue));
|
||||
dispParams.cNamedArgs = 0;
|
||||
dispParams.rgdispidNamedArgs = 0;
|
||||
_variant_t result2;
|
||||
hResult = obj->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dispParams, &result2, 0, 0);
|
||||
if (FAILED(hResult))
|
||||
{
|
||||
std::ostringstream msg;
|
||||
msg << "IDispatch::Invoke on " << testData.mName << " failed to retrieve property with result " << hResult;
|
||||
return msg.str();
|
||||
}
|
||||
if (!testData.mCompFunc(result2,testData.mValue))
|
||||
{
|
||||
std::ostringstream msg;
|
||||
VARIANT temp = testData.mValue;
|
||||
char const * const desired = SUCCEEDED(VariantChangeType(&temp, &temp, 0, VT_BSTR)) ? 0 : "**Conversion Failed";
|
||||
char const * const actual = SUCCEEDED(VariantChangeType(&result2, &result2, 0, VT_BSTR)) ? 0 : "**Conversion Failed";
|
||||
|
||||
msg << testData.mName << " ["
|
||||
<< (desired ? desired : static_cast<char const *>(static_cast<_bstr_t>(testData.mValue))) << "] ["
|
||||
<< (actual ? actual : static_cast<char const *>(static_cast<_bstr_t>(result2))) << "]";
|
||||
return msg.str();
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestWrappedJS::TestParamTypes(IDispatch *obj, BSTR *errMsg)
|
||||
{
|
||||
CComPtr<IDispatch> ptr;
|
||||
CComBSTR progID("XPCIDispatchTest.nsXPCDispSimple.1");
|
||||
ptr.CoCreateInstance(progID);
|
||||
_variant_t dispatchPtr;
|
||||
dispatchPtr = static_cast<IDispatch*>(ptr);
|
||||
CURRENCY currency;
|
||||
currency.int64 = 55555;
|
||||
_variant_t date(3000.0, VT_DATE);
|
||||
_variant_t nullVariant;
|
||||
nullVariant.ChangeType(VT_NULL);
|
||||
const TestData tests[] =
|
||||
{
|
||||
TestData("Boolean", _variant_t(true), CompareVariant),
|
||||
TestData("Short", _variant_t(short(4200)), reinterpret_cast<TestData::CompFunc>(CompareVariantlong)),
|
||||
TestData("Long", _variant_t(long(-42000000)), CompareVariantlong),
|
||||
TestData("Float", _variant_t(float(4.5)), CompareVariantfloat),
|
||||
TestData("Double", _variant_t(-11111.11), CompareVariant),
|
||||
// TestData("Currency", _variant_t(currency), CompareVariantdouble),
|
||||
TestData("Date", date, CompareVariant_bstr_t),
|
||||
TestData("String", _variant_t("A String"), CompareVariant),
|
||||
TestData("DispatchPtr", dispatchPtr, CompareVariant),
|
||||
// TestData("SCode", _variant_t(long(5), VT_ERROR), CompareVariant_bstr_t),
|
||||
TestData("Variant", nullVariant, CompareVariant),
|
||||
TestData("Char", _variant_t(BYTE('x')), CompareVariant_bstr_t)
|
||||
};
|
||||
std::string errors;
|
||||
for (size_t index = 0; index < sizeof(tests) / sizeof(TestData); ++index)
|
||||
{
|
||||
std::string msg = DispInvoke(obj, tests[index]);
|
||||
if (!msg.empty())
|
||||
{
|
||||
errors += msg;
|
||||
errors += "\r\n";
|
||||
}
|
||||
}
|
||||
CComBSTR errorMsg(errors.c_str());
|
||||
*errMsg = errorMsg.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
// nsXPCDispTestWrappedJS.h: Definition of the nsXPCDispTestWrappedJS class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestWrappedJS
|
||||
|
||||
class nsXPCDispTestWrappedJS :
|
||||
public IDispatchImpl<nsIXPCDispTestWrappedJS, &IID_nsIXPCDispTestWrappedJS, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestWrappedJS,&CLSID_nsXPCDispTestWrappedJS>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestWrappedJS() {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestWrappedJS)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestWrappedJS)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestWrappedJS)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestWrappedJS)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestWrappedJS)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestWrappedJS
|
||||
public:
|
||||
/**
|
||||
* This tests interacting with JS Objects via IDispatch
|
||||
* @param obj the object being tested
|
||||
* @param errMsg string receiving any error message, blank if no error
|
||||
*/
|
||||
STDMETHOD(TestParamTypes)(/*[in]*/ IDispatch * obj,
|
||||
/*[out]*/BSTR * errMsg);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestWrappedJS.1 = s 'nsXPCDispTestWrappedJS Class'
|
||||
{
|
||||
CLSID = s '{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestWrappedJS = s 'nsXPCDispTestWrappedJS Class'
|
||||
{
|
||||
CLSID = s '{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {EAEE6BB2-C005-4B91-BCA7-6613236F6F69} = s 'nsXPCDispTestWrappedJS Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestWrappedJS.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestWrappedJS'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by XPCIDispatchTest.rc
|
||||
//
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDS_NSXPCDISPTTESTMETHODS_DESC 101
|
||||
#define IDR_nsXPCDisptTestMethods 102
|
||||
#define IDS_NSXPCDISPTESTMETHODS_DESC 103
|
||||
#define IDR_nsXPCDispTestMethods 104
|
||||
#define IDS_NSXPCDISPSIMPLE_DESC 105
|
||||
#define IDR_nsXPCDispSimple 106
|
||||
#define IDS_NSXPCDISPTESTNOIDISPATCH_DESC 107
|
||||
#define IDR_nsXPCDispTestNoIDispatch 108
|
||||
#define IDS_NSXPCDISPTESTNOSCRIPT_DESC 109
|
||||
#define IDR_nsXPCDispTestNoScript 110
|
||||
#define IDS_NSXPCDISPTESTPROPERTIES_DESC 111
|
||||
#define IDR_nsXPCDispTestProperties 112
|
||||
#define IDS_NSXPCDISPTESTARRAYS_DESC 113
|
||||
#define IDR_nsXPCDispTestArrays 114
|
||||
#define IDS_NSXPCDISPTESTSCRIPTON_DESC 115
|
||||
#define IDR_nsXPCDispTestScriptOn 116
|
||||
#define IDS_NSXPCDISPTESTSCRIPTOFF_DESC 117
|
||||
#define IDR_nsXPCDispTestScriptOff 118
|
||||
#define IDS_NSXPCDISPTESTWRAPPEDJS_DESC 119
|
||||
#define IDR_nsXPCDispTestWrappedJS 120
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 204
|
||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
||||
#define _APS_NEXT_CONTROL_VALUE 201
|
||||
#define _APS_NEXT_SYMED_VALUE 121
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Verify that we can access but not overwrite the values of read-only
|
||||
* attributes.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function test()
|
||||
{
|
||||
printStatus("Testing arrays");
|
||||
var obj = COMObject(CLSID_nsXPCDispTestArrays);
|
||||
var anArray = [ 0, 1, 2, 3];
|
||||
obj.TakesSafeArray(anArray);
|
||||
var strArray = [ "0", "1", "2", "3"];
|
||||
obj.TakesSafeArrayBSTR(strArray);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* \file XPCIDispatchAttributeTests.js
|
||||
* Test IDispatch properties and also type conversion
|
||||
*/
|
||||
|
||||
try
|
||||
{
|
||||
// Test object used to test IDispatch property.
|
||||
testObject = { one : 1, two : 2, three : 'three' };
|
||||
test();
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Unhandled exception encountered: " + e.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function to perform test
|
||||
*/
|
||||
function test()
|
||||
{
|
||||
printStatus("Read-Write Attributes");
|
||||
|
||||
/*
|
||||
* These values come from xpctest_attributes.idl and xpctest_attributes.cpp
|
||||
*/
|
||||
|
||||
o = COMObject(CLSID_nsXPCDispTestProperties);
|
||||
|
||||
// Check the class an interface to make sure they're ok
|
||||
reportCompare(
|
||||
"object",
|
||||
typeof o,
|
||||
"typeof COMObject(CLSID_nsXPCDispTestProperties)");
|
||||
// Make sure we can read the values
|
||||
testProperty("o.Boolean", ["true", "1","testObject", "'T'", "'F'", "'true'","'false'"], false);
|
||||
testProperty("o.Char", ["32"], true);
|
||||
testProperty("o.COMPtr", ["0"], true);
|
||||
testProperty("o.Currency", ["0", "0.5", "10000.00"], true);
|
||||
testProperty("o.Date", ["'04/01/03'"], false);
|
||||
testProperty("o.DispatchPtr", ["testObject"], false);
|
||||
testProperty("o.Double", ["5.555555555555555555555", "5.555555555555555555555", "5", "-5"], true);
|
||||
testProperty("o.Float", ["-5.55555555", "5.5555555", "5", "-5"], true);
|
||||
testProperty("o.Long", ["-5", "1073741823", "-1073741824", "1073741824", "-1073741825", "5.5"], true);
|
||||
testProperty("o.SCode", ["5"], true);
|
||||
testProperty("o.Short", ["5", "-5", "32767", "-32768"], true);
|
||||
testProperty("o.String", ["'A String'", "'c'", "5", "true"], false);
|
||||
testProperty("o.Variant", ["'A Variant String'", "testObject", "10", "5.5"], false);
|
||||
|
||||
// Parameterized property tests
|
||||
for (index = 0; index < o.ParameterizedPropertyCount; ++index)
|
||||
compareExpression(
|
||||
"o.ParameterizedProperty(index)",
|
||||
index + 1,
|
||||
"Reading initial value from parameterized property " + index);
|
||||
for (index = 0; index < o.ParameterizedPropertyCount; ++index)
|
||||
compareExpression(
|
||||
"o.ParameterizedProperty(index) = index + 5",
|
||||
index + 5,
|
||||
"Assigning parameterized property " + index);
|
||||
|
||||
for (index = 0; index < o.ParameterizedPropertyCount; ++index)
|
||||
compareExpression(
|
||||
"o.ParameterizedProperty(index)",
|
||||
index + 5,
|
||||
"Reading new value from parameterized property " + index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests retrieving a value from a property and setting multiple values on
|
||||
* the property
|
||||
*/
|
||||
function testProperty(propertyExpression, values, tryString)
|
||||
{
|
||||
print(propertyExpression);
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
eval(propertyExpression),
|
||||
eval(propertyExpression),
|
||||
propertyExpression);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing initial value of " + propertyExpression + " Exception: " + e.toString());
|
||||
}
|
||||
for (i = 0; i < values.length; ++i)
|
||||
{
|
||||
var value = values[i];
|
||||
var expression = propertyExpression + "=" + value;
|
||||
print(expression);
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
eval(expression),
|
||||
eval(value),
|
||||
expression);
|
||||
if (tryString)
|
||||
{
|
||||
expression = propertyExpression + "='" + value + "'";
|
||||
print(expression);
|
||||
reportCompare(
|
||||
eval(expression),
|
||||
eval("'" + value + "'"),
|
||||
expression);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing assignment: " + expression + " Exception: " + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Verify that we can access but not overwrite the values of read-only
|
||||
* attributes.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function testInstantiate(name, id, scriptable, methods)
|
||||
{
|
||||
var IDISPATCH_TEXT = "[xpconnect wrapped IDispatch";
|
||||
var obj = COMObject(id);
|
||||
var value = obj.toString().substr(0, IDISPATCH_TEXT.length);
|
||||
reportCompare(
|
||||
IDISPATCH_TEXT,
|
||||
value,
|
||||
"var obj = COMObject(" + id + ");");
|
||||
try
|
||||
{
|
||||
obj = COMObject(id);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
if (scriptable)
|
||||
{
|
||||
reportFailure("COMObject('" + id + "') generated an exception");
|
||||
}
|
||||
return;
|
||||
}
|
||||
value = obj.toString().substr(0, IDISPATCH_TEXT.length);
|
||||
reportCompare(
|
||||
scriptable ? IDISPATCH_TEXT : undefined,
|
||||
scriptable ? value : obj,
|
||||
"var obj = COMObject(" + id + ");");
|
||||
}
|
||||
|
||||
function testEnumeration(compInfo)
|
||||
{
|
||||
var obj = COMObject(compInfo.cid);
|
||||
compareObject(obj, compInfo, "Enumeration Test");
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
printStatus("Instantiation Tests - " + objectsDesc.length + " objects to test");
|
||||
for (index = 0; index < objectsDesc.length; ++index)
|
||||
{
|
||||
compInfo = objectsDesc[index];
|
||||
printStatus("Testing " + compInfo.name);
|
||||
testInstantiate(compInfo.name, compInfo.cid, compInfo.scriptable);
|
||||
testInstantiate(compInfo.name, compInfo.progid, compInfo.scriptable);
|
||||
}
|
||||
// Test a non-existant COM object
|
||||
var obj;
|
||||
try
|
||||
{
|
||||
obj = COMObject("dwbnonexistantobject");
|
||||
printFailure("var obj = COMObject('dwbnonexistantobject'); did not throw an exception");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
obj = COMObject("dwbnonexistantobject");
|
||||
printFailure("obj = COMObject('dwbnonexistantobject'); did not throw an exception");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
}
|
||||
printStatus("Enumeration Tests - testing " + objectsDesc.length + " objects");
|
||||
for (var index = 0; index < objectsDesc.length; ++index)
|
||||
{
|
||||
printStatus("Enumerating " + objectsDesc[index].name);
|
||||
testEnumeration(objectsDesc[index]);
|
||||
}
|
||||
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Unhandled exception occured:" + e.toString());
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Make repeated calls so GC kicks in and we can check for memory leaks.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function test()
|
||||
{
|
||||
printStatus("Stress testing");
|
||||
for (index = 0; index < 10000; ++index)
|
||||
{
|
||||
for (x = 0; x < objectsDesc.length; ++x)
|
||||
{
|
||||
var obj = COMObject(objectsDesc[x].cid);
|
||||
for (prop in obj)
|
||||
{
|
||||
print(index + ":" +objectsDesc[x].name + ":" + prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,376 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Verify that we can access but not overwrite the values of read-only
|
||||
* attributes.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function TestOutMethod(obj, method, value)
|
||||
{
|
||||
printDebug("TestOutMethod - " + method);
|
||||
var x = new Object();
|
||||
try
|
||||
{
|
||||
obj[method](x);
|
||||
reportCompare(value, x.value, "Testing output parameter: " + method);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing output parameter failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function TestReturnMethod(obj, method, value)
|
||||
{
|
||||
printDebug("TestReturnMethod - " + method);
|
||||
try
|
||||
{
|
||||
reportCompare(value, obj[method](), "Testing output parameter: " + method);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing return value failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function TestInputMethod(obj, method, value)
|
||||
{
|
||||
printDebug("TestInputMethod - " + method);
|
||||
try
|
||||
{
|
||||
obj[method.toLowerCase()](value);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing input parameter failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function TestInOutMethod(obj, method, inValue, outValue)
|
||||
{
|
||||
printDebug("TestInOutMethod - " + method);
|
||||
try
|
||||
{
|
||||
var param = { value : inValue };
|
||||
obj[method](param);
|
||||
reportCompare(outValue, param.value, "Testing in/out parameter: " + method);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing in/out parameter failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
printStatus("Testing methods");
|
||||
var obj = COMObject(CLSID_nsXPCDispTestMethods);
|
||||
try
|
||||
{
|
||||
obj.NoParameters();
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("NoParameters failed: " + e.toString());
|
||||
}
|
||||
printStatus("Test method - Return values");
|
||||
TestReturnMethod(obj, "ReturnBSTR", "Boo");
|
||||
TestReturnMethod(obj, "ReturnI4",99999);
|
||||
TestReturnMethod(obj, "ReturnUI1", 99);
|
||||
TestReturnMethod(obj, "ReturnI2",9999);
|
||||
TestReturnMethod(obj, "ReturnR4",99999.1);
|
||||
TestReturnMethod(obj, "ReturnR8", 99999999999.99);
|
||||
TestReturnMethod(obj, "ReturnBool", true);
|
||||
|
||||
printStatus("TestReturnMethod - ReturnIDispatch");
|
||||
compareObject(obj.ReturnIDispatch(), nsXPCDispSimpleDesc, "Test method - Return IDispatch");
|
||||
var E_FAIL= -2147467259;
|
||||
TestReturnMethod(obj, "ReturnError", E_FAIL);
|
||||
TestReturnMethod(obj, "ReturnDate", "5/2/2002");
|
||||
// TestReturnMethod(obj, ReturnIUnknown(IUnknown * * result)
|
||||
TestReturnMethod(obj, "ReturnI1", 120);
|
||||
TestReturnMethod(obj, "ReturnUI2", 9999);
|
||||
TestReturnMethod(obj, "ReturnUI4", 3000000000);
|
||||
TestReturnMethod(obj, "ReturnInt", -999999);
|
||||
TestReturnMethod(obj, "ReturnUInt", 3000000000);
|
||||
|
||||
printStatus("Test method - Input params");
|
||||
TestInputMethod(obj, "TakesBSTR", "TakesBSTR");
|
||||
TestInputMethod(obj, "TakesI4", 999999);
|
||||
TestInputMethod(obj, "TakesUI1", 42);
|
||||
TestInputMethod(obj, "TakesI2", 32000);
|
||||
TestInputMethod(obj, "TakesR4", 99999.99);
|
||||
TestInputMethod(obj, "TakesR8", 999999999.99);
|
||||
TestInputMethod(obj, "TakesBool", true);
|
||||
var x = { Number : 5, ClassName : "nsXPCDispSimple" };
|
||||
TestInputMethod(obj, "TakesIDispatch", x);
|
||||
// This would always fail, type mismatch (no way to indicate this is going
|
||||
// to an error, and there's no automatic conversion from integers to error
|
||||
// codes
|
||||
// TestInputMethod(obj, "TakesError", E_FAIL);
|
||||
TestInputMethod(obj, "TakesDate", "5/2/2002");
|
||||
// TestInputMethod(obj, TakesIUnknown, );
|
||||
TestInputMethod(obj, "TakesI1", 42);
|
||||
TestInputMethod(obj, "TakesUI2", 50000);
|
||||
TestInputMethod(obj, "TakesUI4", 4026531840);
|
||||
TestInputMethod(obj, "TakesInt", -10000000);
|
||||
TestInputMethod(obj, "TakesUInt", 3758096384);
|
||||
|
||||
printStatus("Test method - Output params");
|
||||
TestOutMethod(obj, "OutputsBSTR", "Boo");
|
||||
TestOutMethod(obj, "OutputsI4",99999);
|
||||
TestOutMethod(obj, "OutputsUI1", 99);
|
||||
TestOutMethod(obj, "OutputsI2",9999);
|
||||
TestOutMethod(obj, "OutputsR4",999999.1);
|
||||
TestOutMethod(obj, "OutputsR8", 99999999999.99);
|
||||
TestOutMethod(obj, "OutputsBool", true);
|
||||
|
||||
var outParam = new Object();
|
||||
obj.OutputsIDispatch(outParam);
|
||||
compareObject(outParam.value, nsXPCDispSimpleDesc, "Test method - Output params");
|
||||
TestOutMethod(obj, "OutputsError", E_FAIL);
|
||||
TestOutMethod(obj, "OutputsDate", "5/2/2002");
|
||||
// TestOutMethod(obj, OutputsIUnknown(IUnknown * * result)
|
||||
TestOutMethod(obj, "OutputsI1", 120);
|
||||
TestOutMethod(obj, "OutputsUI2", 9999);
|
||||
TestOutMethod(obj, "OutputsUI4", 3000000000);
|
||||
|
||||
printStatus("Test method - In/out params");
|
||||
TestInOutMethod(obj, "InOutsBSTR", "String", "StringAppended");
|
||||
TestInOutMethod(obj, "InOutsI4", 2000000, -2000000);
|
||||
TestInOutMethod(obj, "InOutsUI1", 50, 8);
|
||||
TestInOutMethod(obj, "InOutsI2", -1000, 9000);
|
||||
TestInOutMethod(obj, "InOutsR4", -2.05, 3.0);
|
||||
TestInOutMethod(obj, "InOutsR8", -5.5, 49999994.50000005);
|
||||
TestInOutMethod(obj, "InOutsBool", true, false);
|
||||
TestInOutMethod(obj, "InOutsBool", false, true);
|
||||
var inoutParam = { value : {ClassName : "InOutTest", Number : 10 } };
|
||||
try
|
||||
{
|
||||
obj.InOutsIDispatch(inoutParam);
|
||||
if (inoutParam.value.Number != 15)
|
||||
reportFailure("Testing in/out parameter failed: IDispatch");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing in/out parameter failed: IDispatch - " + e.toString());
|
||||
}
|
||||
// See the TakesError case
|
||||
//TestInOutMethod(obj, "InOutsError", E_FAIL, E_FAIL + 1);
|
||||
TestInOutMethod(obj, "InOutsDate", "5/23/2001", "5/24/2001");
|
||||
//TestInOutMethod(obj, InOutsIUnknown(IUnknown * * result)
|
||||
TestInOutMethod(obj, "InOutsI1", -42, -41);
|
||||
TestInOutMethod(obj, "InOutsUI2", 43, 85);
|
||||
TestInOutMethod(obj, "InOutsUI4", 88, 46);
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(obj.OneParameterWithReturn(-20), 22, "Testing OneParameterWithReturn");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing OneParameterWithReturn: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(obj.StringInputAndReturn("A String "), "A String Appended", "Testing StringInputAndReturn");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing StringInputAndReturn: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
var inoutIDispatch = { className : "inouttest", Number : 5 };
|
||||
var result = obj.IDispatchInputAndReturn(inoutIDispatch);
|
||||
reportCompare(81, result.Number, "IDispatchInputAndReturn");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing IDispatchInputAndReturn: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
obj.TwoParameters(1, 2);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwoParameters: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
obj.TwelveInParameters(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveInParameters: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var out1 = new Object();
|
||||
var out2 = new Object();
|
||||
var out3 = new Object();
|
||||
var out4 = new Object();
|
||||
var out5 = new Object();
|
||||
var out6 = new Object();
|
||||
var out7 = new Object();
|
||||
var out8 = new Object();
|
||||
var out9 = new Object();
|
||||
var out10 = new Object();
|
||||
var out11 = new Object();
|
||||
var out12 = new Object();
|
||||
obj.TwelveOutParameters(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
reportCompare(78, out1.value + out2.value + out3.value + out4.value + out5.value + out6.value + out7.value + out8.value + out9.value + out10.value + out11.value + out12.value, "Testing TwelveOutParameters");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveOutParameters: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
obj.TwelveStrings("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveStrings: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var out1 = new Object();
|
||||
var out2 = new Object();
|
||||
var out3 = new Object();
|
||||
var out4 = new Object();
|
||||
var out5 = new Object();
|
||||
var out6 = new Object();
|
||||
var out7 = new Object();
|
||||
var out8 = new Object();
|
||||
var out9 = new Object();
|
||||
var out10 = new Object();
|
||||
var out11 = new Object();
|
||||
var out12 = new Object();
|
||||
obj.TwelveOutStrings(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
reportCompare(true, out1.value == "one" && out2.value == "two" &&
|
||||
out3.value == "three" && out4.value == "four" &&
|
||||
out5.value == "five" && out6.value == "six" &&
|
||||
out7.value == "seven" && out8.value == "eight" &&
|
||||
out9.value == "nine" && out10.value == "ten" &&
|
||||
out11.value == "eleven" && out12.value == "twelve",
|
||||
"Testing TwelveOutString");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveOutParameters: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
var out1 = { className : "out1", Number : 5 };
|
||||
var out2 = { className : "out2", Number : 5 };
|
||||
var out3 = { className : "out3", Number : 5 };
|
||||
var out4 = { className : "out4", Number : 5 };
|
||||
var out5 = { className : "out5", Number : 5 };
|
||||
var out6 = { className : "out6", Number : 5 };
|
||||
var out7 = { className : "out7", Number : 5 };
|
||||
var out8 = { className : "out8", Number : 5 };
|
||||
var out9 = { className : "out9", Number : 5 };
|
||||
var out10 = { className : "out10", Number : 5 };
|
||||
var out11 = { className : "out11", Number : 5 };
|
||||
var out12 = { className : "out12", Number : 5 };
|
||||
obj.TwelveIDispatch(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveIDispatch: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
var out1 = new Object();
|
||||
var out2 = new Object();
|
||||
var out3 = new Object();
|
||||
var out4 = new Object();
|
||||
var out5 = new Object();
|
||||
var out6 = new Object();
|
||||
var out7 = new Object();
|
||||
var out8 = new Object();
|
||||
var out9 = new Object();
|
||||
var out10 = new Object();
|
||||
var out11 = new Object();
|
||||
var out12 = new Object();
|
||||
obj.TwelveOutIDispatch(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
print("out1.value" + out1.value.Number);
|
||||
reportCompare(true, out1.value.Number == 5 && out2.value.Number == 5 &&
|
||||
out3.value.Number == 5 && out4.value.Number == 5 &&
|
||||
out5.value.Number == 5 && out6.value.Number == 5 &&
|
||||
out7.value.Number == 5 && out8.value.Number == 5 &&
|
||||
out9.value.Number == 5 && out10.value.Number == 5 &&
|
||||
out11.value.Number == 5 && out12.value.Number == 5,
|
||||
"Testing TwelveOutIDispatch");
|
||||
compareObject(out1.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out1");
|
||||
compareObject(out2.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out2");
|
||||
compareObject(out3.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out3");
|
||||
compareObject(out4.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out4");
|
||||
compareObject(out5.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out5");
|
||||
compareObject(out6.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out6");
|
||||
compareObject(out7.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out7");
|
||||
compareObject(out8.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out8");
|
||||
compareObject(out9.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out9");
|
||||
compareObject(out10.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out10");
|
||||
compareObject(out11.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out11");
|
||||
compareObject(out12.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out12");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveOutIDispatch: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
obj.CreateError();
|
||||
reportFailure("Testing CreateError: Didn't generate a catchable exception");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportCompare(true, e.toString().search("CreateError Test") != -1, "Testing CreateError");
|
||||
}
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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 Communicator client code, released March
|
||||
* 31, 1998.
|
||||
*
|
||||
* 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):
|
||||
* Rob Ginda rginda@netscape.com
|
||||
*/
|
||||
|
||||
FAILED = "FAILED!: ";
|
||||
STATUS = "STATUS: ";
|
||||
BUGNUMBER = "BUGNUMBER: ";
|
||||
DEBUGLINE = "DEBUG: ";
|
||||
|
||||
DEBUG = false;
|
||||
VERBOSE = false;
|
||||
|
||||
var CLSID_nsXPCDispSimple = "{9F39237C-D179-4260-8EF3-4B6D4D7D5570}";
|
||||
var ProgID_nsXPCDispSimple = "XPCIDispatchTest.nsXPCDispSimple.1";
|
||||
var nsXPCDispSimpleDesc =
|
||||
{
|
||||
name : "nsXPCDispSimple",
|
||||
cid : CLSID_nsXPCDispSimple,
|
||||
progid : ProgID_nsXPCDispSimple,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ClassName",
|
||||
"Number"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestMethods = "{745D1149-9F46-418C-B176-71EAA98974BA}";
|
||||
var ProgID_nsXPCDispTestMethods = "XPCIDispatchTest.nsXPCDispTestMethods.1";
|
||||
var nsXPCDispTestMethodsDesc =
|
||||
{
|
||||
name : "nsXPCDispTestMethods",
|
||||
cid : CLSID_nsXPCDispTestMethods,
|
||||
progid : ProgID_nsXPCDispTestMethods,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"NoParameters", "ReturnBSTR", "ReturnI4",
|
||||
"ReturnUI1", "ReturnI2", "ReturnR4", "ReturnR8", "ReturnBool",
|
||||
"ReturnIDispatch", "ReturnError", "ReturnDate",
|
||||
"ReturnIUnknown", "ReturnI1", "ReturnUI2", "ReturnUI4",
|
||||
"ReturnInt", "ReturnUInt", "TakesBSTR", "TakesI4", "TakesUI1",
|
||||
"TakesI2", "TakesR4", "TakesR8", "TakesBool",
|
||||
"TakesIDispatch", "TakesError", "TakesDate", "TakesIUnknown",
|
||||
"TakesI1", "TakesUI2", "TakesUI4", "TakesInt", "TakesUInt",
|
||||
"OutputsBSTR", "OutputsI4", "OutputsUI1", "OutputsI2",
|
||||
"OutputsR4", "OutputsR8", "OutputsBool", "OutputsIDispatch",
|
||||
"OutputsError", "OutputsDate", "OutputsIUnknown", "OutputsI1",
|
||||
"OutputsUI2", "OutputsUI4", "InOutsBSTR", "InOutsI4",
|
||||
"InOutsUI1", "InOutsI2", "InOutsR4", "InOutsR8", "InOutsBool",
|
||||
"InOutsIDispatch", "InOutsError", "InOutsDate",
|
||||
"InOutsIUnknown", "InOutsI1", "InOutsUI2", "InOutsUI4",
|
||||
"InOutsInt", "InOutsUInt", "OneParameterWithReturn",
|
||||
"StringInputAndReturn", "IDispatchInputAndReturn",
|
||||
"TwoParameters", "TwelveInParameters", "TwelveOutParameters",
|
||||
"TwelveStrings", "TwelveOutStrings", "TwelveIDispatch",
|
||||
"TwelveOutIDispatch", "CreateError"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestArrays = "{AB085C43-C619-48C8-B68C-C495BDE12DFB}";
|
||||
var ProgID_nsXPCDispTestArrays = "XPCIDispatchTest.nsXPCDispTestArrays.1";
|
||||
var nsXPCDispTestArraysDesc =
|
||||
{
|
||||
name : "nsXPCDispTestArrays",
|
||||
cid : CLSID_nsXPCDispTestArrays,
|
||||
progid : ProgID_nsXPCDispTestArrays,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ReturnSafeArray", "ReturnSafeArrayBSTR", "ReturnSafeArrayIDispatch",
|
||||
"TakesSafeArray", "TakesSafeArrayBSTR", "TakesSafeArrayIDispatch",
|
||||
"InOutSafeArray", "InOutSafeArrayBSTR", "InOutSafeArrayIDispatch"
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var CLSID_nsXPCDispTestNoIDispatch = "{7414404F-A4CC-4E3C-9B32-BB20CB22F541}";
|
||||
var ProgID_nsXPCDispTestNoIDispatch = "XPCIDispatchTest.nsXPCDispTestNoIDispatch.1";
|
||||
|
||||
var CLSID_nsXPCDispTestNoScript = "{F8D54F00-4FC4-4731-B467-10F1CB8DB0AD}";
|
||||
var ProgID_nsXPCDispTestNoScript = "XPCIDispatchTest.nsXPCDispTestNoScript.1";
|
||||
|
||||
var CLSID_nsXPCDispTestProperties = "{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}";
|
||||
var ProgID_nsXPCDispTestProperties = "XPCIDispatchTest.nsXPCDispTestProperties.1";
|
||||
var nsXPCDispTestPropertiesDesc =
|
||||
{
|
||||
name : "nsXPCDispTestProperties",
|
||||
cid : CLSID_nsXPCDispTestProperties,
|
||||
progid : ProgID_nsXPCDispTestProperties,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"Short", "Long", "Float", "Double", "Currency",
|
||||
"Date", "String", "DispatchPtr", "SCode", "Boolean", "Variant",
|
||||
"COMPtr", "Char"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOn = "{2A06373F-3E61-4882-A3D7-A104F70B09ED}";
|
||||
var ProgID_nsXPCDispTestScriptOn = "XPCIDispatchTest.nsXPCDispTestScriptOn.1";
|
||||
var nsXPCDispTestScriptOnDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOn",
|
||||
cid : CLSID_nsXPCDispTestScriptOn,
|
||||
progid : ProgID_nsXPCDispTestScriptOn,
|
||||
scriptable : true,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOff = "{959CD122-9826-4757-BA09-DE327D55F9E7}";
|
||||
var ProgID_nsXPCDispTestScriptOff = "XPCIDispatchTest.nsXPCDispTestScriptOff.1";
|
||||
var nsXPCDispTestScriptOffDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOff",
|
||||
cid : CLSID_nsXPCDispTestScriptOff,
|
||||
progid : ProgID_nsXPCDispTestScriptOff,
|
||||
scriptable : false,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestWrappedJS = "{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}";
|
||||
var ProgID_nsXPCDispTestWrappedJS = "XPCIDispatchTest.nsXPCDispTestWrappedJS.1";
|
||||
var nsXPCDispTestWrappedJSDesc =
|
||||
{
|
||||
name : "nsXPCDispTestWrappedJS",
|
||||
cid : CLSID_nsXPCDispTestWrappedJS,
|
||||
progid : ProgID_nsXPCDispTestWrappedJS,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"TestParamTypes"
|
||||
]
|
||||
};
|
||||
|
||||
// create list of COM components
|
||||
var objectsDesc =
|
||||
[
|
||||
nsXPCDispSimpleDesc,
|
||||
nsXPCDispTestMethodsDesc,
|
||||
nsXPCDispTestArraysDesc,
|
||||
nsXPCDispTestPropertiesDesc,
|
||||
nsXPCDispTestScriptOnDesc,
|
||||
nsXPCDispTestScriptOffDesc,
|
||||
nsXPCDispTestWrappedJSDesc
|
||||
];
|
||||
|
||||
function findProp(prop, array, marked)
|
||||
{
|
||||
len = array.length;
|
||||
for (index = 0; index < len; ++index)
|
||||
{
|
||||
if (prop == array[index])
|
||||
{
|
||||
marked[index] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function compareObject(obj, objDesc, testName)
|
||||
{
|
||||
if (obj == undefined)
|
||||
{
|
||||
reportFailure("compareObject passed an invalid object");
|
||||
return;
|
||||
}
|
||||
var marked = new Array();
|
||||
for (prop in obj)
|
||||
{
|
||||
printDebug("Found " + prop);
|
||||
reportCompare(
|
||||
true,
|
||||
findProp(prop, objDesc.methods, marked),
|
||||
testName + ": " + prop + " exists on " + objDesc.name + ", but was not expected");
|
||||
}
|
||||
len = objDesc.methods.length;
|
||||
for (var index = 0; index < len; ++index)
|
||||
{
|
||||
reportCompare(
|
||||
true,
|
||||
marked[index],
|
||||
testName + ": " + objDesc.methods[index] + " does not exist on " + objDesc.name);
|
||||
}
|
||||
}
|
||||
|
||||
function compareExpression(expression, expectedResult, testName)
|
||||
{
|
||||
if (VERBOSE && (typeof testName != "undefined"))
|
||||
printStatus(testName + " - evaluating:" + expression);
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
expectedResult,
|
||||
eval(expression),
|
||||
testName);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure(expression + " generated the following exception:" + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
var callStack = new Array();
|
||||
|
||||
/*
|
||||
* Report a failure in the 'accepted' manner
|
||||
*/
|
||||
function reportFailure (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
var funcName = currentFunc();
|
||||
var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (FAILED + prefix + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printDebug (msg)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (DEBUGLINE + lines[i]);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printStatus (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (STATUS + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a bugnumber message.
|
||||
*/
|
||||
function printBugNumber (num)
|
||||
{
|
||||
|
||||
print (BUGNUMBER + num);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare expected result to actual result, if they differ (in value and/or
|
||||
* type) report a failure. If description is provided, include it in the
|
||||
* failure report.
|
||||
*/
|
||||
function reportCompare (expected, actual, description)
|
||||
{
|
||||
var expected_t = typeof expected;
|
||||
var actual_t = typeof actual;
|
||||
var output = "";
|
||||
|
||||
if ((VERBOSE) && (typeof description != "undefined"))
|
||||
printStatus ("Comparing '" + description + "'");
|
||||
|
||||
if (expected_t != actual_t)
|
||||
output += "Type mismatch, expected type " + expected_t +
|
||||
", actual type " + actual_t + "\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected type '" + actual_t + "' matched actual " +
|
||||
"type '" + expected_t + "'");
|
||||
|
||||
if (expected != actual)
|
||||
output += "Expected value '" + expected + "', Actual value '" + actual +
|
||||
"'\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected value '" + actual + "' matched actual " +
|
||||
"value '" + expected + "'");
|
||||
|
||||
if (output != "")
|
||||
{
|
||||
if (typeof description != "undefined")
|
||||
reportFailure (description);
|
||||
reportFailure (output);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Puts funcName at the top of the call stack. This stack is used to show
|
||||
* a function-reported-from field when reporting failures.
|
||||
*/
|
||||
function enterFunc (funcName)
|
||||
{
|
||||
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
callStack.push(funcName);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Pops the top funcName off the call stack. funcName is optional, and can be
|
||||
* used to check push-pop balance.
|
||||
*/
|
||||
function exitFunc (funcName)
|
||||
{
|
||||
var lastFunc = callStack.pop();
|
||||
|
||||
if (funcName)
|
||||
{
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
if (lastFunc != funcName)
|
||||
reportFailure ("Test driver failure, expected to exit function '" +
|
||||
funcName + "' but '" + lastFunc + "' came off " +
|
||||
"the stack");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Peeks at the top of the call stack.
|
||||
*/
|
||||
function currentFunc()
|
||||
{
|
||||
|
||||
return callStack[callStack.length - 1];
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* \file
|
||||
* This file contains the tests for making sure that JS Objects access via the IDispatch interface
|
||||
* work properly
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function test()
|
||||
{
|
||||
try
|
||||
{
|
||||
var variantObj = Components.classes["@mozilla.org/variant;1"].createInstance(Components.interfaces.nsIVariant);
|
||||
var jsobj =
|
||||
{
|
||||
Boolean : false,
|
||||
Short : 0,
|
||||
Long : 0,
|
||||
Float : 0.0,
|
||||
Double : 0.0,
|
||||
Currency : 0.0,
|
||||
Date : new Date(),
|
||||
String : "",
|
||||
DispatchPtr : {},
|
||||
SCode : 0,
|
||||
Variant : variantObj,
|
||||
Char : 'a'
|
||||
};
|
||||
var obj = COMObject(CLSID_nsXPCDispTestWrappedJS);
|
||||
reportCompare(
|
||||
obj.TestParamTypes(jsobj),
|
||||
"",
|
||||
"Testing IDispatch wrapped JS objects");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure(e.toString());
|
||||
}
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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 Communicator client code, released March
|
||||
* 31, 1998.
|
||||
*
|
||||
* 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):
|
||||
* Rob Ginda rginda@netscape.com
|
||||
*/
|
||||
|
||||
FAILED = "FAILED!: ";
|
||||
STATUS = "STATUS: ";
|
||||
BUGNUMBER = "BUGNUMBER: ";
|
||||
DEBUGLINE = "DEBUG: ";
|
||||
|
||||
DEBUG = false;
|
||||
VERBOSE = false;
|
||||
|
||||
var CLSID_nsXPCDispSimple = "{9F39237C-D179-4260-8EF3-4B6D4D7D5570}";
|
||||
var ProgID_nsXPCDispSimple = "XPCIDispatchTest.nsXPCDispSimple.1";
|
||||
var nsXPCDispSimpleDesc =
|
||||
{
|
||||
name : "nsXPCDispSimple",
|
||||
cid : CLSID_nsXPCDispSimple,
|
||||
progid : ProgID_nsXPCDispSimple,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ClassName",
|
||||
"Number"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestMethods = "{745D1149-9F46-418C-B176-71EAA98974BA}";
|
||||
var ProgID_nsXPCDispTestMethods = "XPCIDispatchTest.nsXPCDispTestMethods.1";
|
||||
var nsXPCDispTestMethodsDesc =
|
||||
{
|
||||
name : "nsXPCDispTestMethods",
|
||||
cid : CLSID_nsXPCDispTestMethods,
|
||||
progid : ProgID_nsXPCDispTestMethods,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"NoParameters", "ReturnBSTR", "ReturnI4",
|
||||
"ReturnUI1", "ReturnI2", "ReturnR4", "ReturnR8", "ReturnBool",
|
||||
"ReturnIDispatch", "ReturnError", "ReturnDate",
|
||||
"ReturnIUnknown", "ReturnI1", "ReturnUI2", "ReturnUI4",
|
||||
"ReturnInt", "ReturnUInt", "TakesBSTR", "TakesI4", "TakesUI1",
|
||||
"TakesI2", "TakesR4", "TakesR8", "TakesBool",
|
||||
"TakesIDispatch", "TakesError", "TakesDate", "TakesIUnknown",
|
||||
"TakesI1", "TakesUI2", "TakesUI4", "TakesInt", "TakesUInt",
|
||||
"OutputsBSTR", "OutputsI4", "OutputsUI1", "OutputsI2",
|
||||
"OutputsR4", "OutputsR8", "OutputsBool", "OutputsIDispatch",
|
||||
"OutputsError", "OutputsDate", "OutputsIUnknown", "OutputsI1",
|
||||
"OutputsUI2", "OutputsUI4", "InOutsBSTR", "InOutsI4",
|
||||
"InOutsUI1", "InOutsI2", "InOutsR4", "InOutsR8", "InOutsBool",
|
||||
"InOutsIDispatch", "InOutsError", "InOutsDate",
|
||||
"InOutsIUnknown", "InOutsI1", "InOutsUI2", "InOutsUI4",
|
||||
"InOutsInt", "InOutsUInt", "OneParameterWithReturn",
|
||||
"StringInputAndReturn", "IDispatchInputAndReturn",
|
||||
"TwoParameters", "TwelveInParameters", "TwelveOutParameters",
|
||||
"TwelveStrings", "TwelveOutStrings", "TwelveIDispatch",
|
||||
"TwelveOutIDispatch", "CreateError"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestArrays = "{AB085C43-C619-48C8-B68C-C495BDE12DFB}";
|
||||
var ProgID_nsXPCDispTestArrays = "XPCIDispatchTest.nsXPCDispTestArrays.1";
|
||||
var nsXPCDispTestArraysDesc =
|
||||
{
|
||||
name : "nsXPCDispTestArrays",
|
||||
cid : CLSID_nsXPCDispTestArrays,
|
||||
progid : ProgID_nsXPCDispTestArrays,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ReturnSafeArray", "ReturnSafeArrayBSTR", "ReturnSafeArrayIDispatch",
|
||||
"TakesSafeArray", "TakesSafeArrayBSTR", "TakesSafeArrayIDispatch",
|
||||
"InOutSafeArray", "InOutSafeArrayBSTR", "InOutSafeArrayIDispatch"
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var CLSID_nsXPCDispTestNoIDispatch = "{7414404F-A4CC-4E3C-9B32-BB20CB22F541}";
|
||||
var ProgID_nsXPCDispTestNoIDispatch = "XPCIDispatchTest.nsXPCDispTestNoIDispatch.1";
|
||||
|
||||
var CLSID_nsXPCDispTestNoScript = "{F8D54F00-4FC4-4731-B467-10F1CB8DB0AD}";
|
||||
var ProgID_nsXPCDispTestNoScript = "XPCIDispatchTest.nsXPCDispTestNoScript.1";
|
||||
|
||||
var CLSID_nsXPCDispTestProperties = "{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}";
|
||||
var ProgID_nsXPCDispTestProperties = "XPCIDispatchTest.nsXPCDispTestProperties.1";
|
||||
var nsXPCDispTestPropertiesDesc =
|
||||
{
|
||||
name : "nsXPCDispTestProperties",
|
||||
cid : CLSID_nsXPCDispTestProperties,
|
||||
progid : ProgID_nsXPCDispTestProperties,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"Short", "Long", "Float", "Double", "Currency",
|
||||
"Date", "String", "DispatchPtr", "SCode", "Boolean", "Variant",
|
||||
"COMPtr", "Char"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOn = "{2A06373F-3E61-4882-A3D7-A104F70B09ED}";
|
||||
var ProgID_nsXPCDispTestScriptOn = "XPCIDispatchTest.nsXPCDispTestScriptOn.1";
|
||||
var nsXPCDispTestScriptOnDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOn",
|
||||
cid : CLSID_nsXPCDispTestScriptOn,
|
||||
progid : ProgID_nsXPCDispTestScriptOn,
|
||||
scriptable : true,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOff = "{959CD122-9826-4757-BA09-DE327D55F9E7}";
|
||||
var ProgID_nsXPCDispTestScriptOff = "XPCIDispatchTest.nsXPCDispTestScriptOff.1";
|
||||
var nsXPCDispTestScriptOffDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOff",
|
||||
cid : CLSID_nsXPCDispTestScriptOff,
|
||||
progid : ProgID_nsXPCDispTestScriptOff,
|
||||
scriptable : false,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestWrappedJS = "{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}";
|
||||
var ProgID_nsXPCDispTestWrappedJS = "XPCIDispatchTest.nsXPCDispTestWrappedJS.1";
|
||||
var nsXPCDispTestWrappedJSDesc =
|
||||
{
|
||||
name : "nsXPCDispTestWrappedJS",
|
||||
cid : CLSID_nsXPCDispTestWrappedJS,
|
||||
progid : ProgID_nsXPCDispTestWrappedJS,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"TestParamTypes"
|
||||
]
|
||||
};
|
||||
|
||||
// create list of COM components
|
||||
var objectsDesc =
|
||||
[
|
||||
nsXPCDispSimpleDesc,
|
||||
nsXPCDispTestMethodsDesc,
|
||||
nsXPCDispTestArraysDesc,
|
||||
nsXPCDispTestPropertiesDesc,
|
||||
nsXPCDispTestScriptOnDesc,
|
||||
nsXPCDispTestScriptOffDesc,
|
||||
nsXPCDispTestWrappedJSDesc
|
||||
];
|
||||
|
||||
function findProp(prop, array, marked)
|
||||
{
|
||||
len = array.length;
|
||||
for (index = 0; index < len; ++index)
|
||||
{
|
||||
if (prop == array[index])
|
||||
{
|
||||
marked[index] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function compareObject(obj, objDesc, testName)
|
||||
{
|
||||
if (obj == undefined)
|
||||
{
|
||||
reportFailure("compareObject passed an invalid object");
|
||||
return;
|
||||
}
|
||||
var marked = new Array();
|
||||
for (prop in obj)
|
||||
{
|
||||
printDebug("Found " + prop);
|
||||
reportCompare(
|
||||
true,
|
||||
findProp(prop, objDesc.methods, marked),
|
||||
testName + ": " + prop + " exists on " + objDesc.name + ", but was not expected");
|
||||
}
|
||||
len = objDesc.methods.length;
|
||||
for (var index = 0; index < len; ++index)
|
||||
{
|
||||
reportCompare(
|
||||
true,
|
||||
marked[index],
|
||||
testName + ": " + objDesc.methods[index] + " does not exist on " + objDesc.name);
|
||||
}
|
||||
}
|
||||
|
||||
function compareExpression(expression, expectedResult, testName)
|
||||
{
|
||||
if (VERBOSE && (typeof testName != "undefined"))
|
||||
printStatus(testName + " - evaluating:" + expression);
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
expectedResult,
|
||||
eval(expression),
|
||||
testName);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure(expression + " generated the following exception:" + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
var callStack = new Array();
|
||||
|
||||
/*
|
||||
* Report a failure in the 'accepted' manner
|
||||
*/
|
||||
function reportFailure (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
var funcName = currentFunc();
|
||||
var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (FAILED + prefix + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printDebug (msg)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (DEBUGLINE + lines[i]);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printStatus (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (STATUS + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a bugnumber message.
|
||||
*/
|
||||
function printBugNumber (num)
|
||||
{
|
||||
|
||||
print (BUGNUMBER + num);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare expected result to actual result, if they differ (in value and/or
|
||||
* type) report a failure. If description is provided, include it in the
|
||||
* failure report.
|
||||
*/
|
||||
function reportCompare (expected, actual, description)
|
||||
{
|
||||
var expected_t = typeof expected;
|
||||
var actual_t = typeof actual;
|
||||
var output = "";
|
||||
|
||||
if ((VERBOSE) && (typeof description != "undefined"))
|
||||
printStatus ("Comparing '" + description + "'");
|
||||
|
||||
if (expected_t != actual_t)
|
||||
output += "Type mismatch, expected type " + expected_t +
|
||||
", actual type " + actual_t + "\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected type '" + actual_t + "' matched actual " +
|
||||
"type '" + expected_t + "'");
|
||||
|
||||
if (expected != actual)
|
||||
output += "Expected value '" + expected + "', Actual value '" + actual +
|
||||
"'\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected value '" + actual + "' matched actual " +
|
||||
"value '" + expected + "'");
|
||||
|
||||
if (output != "")
|
||||
{
|
||||
if (typeof description != "undefined")
|
||||
reportFailure (description);
|
||||
reportFailure (output);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Puts funcName at the top of the call stack. This stack is used to show
|
||||
* a function-reported-from field when reporting failures.
|
||||
*/
|
||||
function enterFunc (funcName)
|
||||
{
|
||||
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
callStack.push(funcName);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Pops the top funcName off the call stack. funcName is optional, and can be
|
||||
* used to check push-pop balance.
|
||||
*/
|
||||
function exitFunc (funcName)
|
||||
{
|
||||
var lastFunc = callStack.pop();
|
||||
|
||||
if (funcName)
|
||||
{
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
if (lastFunc != funcName)
|
||||
reportFailure ("Test driver failure, expected to exit function '" +
|
||||
funcName + "' but '" + lastFunc + "' came off " +
|
||||
"the stack");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Peeks at the top of the call stack.
|
||||
*/
|
||||
function currentFunc()
|
||||
{
|
||||
|
||||
return callStack[callStack.length - 1];
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
perl jsDriver.pl -e xpcshell %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user