зеркало из https://github.com/mozilla/pjs.git
Land TEMPLATE_19990726_BRANCH; RDF C++ content model builder exorcism.
This commit is contained in:
Родитель
45d1045d17
Коммит
f6b84db71a
|
@ -79,7 +79,6 @@
|
|||
#include "nsIStyledContent.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsXULTreeElement.h"
|
||||
#include "rdfutil.h"
|
||||
#include "prlog.h"
|
||||
#include "rdf.h"
|
||||
|
@ -317,8 +316,8 @@ private:
|
|||
PRBool mContentsMustBeGenerated;
|
||||
nsVoidArray* mBroadcastListeners; // [WEAK]
|
||||
nsIDOMXULElement* mBroadcaster; // [OWNER]
|
||||
nsXULElement* mInnerXULElement; // [OWNER]
|
||||
nsIController* mController; // [OWNER]
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase; // [OWNER]
|
||||
};
|
||||
|
||||
|
||||
|
@ -397,7 +396,6 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag)
|
|||
mContentsMustBeGenerated(PR_FALSE),
|
||||
mBroadcastListeners(nsnull),
|
||||
mBroadcaster(nsnull),
|
||||
mInnerXULElement(nsnull),
|
||||
mController(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -514,8 +512,6 @@ RDFElementImpl::~RDFElementImpl()
|
|||
++entry;
|
||||
}
|
||||
}
|
||||
|
||||
delete mInnerXULElement;
|
||||
}
|
||||
|
||||
|
||||
|
@ -576,16 +572,6 @@ RDFElementImpl::QueryInterface(REFNSIID iid, void** result)
|
|||
else if (iid.Equals(kIJSScriptObjectIID)) {
|
||||
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
|
||||
}
|
||||
else if (iid.Equals(nsIDOMXULTreeElement::GetIID()) &&
|
||||
(mNameSpaceID == kNameSpaceID_XUL) &&
|
||||
(mTag == kTreeAtom)) {
|
||||
if (! mInnerXULElement) {
|
||||
if ((mInnerXULElement = new nsXULTreeElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return mInnerXULElement->QueryInterface(iid, result);
|
||||
}
|
||||
else {
|
||||
*result = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -1275,16 +1261,8 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject
|
|||
if (! mScriptObject) {
|
||||
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
|
||||
|
||||
nsresult (*fn)(nsIScriptContext* aContext, nsISupports* aSupports, nsISupports* aParent, void** aReturn);
|
||||
rv = NS_NewScriptXULElement(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
|
||||
|
||||
if (mTag == kTreeAtom) {
|
||||
fn = NS_NewScriptXULTreeElement;
|
||||
}
|
||||
else {
|
||||
fn = NS_NewScriptXULElement;
|
||||
}
|
||||
|
||||
rv = fn(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
|
||||
NS_RELEASE(global);
|
||||
|
||||
// Ensure that a reference exists to this element
|
||||
|
@ -2532,6 +2510,36 @@ RDFElementImpl::GetResource(nsIRDFResource** aResource)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFElementImpl::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
|
||||
{
|
||||
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
|
||||
if (! aDatabase)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aDatabase = mDatabase;
|
||||
NS_IF_ADDREF(*aDatabase);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFElementImpl::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
|
||||
{
|
||||
// XXX maybe someday you'll be allowed to change it.
|
||||
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
|
||||
if (mDatabase)
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
mDatabase = aDatabase;
|
||||
|
||||
// XXX reconstruct the entire tree now!
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation methods
|
||||
|
||||
|
|
|
@ -2746,6 +2746,17 @@ XULDocumentImpl::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn
|
|||
|
||||
nsresult rv;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
|
||||
char* tagCStr = aTagName.ToNewCString();
|
||||
|
||||
PR_LOG(gXULLog, PR_LOG_DEBUG,
|
||||
("xul[CreateElement] %s", tagCStr));
|
||||
|
||||
delete[] tagCStr;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIAtom> name;
|
||||
PRInt32 nameSpaceID;
|
||||
|
||||
|
@ -2925,6 +2936,19 @@ XULDocumentImpl::CreateElementWithNameSpace(const nsString& aTagName,
|
|||
|
||||
nsresult rv;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
|
||||
char* namespaceCStr = aNameSpace.ToNewCString();
|
||||
char* tagCStr = aTagName.ToNewCString();
|
||||
|
||||
PR_LOG(gXULLog, PR_LOG_DEBUG,
|
||||
("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr));
|
||||
|
||||
delete[] tagCStr;
|
||||
delete[] namespaceCStr;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIAtom> name = dont_AddRef(NS_NewAtom(aTagName.GetUnicode()));
|
||||
if (! name)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -3005,12 +3029,12 @@ XULDocumentImpl::GetElementById(const nsString& aId, nsIDOMElement** aReturn)
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsAutoString uri;
|
||||
nsCAutoString uri;
|
||||
rv = nsRDFContentUtils::MakeElementURI(this, aId, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(resource)))) {
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(resource)))) {
|
||||
NS_ERROR("unable to get resource");
|
||||
return rv;
|
||||
}
|
||||
|
@ -3209,15 +3233,14 @@ XULDocumentImpl::CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aR
|
|||
nsCOMPtr<nsIDOMElement> domRoot = do_QueryInterface(aPopupElement);
|
||||
domRoot->GetAttribute("id", idValue);
|
||||
|
||||
nsAutoString uri;
|
||||
nsCAutoString uri;
|
||||
rv = nsRDFContentUtils::MakeElementURI(this, idValue, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Use the absolute URL to retrieve a resource from the RDF
|
||||
// service that corresponds to the root content.
|
||||
nsCOMPtr<nsIRDFResource> rootResource;
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(),
|
||||
getter_AddRefs(rootResource)))) {
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(rootResource)))) {
|
||||
NS_ERROR("Uh-oh. Couldn't obtain the resource for the popup doc root.");
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@
|
|||
#include "nsIRDFService.h"
|
||||
#include "rdf.h"
|
||||
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
|
||||
#include "nsILocale.h"
|
||||
|
@ -112,7 +111,6 @@ static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
|||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIDomXulTreeElementIID, NS_IDOMXULTREEELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDomXulElementIID, NS_IDOMXULELEMENT_IID);
|
||||
|
||||
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
||||
|
@ -1292,7 +1290,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
|
|||
if (NS_FAILED(rv = FindTreeElement(container, getter_AddRefs(treeNode)))) return(rv);
|
||||
|
||||
// get composite db for tree
|
||||
nsCOMPtr<nsIDOMXULTreeElement> domXulTree;
|
||||
nsCOMPtr<nsIDOMXULElement> domXulTree;
|
||||
sortInfo.rdfService = gRDFService;
|
||||
sortInfo.db = nsnull;
|
||||
|
||||
|
@ -1300,7 +1298,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
|
|||
// that we're sure that we'll hold a reference to it (and actually
|
||||
// release that reference when the stack frame goes away).
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> cds;
|
||||
rv = treeNode->QueryInterface(kIDomXulTreeElementIID, getter_AddRefs(domXulTree));
|
||||
rv = treeNode->QueryInterface(kIDomXulElementIID, getter_AddRefs(domXulTree));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))
|
||||
|
@ -1488,7 +1486,7 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
|
|||
// get composite db for tree
|
||||
sortInfo.rdfService = gRDFService;
|
||||
sortInfo.db = nsnull;
|
||||
nsCOMPtr<nsIDOMXULTreeElement> domXulTree = do_QueryInterface(treeNode);
|
||||
nsCOMPtr<nsIDOMXULElement> domXulTree = do_QueryInterface(treeNode);
|
||||
if (!domXulTree) return(NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> cds;
|
||||
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -2,16 +2,16 @@ interface XULElement : Element {
|
|||
|
||||
/* IID: { 0x574ed81, 0xc088, 0x11d2, \
|
||||
{ 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } } */
|
||||
readonly attribute xpidl nsIRDFResource resource;
|
||||
attribute xpidl nsIController controller;
|
||||
attribute DOMString id;
|
||||
attribute DOMString className;
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
attribute xpidl nsIRDFCompositeDataSource database;
|
||||
readonly attribute xpidl nsIRDFResource resource;
|
||||
attribute xpidl nsIController controller;
|
||||
|
||||
attribute DOMString id;
|
||||
attribute DOMString className;
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
void addBroadcastListener(in DOMString attr, in Element element);
|
||||
void removeBroadcastListener(in DOMString attr, in Element element);
|
||||
void doCommand();
|
||||
|
||||
void addBroadcastListener(in DOMString attr, in Element element);
|
||||
void removeBroadcastListener(in DOMString attr, in Element element);
|
||||
void doCommand();
|
||||
|
||||
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
|
||||
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
class nsIController;
|
||||
class nsIDOMElement;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
class nsIRDFCompositeDataSource;
|
||||
class nsIRDFResource;
|
||||
class nsIDOMNodeList;
|
||||
|
||||
|
@ -39,11 +40,6 @@ class nsIDOMXULElement : public nsIDOMElement {
|
|||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULELEMENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
|
||||
|
||||
NS_IMETHOD GetController(nsIController** aController)=0;
|
||||
NS_IMETHOD SetController(nsIController* aController)=0;
|
||||
|
||||
NS_IMETHOD GetId(nsString& aId)=0;
|
||||
NS_IMETHOD SetId(const nsString& aId)=0;
|
||||
|
||||
|
@ -52,6 +48,14 @@ public:
|
|||
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0;
|
||||
|
||||
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase)=0;
|
||||
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase)=0;
|
||||
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
|
||||
|
||||
NS_IMETHOD GetController(nsIController** aController)=0;
|
||||
NS_IMETHOD SetController(nsIController* aController)=0;
|
||||
|
||||
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
|
||||
|
||||
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
|
||||
|
@ -63,14 +67,16 @@ public:
|
|||
|
||||
|
||||
#define NS_DECL_IDOMXULELEMENT \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
|
||||
NS_IMETHOD GetController(nsIController** aController); \
|
||||
NS_IMETHOD SetController(nsIController* aController); \
|
||||
NS_IMETHOD GetId(nsString& aId); \
|
||||
NS_IMETHOD SetId(const nsString& aId); \
|
||||
NS_IMETHOD GetClassName(nsString& aClassName); \
|
||||
NS_IMETHOD SetClassName(const nsString& aClassName); \
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \
|
||||
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \
|
||||
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase); \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
|
||||
NS_IMETHOD GetController(nsIController** aController); \
|
||||
NS_IMETHOD SetController(nsIController* aController); \
|
||||
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
|
||||
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
|
||||
NS_IMETHOD DoCommand(); \
|
||||
|
@ -79,14 +85,16 @@ public:
|
|||
|
||||
|
||||
#define NS_FORWARD_IDOMXULELEMENT(_to) \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
|
||||
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
|
||||
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
|
||||
NS_IMETHOD GetId(nsString& aId) { return _to GetId(aId); } \
|
||||
NS_IMETHOD SetId(const nsString& aId) { return _to SetId(aId); } \
|
||||
NS_IMETHOD GetClassName(nsString& aClassName) { return _to GetClassName(aClassName); } \
|
||||
NS_IMETHOD SetClassName(const nsString& aClassName) { return _to SetClassName(aClassName); } \
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \
|
||||
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \
|
||||
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase) { return _to SetDatabase(aDatabase); } \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
|
||||
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
|
||||
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
|
||||
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \
|
||||
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \
|
||||
NS_IMETHOD DoCommand() { return _to DoCommand(); } \
|
||||
|
|
|
@ -51,11 +51,8 @@ NS_DEF_PTR(nsIDOMNodeList);
|
|||
//
|
||||
enum XULDocument_slots {
|
||||
XULDOCUMENT_POPUPELEMENT = -1,
|
||||
|
||||
XULDOCUMENT_TOOLTIPELEMENT = -2,
|
||||
|
||||
XULDOCUMENT_FOCUS = -3
|
||||
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -67,86 +64,45 @@ GetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
{
|
||||
nsIDOMXULDocument *a = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
|
||||
if (nsnull == a) {
|
||||
|
||||
return JS_TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
|
||||
nsIScriptSecurityManager *secMan;
|
||||
|
||||
PRBool ok = PR_FALSE;
|
||||
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
case XULDOCUMENT_POPUPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (NS_OK == a->GetPopupElement(&prop)) {
|
||||
|
||||
// get the js object
|
||||
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case XULDOCUMENT_TOOLTIPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (NS_OK == a->GetTooltipElement(&prop)) {
|
||||
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
|
||||
}
|
||||
|
@ -193,100 +149,52 @@ SetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
{
|
||||
nsIDOMXULDocument *a = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
|
||||
if (nsnull == a) {
|
||||
|
||||
return JS_TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
|
||||
nsIScriptSecurityManager *secMan;
|
||||
|
||||
PRBool ok = PR_FALSE;
|
||||
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
case XULDOCUMENT_POPUPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
|
||||
kIElementIID, "Element",
|
||||
|
||||
cx, *vp)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
a->SetPopupElement(prop);
|
||||
|
||||
NS_IF_RELEASE(prop);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case XULDOCUMENT_TOOLTIPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
|
||||
kIElementIID, "Element",
|
||||
|
||||
cx, *vp)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
a->SetTooltipElement(prop);
|
||||
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
|
@ -340,8 +248,6 @@ PR_STATIC_CALLBACK(JSBool)
|
|||
XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMElement* nativeRet;
|
||||
nsAutoString b0;
|
||||
|
||||
|
@ -393,8 +299,6 @@ PR_STATIC_CALLBACK(JSBool)
|
|||
XULDocumentGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodeList* nativeRet;
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
|
@ -466,9 +370,7 @@ JSClass XULDocumentClass = {
|
|||
static JSPropertySpec XULDocumentProperties[] =
|
||||
{
|
||||
{"popupElement", XULDOCUMENT_POPUPELEMENT, JSPROP_ENUMERATE},
|
||||
|
||||
{"tooltipElement", XULDOCUMENT_TOOLTIPELEMENT, JSPROP_ENUMERATE},
|
||||
|
||||
{"focus", XULDOCUMENT_FOCUS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsIController.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
@ -41,6 +42,7 @@ static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
|||
static NS_DEFINE_IID(kIControllerIID, NS_ICONTROLLER_IID);
|
||||
static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kICSSStyleDeclarationIID, NS_IDOMCSSSTYLEDECLARATION_IID);
|
||||
static NS_DEFINE_IID(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID);
|
||||
static NS_DEFINE_IID(kIXULElementIID, NS_IDOMXULELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
|
||||
|
@ -48,6 +50,7 @@ static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
|
|||
NS_DEF_PTR(nsIController);
|
||||
NS_DEF_PTR(nsIDOMElement);
|
||||
NS_DEF_PTR(nsIDOMCSSStyleDeclaration);
|
||||
NS_DEF_PTR(nsIRDFCompositeDataSource);
|
||||
NS_DEF_PTR(nsIDOMXULElement);
|
||||
NS_DEF_PTR(nsIRDFResource);
|
||||
NS_DEF_PTR(nsIDOMNodeList);
|
||||
|
@ -56,11 +59,12 @@ NS_DEF_PTR(nsIDOMNodeList);
|
|||
// XULElement property ids
|
||||
//
|
||||
enum XULElement_slots {
|
||||
XULELEMENT_RESOURCE = -1,
|
||||
XULELEMENT_CONTROLLER = -2,
|
||||
XULELEMENT_ID = -3,
|
||||
XULELEMENT_CLASSNAME = -4,
|
||||
XULELEMENT_STYLE = -5
|
||||
XULELEMENT_ID = -1,
|
||||
XULELEMENT_CLASSNAME = -2,
|
||||
XULELEMENT_STYLE = -3,
|
||||
XULELEMENT_DATABASE = -4,
|
||||
XULELEMENT_RESOURCE = -5,
|
||||
XULELEMENT_CONTROLLER = -6
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -70,7 +74,7 @@ enum XULElement_slots {
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -80,45 +84,11 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case XULELEMENT_RESOURCE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFResource* prop;
|
||||
if (NS_OK == a->GetResource(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (NS_OK == a->GetController(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_ID:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
|
||||
|
@ -168,6 +138,57 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_DATABASE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFCompositeDataSource* prop;
|
||||
if (NS_OK == a->GetDatabase(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFCompositeDataSource::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_RESOURCE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFResource* prop;
|
||||
if (NS_OK == a->GetResource(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (NS_OK == a->GetController(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -187,7 +208,7 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -197,28 +218,11 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
|
||||
kIControllerIID, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetController(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_ID:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
|
||||
|
@ -247,6 +251,40 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_DATABASE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFCompositeDataSource* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
|
||||
kIRDFCompositeDataSourceIID, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetDatabase(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
|
||||
kIControllerIID, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetController(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -296,8 +334,7 @@ ResolveXULElement(JSContext *cx, JSObject *obj, jsval id)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
nsIDOMElementPtr b1;
|
||||
|
||||
|
@ -356,8 +393,7 @@ XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
nsIDOMElementPtr b1;
|
||||
|
||||
|
@ -416,8 +452,7 @@ XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsva
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
|
@ -464,8 +499,7 @@ XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMNodeList* nativeRet;
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
|
@ -536,11 +570,12 @@ JSClass XULElementClass = {
|
|||
//
|
||||
static JSPropertySpec XULElementProperties[] =
|
||||
{
|
||||
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
|
||||
{"id", XULELEMENT_ID, JSPROP_ENUMERATE},
|
||||
{"className", XULELEMENT_CLASSNAME, JSPROP_ENUMERATE},
|
||||
{"style", XULELEMENT_STYLE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"database", XULELEMENT_DATABASE, JSPROP_ENUMERATE},
|
||||
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -24,15 +24,14 @@
|
|||
|
||||
%{C++
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(D60B84F1-2A8C-11d3-9E07-00A0C92B5F0D)]
|
||||
interface nsIAddressBook : nsISupports {
|
||||
|
||||
void DeleteCards(in nsIDOMXULTreeElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
|
||||
void DeleteCards(in nsIDOMXULElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
|
||||
void NewAddressBook(in nsIRDFCompositeDataSource db, in nsIDOMXULElement srcDir, in string name);
|
||||
void DeleteAddressBook(in nsIDOMXULTreeElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
|
||||
void DeleteAddressBook(in nsIDOMXULElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
function ChangeDirectoryByDOMNode(dirNode)
|
||||
{
|
||||
var uri = dirNode.getAttribute('id');
|
||||
dump(uri + "\n");
|
||||
ChangeDirectoryByURI(uri);
|
||||
}
|
||||
|
||||
function ChangeDirectoryByURI(uri)
|
||||
{
|
||||
var tree = top.window.frames[0].frames[1].document.getElementById('resultTree');
|
||||
//dump("tree = " + tree + "\n");
|
||||
|
||||
var treechildrenList = tree.getElementsByTagName('treechildren');
|
||||
if ( treechildrenList.length == 1 )
|
||||
{
|
||||
var body = treechildrenList[0];
|
||||
body.setAttribute('id', uri);// body no longer valid after setting id.
|
||||
}
|
||||
}
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
<tree class="abDirectory" rdf:datasources="rdf:addressdirectory" id="dirTree" onclick="return ChangeDirectoryByDOMNode(event.target.parentNode.parentNode)">
|
||||
<template>
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow >
|
||||
<treecell>
|
||||
|
@ -27,6 +28,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
rdf:containment="http://home.netscape.com/NC-rdf#CardChild">
|
||||
|
||||
<template>
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow >
|
||||
<treecell>
|
||||
|
@ -38,6 +39,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,220 +0,0 @@
|
|||
var composeWindow = 0;
|
||||
var msgCompFields = 0;
|
||||
|
||||
// localization strings
|
||||
var prefixTo = "To: ";
|
||||
var prefixCc = "Cc: ";
|
||||
var prefixBcc = "Bcc: ";
|
||||
|
||||
function OnLoadSelectAddress()
|
||||
{
|
||||
var toAddress="", ccAddress="", bccAddress="";
|
||||
|
||||
doSetOKCancel(SelectAddressOKButton, 0);
|
||||
|
||||
// look in arguments[0] for parameters
|
||||
if (window.arguments && window.arguments[0])
|
||||
{
|
||||
// keep parameters in global for later
|
||||
if ( window.arguments[0].composeWindow )
|
||||
top.composeWindow = window.arguments[0].composeWindow;
|
||||
if ( window.arguments[0].msgCompFields )
|
||||
top.msgCompFields = window.arguments[0].msgCompFields;
|
||||
if ( window.arguments[0].toAddress )
|
||||
toAddress = window.arguments[0].toAddress;
|
||||
if ( window.arguments[0].ccAddress )
|
||||
ccAddress = window.arguments[0].ccAddress;
|
||||
if ( window.arguments[0].bccAddress )
|
||||
bccAddress = window.arguments[0].bccAddress;
|
||||
|
||||
dump("onload top.composeWindow: " + top.composeWindow + "\n");
|
||||
dump("onload toAddress: " + toAddress + "\n");
|
||||
|
||||
// put the addresses into the bucket
|
||||
AddAddressFromComposeWindow(toAddress, prefixTo);
|
||||
AddAddressFromComposeWindow(ccAddress, prefixCc);
|
||||
AddAddressFromComposeWindow(bccAddress, prefixBcc);
|
||||
}
|
||||
}
|
||||
|
||||
function AddAddressFromComposeWindow(addresses, prefix)
|
||||
{
|
||||
if ( addresses )
|
||||
{
|
||||
var bucketDoc = frames["addressbucket"].document;
|
||||
var addressArray = addresses.split(",");
|
||||
|
||||
for ( var index = 0; index < addressArray.length; index++ )
|
||||
{
|
||||
// remove leading spaces
|
||||
while ( addressArray[index][0] == " " )
|
||||
addressArray[index] = addressArray[index].substring(1, addressArray[index].length);
|
||||
|
||||
AddAddressIntoBucket(bucketDoc, prefix + addressArray[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SelectAddressOKButton()
|
||||
{
|
||||
var bucketDoc = frames["addressbucket"].document;
|
||||
var body = bucketDoc.getElementById('bucketBody');
|
||||
var item, row, cell, text, colon;
|
||||
var toAddress="", ccAddress="", bccAddress="";
|
||||
|
||||
for ( var index = 0; index < body.childNodes.length; index++ )
|
||||
{
|
||||
item = body.childNodes[index];
|
||||
if ( item.childNodes && item.childNodes.length )
|
||||
{
|
||||
row = item.childNodes[0];
|
||||
if ( row.childNodes && row.childNodes.length )
|
||||
{
|
||||
cell = row.childNodes[0];
|
||||
if ( cell.childNodes && cell.childNodes.length )
|
||||
{
|
||||
text = cell.childNodes[0];
|
||||
if ( text && text.data && text.data.length )
|
||||
{
|
||||
switch ( text.data[0] )
|
||||
{
|
||||
case prefixTo[0]:
|
||||
if ( toAddress )
|
||||
toAddress += ", ";
|
||||
toAddress += text.data.substring(prefixTo.length, text.data.length);
|
||||
break;
|
||||
case prefixCc[0]:
|
||||
if ( ccAddress )
|
||||
ccAddress += ", ";
|
||||
ccAddress += text.data.substring(prefixCc.length, text.data.length);
|
||||
break;
|
||||
case prefixBcc[0]:
|
||||
if ( bccAddress )
|
||||
bccAddress += ", ";
|
||||
bccAddress += text.data.substring(prefixBcc.length, text.data.length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reset the UI in compose window
|
||||
msgCompFields.SetTo(toAddress);
|
||||
msgCompFields.SetCc(ccAddress);
|
||||
msgCompFields.SetBcc(bccAddress);
|
||||
top.composeWindow.CompFields2Recipients(top.msgCompFields);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function saChangeDirectoryByDOMNode(dirNode)
|
||||
{
|
||||
var uri = dirNode.getAttribute('id');
|
||||
dump(uri + "\n");
|
||||
saChangeDirectoryByURI(uri);
|
||||
}
|
||||
|
||||
function saChangeDirectoryByURI(uri)
|
||||
{
|
||||
var tree = frames["resultsFrame"].document.getElementById('resultTree');
|
||||
//dump("tree = " + tree + "\n");
|
||||
|
||||
var treechildrenList = tree.getElementsByTagName('treechildren');
|
||||
if ( treechildrenList.length == 1 )
|
||||
{
|
||||
var body = treechildrenList[0];
|
||||
body.setAttribute('id', uri);// body no longer valid after setting id.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SelectAddressToButton()
|
||||
{
|
||||
AddSelectedAddressesIntoBucket(prefixTo);
|
||||
}
|
||||
|
||||
function SelectAddressCcButton()
|
||||
{
|
||||
AddSelectedAddressesIntoBucket(prefixCc);
|
||||
}
|
||||
|
||||
function SelectAddressBccButton()
|
||||
{
|
||||
AddSelectedAddressesIntoBucket(prefixBcc);
|
||||
}
|
||||
|
||||
function SelectAddressNewButton()
|
||||
{
|
||||
AbNewCardDialog();
|
||||
}
|
||||
|
||||
function SelectAddressEditButton()
|
||||
{
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
|
||||
var resultsDoc = frames["resultsFrame"].document;
|
||||
var selArray = resultsDoc.getElementsByAttribute('selected', 'true');
|
||||
|
||||
if ( selArray && selArray.length == 1 )
|
||||
{
|
||||
var uri = selArray[0].getAttribute('id');
|
||||
var card = rdf.GetResource(uri);
|
||||
card = card.QueryInterface(Components.interfaces.nsIAbCard);
|
||||
AbEditCardDialog(card, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function AddSelectedAddressesIntoBucket(prefix)
|
||||
{
|
||||
var item, uri, rdf, cardResource, card, address;
|
||||
var resultsDoc = frames["resultsFrame"].document;
|
||||
var bucketDoc = frames["addressbucket"].document;
|
||||
|
||||
rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
|
||||
var selArray = resultsDoc.getElementsByAttribute('selected', 'true');
|
||||
if ( selArray && selArray.length )
|
||||
{
|
||||
for ( item = 0; item < selArray.length; item++ )
|
||||
{
|
||||
uri = selArray[item].getAttribute('id');
|
||||
cardResource = rdf.GetResource(uri);
|
||||
card = cardResource.QueryInterface(Components.interfaces.nsIAbCard);
|
||||
address = prefix + "\"" + card.DisplayName + "\" <" + card.PrimaryEmail + ">";
|
||||
AddAddressIntoBucket(bucketDoc, address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AddAddressIntoBucket(doc, address)
|
||||
{
|
||||
var body = doc.getElementById("bucketBody");
|
||||
|
||||
var item = doc.createElement('treeitem');
|
||||
var row = doc.createElement('treerow');
|
||||
var cell = doc.createElement('treecell');
|
||||
var text = doc.createTextNode(address);
|
||||
|
||||
cell.appendChild(text);
|
||||
row.appendChild(cell);
|
||||
item.appendChild(row);
|
||||
body.appendChild(item);
|
||||
}
|
||||
|
||||
function RemoveSelectedFromBucket()
|
||||
{
|
||||
var bucketDoc = frames["addressbucket"].document;
|
||||
var body = bucketDoc.getElementById("bucketBody");
|
||||
|
||||
var selArray = body.getElementsByAttribute('selected', 'true');
|
||||
if ( selArray && selArray.length )
|
||||
{
|
||||
for ( var item = selArray.length - 1; item >= 0; item-- )
|
||||
body.removeChild(selArray[item]);
|
||||
}
|
||||
}
|
|
@ -93,6 +93,16 @@ Rights Reserved.
|
|||
<tree id="dirTree" class="abDirectory" flex="100%"
|
||||
rdf:datasources="rdf:addressdirectory"
|
||||
onclick="return saChangeDirectoryByDOMNode(event.target.parentNode.parentNode)">
|
||||
<template>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell><text value="http://home.netscape.com/NC-rdf#DirName" /></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</template>
|
||||
|
||||
<treecol style="width:100%" rdf:resource="http://home.netscape.com/NC-rdf#DirName" />
|
||||
<treehead>
|
||||
<treerow>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "prprf.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFService.h"
|
||||
|
@ -55,7 +55,7 @@ static nsresult ConvertDOMListToResourceArray(nsIDOMNodeList *nodeList, nsISuppo
|
|||
nsresult rv = NS_OK;
|
||||
PRUint32 listLength;
|
||||
nsIDOMNode *node;
|
||||
nsIDOMXULTreeElement *xulElement;
|
||||
nsIDOMXULElement *xulElement;
|
||||
nsIRDFResource *resource;
|
||||
|
||||
if(!resourceArray)
|
||||
|
@ -109,7 +109,7 @@ NS_IMPL_ISUPPORTS(nsAddressBook, nsIAddressBook::GetIID());
|
|||
//
|
||||
|
||||
NS_IMETHODIMP nsAddressBook::DeleteCards
|
||||
(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
|
||||
(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -206,7 +206,7 @@ NS_IMETHODIMP nsAddressBook::NewAddressBook
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsAddressBook::DeleteAddressBook
|
||||
(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
|
||||
(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAddressBook
|
||||
NS_IMETHOD DeleteCards(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
|
||||
NS_IMETHOD DeleteCards(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
|
||||
NS_IMETHOD NewAddressBook(nsIRDFCompositeDataSource* db, nsIDOMXULElement *srcDirectory, const char *name);
|
||||
NS_IMETHOD DeleteAddressBook(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
|
||||
NS_IMETHOD DeleteAddressBook(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
|
||||
|
||||
protected:
|
||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, char * command, nsISupportsArray *srcArray,
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
<tree rdf:datasources="rdf:msgaccountmanager" onclick="showPage(event)" id="accounttree">
|
||||
|
||||
<template>
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow >
|
||||
<treecell>
|
||||
|
@ -30,6 +31,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
%{C++
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
%}
|
||||
|
||||
|
@ -39,12 +38,12 @@ interface nsIMessenger : nsISupports {
|
|||
void Open3PaneWindow();
|
||||
void SetWindow(in nsIDOMWindow ptr);
|
||||
void OpenURL(in string str);
|
||||
void DeleteMessages(in nsIDOMXULTreeElement tree, in nsIDOMXULElement srcFolder, in nsIDOMNodeList node);
|
||||
void DeleteMessages(in nsIDOMXULElement tree, in nsIDOMXULElement srcFolder, in nsIDOMNodeList node);
|
||||
void DeleteFolders(in nsIRDFCompositeDataSource db, in nsIDOMXULElement parentFolder, in nsIDOMXULElement folder);
|
||||
void CopyMessages(in nsIRDFCompositeDataSource database, in nsIDOMXULElement srcFolderElement,
|
||||
in nsIDOMXULElement dstFolderElement, in nsIDOMNodeList messages,
|
||||
in boolean isMove);
|
||||
nsISupports GetRDFResourceForMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
|
||||
nsISupports GetRDFResourceForMessage(in nsIDOMXULElement tree, in nsIDOMNodeList node);
|
||||
void Exit();
|
||||
void Close();
|
||||
void OnUnload();
|
||||
|
|
|
@ -71,7 +71,7 @@ function GetThreadTree()
|
|||
function GetThreadTreeFolder()
|
||||
{
|
||||
var tree = GetThreadTree();
|
||||
return tree.childNodes[9];
|
||||
return tree;
|
||||
}
|
||||
|
||||
function FindMessenger()
|
||||
|
@ -194,7 +194,7 @@ function ChangeFolderByURI(uri)
|
|||
{
|
||||
var folder = GetThreadTreeFolder();
|
||||
var beforeTime = new Date();
|
||||
folder.setAttribute('id', uri);
|
||||
folder.setAttribute('ref', uri);
|
||||
var afterTime = new Date();
|
||||
var timeToLoad = (afterTime.getTime() - beforeTime.getTime())/1000;
|
||||
if(showPerformance)
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
<html:div flex="100%">
|
||||
<tree style="height: 100%" rdf:datasources="rdf:mailnewsfolders rdf:msgaccountmanager" id="folderTree" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild" onclick="return top.ChangeFolderByDOMNode(event.target.parentNode.parentNode)">
|
||||
<template>
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..."
|
||||
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
|
||||
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState">
|
||||
|
@ -57,6 +58,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -477,9 +477,25 @@ Rights Reserved.
|
|||
<separator/>
|
||||
<menu name="&moveMsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
|
||||
onclick="MsgMoveMessage(event.target)">
|
||||
<template>
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" onclick="MsgCopyMessage(event.target)" />
|
||||
</rule>
|
||||
</template>
|
||||
</menu>
|
||||
<menu name="©MsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
|
||||
onclick="MsgCopyMessage(event.target)">
|
||||
<template>
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" onclick="MsgCopyMessage(event.target)" />
|
||||
</rule>
|
||||
</template>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menuitem name="&addSenderToAddressBookCmd.label;" onclick="MsgAddSenderToAddressBook();"/>
|
||||
|
|
|
@ -42,7 +42,8 @@ Rights Reserved.
|
|||
<tree style="height: 100%" datasources="rdf:mailnewsfolders rdf:mailnewsmessages" id="threadTree" onclick="return parent.parent.parent.LoadMessage(event.target.parentNode.parentNode)" containment="http://home.netscape.com/NC-rdf#MessageChild">
|
||||
|
||||
<template>
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..."
|
||||
Status="rdf:http://home.netscape.com/NC-rdf#Status">
|
||||
<treerow >
|
||||
|
@ -70,6 +71,7 @@ Rights Reserved.
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -93,10 +95,6 @@ Rights Reserved.
|
|||
<treecell onclick="return top.SortThreadPane('TotalColumn', 'http://home.netscape.com/NC-rdf#TotalMessages');">&totalColumn.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
|
||||
<treechildren id="" name="threadTreeBody" open="true">
|
||||
</treechildren>
|
||||
</tree>
|
||||
</html:div>
|
||||
</window>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIMsgFolder.h"
|
||||
#include "nsIPop3Service.h"
|
||||
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFService.h"
|
||||
|
@ -100,12 +100,12 @@ public:
|
|||
NS_IMETHOD GetNewMessages(nsIRDFCompositeDataSource *db, nsIDOMXULElement *folderElement);
|
||||
NS_IMETHOD SetWindow(nsIDOMWindow* aWin);
|
||||
NS_IMETHOD OpenURL(const char * url);
|
||||
NS_IMETHOD DeleteMessages(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList);
|
||||
NS_IMETHOD DeleteMessages(nsIDOMXULElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList);
|
||||
NS_IMETHOD DeleteFolders(nsIRDFCompositeDataSource *db, nsIDOMXULElement *parentFolder, nsIDOMXULElement *folder);
|
||||
|
||||
NS_IMETHOD CopyMessages(nsIRDFCompositeDataSource *database, nsIDOMXULElement *srcFolderElement,
|
||||
nsIDOMXULElement *dstFolderElement, nsIDOMNodeList *messages, PRBool isMove);
|
||||
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
|
||||
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULElement *tree,
|
||||
nsIDOMNodeList *nodeList, nsISupports
|
||||
**aSupport);
|
||||
NS_IMETHOD Exit();
|
||||
|
@ -150,7 +150,7 @@ static nsresult ConvertDOMListToResourceArray(nsIDOMNodeList *nodeList, nsISuppo
|
|||
nsresult rv = NS_OK;
|
||||
PRUint32 listLength;
|
||||
nsIDOMNode *node;
|
||||
nsIDOMXULTreeElement *xulElement;
|
||||
nsIDOMXULElement *xulElement;
|
||||
nsIRDFResource *resource;
|
||||
|
||||
if(!resourceArray)
|
||||
|
@ -465,7 +465,7 @@ nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, char *command,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessenger::DeleteMessages(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList)
|
||||
nsMessenger::DeleteMessages(nsIDOMXULElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -664,7 +664,7 @@ nsMessenger::CopyMessages(nsIRDFCompositeDataSource *database, nsIDOMXULElement
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessenger::GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
|
||||
nsMessenger::GetRDFResourceForMessage(nsIDOMXULElement *tree,
|
||||
nsIDOMNodeList *nodeList, nsISupports
|
||||
**aSupport)
|
||||
{
|
||||
|
|
|
@ -156,6 +156,14 @@ Rights Reserved.
|
|||
<separator/>
|
||||
<menu name="&fileCarbonCopyCmd.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
|
||||
onclick="MessageFcc(event.target)">
|
||||
<template>
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" onclick="MsgCopyMessage(event.target)" />
|
||||
</rule>
|
||||
</template>
|
||||
</menu>
|
||||
</menu>
|
||||
<menu id="tasksMenu"/>
|
||||
|
|
|
@ -529,10 +529,6 @@ RDFContentSinkImpl::OpenContainer(const nsIParserNode& aNode)
|
|||
NS_IMETHODIMP
|
||||
RDFContentSinkImpl::CloseContainer(const nsIParserNode& aNode)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
const nsString& text = aNode.GetText();
|
||||
#endif
|
||||
|
||||
FlushText();
|
||||
|
||||
nsIRDFResource* resource;
|
||||
|
@ -540,13 +536,14 @@ RDFContentSinkImpl::CloseContainer(const nsIParserNode& aNode)
|
|||
// XXX parser didn't catch unmatched tags?
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gLog, PR_LOG_ALWAYS)) {
|
||||
char* tag = text.ToNewCString();
|
||||
const nsString& tagStr = aNode.GetText();
|
||||
char* tagCStr = tagStr.ToNewCString();
|
||||
|
||||
PR_LOG(gLog, PR_LOG_ALWAYS,
|
||||
("rdfxml: extra close tag '%s' at line %d",
|
||||
tag, aNode.GetSourceLineNumber()));
|
||||
tagCStr, aNode.GetSourceLineNumber()));
|
||||
|
||||
delete[] tag;
|
||||
delete[] tagCStr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
void XXXNeverCalled()
|
||||
{
|
||||
nsAutoString s;
|
||||
nsCAutoString cs;
|
||||
|
||||
// nsRDFParserUtils
|
||||
nsRDFParserUtils::EntityToUnicode("");
|
||||
|
@ -36,12 +37,12 @@ void XXXNeverCalled()
|
|||
// nsRDFContentUtils
|
||||
nsRDFContentUtils::AttachTextNode(nsnull, nsnull);
|
||||
nsRDFContentUtils::FindChildByTag(nsnull, 0, nsnull, nsnull);
|
||||
nsRDFContentUtils::FindChildByTagAndResource(nsnull, 0, nsnull, nsnull, nsnull);
|
||||
nsRDFContentUtils::FindChildByResource(nsnull, nsnull, nsnull);
|
||||
nsRDFContentUtils::GetElementResource(nsnull, nsnull);
|
||||
nsRDFContentUtils::GetElementRefResource(nsnull, nsnull);
|
||||
nsRDFContentUtils::GetTextForNode(nsnull, s);
|
||||
nsRDFContentUtils::GetElementLogString(nsnull, s);
|
||||
nsRDFContentUtils::MakeElementURI(nsnull, s, s);
|
||||
nsRDFContentUtils::MakeElementURI(nsnull, s, cs);
|
||||
nsRDFContentUtils::MakeElementID(nsnull, s, s);
|
||||
|
||||
// rdfutils
|
||||
|
|
|
@ -66,22 +66,10 @@
|
|||
#define NS_RDFCOMPOSITEDATASOURCE_CID \
|
||||
{ 0xe638d761, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
// {954F0813-81DC-11d2-B52A-000000000000}
|
||||
#define NS_RDFHTMLBUILDER_CID \
|
||||
{ 0x954f0813, 0x81dc, 0x11d2, { 0xb5, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
// {3D262D00-8B5A-11d2-8EB0-00805F29F370}
|
||||
#define NS_RDFTREEBUILDER_CID \
|
||||
#define NS_XULTEMPLATEBUILDER_CID \
|
||||
{ 0x3d262d00, 0x8b5a, 0x11d2, { 0x8e, 0xb0, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {CF6547E1-D427-11d2-96ED-00104B7B7DEB}
|
||||
#define NS_RDFMENUBUILDER_CID \
|
||||
{ 0xcf6547e1, 0xd427, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
|
||||
|
||||
// {FEA36A61-D48F-11d2-96ED-00104B7B7DEB}
|
||||
#define NS_RDFTOOLBARBUILDER_CID \
|
||||
{ 0xfea36a61, 0xd48f, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
|
||||
|
||||
// {7BAF62E0-8E61-11d2-8EB1-00805F29F370}
|
||||
#define NS_RDFXMLDATASOURCE_CID \
|
||||
{ 0x7baf62e0, 0x8e61, 0x11d2, { 0x8e, 0xb1, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
|
|
@ -65,12 +65,8 @@ static NS_DEFINE_CID(kRDFFileSystemDataSourceCID, NS_RDFFILESYSTEMDATASO
|
|||
static NS_DEFINE_CID(kRDFSearchDataSourceCID, NS_RDFSEARCHDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFFindDataSourceCID, NS_RDFFINDDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFFTPDataSourceCID, NS_RDFFTPDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFHTMLBuilderCID, NS_RDFHTMLBUILDER_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFMenuBuilderCID, NS_RDFMENUBUILDER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFToolbarBuilderCID, NS_RDFTOOLBARBUILDER_CID);
|
||||
static NS_DEFINE_CID(kRDFTreeBuilderCID, NS_RDFTREEBUILDER_CID);
|
||||
static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFXULBuilderCID, NS_RDFXULBUILDER_CID);
|
||||
static NS_DEFINE_CID(kXULContentSinkCID, NS_XULCONTENTSINK_CID);
|
||||
|
@ -80,6 +76,7 @@ static NS_DEFINE_CID(kXULDocumentInfoCID, NS_XULDOCUMENTINFO_CID
|
|||
static NS_DEFINE_CID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID);
|
||||
static NS_DEFINE_CID(kXULKeyListenerCID, NS_XULKEYLISTENER_CID);
|
||||
static NS_DEFINE_CID(kXULFocusTrackerCID, NS_XULFOCUSTRACKER_CID);
|
||||
static NS_DEFINE_CID(kXULTemplateBuilderCID, NS_XULTEMPLATEBUILDER_CID);
|
||||
|
||||
class RDFFactoryImpl : public nsIFactory
|
||||
{
|
||||
|
@ -224,20 +221,8 @@ RDFFactoryImpl::CreateInstance(nsISupports *aOuter,
|
|||
if (NS_FAILED(rv = NS_NewXULDocumentInfo((nsIXULDocumentInfo**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFHTMLBuilderCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFHTMLBuilder((nsIRDFContentModelBuilder**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFMenuBuilderCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFMenuBuilder((nsIRDFContentModelBuilder**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFToolbarBuilderCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFToolbarBuilder((nsIRDFContentModelBuilder**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFTreeBuilderCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFTreeBuilder((nsIRDFContentModelBuilder**) &inst)))
|
||||
else if (mClassID.Equals(kXULTemplateBuilderCID)) {
|
||||
if (NS_FAILED(rv = NS_NewXULTemplateBuilder((nsIRDFContentModelBuilder**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFXULBuilderCID)) {
|
||||
|
@ -415,11 +400,6 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
|||
NS_RDF_PROGID "/container-utils",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->RegisterComponent(kRDFHTMLBuilderCID,
|
||||
"RDF HTML Builder",
|
||||
NS_RDF_PROGID "/html-builder",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->RegisterComponent(kRDFServiceCID,
|
||||
"RDF Service",
|
||||
NS_RDF_PROGID "/rdf-service",
|
||||
|
@ -430,19 +410,9 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
|||
NS_RDF_PROGID "/xul-sort-service",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->RegisterComponent(kRDFTreeBuilderCID,
|
||||
"RDF Tree Builder",
|
||||
NS_RDF_PROGID "/tree-builder",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->RegisterComponent(kRDFMenuBuilderCID,
|
||||
"RDF Menu Builder",
|
||||
NS_RDF_PROGID "/menu-builder",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->RegisterComponent(kRDFToolbarBuilderCID,
|
||||
"RDF Toolbar Builder",
|
||||
NS_RDF_PROGID "/toolbar-builder",
|
||||
rv = compMgr->RegisterComponent(kXULTemplateBuilderCID,
|
||||
"XUL Template Builder",
|
||||
NS_RDF_PROGID "/xul-template-builder",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->RegisterComponent(kRDFXULBuilderCID,
|
||||
|
@ -524,17 +494,11 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
|||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kRDFContentSinkCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kRDFHTMLBuilderCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kRDFServiceCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kXULSortServiceCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kRDFTreeBuilderCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kRDFMenuBuilderCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kRDFToolbarBuilderCID, aPath);
|
||||
rv = compMgr->UnregisterComponent(kXULTemplateBuilderCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = compMgr->UnregisterComponent(kRDFXULBuilderCID, aPath);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
|
|
@ -3,7 +3,6 @@ nsIDOMElementObserver.h
|
|||
nsIDOMNodeObserver.h
|
||||
nsIDOMXULDocument.h
|
||||
nsIDOMXULElement.h
|
||||
nsIDOMXULTreeElement.h
|
||||
nsIRDFContentModelBuilder.h
|
||||
nsIRDFDocument.h
|
||||
nsIXULSortService.h
|
||||
|
|
|
@ -29,7 +29,6 @@ EXPORTS = \
|
|||
nsIDOMNodeObserver.h \
|
||||
nsIDOMXULDocument.h \
|
||||
nsIDOMXULElement.h \
|
||||
nsIDOMXULTreeElement.h \
|
||||
nsIRDFContentModelBuilder.h \
|
||||
nsIRDFDocument.h \
|
||||
nsIXULSortService.h \
|
||||
|
|
|
@ -2,16 +2,16 @@ interface XULElement : Element {
|
|||
|
||||
/* IID: { 0x574ed81, 0xc088, 0x11d2, \
|
||||
{ 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } } */
|
||||
readonly attribute xpidl nsIRDFResource resource;
|
||||
attribute xpidl nsIController controller;
|
||||
attribute DOMString id;
|
||||
attribute DOMString className;
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
attribute xpidl nsIRDFCompositeDataSource database;
|
||||
readonly attribute xpidl nsIRDFResource resource;
|
||||
attribute xpidl nsIController controller;
|
||||
|
||||
attribute DOMString id;
|
||||
attribute DOMString className;
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
void addBroadcastListener(in DOMString attr, in Element element);
|
||||
void removeBroadcastListener(in DOMString attr, in Element element);
|
||||
void doCommand();
|
||||
|
||||
void addBroadcastListener(in DOMString attr, in Element element);
|
||||
void removeBroadcastListener(in DOMString attr, in Element element);
|
||||
void doCommand();
|
||||
|
||||
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
|
||||
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
|
||||
};
|
||||
|
|
|
@ -25,8 +25,7 @@ IDLSRCS = \
|
|||
NodeObserver.idl \
|
||||
XULDocument.idl \
|
||||
XULElement.idl \
|
||||
XULTreeElement.idl \
|
||||
XULFocusTracker.idl \
|
||||
XULFocusTracker.idl \
|
||||
$(NULL)
|
||||
|
||||
XPCOM_DESTDIR=$(DEPTH)\rdf\content\public
|
||||
|
|
|
@ -25,7 +25,6 @@ EXPORTS = \
|
|||
nsIDOMNodeObserver.h \
|
||||
nsIDOMXULDocument.h \
|
||||
nsIDOMXULElement.h \
|
||||
nsIDOMXULTreeElement.h \
|
||||
nsIRDFContentModelBuilder.h \
|
||||
nsIRDFDocument.h \
|
||||
nsIXULSortService.h \
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
class nsIController;
|
||||
class nsIDOMElement;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
class nsIRDFCompositeDataSource;
|
||||
class nsIRDFResource;
|
||||
class nsIDOMNodeList;
|
||||
|
||||
|
@ -39,11 +40,6 @@ class nsIDOMXULElement : public nsIDOMElement {
|
|||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULELEMENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
|
||||
|
||||
NS_IMETHOD GetController(nsIController** aController)=0;
|
||||
NS_IMETHOD SetController(nsIController* aController)=0;
|
||||
|
||||
NS_IMETHOD GetId(nsString& aId)=0;
|
||||
NS_IMETHOD SetId(const nsString& aId)=0;
|
||||
|
||||
|
@ -52,6 +48,14 @@ public:
|
|||
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0;
|
||||
|
||||
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase)=0;
|
||||
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase)=0;
|
||||
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
|
||||
|
||||
NS_IMETHOD GetController(nsIController** aController)=0;
|
||||
NS_IMETHOD SetController(nsIController* aController)=0;
|
||||
|
||||
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
|
||||
|
||||
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
|
||||
|
@ -63,14 +67,16 @@ public:
|
|||
|
||||
|
||||
#define NS_DECL_IDOMXULELEMENT \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
|
||||
NS_IMETHOD GetController(nsIController** aController); \
|
||||
NS_IMETHOD SetController(nsIController* aController); \
|
||||
NS_IMETHOD GetId(nsString& aId); \
|
||||
NS_IMETHOD SetId(const nsString& aId); \
|
||||
NS_IMETHOD GetClassName(nsString& aClassName); \
|
||||
NS_IMETHOD SetClassName(const nsString& aClassName); \
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \
|
||||
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \
|
||||
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase); \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
|
||||
NS_IMETHOD GetController(nsIController** aController); \
|
||||
NS_IMETHOD SetController(nsIController* aController); \
|
||||
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
|
||||
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
|
||||
NS_IMETHOD DoCommand(); \
|
||||
|
@ -79,14 +85,16 @@ public:
|
|||
|
||||
|
||||
#define NS_FORWARD_IDOMXULELEMENT(_to) \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
|
||||
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
|
||||
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
|
||||
NS_IMETHOD GetId(nsString& aId) { return _to GetId(aId); } \
|
||||
NS_IMETHOD SetId(const nsString& aId) { return _to SetId(aId); } \
|
||||
NS_IMETHOD GetClassName(nsString& aClassName) { return _to GetClassName(aClassName); } \
|
||||
NS_IMETHOD SetClassName(const nsString& aClassName) { return _to SetClassName(aClassName); } \
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \
|
||||
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \
|
||||
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase) { return _to SetDatabase(aDatabase); } \
|
||||
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
|
||||
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
|
||||
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
|
||||
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \
|
||||
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \
|
||||
NS_IMETHOD DoCommand() { return _to DoCommand(); } \
|
||||
|
|
|
@ -78,10 +78,7 @@ public:
|
|||
nsIContent** aResult) = 0;
|
||||
};
|
||||
|
||||
extern nsresult NS_NewRDFHTMLBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
extern nsresult NS_NewRDFMenuBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
extern nsresult NS_NewRDFToolbarBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
extern nsresult NS_NewRDFTreeBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
extern nsresult NS_NewXULTemplateBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
extern nsresult NS_NewRDFXULBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
|
||||
#endif // nsIRDFContentModelBuilder_h__
|
||||
|
|
|
@ -31,21 +31,15 @@ CPPSRCS = \
|
|||
nsJSNodeObserver.cpp \
|
||||
nsJSXULDocument.cpp \
|
||||
nsJSXULElement.cpp \
|
||||
nsJSXULTreeElement.cpp \
|
||||
nsJSXULFocusTracker.cpp \
|
||||
nsRDFContentUtils.cpp \
|
||||
nsRDFDOMNodeList.cpp \
|
||||
nsRDFElement.cpp \
|
||||
nsRDFGenericBuilder.cpp \
|
||||
nsRDFHTMLBuilder.cpp \
|
||||
nsRDFMenuBuilder.cpp \
|
||||
nsRDFToolbarBuilder.cpp \
|
||||
nsRDFTreeBuilder.cpp \
|
||||
nsRDFXULBuilder.cpp \
|
||||
nsXULAttributes.cpp \
|
||||
nsXULDocument.cpp \
|
||||
nsXULSortService.cpp \
|
||||
nsXULTreeElement.cpp \
|
||||
nsXULSortService.cpp \
|
||||
nsXULDocumentInfo.cpp \
|
||||
nsXULPopupListener.cpp \
|
||||
nsXULFocusTracker.cpp \
|
||||
|
|
|
@ -27,29 +27,23 @@ LCFLAGS = \
|
|||
$(NULL)
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsJSXULFocusTracker.obj \
|
||||
.\$(OBJDIR)\nsRDFGenericBuilder.obj \
|
||||
.\$(OBJDIR)\nsRDFMenuBuilder.obj \
|
||||
.\$(OBJDIR)\nsRDFToolbarBuilder.obj \
|
||||
.\$(OBJDIR)\nsXULAttributes.obj \
|
||||
.\$(OBJDIR)\nsXULFocusTracker.obj \
|
||||
.\$(OBJDIR)\nsXULPopupListener.obj \
|
||||
.\$(OBJDIR)\nsJSElementObserver.obj \
|
||||
.\$(OBJDIR)\nsJSNodeObserver.obj \
|
||||
.\$(OBJDIR)\nsJSXULDocument.obj \
|
||||
.\$(OBJDIR)\nsJSXULElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULTreeElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULFocusTracker.obj \
|
||||
.\$(OBJDIR)\nsRDFContentUtils.obj \
|
||||
.\$(OBJDIR)\nsRDFDOMNodeList.obj \
|
||||
.\$(OBJDIR)\nsRDFElement.obj \
|
||||
.\$(OBJDIR)\nsRDFHTMLBuilder.obj \
|
||||
.\$(OBJDIR)\nsRDFTreeBuilder.obj \
|
||||
.\$(OBJDIR)\nsRDFXULBuilder.obj \
|
||||
.\$(OBJDIR)\nsXULDocument.obj \
|
||||
.\$(OBJDIR)\nsXULDocumentInfo.obj \
|
||||
.\$(OBJDIR)\nsXULPopupListener.obj \
|
||||
.\$(OBJDIR)\nsXULFocusTracker.obj \
|
||||
.\$(OBJDIR)\nsXULSortService.obj \
|
||||
.\$(OBJDIR)\nsXULTreeElement.obj \
|
||||
.\$(OBJDIR)\nsXULDocumentInfo.obj \
|
||||
.\$(OBJDIR)\nsXULKeyListener.obj \
|
||||
.\$(OBJDIR)\nsXULSortService.obj \
|
||||
$(NULL)
|
||||
|
||||
# XXX we are including layout\html\base\src to get HTML elements
|
||||
|
|
|
@ -51,7 +51,7 @@ NS_DEF_PTR(nsIDOMElementObserver);
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMElementObserver *a = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMElementObserver *a = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -61,6 +61,7 @@ GetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ GetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMElementObserver *a = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMElementObserver *a = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -95,6 +96,7 @@ SetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -149,7 +151,7 @@ ResolveElementObserver(JSContext *cx, JSObject *obj, jsval id)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
ElementObserverOnSetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMElementPtr b0;
|
||||
nsAutoString b1;
|
||||
nsAutoString b2;
|
||||
|
@ -211,7 +213,7 @@ ElementObserverOnSetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *a
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
ElementObserverOnRemoveAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMElementPtr b0;
|
||||
nsAutoString b1;
|
||||
|
||||
|
@ -270,7 +272,7 @@ ElementObserverOnRemoveAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
ElementObserverOnSetAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMElementPtr b0;
|
||||
nsIDOMAttrPtr b1;
|
||||
|
||||
|
@ -335,7 +337,7 @@ ElementObserverOnSetAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsva
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
ElementObserverOnRemoveAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMElementPtr b0;
|
||||
nsIDOMAttrPtr b1;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ NS_DEF_PTR(nsIDOMNodeObserver);
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -58,6 +58,7 @@ GetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -82,7 +83,7 @@ GetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -92,6 +93,7 @@ SetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -146,8 +148,7 @@ ResolveNodeObserver(JSContext *cx, JSObject *obj, jsval id)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
NodeObserverOnSetNodeValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMNodePtr b0;
|
||||
nsAutoString b1;
|
||||
|
||||
|
@ -206,8 +207,7 @@ NodeObserverOnSetNodeValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
NodeObserverOnInsertBefore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMNodePtr b0;
|
||||
nsIDOMNodePtr b1;
|
||||
nsIDOMNodePtr b2;
|
||||
|
@ -281,8 +281,7 @@ NodeObserverOnInsertBefore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
NodeObserverOnReplaceChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMNodePtr b0;
|
||||
nsIDOMNodePtr b1;
|
||||
nsIDOMNodePtr b2;
|
||||
|
@ -356,8 +355,7 @@ NodeObserverOnReplaceChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
NodeObserverOnRemoveChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMNodePtr b0;
|
||||
nsIDOMNodePtr b1;
|
||||
|
||||
|
@ -422,8 +420,7 @@ NodeObserverOnRemoveChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
NodeObserverOnAppendChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMNodePtr b0;
|
||||
nsIDOMNodePtr b1;
|
||||
|
||||
|
|
|
@ -51,11 +51,8 @@ NS_DEF_PTR(nsIDOMNodeList);
|
|||
//
|
||||
enum XULDocument_slots {
|
||||
XULDOCUMENT_POPUPELEMENT = -1,
|
||||
|
||||
XULDOCUMENT_TOOLTIPELEMENT = -2,
|
||||
|
||||
XULDOCUMENT_FOCUS = -3
|
||||
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -67,86 +64,45 @@ GetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
{
|
||||
nsIDOMXULDocument *a = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
|
||||
if (nsnull == a) {
|
||||
|
||||
return JS_TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
|
||||
nsIScriptSecurityManager *secMan;
|
||||
|
||||
PRBool ok = PR_FALSE;
|
||||
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
case XULDOCUMENT_POPUPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (NS_OK == a->GetPopupElement(&prop)) {
|
||||
|
||||
// get the js object
|
||||
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case XULDOCUMENT_TOOLTIPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (NS_OK == a->GetTooltipElement(&prop)) {
|
||||
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
|
||||
}
|
||||
|
@ -193,100 +149,52 @@ SetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
{
|
||||
nsIDOMXULDocument *a = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
|
||||
if (nsnull == a) {
|
||||
|
||||
return JS_TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
|
||||
nsIScriptSecurityManager *secMan;
|
||||
|
||||
PRBool ok = PR_FALSE;
|
||||
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
case XULDOCUMENT_POPUPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
|
||||
kIElementIID, "Element",
|
||||
|
||||
cx, *vp)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
a->SetPopupElement(prop);
|
||||
|
||||
NS_IF_RELEASE(prop);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case XULDOCUMENT_TOOLTIPELEMENT:
|
||||
|
||||
{
|
||||
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
|
||||
|
||||
if (!ok) {
|
||||
|
||||
//Need to throw error here
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsIDOMElement* prop;
|
||||
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
|
||||
kIElementIID, "Element",
|
||||
|
||||
cx, *vp)) {
|
||||
|
||||
return JS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
a->SetTooltipElement(prop);
|
||||
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
|
@ -340,8 +248,6 @@ PR_STATIC_CALLBACK(JSBool)
|
|||
XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMElement* nativeRet;
|
||||
nsAutoString b0;
|
||||
|
||||
|
@ -393,8 +299,6 @@ PR_STATIC_CALLBACK(JSBool)
|
|||
XULDocumentGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodeList* nativeRet;
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
|
@ -466,9 +370,7 @@ JSClass XULDocumentClass = {
|
|||
static JSPropertySpec XULDocumentProperties[] =
|
||||
{
|
||||
{"popupElement", XULDOCUMENT_POPUPELEMENT, JSPROP_ENUMERATE},
|
||||
|
||||
{"tooltipElement", XULDOCUMENT_TOOLTIPELEMENT, JSPROP_ENUMERATE},
|
||||
|
||||
{"focus", XULDOCUMENT_FOCUS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsIController.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
@ -41,6 +42,7 @@ static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
|||
static NS_DEFINE_IID(kIControllerIID, NS_ICONTROLLER_IID);
|
||||
static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kICSSStyleDeclarationIID, NS_IDOMCSSSTYLEDECLARATION_IID);
|
||||
static NS_DEFINE_IID(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID);
|
||||
static NS_DEFINE_IID(kIXULElementIID, NS_IDOMXULELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
|
||||
|
@ -48,6 +50,7 @@ static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
|
|||
NS_DEF_PTR(nsIController);
|
||||
NS_DEF_PTR(nsIDOMElement);
|
||||
NS_DEF_PTR(nsIDOMCSSStyleDeclaration);
|
||||
NS_DEF_PTR(nsIRDFCompositeDataSource);
|
||||
NS_DEF_PTR(nsIDOMXULElement);
|
||||
NS_DEF_PTR(nsIRDFResource);
|
||||
NS_DEF_PTR(nsIDOMNodeList);
|
||||
|
@ -56,11 +59,12 @@ NS_DEF_PTR(nsIDOMNodeList);
|
|||
// XULElement property ids
|
||||
//
|
||||
enum XULElement_slots {
|
||||
XULELEMENT_RESOURCE = -1,
|
||||
XULELEMENT_CONTROLLER = -2,
|
||||
XULELEMENT_ID = -3,
|
||||
XULELEMENT_CLASSNAME = -4,
|
||||
XULELEMENT_STYLE = -5
|
||||
XULELEMENT_ID = -1,
|
||||
XULELEMENT_CLASSNAME = -2,
|
||||
XULELEMENT_STYLE = -3,
|
||||
XULELEMENT_DATABASE = -4,
|
||||
XULELEMENT_RESOURCE = -5,
|
||||
XULELEMENT_CONTROLLER = -6
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -70,7 +74,7 @@ enum XULElement_slots {
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -80,45 +84,11 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case XULELEMENT_RESOURCE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFResource* prop;
|
||||
if (NS_OK == a->GetResource(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (NS_OK == a->GetController(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_ID:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
|
||||
|
@ -168,6 +138,57 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_DATABASE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFCompositeDataSource* prop;
|
||||
if (NS_OK == a->GetDatabase(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFCompositeDataSource::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_RESOURCE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFResource* prop;
|
||||
if (NS_OK == a->GetResource(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (NS_OK == a->GetController(&prop)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -187,7 +208,7 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -197,28 +218,11 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
|
||||
kIControllerIID, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetController(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_ID:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
|
||||
|
@ -247,6 +251,40 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_DATABASE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIRDFCompositeDataSource* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
|
||||
kIRDFCompositeDataSourceIID, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetDatabase(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
case XULELEMENT_CONTROLLER:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIController* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
|
||||
kIControllerIID, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetController(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -296,8 +334,7 @@ ResolveXULElement(JSContext *cx, JSObject *obj, jsval id)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
nsIDOMElementPtr b1;
|
||||
|
||||
|
@ -356,8 +393,7 @@ XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
nsIDOMElementPtr b1;
|
||||
|
||||
|
@ -416,8 +452,7 @@ XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsva
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
|
@ -464,8 +499,7 @@ XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULElementGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMNodeList* nativeRet;
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
|
@ -536,11 +570,12 @@ JSClass XULElementClass = {
|
|||
//
|
||||
static JSPropertySpec XULElementProperties[] =
|
||||
{
|
||||
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
|
||||
{"id", XULELEMENT_ID, JSPROP_ENUMERATE},
|
||||
{"className", XULELEMENT_CLASSNAME, JSPROP_ENUMERATE},
|
||||
{"style", XULELEMENT_STYLE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"database", XULELEMENT_DATABASE, JSPROP_ENUMERATE},
|
||||
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ enum XULFocusTracker_slots {
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -67,7 +67,7 @@ GetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ GetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
|
@ -118,7 +118,7 @@ SetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ ResolveXULFocusTracker(JSContext *cx, JSObject *obj, jsval id)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULFocusTrackerAddFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMElementPtr b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -246,7 +246,7 @@ XULFocusTrackerAddFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULFocusTrackerRemoveFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIDOMElementPtr b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -302,7 +302,7 @@ XULFocusTrackerRemoveFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULFocusTrackerFocusChanged(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
|
@ -349,7 +349,7 @@ XULFocusTrackerFocusChanged(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULFocusTrackerGetController(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIController* nativeRet;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -398,7 +398,7 @@ XULFocusTrackerGetController(JSContext *cx, JSObject *obj, uintN argc, jsval *ar
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULFocusTrackerSetController(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsIControllerPtr b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -425,7 +425,7 @@ XULFocusTrackerSetController(JSContext *cx, JSObject *obj, uintN argc, jsval *ar
|
|||
|
||||
if (argc >= 1) {
|
||||
|
||||
if (JS_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports**)&b0,
|
||||
if (JS_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports**) &b0,
|
||||
kIControllerIID, cx, argv[0])) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,6 @@ static NS_DEFINE_IID(kILocaleIID, NS_ILOCALE_IID);
|
|||
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
static NS_DEFINE_CID(kDateTimeFormatIID, NS_IDATETIMEFORMAT_IID);
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
nsRDFContentUtils::AttachTextNode(nsIContent* parent, nsIRDFNode* value)
|
||||
{
|
||||
|
@ -142,11 +140,9 @@ nsRDFContentUtils::FindChildByTag(nsIContent* aElement,
|
|||
|
||||
|
||||
nsresult
|
||||
nsRDFContentUtils::FindChildByTagAndResource(nsIContent* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aTag,
|
||||
nsIRDFResource* aResource,
|
||||
nsIContent** aResult)
|
||||
nsRDFContentUtils::FindChildByResource(nsIContent* aElement,
|
||||
nsIRDFResource* aResource,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -159,28 +155,12 @@ nsRDFContentUtils::FindChildByTagAndResource(nsIContent* aElement,
|
|||
if (NS_FAILED(rv = aElement->ChildAt(i, *getter_AddRefs(kid))))
|
||||
return rv; // XXX fatal
|
||||
|
||||
// Make sure it's a <xul:treecell>
|
||||
PRInt32 nameSpaceID;
|
||||
if (NS_FAILED(rv = kid->GetNameSpaceID(nameSpaceID)))
|
||||
return rv; // XXX fatal
|
||||
|
||||
if (nameSpaceID != aNameSpaceID)
|
||||
continue; // wrong namespace
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
if (NS_FAILED(rv = kid->GetTag(*getter_AddRefs(tag))))
|
||||
return rv; // XXX fatal
|
||||
|
||||
if (tag.get() != aTag)
|
||||
continue; // wrong tag
|
||||
|
||||
// Now get the resource ID from the RDF:ID attribute. We do it
|
||||
// via the content model, because you're never sure who
|
||||
// might've added this stuff in...
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = GetElementResource(kid, getter_AddRefs(resource));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "severe error retrieving resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
if (resource.get() != aResource)
|
||||
continue; // not the resource we want
|
||||
|
@ -221,14 +201,18 @@ nsRDFContentUtils::GetElementResource(nsIContent* aElement, nsIRDFResource** aRe
|
|||
if (! doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString uri;
|
||||
char buf[256];
|
||||
nsCAutoString uri;
|
||||
nsStr::Initialize(uri, buf, sizeof(buf) - 1, 0, eOneByte, PR_FALSE);
|
||||
buf[0] = 0;
|
||||
|
||||
rv = nsRDFContentUtils::MakeElementURI(doc, id, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = rdf->GetUnicodeResource(uri.GetUnicode(), aResult);
|
||||
rv = rdf->GetResource(uri, aResult);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -452,7 +436,7 @@ nsRDFContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpac
|
|||
|
||||
|
||||
nsresult
|
||||
nsRDFContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsString& aURI)
|
||||
nsRDFContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI)
|
||||
{
|
||||
// Convert an element's ID to a URI that can be used to refer to
|
||||
// the element in the XUL graph.
|
||||
|
@ -477,11 +461,12 @@ nsRDFContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aEleme
|
|||
if (! spec)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
aURI = spec; // copied by nsString, right
|
||||
aURI = spec;
|
||||
|
||||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
#endif
|
||||
if (aElementID.First() != PRUnichar('#')) {
|
||||
if (aElementID.First() != '#') {
|
||||
aURI += '#';
|
||||
}
|
||||
aURI += aElementID;
|
||||
|
|
|
@ -33,6 +33,7 @@ class nsIContent;
|
|||
class nsIDocument;
|
||||
class nsIDOMNodeList;
|
||||
class nsIRDFNode;
|
||||
class nsCString;
|
||||
class nsString;
|
||||
|
||||
|
||||
|
@ -50,11 +51,9 @@ public:
|
|||
nsIContent **aResult);
|
||||
|
||||
static nsresult
|
||||
FindChildByTagAndResource(nsIContent* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aTag,
|
||||
nsIRDFResource* aResource,
|
||||
nsIContent** aResult);
|
||||
FindChildByResource(nsIContent* aElement,
|
||||
nsIRDFResource* aResource,
|
||||
nsIContent** aResult);
|
||||
|
||||
static nsresult
|
||||
GetElementResource(nsIContent* aElement, nsIRDFResource** aResult);
|
||||
|
@ -72,7 +71,7 @@ public:
|
|||
GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult);
|
||||
|
||||
static nsresult
|
||||
MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsString& aURI);
|
||||
MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI);
|
||||
|
||||
static nsresult
|
||||
MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID);
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
#include "nsIStyledContent.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsXULTreeElement.h"
|
||||
#include "rdfutil.h"
|
||||
#include "prlog.h"
|
||||
#include "rdf.h"
|
||||
|
@ -317,8 +316,8 @@ private:
|
|||
PRBool mContentsMustBeGenerated;
|
||||
nsVoidArray* mBroadcastListeners; // [WEAK]
|
||||
nsIDOMXULElement* mBroadcaster; // [OWNER]
|
||||
nsXULElement* mInnerXULElement; // [OWNER]
|
||||
nsIController* mController; // [OWNER]
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase; // [OWNER]
|
||||
};
|
||||
|
||||
|
||||
|
@ -397,7 +396,6 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag)
|
|||
mContentsMustBeGenerated(PR_FALSE),
|
||||
mBroadcastListeners(nsnull),
|
||||
mBroadcaster(nsnull),
|
||||
mInnerXULElement(nsnull),
|
||||
mController(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -514,8 +512,6 @@ RDFElementImpl::~RDFElementImpl()
|
|||
++entry;
|
||||
}
|
||||
}
|
||||
|
||||
delete mInnerXULElement;
|
||||
}
|
||||
|
||||
|
||||
|
@ -576,16 +572,6 @@ RDFElementImpl::QueryInterface(REFNSIID iid, void** result)
|
|||
else if (iid.Equals(kIJSScriptObjectIID)) {
|
||||
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
|
||||
}
|
||||
else if (iid.Equals(nsIDOMXULTreeElement::GetIID()) &&
|
||||
(mNameSpaceID == kNameSpaceID_XUL) &&
|
||||
(mTag == kTreeAtom)) {
|
||||
if (! mInnerXULElement) {
|
||||
if ((mInnerXULElement = new nsXULTreeElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return mInnerXULElement->QueryInterface(iid, result);
|
||||
}
|
||||
else {
|
||||
*result = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -1275,16 +1261,8 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject
|
|||
if (! mScriptObject) {
|
||||
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
|
||||
|
||||
nsresult (*fn)(nsIScriptContext* aContext, nsISupports* aSupports, nsISupports* aParent, void** aReturn);
|
||||
rv = NS_NewScriptXULElement(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
|
||||
|
||||
if (mTag == kTreeAtom) {
|
||||
fn = NS_NewScriptXULTreeElement;
|
||||
}
|
||||
else {
|
||||
fn = NS_NewScriptXULElement;
|
||||
}
|
||||
|
||||
rv = fn(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
|
||||
NS_RELEASE(global);
|
||||
|
||||
// Ensure that a reference exists to this element
|
||||
|
@ -2532,6 +2510,36 @@ RDFElementImpl::GetResource(nsIRDFResource** aResource)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFElementImpl::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
|
||||
{
|
||||
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
|
||||
if (! aDatabase)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aDatabase = mDatabase;
|
||||
NS_IF_ADDREF(*aDatabase);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFElementImpl::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
|
||||
{
|
||||
// XXX maybe someday you'll be allowed to change it.
|
||||
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
|
||||
if (mDatabase)
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
mDatabase = aDatabase;
|
||||
|
||||
// XXX reconstruct the entire tree now!
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation methods
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -51,6 +51,8 @@ public:
|
|||
RDFGenericBuilderImpl();
|
||||
virtual ~RDFGenericBuilderImpl();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
@ -91,30 +93,42 @@ public:
|
|||
// nsIDOMElementObserver interface
|
||||
NS_DECL_IDOMELEMENTOBSERVER
|
||||
|
||||
// nsITimerCallback interface
|
||||
virtual void Notify(nsITimer* aTimer);
|
||||
|
||||
// Implementation methods
|
||||
nsresult
|
||||
SetAllAttributesOnElement(nsIContent *aParentNode, nsIContent *aNode, nsIRDFResource *res);
|
||||
|
||||
nsresult
|
||||
FindTemplateForResource(nsIRDFResource *aNode, nsIContent **theTemplate);
|
||||
FindTemplate(nsIContent* aElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aChild,
|
||||
nsIContent **theTemplate);
|
||||
|
||||
nsresult
|
||||
IsTemplateRuleMatch(nsIRDFResource *aNode, nsIContent *aRule, PRBool *matchingRuleFound);
|
||||
IsTemplateRuleMatch(nsIContent* aElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aChild,
|
||||
nsIContent *aRule,
|
||||
PRBool *isMatch);
|
||||
|
||||
PRBool
|
||||
IsIgnoreableAttribute(PRInt32 aNameSpaceID, nsIAtom* aAtom);
|
||||
|
||||
nsresult
|
||||
GetSubstitutionText(nsIRDFResource* aResource,
|
||||
const nsString& aSubstitution,
|
||||
nsString& aResult);
|
||||
|
||||
nsresult
|
||||
BuildContentFromTemplate(nsIContent *aTemplateNode,
|
||||
nsIContent *aRealNode,
|
||||
PRBool aIsUnique,
|
||||
nsIRDFResource* aValue,
|
||||
nsIRDFResource* aChild,
|
||||
PRInt32 aNaturalOrderPos);
|
||||
|
||||
nsresult
|
||||
CreateWidgetItem(nsIContent* aElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue,
|
||||
nsIRDFResource* aChild,
|
||||
PRInt32 aNaturalOrderPos);
|
||||
|
||||
enum eUpdateAction { eSet, eClear };
|
||||
|
@ -126,6 +140,11 @@ public:
|
|||
nsIRDFResource* aProperty,
|
||||
nsIRDFNode* aValue);
|
||||
|
||||
nsresult
|
||||
RemoveWidgetItem(nsIContent* aElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue);
|
||||
|
||||
nsresult
|
||||
CreateContainerContents(nsIContent* aElement, nsIRDFResource* aResource);
|
||||
|
||||
|
@ -138,27 +157,6 @@ public:
|
|||
nsIAtom* aTag,
|
||||
nsIContent** aResult);
|
||||
|
||||
virtual nsresult
|
||||
AddWidgetItem(nsIContent* aWidgetElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue,
|
||||
PRInt32 naturalOrderPos) = 0;
|
||||
|
||||
virtual nsresult
|
||||
RemoveWidgetItem(nsIContent* aWidgetElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue) = 0;
|
||||
|
||||
virtual nsresult
|
||||
SetWidgetAttribute(nsIContent* aWidgetElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFNode* aValue) = 0;
|
||||
|
||||
virtual nsresult
|
||||
UnsetWidgetAttribute(nsIContent* aWidgetElement,
|
||||
nsIRDFResource* aProperty,
|
||||
nsIRDFNode* aValue) = 0;
|
||||
|
||||
virtual PRBool
|
||||
IsContainmentProperty(nsIContent* aElement, nsIRDFResource* aProperty);
|
||||
|
||||
|
@ -178,11 +176,8 @@ public:
|
|||
IsElementInWidget(nsIContent* aElement);
|
||||
|
||||
PRBool
|
||||
IsItemOrFolder(nsIContent* aElement);
|
||||
IsResourceElement(nsIContent* aElement);
|
||||
|
||||
PRBool
|
||||
IsWidgetInsertionRootElement(nsIContent* aElement);
|
||||
|
||||
nsresult
|
||||
GetDOMNodeResource(nsIDOMNode* aNode, nsIRDFResource** aResource);
|
||||
|
||||
|
@ -198,20 +193,8 @@ public:
|
|||
CloseWidgetItem(nsIContent* aElement);
|
||||
|
||||
virtual nsresult
|
||||
GetRootWidgetAtom(nsIAtom** aResult) = 0;
|
||||
|
||||
virtual nsresult
|
||||
GetWidgetItemAtom(nsIAtom** aResult) = 0;
|
||||
|
||||
virtual nsresult
|
||||
GetWidgetFolderAtom(nsIAtom** aResult) = 0;
|
||||
|
||||
virtual nsresult
|
||||
GetInsertionRootAtom(nsIAtom** aResult) = 0;
|
||||
|
||||
virtual nsresult
|
||||
GetItemAtomThatContainsTheChildren(nsIAtom** aResult) = 0;
|
||||
// Well, you come up with a better name.
|
||||
RemoveAndRebuildGeneratedChildren(nsIContent* aElement);
|
||||
|
||||
|
||||
protected:
|
||||
nsIRDFDocument* mDocument;
|
||||
|
@ -220,9 +203,6 @@ protected:
|
|||
|
||||
nsITimer *mTimer;
|
||||
|
||||
virtual void
|
||||
Notify(nsITimer *timer) = 0;
|
||||
|
||||
// pseudo-constants
|
||||
static nsrefcnt gRefCnt;
|
||||
static nsIRDFService* gRDFService;
|
||||
|
@ -232,6 +212,7 @@ protected:
|
|||
static nsIAtom* kContainerAtom;
|
||||
static nsIAtom* kLazyContentAtom;
|
||||
static nsIAtom* kIsContainerAtom;
|
||||
static nsIAtom* kIsEmptyAtom;
|
||||
static nsIAtom* kXULContentsGeneratedAtom;
|
||||
static nsIAtom* kTemplateContentsGeneratedAtom;
|
||||
static nsIAtom* kContainerContentsGeneratedAtom;
|
||||
|
@ -244,9 +225,8 @@ protected:
|
|||
static nsIAtom* kContainmentAtom;
|
||||
static nsIAtom* kIgnoreAtom;
|
||||
static nsIAtom* kRefAtom;
|
||||
static nsIAtom* kValueAtom;
|
||||
|
||||
static nsIAtom* kSubcontainmentAtom;
|
||||
static nsIAtom* kRootcontainmentAtom;
|
||||
static nsIAtom* kTemplateAtom;
|
||||
static nsIAtom* kRuleAtom;
|
||||
static nsIAtom* kTextAtom;
|
||||
|
|
|
@ -109,9 +109,7 @@ static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
|||
static NS_DEFINE_CID(kRDFCompositeDataSourceCID, NS_RDFCOMPOSITEDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
|
||||
static NS_DEFINE_CID(kRDFTreeBuilderCID, NS_RDFTREEBUILDER_CID);
|
||||
static NS_DEFINE_CID(kRDFMenuBuilderCID, NS_RDFMENUBUILDER_CID);
|
||||
static NS_DEFINE_CID(kRDFToolbarBuilderCID, NS_RDFTOOLBARBUILDER_CID);
|
||||
static NS_DEFINE_CID(kXULTemplateBuilderCID, NS_XULTEMPLATEBUILDER_CID);
|
||||
static NS_DEFINE_CID(kXULDocumentCID, NS_XULDOCUMENT_CID);
|
||||
static NS_DEFINE_CID(kXULDocumentInfoCID, NS_XULDOCUMENTINFO_CID);
|
||||
static NS_DEFINE_CID(kXULKeyListenerCID, NS_XULKEYLISTENER_CID);
|
||||
|
@ -317,8 +315,8 @@ public:
|
|||
nsIRDFResource* aProperty,
|
||||
nsIRDFNode* aValue);
|
||||
|
||||
nsresult CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
|
||||
const nsString& aDataSources);
|
||||
nsresult CreateTemplateBuilder(nsIContent* aElement,
|
||||
const nsString& aDataSources);
|
||||
|
||||
nsresult
|
||||
GetRDFResourceFromXULElement(nsIDOMNode* aNode, nsIRDFResource** aResult);
|
||||
|
@ -430,7 +428,7 @@ RDFXULBuilderImpl::Init()
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
kLazyContentAtom = NS_NewAtom("lazycontent");
|
||||
kLazyContentAtom = NS_NewAtom("lazycontent");
|
||||
kDataSourcesAtom = NS_NewAtom("datasources");
|
||||
kIdAtom = NS_NewAtom("id");
|
||||
kInstanceOfAtom = NS_NewAtom("instanceof");
|
||||
|
@ -1669,63 +1667,6 @@ RDFXULBuilderImpl::OnSetAttribute(nsIDOMElement* aElement, const nsString& aName
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if ((nameSpaceID == kNameSpaceID_None) && (nameAtom.get() == kRefAtom)) {
|
||||
// They're changing the RDF 'ref=' of the element. Do some
|
||||
// trickery so that any generic builders that are referring to
|
||||
// this element will reconstruct the contents of the
|
||||
// element. Blow away _all_ of the children, and re-annotate
|
||||
// the node s.t. children will be reconstructed properly.
|
||||
PRInt32 count;
|
||||
rv = element->ChildCount(count);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get element's child count");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
while (--count >= 0) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
rv = element->ChildAt(count, *getter_AddRefs(child));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = element->RemoveChildAt(count, PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "error removing child");
|
||||
|
||||
if (! IsXULElement(child)) {
|
||||
// If it's _not_ a XUL element, then we want to blow
|
||||
// it and all of its kids out of the XUL document's
|
||||
// resource-to-element map.
|
||||
rv = child->SetDocument(nsnull, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the contents-generated attribute so that the next time we
|
||||
// come back, we'll regenerate the kids we just killed.
|
||||
rv = element->UnsetAttribute(kNameSpaceID_None,
|
||||
kTemplateContentsGeneratedAtom,
|
||||
PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = element->UnsetAttribute(kNameSpaceID_None,
|
||||
kContainerContentsGeneratedAtom,
|
||||
PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// This is a _total_ hack to make sure that any XUL we blow away
|
||||
// gets rebuilt.
|
||||
rv = element->UnsetAttribute(kNameSpaceID_None,
|
||||
kXULContentsGeneratedAtom,
|
||||
PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = element->SetAttribute(kNameSpaceID_RDF,
|
||||
kLazyContentAtom,
|
||||
"true",
|
||||
PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Fall through and change the property "normally" now.
|
||||
}
|
||||
|
||||
|
||||
// If we get here, it's a vanilla property that we need to go into
|
||||
// the RDF graph to update. So, build an RDF resource from the
|
||||
// property name...
|
||||
|
@ -2643,15 +2584,7 @@ RDFXULBuilderImpl::CreateXULElement(nsINameSpace* aContainingNameSpace,
|
|||
kDataSourcesAtom,
|
||||
dataSources)) {
|
||||
|
||||
nsCID builderCID;
|
||||
if (aTagName == kTreeAtom)
|
||||
builderCID = kRDFTreeBuilderCID;
|
||||
else if (aTagName == kMenuAtom || aTagName == kMenuBarAtom)
|
||||
builderCID = kRDFMenuBuilderCID;
|
||||
else if (aTagName == kToolbarAtom)
|
||||
builderCID = kRDFToolbarBuilderCID;
|
||||
|
||||
rv = CreateBuilder(builderCID, element, dataSources);
|
||||
rv = CreateTemplateBuilder(element, dataSources);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add datasources");
|
||||
}
|
||||
}
|
||||
|
@ -2928,20 +2861,19 @@ RDFXULBuilderImpl::RemoveAttribute(nsIContent* aElement,
|
|||
}
|
||||
|
||||
nsresult
|
||||
RDFXULBuilderImpl::CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
|
||||
const nsString& aDataSources)
|
||||
RDFXULBuilderImpl::CreateTemplateBuilder(nsIContent* aElement,
|
||||
const nsString& aDataSources)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// construct a new builder
|
||||
nsCOMPtr<nsIRDFContentModelBuilder> builder;
|
||||
if (NS_FAILED(rv = nsComponentManager::CreateInstance(aBuilderCID,
|
||||
nsnull,
|
||||
kIRDFContentModelBuilderIID,
|
||||
(void**) getter_AddRefs(builder)))) {
|
||||
NS_ERROR("unable to create tree content model builder");
|
||||
return rv;
|
||||
}
|
||||
rv = nsComponentManager::CreateInstance(kXULTemplateBuilderCID,
|
||||
nsnull,
|
||||
kIRDFContentModelBuilderIID,
|
||||
(void**) getter_AddRefs(builder));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create tree content model builder");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (NS_FAILED(rv = builder->SetRootContent(aElement))) {
|
||||
NS_ERROR("unable to set builder's root content element");
|
||||
|
@ -2981,6 +2913,14 @@ RDFXULBuilderImpl::CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
|
|||
//
|
||||
PRInt32 first = 0;
|
||||
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(mDocument);
|
||||
if (! document)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIURI> docURL = dont_AddRef( document->GetDocumentURL() );
|
||||
if (! docURL)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
while(1) {
|
||||
while (first < aDataSources.Length() && nsString::IsSpace(aDataSources.CharAt(first)))
|
||||
++first;
|
||||
|
@ -2996,6 +2936,9 @@ RDFXULBuilderImpl::CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
|
|||
aDataSources.Mid(uri, first, last - first);
|
||||
first = last + 1;
|
||||
|
||||
rv = rdf_MakeAbsoluteURI(docURL, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFDataSource> ds;
|
||||
|
||||
// Some monkey business to convert the nsAutoString to a
|
||||
|
|
|
@ -2746,6 +2746,17 @@ XULDocumentImpl::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn
|
|||
|
||||
nsresult rv;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
|
||||
char* tagCStr = aTagName.ToNewCString();
|
||||
|
||||
PR_LOG(gXULLog, PR_LOG_DEBUG,
|
||||
("xul[CreateElement] %s", tagCStr));
|
||||
|
||||
delete[] tagCStr;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIAtom> name;
|
||||
PRInt32 nameSpaceID;
|
||||
|
||||
|
@ -2925,6 +2936,19 @@ XULDocumentImpl::CreateElementWithNameSpace(const nsString& aTagName,
|
|||
|
||||
nsresult rv;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
|
||||
char* namespaceCStr = aNameSpace.ToNewCString();
|
||||
char* tagCStr = aTagName.ToNewCString();
|
||||
|
||||
PR_LOG(gXULLog, PR_LOG_DEBUG,
|
||||
("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr));
|
||||
|
||||
delete[] tagCStr;
|
||||
delete[] namespaceCStr;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIAtom> name = dont_AddRef(NS_NewAtom(aTagName.GetUnicode()));
|
||||
if (! name)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -3005,12 +3029,12 @@ XULDocumentImpl::GetElementById(const nsString& aId, nsIDOMElement** aReturn)
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsAutoString uri;
|
||||
nsCAutoString uri;
|
||||
rv = nsRDFContentUtils::MakeElementURI(this, aId, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(resource)))) {
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(resource)))) {
|
||||
NS_ERROR("unable to get resource");
|
||||
return rv;
|
||||
}
|
||||
|
@ -3209,15 +3233,14 @@ XULDocumentImpl::CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aR
|
|||
nsCOMPtr<nsIDOMElement> domRoot = do_QueryInterface(aPopupElement);
|
||||
domRoot->GetAttribute("id", idValue);
|
||||
|
||||
nsAutoString uri;
|
||||
nsCAutoString uri;
|
||||
rv = nsRDFContentUtils::MakeElementURI(this, idValue, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Use the absolute URL to retrieve a resource from the RDF
|
||||
// service that corresponds to the root content.
|
||||
nsCOMPtr<nsIRDFResource> rootResource;
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(),
|
||||
getter_AddRefs(rootResource)))) {
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(rootResource)))) {
|
||||
NS_ERROR("Uh-oh. Couldn't obtain the resource for the popup doc root.");
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
#include "nsIStyledContent.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsXULTreeElement.h"
|
||||
#include "rdfutil.h"
|
||||
#include "prlog.h"
|
||||
#include "rdf.h"
|
||||
|
@ -317,8 +316,8 @@ private:
|
|||
PRBool mContentsMustBeGenerated;
|
||||
nsVoidArray* mBroadcastListeners; // [WEAK]
|
||||
nsIDOMXULElement* mBroadcaster; // [OWNER]
|
||||
nsXULElement* mInnerXULElement; // [OWNER]
|
||||
nsIController* mController; // [OWNER]
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase; // [OWNER]
|
||||
};
|
||||
|
||||
|
||||
|
@ -397,7 +396,6 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag)
|
|||
mContentsMustBeGenerated(PR_FALSE),
|
||||
mBroadcastListeners(nsnull),
|
||||
mBroadcaster(nsnull),
|
||||
mInnerXULElement(nsnull),
|
||||
mController(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -514,8 +512,6 @@ RDFElementImpl::~RDFElementImpl()
|
|||
++entry;
|
||||
}
|
||||
}
|
||||
|
||||
delete mInnerXULElement;
|
||||
}
|
||||
|
||||
|
||||
|
@ -576,16 +572,6 @@ RDFElementImpl::QueryInterface(REFNSIID iid, void** result)
|
|||
else if (iid.Equals(kIJSScriptObjectIID)) {
|
||||
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
|
||||
}
|
||||
else if (iid.Equals(nsIDOMXULTreeElement::GetIID()) &&
|
||||
(mNameSpaceID == kNameSpaceID_XUL) &&
|
||||
(mTag == kTreeAtom)) {
|
||||
if (! mInnerXULElement) {
|
||||
if ((mInnerXULElement = new nsXULTreeElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return mInnerXULElement->QueryInterface(iid, result);
|
||||
}
|
||||
else {
|
||||
*result = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -1275,16 +1261,8 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject
|
|||
if (! mScriptObject) {
|
||||
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
|
||||
|
||||
nsresult (*fn)(nsIScriptContext* aContext, nsISupports* aSupports, nsISupports* aParent, void** aReturn);
|
||||
rv = NS_NewScriptXULElement(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
|
||||
|
||||
if (mTag == kTreeAtom) {
|
||||
fn = NS_NewScriptXULTreeElement;
|
||||
}
|
||||
else {
|
||||
fn = NS_NewScriptXULElement;
|
||||
}
|
||||
|
||||
rv = fn(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
|
||||
NS_RELEASE(global);
|
||||
|
||||
// Ensure that a reference exists to this element
|
||||
|
@ -2532,6 +2510,36 @@ RDFElementImpl::GetResource(nsIRDFResource** aResource)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFElementImpl::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
|
||||
{
|
||||
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
|
||||
if (! aDatabase)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aDatabase = mDatabase;
|
||||
NS_IF_ADDREF(*aDatabase);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFElementImpl::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
|
||||
{
|
||||
// XXX maybe someday you'll be allowed to change it.
|
||||
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
|
||||
if (mDatabase)
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
mDatabase = aDatabase;
|
||||
|
||||
// XXX reconstruct the entire tree now!
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation methods
|
||||
|
||||
|
|
|
@ -82,7 +82,6 @@
|
|||
#include "nsIRDFService.h"
|
||||
#include "rdf.h"
|
||||
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
|
||||
#include "nsILocale.h"
|
||||
|
@ -112,7 +111,6 @@ static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
|||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIDomXulTreeElementIID, NS_IDOMXULTREEELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDomXulElementIID, NS_IDOMXULELEMENT_IID);
|
||||
|
||||
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
||||
|
@ -1292,7 +1290,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
|
|||
if (NS_FAILED(rv = FindTreeElement(container, getter_AddRefs(treeNode)))) return(rv);
|
||||
|
||||
// get composite db for tree
|
||||
nsCOMPtr<nsIDOMXULTreeElement> domXulTree;
|
||||
nsCOMPtr<nsIDOMXULElement> domXulTree;
|
||||
sortInfo.rdfService = gRDFService;
|
||||
sortInfo.db = nsnull;
|
||||
|
||||
|
@ -1300,7 +1298,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
|
|||
// that we're sure that we'll hold a reference to it (and actually
|
||||
// release that reference when the stack frame goes away).
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> cds;
|
||||
rv = treeNode->QueryInterface(kIDomXulTreeElementIID, getter_AddRefs(domXulTree));
|
||||
rv = treeNode->QueryInterface(kIDomXulElementIID, getter_AddRefs(domXulTree));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))
|
||||
|
@ -1488,7 +1486,7 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
|
|||
// get composite db for tree
|
||||
sortInfo.rdfService = gRDFService;
|
||||
sortInfo.db = nsnull;
|
||||
nsCOMPtr<nsIDOMXULTreeElement> domXulTree = do_QueryInterface(treeNode);
|
||||
nsCOMPtr<nsIDOMXULElement> domXulTree = do_QueryInterface(treeNode);
|
||||
if (!domXulTree) return(NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> cds;
|
||||
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1292,10 +1292,10 @@ XULContentSinkImpl::GetXULIDAttribute(const nsIParserNode& aNode,
|
|||
nsAutoString id = aNode.GetValueAt(i);
|
||||
nsRDFParserUtils::StripAndConvert(id);
|
||||
|
||||
nsAutoString uri;
|
||||
nsCAutoString uri;
|
||||
nsRDFContentUtils::MakeElementURI(mDocument, id, uri);
|
||||
|
||||
return gRDFService->GetUnicodeResource(uri.GetUnicode(), aResource);
|
||||
return gRDFService->GetResource(uri, aResource);
|
||||
}
|
||||
|
||||
// Otherwise, we couldn't find anything, so just gensym one...
|
||||
|
|
Двоичные данные
rdf/macbuild/rdf.mcp
Двоичные данные
rdf/macbuild/rdf.mcp
Двоичный файл не отображается.
|
@ -53,11 +53,13 @@
|
|||
|
||||
<tree id="other-panels" style="width:15em;height:15em;"
|
||||
datasources="resource://res/rdf/sidebar-registry.rdf"
|
||||
onclick="selected()" >
|
||||
onclick="selected()"
|
||||
ref="NC:SidebarRoot" >
|
||||
|
||||
<!-- The template we'll use to build rows in the content model. -->
|
||||
<template>
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -67,6 +69,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -75,9 +78,6 @@
|
|||
<treecell>Name</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<!-- The tree body: it's rooted at sitemap1.rdf's root -->
|
||||
<treechildren id="other-panels-children" ref="NC:SidebarRoot" open="true"/>
|
||||
</tree>
|
||||
|
||||
<box align="vertical" class="button-group">
|
||||
|
|
|
@ -71,17 +71,14 @@
|
|||
var tree = document.getElementById("tree");
|
||||
dump("tree = " + tree + "\n");
|
||||
|
||||
var body = tree.childNodes[2]; // template, treehead, treechildren
|
||||
dump("body = " + body + "\n");
|
||||
|
||||
var currentRef = body.getAttribute("ref");
|
||||
var currentRef = tree.getAttribute("ref");
|
||||
dump("currentRef = " + currentRef + "\n");
|
||||
|
||||
if (currentRef == "NC:BookmarksRoot") {
|
||||
body.setAttribute("ref", "NC:PersonalToolbarFolder");
|
||||
tree.setAttribute("ref", "NC:PersonalToolbarFolder");
|
||||
}
|
||||
else {
|
||||
body.setAttribute("ref", "NC:BookmarksRoot");
|
||||
tree.setAttribute("ref", "NC:BookmarksRoot");
|
||||
}
|
||||
}
|
||||
</html:script>
|
||||
|
@ -92,31 +89,35 @@
|
|||
<html:button onclick="MutateBody();">Swap Body (Bookmarks Root/Personal Toolbar Folder)</html:button>
|
||||
</box>
|
||||
|
||||
<tree id="tree" datasources="rdf:bookmarks" onclick="return OpenURL(event,event.target.parentNode);">
|
||||
<tree id="tree" datasources="rdf:bookmarks" onclick="return OpenURL(event,event.target.parentNode);" ref="NC:BookmarksRoot">
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</rule>
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treehead>
|
||||
|
@ -125,8 +126,6 @@
|
|||
<treecell>URL</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren id="treeroot" ref="NC:BookmarksRoot" open="true" />
|
||||
</tree>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -38,31 +38,35 @@
|
|||
<html:script src="flash.js" />
|
||||
|
||||
<tree id="tree"
|
||||
ref="NC:FlashRoot"
|
||||
flex="100%"
|
||||
style="height: 100%"
|
||||
style="height: 100%"
|
||||
datasources="rdf:null"
|
||||
rdf:containment="http://home.netscape.com/NC-rdf#child"
|
||||
onclick="OpenURL(event.target.parentNode.parentNode);">
|
||||
|
||||
<template>
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#source" align="right" />
|
||||
</treecell>
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#source" align="right" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#description" align="right"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#description" align="right"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#timestamp" align="right"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#timestamp" align="right"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -78,7 +82,5 @@
|
|||
<treecell>&tree.header.time.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren ref="NC:FlashRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" open="true" />
|
||||
</tree>
|
||||
</window>
|
||||
|
|
|
@ -484,7 +484,7 @@ Contributor(s): ______________________________________. -->
|
|||
datasources="rdf:bookmarks rdf:files rdf:find" id="NC:BookmarksRoot">
|
||||
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
|
@ -499,7 +499,18 @@ Contributor(s): ______________________________________. -->
|
|||
<menuitem name="&manBookmarksCmd.label;" onclick="BrowserEditBookmarks();"/>
|
||||
<separator/>
|
||||
</menu>
|
||||
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" id="NC:WindowMediatorRoot" open="true" >
|
||||
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot" >
|
||||
<template>
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<separator uri="..." />
|
||||
</rule>
|
||||
<rule>
|
||||
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
</template>
|
||||
<menuitem name="&navigatorCmd.label;" onclick="BrowserReload();"/>
|
||||
<menuitem name="&messengerCmd.label;" onclick="OpenMessenger();" />
|
||||
<menuitem name="&editorCmd.label;" onclick="OpenEditor();" />
|
||||
|
|
|
@ -347,18 +347,20 @@ Contributor(s): ______________________________________. -->
|
|||
onclick="return opener.BookmarkPopupSingleClick(window,event.target.parentNode.parentNode);" flex="100%">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -368,13 +370,12 @@ Contributor(s): ______________________________________. -->
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol id="NameColumn"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<treechildren id="cascade:treechildren" ref="" open="true" />
|
||||
</tree>
|
||||
</window>
|
||||
</popup>
|
||||
|
|
|
@ -33,38 +33,40 @@
|
|||
<menu />
|
||||
</popup>
|
||||
|
||||
<tree id="bookmarksTree" context="contextual"
|
||||
<tree id="bookmarksTree" context="contextual" ref="NC:BookmarksRoot"
|
||||
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
|
||||
ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
|
||||
|
||||
<!-- Commented out until new tree content model and template builder can play nice -->
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treechildren id="NC:BookmarksRoot" open="true" />
|
||||
</tree>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -153,8 +153,8 @@ function doSort(sortColName)
|
|||
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -164,9 +164,11 @@ function doSort(sortColName)
|
|||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -185,6 +187,7 @@ function doSort(sortColName)
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
<?xml-stylesheet href="chrome://sidebar/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="resource:/res/samples/related-panel.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window
|
||||
[
|
||||
<!ENTITY related.row.label "Related Links">
|
||||
<!ENTITY sitemap.row.label "Sitemap">
|
||||
]>
|
||||
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
|
@ -42,30 +48,31 @@
|
|||
ondblclick="return OnDblClick(event.target.parentNode.parentNode);">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren"
|
||||
subcontainment="treechildren">
|
||||
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="..."
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..."
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -74,13 +81,13 @@
|
|||
<treechildren>
|
||||
<treeitem id="NC:RelatedLinks">
|
||||
<treerow>
|
||||
<treecell><treeindentation/><titledbutton />Related Links</treecell>
|
||||
<treecell><treeindentation/><titledbutton />&related.row.label;</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:SiteMapRoot">
|
||||
<treerow>
|
||||
<treecell><treeindentation/><titledbutton />Site Map</treecell>
|
||||
<treecell><treeindentation/><titledbutton />&sitemap.row.label;</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
|
|
|
@ -33,17 +33,20 @@
|
|||
<treecol id="EngineColumn" rdf:resource="http://home.netscape.com/NC-rdf#Engine"/>
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -62,6 +65,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -89,8 +93,5 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren open="true" />
|
||||
|
||||
</tree>
|
||||
</window>
|
||||
|
|
|
@ -347,18 +347,20 @@ Contributor(s): ______________________________________. -->
|
|||
onclick="return opener.BookmarkPopupSingleClick(window,event.target.parentNode.parentNode);" flex="100%">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -368,13 +370,12 @@ Contributor(s): ______________________________________. -->
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol id="NameColumn"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<treechildren id="cascade:treechildren" ref="" open="true" />
|
||||
</tree>
|
||||
</window>
|
||||
</popup>
|
||||
|
|
|
@ -33,38 +33,40 @@
|
|||
<menu />
|
||||
</popup>
|
||||
|
||||
<tree id="bookmarksTree" context="contextual"
|
||||
<tree id="bookmarksTree" context="contextual" ref="NC:BookmarksRoot"
|
||||
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
|
||||
ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
|
||||
|
||||
<!-- Commented out until new tree content model and template builder can play nice -->
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treechildren id="NC:BookmarksRoot" open="true" />
|
||||
</tree>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
Script for the bookmarks popup window
|
||||
*/
|
||||
function BookmarkPopupFillTree(popup,node) {
|
||||
if (gBookmarkPopup) {
|
||||
gBookmarkPopup.close();
|
||||
}
|
||||
|
||||
var uri = node.getAttribute('id');
|
||||
var treechildren = document.getElementById('cascade:treechildren');
|
||||
treechildren.setAttribute('ref', uri);
|
||||
gBookmarkPopup = popup;
|
||||
}
|
||||
|
||||
function BookmarkPopupSingleClick(popup,node) {
|
||||
if (node.getAttribute('container') == "true")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OpenBookmarkURL(node);
|
||||
|
||||
gBookmarkPopup = null;
|
||||
|
||||
popup.close();
|
||||
|
||||
return true;
|
||||
}
|
|
@ -95,14 +95,15 @@
|
|||
<menu />
|
||||
</popup>
|
||||
|
||||
<tree id="bookmarksTree" context="contextual"
|
||||
<tree id="bookmarksTree" ref="NC:BookmarksRoot" context="contextual"
|
||||
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
|
||||
onclick="return DoSingleClick(event, event.target);"
|
||||
ondblclick="return OpenURL(event,event.target.parentNode.parentNode.parentNode);"
|
||||
style="height:100%;">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="..." rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type" loading="rdf:http://home.netscape.com/NC-rdf#loading">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -110,9 +111,11 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type" loading="rdf:http://home.netscape.com/NC-rdf#loading">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -140,6 +143,7 @@
|
|||
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -184,8 +188,6 @@
|
|||
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren ref="NC:BookmarksRoot" open="true" />
|
||||
</tree>
|
||||
|
||||
</xul:window>
|
||||
|
|
|
@ -153,8 +153,8 @@ function doSort(sortColName)
|
|||
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -164,9 +164,11 @@ function doSort(sortColName)
|
|||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -185,6 +187,7 @@ function doSort(sortColName)
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
<?xml-stylesheet href="chrome://sidebar/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="resource:/res/samples/related-panel.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window
|
||||
[
|
||||
<!ENTITY related.row.label "Related Links">
|
||||
<!ENTITY sitemap.row.label "Sitemap">
|
||||
]>
|
||||
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
|
@ -42,30 +48,31 @@
|
|||
ondblclick="return OnDblClick(event.target.parentNode.parentNode);">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
|
||||
rootcontainment="treechildren"
|
||||
subcontainment="treechildren">
|
||||
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<treeitem uri="..."
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..."
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -74,13 +81,13 @@
|
|||
<treechildren>
|
||||
<treeitem id="NC:RelatedLinks">
|
||||
<treerow>
|
||||
<treecell><treeindentation/><titledbutton />Related Links</treecell>
|
||||
<treecell><treeindentation/><titledbutton />&related.row.label;</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:SiteMapRoot">
|
||||
<treerow>
|
||||
<treecell><treeindentation/><titledbutton />Site Map</treecell>
|
||||
<treecell><treeindentation/><titledbutton />&sitemap.row.label;</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
|
|
|
@ -45,13 +45,7 @@ function doFind()
|
|||
// load find URL into results pane
|
||||
var resultsTree = parent.frames[1].document.getElementById("findresultstree");
|
||||
if (!resultsTree) return(false);
|
||||
x = resultsTree.childNodes.length;
|
||||
if (x < 1) return(false);
|
||||
// XXX shouldn't assume that treebody is the last child node in the tree!
|
||||
resultsTree.childNodes[x-1].setAttribute("id", url);
|
||||
|
||||
// resultsTree.childNodes[x-1].setAttribute("open", "true");
|
||||
|
||||
tree.setAttribute("ref", url);
|
||||
dump("doFind done.\n");
|
||||
|
||||
return(true);
|
||||
|
|
|
@ -28,17 +28,20 @@
|
|||
<treecol id="DescriptionColumn" rdf:resource="http://home.netscape.com/NC-rdf#Description"/>
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -56,6 +59,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -58,10 +58,7 @@ function doSearch()
|
|||
// load find URL into results pane
|
||||
var resultsTree = parent.frames[1].document.getElementById("internetresultstree");
|
||||
if (!resultsTree) return(false);
|
||||
x = resultsTree.childNodes.length;
|
||||
if (x < 1) return(false);
|
||||
// XXX shouldn't assume that treebody is the last child node in the tree!
|
||||
resultsTree.childNodes[x-1].setAttribute("id", searchURL);
|
||||
tree.setAttribute("ref", searchURL);
|
||||
|
||||
// enable "Save Search" button
|
||||
var searchButton = document.getElementById("SaveSearch");
|
||||
|
@ -103,10 +100,7 @@ function saveSearch()
|
|||
{
|
||||
var resultsTree = parent.frames[1].document.getElementById("internetresultstree");
|
||||
if (!resultsTree) return(false);
|
||||
x = resultsTree.childNodes.length;
|
||||
if (x < 1) return(false);
|
||||
// XXX shouldn't assume that treebody is the last child node in the tree!
|
||||
var searchURL = resultsTree.childNodes[x-1].getAttribute("id");
|
||||
var searchURL = tree.getAttribute("ref");
|
||||
if (!searchURL) return(false);
|
||||
|
||||
dump("Bookmark search URL: " + searchURL + "\n");
|
||||
|
|
|
@ -34,11 +34,12 @@
|
|||
|
||||
<box align="horizontal" style="height: 85%; width: 100%;" flex="100%" >
|
||||
<spring align="horizontal" flex="100%" />
|
||||
<tree align="horizontal" id="searchengines" border="1" style="height: 90%;" flex="100%" datasources="rdf:internetsearch" >
|
||||
<tree align="horizontal" id="searchengines" border="1" style="height: 90%;" flex="100%" datasources="rdf:internetsearch" ref="NC:SearchEngineRoot">
|
||||
<treecol id="CheckboxColumn" />
|
||||
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name" sortActive="true" sortDirection="ascending" />
|
||||
|
||||
<template rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<template>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell treeallowevents="true">
|
||||
|
@ -49,6 +50,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</template>
|
||||
|
||||
<treehead>
|
||||
|
@ -63,8 +65,6 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren id="NC:SearchEngineRoot" open="true" />
|
||||
</tree>
|
||||
<spring align="horizontal" flex="100%" />
|
||||
</box>
|
||||
|
|
|
@ -33,17 +33,20 @@
|
|||
<treecol id="EngineColumn" rdf:resource="http://home.netscape.com/NC-rdf#Engine"/>
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule rootcontainment="treechildren" subcontainment="treechildren">
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
|
@ -62,6 +65,7 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
@ -89,8 +93,5 @@
|
|||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren open="true" />
|
||||
|
||||
</tree>
|
||||
</window>
|
||||
|
|
|
@ -484,7 +484,7 @@ Contributor(s): ______________________________________. -->
|
|||
datasources="rdf:bookmarks rdf:files rdf:find" id="NC:BookmarksRoot">
|
||||
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
|
@ -499,7 +499,18 @@ Contributor(s): ______________________________________. -->
|
|||
<menuitem name="&manBookmarksCmd.label;" onclick="BrowserEditBookmarks();"/>
|
||||
<separator/>
|
||||
</menu>
|
||||
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" id="NC:WindowMediatorRoot" open="true" >
|
||||
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot" >
|
||||
<template>
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<separator uri="..." />
|
||||
</rule>
|
||||
<rule>
|
||||
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
</template>
|
||||
<menuitem name="&navigatorCmd.label;" onclick="BrowserReload();"/>
|
||||
<menuitem name="&messengerCmd.label;" onclick="OpenMessenger();" />
|
||||
<menuitem name="&editorCmd.label;" onclick="OpenEditor();" />
|
||||
|
|
|
@ -47,6 +47,18 @@
|
|||
|
||||
<!-- Tasks Menu -->
|
||||
<menu id="tasksMenu" name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot">
|
||||
<template>
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<separator uri="..." />
|
||||
</rule>
|
||||
<rule>
|
||||
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<menuitem name="&navigatorCmd.label;" onclick="toNavigator()"/>
|
||||
<menuitem name="&messengerCmd.label;" onclick="toMessengerWindow()"/>
|
||||
<menuitem name="&editorCmd.label;" onclick="toEditor();" />
|
||||
|
@ -87,6 +99,17 @@
|
|||
|
||||
<popup id="windowPopup" >
|
||||
<menu onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot" >
|
||||
<template>
|
||||
<rule iscontainer="true" isempty="false">
|
||||
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<separator uri="..." />
|
||||
</rule>
|
||||
<rule>
|
||||
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
</template>
|
||||
</menu>
|
||||
</popup>
|
||||
|
||||
|
|
|
@ -1,221 +0,0 @@
|
|||
// the rdf service
|
||||
var RDF = Components.classes['component://netscape/rdf/rdf-service'].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
|
||||
function getAttr(registry,service,attr_name)
|
||||
{
|
||||
|
||||
var attr = registry.GetTarget(service,
|
||||
RDF.GetResource('http://home.netscape.com/NC-rdf#' + attr_name),
|
||||
true);
|
||||
if (attr)
|
||||
attr = attr.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
|
||||
if (attr)
|
||||
attr = attr.Value;
|
||||
return attr;
|
||||
}
|
||||
|
||||
// the location of the flash registry.
|
||||
|
||||
var localSoftwareUpdateRegistry = 'resource:/res/rdf/SoftwareUpdates.rdf';
|
||||
|
||||
|
||||
function Init()
|
||||
{
|
||||
dump("Software Notification!");
|
||||
var tree = document.getElementById('tree');
|
||||
|
||||
var mainRegistry;
|
||||
|
||||
try
|
||||
{
|
||||
// First try to construct a new one and load it
|
||||
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
|
||||
// asynchronously by default.
|
||||
|
||||
mainRegistry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
|
||||
mainRegistry = mainRegistry.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
|
||||
var remote = mainRegistry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
remote.Init(localSoftwareUpdateRegistry); // this will throw if it's already been opened and registered.
|
||||
|
||||
// read it in synchronously.
|
||||
remote.Refresh(true);
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
// if we get here, then the RDF/XML has been opened and read
|
||||
// once. We just need to grab the datasource.
|
||||
mainRegistry = RDF.GetDataSource(localSoftwareUpdateRegistry);
|
||||
}
|
||||
|
||||
// Create a 'container' wrapper around the NC:SoftwareUpdateDataSources
|
||||
// resource so we can use some utility routines that make access a
|
||||
// bit easier.
|
||||
|
||||
var mainContainer = Components.classes['component://netscape/rdf/container'].createInstance();
|
||||
mainContainer = mainContainer.QueryInterface(Components.interfaces.nsIRDFContainer);
|
||||
|
||||
mainContainer.Init(mainRegistry, RDF.GetResource('NC:SoftwareUpdateDataSources'));
|
||||
|
||||
|
||||
// Now enumerate all of the softwareupdate datasources.
|
||||
var mainEnumerator = mainContainer.GetElements();
|
||||
while (mainEnumerator.HasMoreElements())
|
||||
{
|
||||
var aDistributor = mainEnumerator.GetNext();
|
||||
aDistributor = aDistributor.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
|
||||
dump('Contacting Distributor: "' + aDistributor.Value + '"...\n');
|
||||
|
||||
var distributorRegistry;
|
||||
|
||||
try
|
||||
{
|
||||
// First try to construct a new one and load it
|
||||
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
|
||||
// asynchronously by default.
|
||||
|
||||
distributorRegistry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
|
||||
distributorRegistry = distributorRegistry.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
|
||||
var remote = distributorRegistry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
remote.Init(aDistributor.Value); // this will throw if it's already been opened and registered.
|
||||
|
||||
// read it in synchronously.
|
||||
remote.Refresh(true);
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
// if we get here, then the RDF/XML has been opened and read
|
||||
// once. We just need to grab the datasource.
|
||||
distributorRegistry = RDF.GetDataSource(aDistributor.Value);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Create a 'container' wrapper around the NC:SoftwareUpdateRoot
|
||||
// resource so we can use some utility routines that make access a
|
||||
// bit easier.
|
||||
|
||||
var distributorContainer = Components.classes['component://netscape/rdf/container'].createInstance();
|
||||
distributorContainer = distributorContainer.QueryInterface(Components.interfaces.nsIRDFContainer);
|
||||
distributorContainer.Init(distributorRegistry, RDF.GetResource('NC:SoftwarePackages'));
|
||||
|
||||
|
||||
// Now enumerate all of the distributorContainer's packages.
|
||||
|
||||
var distributorEnumerator = distributorContainer.GetElements();
|
||||
|
||||
dump('Parsing "' + aDistributor.Value + '" \n');
|
||||
dump('Contatiner "' + distributorContainer + '" \n');
|
||||
dump('Enumerator "' + distributorEnumerator + '" \n');
|
||||
|
||||
while (distributorEnumerator.HasMoreElements())
|
||||
{
|
||||
// Create a new RDF/XML datasource.
|
||||
|
||||
var aPackage = distributorEnumerator.GetNext();
|
||||
aPackage = aPackage.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
|
||||
// remove any that we do not want.
|
||||
dump('package name "' + getAttr(distributorRegistry, aPackage, 'title') + '" \n');
|
||||
|
||||
// var InstallTrigger.CompareVersion(getAttr(distributorRegistry, aPackage, 'registryKey'),
|
||||
// getAttr(distributorRegistry, aPackage, 'version'));
|
||||
|
||||
|
||||
if (getAttr(distributorRegistry, aPackage, 'title') == "AOL AIM")
|
||||
{
|
||||
distributorContainer.RemoveElement(aPackage, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tree.database.AddDataSource(distributorRegistry);
|
||||
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
dump('an exception occurred trying to load "' + aDistributor.Value + '":\n');
|
||||
dump(ex + '\n');
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
// XXX hack to force the tree to rebuild
|
||||
var treebody = document.getElementById('NC:SoftwareUpdateRoot');
|
||||
treebody.setAttribute('id', 'NC:SoftwareUpdateRoot');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function OpenURL(event, node)
|
||||
{
|
||||
if (node.getAttribute('type') == "http://home.netscape.com/NC-rdf#SoftwarePackage")
|
||||
{
|
||||
url = node.getAttribute('url');
|
||||
|
||||
/*window.open(url,'bookmarks');*/
|
||||
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore)
|
||||
{
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore)
|
||||
{
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
|
||||
if (toolkitCore)
|
||||
{
|
||||
toolkitCore.ShowWindow(url,window);
|
||||
}
|
||||
|
||||
dump("OpenURL(" + url + ")\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function Reload(url, pollInterval)
|
||||
{
|
||||
// Reload the specified datasource and reschedule.
|
||||
dump('Reload(' + url + ', ' + pollInterval + ')\n');
|
||||
|
||||
var datasource = RDF.GetDataSource(url);
|
||||
datasource = datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
|
||||
// Reload, asynchronously.
|
||||
datasource.Refresh(false);
|
||||
|
||||
// Reschedule
|
||||
Schedule(url, pollInterval);
|
||||
}
|
||||
|
||||
function Schedule(url, pollInterval)
|
||||
{
|
||||
setTimeout('Reload("' + url + '", ' + pollInterval + ')', pollInterval * 1000);
|
||||
}
|
||||
|
||||
|
||||
// To get around "window.onload" not working in viewer.
|
||||
function Boot()
|
||||
{
|
||||
var tree = document.getElementById('tree');
|
||||
|
||||
if (tree == null)
|
||||
{
|
||||
setTimeout(Boot, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout('Boot()', 0);
|
||||
|
|
@ -41,8 +41,20 @@
|
|||
flex="100%"
|
||||
style="height: 100%"
|
||||
datasources="rdf:softwareupdates"
|
||||
onclick="OpenURL(event, event.target.parentNode);">
|
||||
|
||||
onclick="OpenURL(event, event.target.parentNode);"
|
||||
ref="NC:SoftwareUpdateRoot">
|
||||
|
||||
<template>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell><treeindentation/><titledbutton /><text value="rdf:http://home.netscape.com/NC-rdf#title"/></treecell>
|
||||
<treecell><text value="rdf:http://home.netscape.com/NC-rdf#description"/></treecell>
|
||||
<treecell><text value="rdf:http://home.netscape.com/NC-rdf#version"/></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
@ -57,8 +69,5 @@
|
|||
<treecell>&tree.header.version.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
|
||||
<treechildren ref="NC:SoftwareUpdateRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" open="true" />
|
||||
</tree>
|
||||
</window>
|
||||
|
|
Загрузка…
Ссылка в новой задаче