Removing unused code and code that was #if 0'ed out on the XPCDOM branch and left in when the branch landed. No code changes.

This commit is contained in:
jst%netscape.com 2001-05-13 10:33:33 +00:00
parent 3111d0b6b9
commit 774b3c62cf
6 changed files with 0 additions and 566 deletions

View File

@ -97,9 +97,6 @@
#include "nsLayoutAtoms.h"
#include "xptinfo.h"
#include "nsIInterfaceInfoManager.h"
#include "nsIPluginInstance.h"
#include "nsIScriptablePlugin.h"
#include "nsIXPConnect.h"
#include "nsIServiceManager.h"
#include "nsIParser.h"
@ -113,10 +110,6 @@ static NS_DEFINE_CID(kPresStateCID, NS_PRESSTATE_CID);
#include "nsIPref.h" // Used by the temp pref, should be removed!
#include "nsIPluginHost.h"
#include "nsPIPluginHost.h"
static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
//----------------------------------------------------------------------
class nsDOMCSSAttributeDeclaration : public nsDOMCSSDeclaration
@ -4114,211 +4107,3 @@ nsGenericHTMLElement::SetElementFocus(PRBool aDoFocus)
return RemoveFocus(presContext);
}
#if 0 // XXX
nsresult
nsGenericHTMLElement::GetPluginInstance(nsIPluginInstance** aPluginInstance)
{
NS_ENSURE_ARG_POINTER(aPluginInstance);
*aPluginInstance = nsnull;
nsresult result;
nsCOMPtr<nsIPresContext> context;
nsCOMPtr<nsIPresShell> shell;
if (mDocument) {
// Make sure the presentation is up-to-date
result = mDocument->FlushPendingNotifications();
if (NS_FAILED(result)) {
return result;
}
}
GetPresContext(this, getter_AddRefs(context));
if (!context) {
return NS_OK;
}
context->GetShell(getter_AddRefs(shell));
if (!shell) {
return NS_OK;
}
nsIFrame* frame = nsnull;
shell->GetPrimaryFrameFor(this, &frame);
if (!frame) {
return NS_OK;
}
nsIObjectFrame* objectFrame = nsnull;
frame->QueryInterface(NS_GET_IID(nsIObjectFrame),(void**)&objectFrame);
if (objectFrame) {
objectFrame->GetPluginInstance(*aPluginInstance);
} else {
NS_WARNING("frame should have been an object frame");
}
return NS_OK;
}
/*
* For plugins, we want to expose both attributes of the plugin tag
* and any scriptable methods that the plugin itself exposes. To do
* this, we get the plugin object itself (the XPCOM object) and wrap
* it as a scriptable object via xpconnect. We then set the original
* node element, which exposes the DOM node methods, as the javascript
* prototype object of that object. Then we get both sets of methods, and
* plugin methods can potentially override DOM methods.
*/
nsresult
nsGenericHTMLElement::GetPluginScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
if (mDOMSlots && mDOMSlots->mScriptObject)
return nsGenericElement::GetScriptObject(aContext, aScriptObject);
nsresult rv;
*aScriptObject = nsnull;
// Get the JS object corresponding to this dom node. This will become
// the javascript prototype object of the object we eventually reflect to the
// DOM.
JSObject* elementObject = nsnull;
rv = nsGenericElement::GetScriptObject(aContext, (void**)&elementObject);
if (NS_FAILED(rv) || !elementObject)
return rv;
nsCOMPtr<nsIPluginInstance> pi;
GetPluginInstance(getter_AddRefs(pi));
// If GetPluginInstance() returns nsnull it most likely means
// there's no frame for this element yet, in that case we return the
// script object for the element but we don't cache it so that the
// next call can get the correct script object if the plugin
// instance is available at the next call.
if (!pi) {
if (mDocument) {
// Since we're resetting the script object to null we'll remove the
// reference to it so that we won't add the same named reference
// again the next time someone requests the script object.
aContext->RemoveReference((void *)&mDOMSlots->mScriptObject,
mDOMSlots->mScriptObject);
}
SetScriptObject(nsnull);
*aScriptObject = elementObject;
return NS_OK;
}
// Check if the plugin object has the nsIScriptablePlugin
// interface, describing how to expose it to JavaScript. Given this
// interface, use it to get the scriptable peer object (possibly the
// plugin object itself) and the scriptable interface to expose it
// with
nsIID scriptableInterface;
nsCOMPtr<nsISupports> scriptablePeer;
if (NS_SUCCEEDED(rv) && pi) {
nsCOMPtr<nsIScriptablePlugin> spi(do_QueryInterface(pi, &rv));
if (NS_SUCCEEDED(rv) && spi) {
nsIID *scriptableInterfacePtr = nsnull;
rv = spi->GetScriptableInterface(&scriptableInterfacePtr);
if (NS_SUCCEEDED(rv) && scriptableInterfacePtr) {
rv = spi->GetScriptablePeer(getter_AddRefs(scriptablePeer));
scriptableInterface = *scriptableInterfacePtr;
nsMemory::Free(scriptableInterfacePtr);
}
}
}
if (NS_FAILED(rv) || !scriptablePeer) {
// Fall back to returning the element object.
*aScriptObject = elementObject;
return NS_OK;
}
// notify the PluginManager that this one is scriptable --
// it will need some special treatment later
nsCOMPtr<nsIPluginHost> pluginManager = do_GetService(kCPluginManagerCID, &rv);
if(NS_SUCCEEDED(rv) && pluginManager) {
nsCOMPtr<nsPIPluginHost> pluginHost = do_QueryInterface(pluginManager, &rv);
if(NS_SUCCEEDED(rv) && pluginHost) {
pluginHost->SetIsScriptableInstance(pi, PR_TRUE);
}
}
// Wrap it.
JSObject* interfaceObject; // XPConnect-wrapped peer object, when we get it.
JSContext *cx = (JSContext *)aContext->GetNativeContext();
nsCOMPtr<nsIXPConnect> xpc =
do_GetService(nsIXPConnect::GetCID());
if (cx && xpc) {
JSObject* parentObject = JS_GetParent(cx, elementObject);
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
if (NS_SUCCEEDED(xpc->WrapNative(cx, parentObject,
scriptablePeer, scriptableInterface,
getter_AddRefs(holder))) && holder &&
NS_SUCCEEDED(holder->GetJSObject(&interfaceObject)) &&
interfaceObject) {
*aScriptObject = interfaceObject;
}
}
// If we got an xpconnect-wrapped plugin object, set its' prototype to the
// element object.
if (!*aScriptObject || !JS_SetPrototype(cx, interfaceObject,
elementObject)) {
*aScriptObject = elementObject; // fall back
return NS_OK;
}
// Cache it.
SetScriptObject(*aScriptObject);
return NS_OK;
}
// Allow access to arbitrary XPCOM interfaces supported by the plugin
// via a pluginObject.nsISomeInterface notation.
PRBool
nsGenericHTMLElement::GetPluginProperty(JSContext *aContext, JSObject *aObj,
jsval aID, jsval *aVp)
{
if (JSVAL_IS_STRING(aID)) {
PRBool retval = PR_FALSE;
char* cString = JS_GetStringBytes(JS_ValueToString(aContext, aID));
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIXPConnect> xpc =
do_GetService(nsIXPConnect::GetCID());
if (iim && xpc) {
nsIID* iid;
if (NS_SUCCEEDED(iim->GetIIDForName(cString, &iid)) && iid) {
nsCOMPtr<nsIPluginInstance> pi;
if (NS_SUCCEEDED(GetPluginInstance(getter_AddRefs(pi))) && pi) {
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
JSObject* ifaceObj;
if (NS_SUCCEEDED(xpc->WrapNative(aContext, aObj, pi, *iid,
getter_AddRefs(holder))) &&
holder && NS_SUCCEEDED(holder->GetJSObject(&ifaceObj)) &&
ifaceObj) {
*aVp = OBJECT_TO_JSVAL(ifaceObj);
retval = PR_TRUE;
}
}
nsMemory::Free(iid);
return retval;
}
}
}
return nsGenericElement::GetProperty(aContext, aObj, aID, aVp);
}
#endif

