From 747ef4d6b7d4d6f046951bba3ce5a4731a1b31cf Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Sun, 14 May 2000 00:09:11 +0000 Subject: [PATCH] Making Processing instructions implement the LinkStyle interface. --- dom/src/coreDOM/nsJSProcessingInstruction.cpp | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/dom/src/coreDOM/nsJSProcessingInstruction.cpp b/dom/src/coreDOM/nsJSProcessingInstruction.cpp index 05d96ead15d..b3378e60d27 100644 --- a/dom/src/coreDOM/nsJSProcessingInstruction.cpp +++ b/dom/src/coreDOM/nsJSProcessingInstruction.cpp @@ -22,6 +22,7 @@ /* AUTO-GENERATED. DO NOT EDIT!!! */ #include "jsapi.h" +#include "jsnum.h" #include "nsJSUtils.h" #include "nsDOMError.h" #include "nscore.h" @@ -35,19 +36,24 @@ #include "nsDOMPropEnums.h" #include "nsString.h" #include "nsIDOMProcessingInstruction.h" +#include "nsIDOMStyleSheet.h" +#include "nsIDOMLinkStyle.h" static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); static NS_DEFINE_IID(kIProcessingInstructionIID, NS_IDOMPROCESSINGINSTRUCTION_IID); +static NS_DEFINE_IID(kIStyleSheetIID, NS_IDOMSTYLESHEET_IID); +static NS_DEFINE_IID(kILinkStyleIID, NS_IDOMLINKSTYLE_IID); // // ProcessingInstruction property ids // enum ProcessingInstruction_slots { PROCESSINGINSTRUCTION_TARGET = -1, - PROCESSINGINSTRUCTION_DATA = -2 + PROCESSINGINSTRUCTION_DATA = -2, + LINKSTYLE_SHEET = -3 }; /***********************************************************************/ @@ -94,6 +100,26 @@ GetProcessingInstructionProperty(JSContext *cx, JSObject *obj, jsval id, jsval * } break; } + case LINKSTYLE_SHEET: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LINKSTYLE_SHEET, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsIDOMStyleSheet* prop; + nsIDOMLinkStyle* b; + if (NS_OK == a->QueryInterface(kILinkStyleIID, (void **)&b)) { + rv = b->GetSheet(&prop); + if(NS_SUCCEEDED(rv)) { + // get the js object + nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp); + } + NS_RELEASE(b); + } + else { + rv = NS_ERROR_DOM_WRONG_TYPE_ERR; + } + } + break; + } default: return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp); } @@ -210,6 +236,7 @@ static JSPropertySpec ProcessingInstructionProperties[] = { {"target", PROCESSINGINSTRUCTION_TARGET, JSPROP_ENUMERATE | JSPROP_READONLY}, {"data", PROCESSINGINSTRUCTION_DATA, JSPROP_ENUMERATE}, + {"sheet", LINKSTYLE_SHEET, JSPROP_ENUMERATE | JSPROP_READONLY}, {0} };