View File

@ -51,7 +51,6 @@ class nsIURI;
class nsIFormControlFrame;
class nsIForm;
class nsIPresState;
class nsIPluginInstance;
extern void GetGenericHTMLElementIIDs(nsVoidArray& aArray);
@ -557,182 +556,6 @@ protected:
//----------------------------------------------------------------------
#define NS_IMPL_HTMLCONTENT_QI0(_class, _base) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
return NS_NOINTERFACE; \
}
#define NS_IMPL_HTMLCONTENT_QI(_class, _base, _if) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if))) { \
inst = NS_STATIC_CAST(_if *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
#define NS_IMPL_HTMLCONTENT_QI2(_class, _base, _if1, _if2) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if1))) { \
inst = NS_STATIC_CAST(_if1 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if2))) { \
inst = NS_STATIC_CAST(_if2 *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
#define NS_IMPL_HTMLCONTENT_QI3(_class, _base, _if1, _if2, _if3) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if1))) { \
inst = NS_STATIC_CAST(_if1 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if2))) { \
inst = NS_STATIC_CAST(_if2 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if3))) { \
inst = NS_STATIC_CAST(_if3 *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
#define NS_IMPL_HTMLCONTENT_QI4(_class, _base, _if1, _if2, _if3, _if4) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if1))) { \
inst = NS_STATIC_CAST(_if1 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if2))) { \
inst = NS_STATIC_CAST(_if2 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if3))) { \
inst = NS_STATIC_CAST(_if3 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if4))) { \
inst = NS_STATIC_CAST(_if4 *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
/**
* A macro to implement the getter and setter for a given string
* valued content property. The method uses the generic SetAttr and

View File

@ -31,14 +31,6 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIObjectFrame.h"
#include "nsIServiceManager.h"
#include "nsIJVMManager.h"
#include "nsILiveConnectManager.h"
#include "nsIPluginInstance.h"
#include "nsIJVMPluginInstance.h"
#include "nsLayoutAtoms.h"
// XXX this is to get around conflicts with windows.h defines
@ -258,123 +250,6 @@ nsHTMLAppletElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapF
return NS_OK;
}
/**
* For backwards compatibility an applet element's JavaScript object
* should expose both the public fields of the applet, and the
* attributes of the applet tag. The call to
* nsGenericElement::GetScriptObject takes case of the tag
* attributes. Here we generate a JavaScript reference to the applet
* object itself, and set its __proto__ property to the tag
* object. That way, if the Java applet has public fields that shadow
* the tag attributes, the applet's fields take precedence.
*/
#if 0
NS_IMETHODIMP
nsHTMLAppletElement::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIJVMManager> jvm(do_GetService(nsIJVMManager::GetCID(), &rv));
if (NS_SUCCEEDED(rv)) {
if (!mReflectedApplet) {
// 0. Make sure the presentation is up-to-date
if (mDocument) {
mDocument->FlushPendingNotifications();
}
// 1. get the script object corresponding to the <APPLET> element itself.
JSObject* elementObject = nsnull;
rv = nsGenericHTMLContainerElement::GetScriptObject(aContext,
(void**)&elementObject);
if (NS_FAILED(rv))
return rv;
// 2. get the plugin instance corresponding to this element.
nsCOMPtr<nsIPresShell> shell;
if (mDocument)
shell = dont_AddRef(mDocument->GetShellAt(0));
nsIFrame* frame = nsnull;
if (shell) {
shell->GetPrimaryFrameFor(this, &frame);
}
if (frame) {
nsCOMPtr<nsIAtom> frameType;
frame->GetFrameType(getter_AddRefs(frameType));
if(nsLayoutAtoms::objectFrame != frameType.get()) {
*aScriptObject = elementObject;
return rv;
}
}
// 3. get the Java object corresponding to this applet, and
// reflect it into JavaScript using the LiveConnect manager.
JSContext* context = (JSContext*)aContext->GetNativeContext();
JSObject* wrappedAppletObject = nsnull;
nsCOMPtr<nsIPluginInstance> pluginInstance;
GetPluginInstance(getter_AddRefs(pluginInstance));
if (pluginInstance) {
nsCOMPtr<nsIJVMPluginInstance> javaPluginInstance;
javaPluginInstance = do_QueryInterface(pluginInstance);
if (javaPluginInstance) {
jobject appletObject = nsnull;
rv = javaPluginInstance->GetJavaObject(&appletObject);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsILiveConnectManager> manager;
manager = do_GetService(nsIJVMManager::GetCID());
if (manager) {
rv = manager->WrapJavaObject(context, appletObject,
&wrappedAppletObject);
}
}
}
}
// 4. set the __proto__ field of the applet object to be the
// element script object.
if (wrappedAppletObject) {
JS_SetPrototype(context, wrappedAppletObject, elementObject);
// Cache the wrapped applet object as our script object.
SetScriptObject(wrappedAppletObject);
mReflectedApplet = PR_TRUE;
*aScriptObject = wrappedAppletObject;
} else {
// We didn't wrap the applet object so we'll fall back and use
// the plain DOM script object.
*aScriptObject = elementObject;
}
}
else {
rv = nsGenericHTMLContainerElement::GetScriptObject(aContext,
aScriptObject);
}
}
else {
rv = nsGenericHTMLContainerElement::GetScriptObject(aContext,
aScriptObject);
}
return rv;
}
#endif
NS_IMETHODIMP
nsHTMLAppletElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{

View File

@ -229,25 +229,6 @@ nsHTMLEmbedElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
return NS_OK;
}
/***************************************************************************/
#if 0
NS_IMETHODIMP
nsHTMLEmbedElement::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
return GetPluginScriptObject(aContext, aScriptObject);
}
PRBool
nsHTMLEmbedElement::GetProperty(JSContext *aContext, JSObject *aObj,
jsval aID, jsval *aVp)
{
return GetPluginProperty(aContext, aObj, aID, aVp);
}
#endif
/////////////////////////////////////////////
// Implement nsIDOMHTMLEmbedElement interface
NS_IMPL_STRING_ATTR(nsHTMLEmbedElement, Align, align)

View File

@ -272,18 +272,3 @@ nsHTMLObjectElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
return NS_OK;
}
#if 0
NS_IMETHODIMP
nsHTMLObjectElement::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
return GetPluginScriptObject(aContext, aScriptObject);
}
PRBool
nsHTMLObjectElement::GetProperty(JSContext *aContext, JSObject *aObj,
jsval aID, jsval *aVp)
{
return GetPluginProperty(aContext, aObj, aID, aVp);
}
#endif

View File

@ -272,18 +272,3 @@ nsHTMLObjectElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
return NS_OK;
}
#if 0
NS_IMETHODIMP
nsHTMLObjectElement::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
return GetPluginScriptObject(aContext, aScriptObject);
}
PRBool
nsHTMLObjectElement::GetProperty(JSContext *aContext, JSObject *aObj,
jsval aID, jsval *aVp)
{
return GetPluginProperty(aContext, aObj, aID, aVp);
}
#endif