From 4281e6f70b3cfc76d392b493c28cc063fd236a0a Mon Sep 17 00:00:00 2001 From: Bob Jamison Date: Tue, 29 Aug 2006 09:56:23 +0000 Subject: Start shell. Begin to make prototypes and wrappers. (bzr r1657) --- src/dom/jsbind.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src/dom/jsbind.cpp') diff --git a/src/dom/jsbind.cpp b/src/dom/jsbind.cpp index 60d7adadc..4e2af1dec 100644 --- a/src/dom/jsbind.cpp +++ b/src/dom/jsbind.cpp @@ -1674,10 +1674,11 @@ public: } + static JSClass classDef; + private: // Standard JS Binding fields - static JSClass classDef; static JSPropertySpec properties[]; enum { @@ -5345,11 +5346,38 @@ JSFunctionSpec ECMA_ProcessingInstruction::methods[] = bool JavascriptEngine::createClasses() { - + nodeProto = + ECMA_Node::JSInit(cx, globalObj); + characterDataProto = + ECMA_CharacterData::JSInit(cx, globalObj, nodeProto); + textProto = + ECMA_Text::JSInit(cx, globalObj, characterDataProto); + cdataProto = + ECMA_CDATASection::JSInit(cx, globalObj, textProto); + documentProto = + ECMA_CDATASection::JSInit(cx, globalObj, cdataProto); return true; } +JSObject *JavascriptEngine::wrapDocument(const Document *doc) +{ + if (!doc) + { + error("wrapDocument: null document parameter"); + return NULL; + } + + JSObject *jsdoc = JS_NewObject(cx, &ECMA_Document::classDef, + documentProto, NULL); + + //Wrap around the document... done! + JS_SetPrivate(cx, jsdoc, (void *)doc); + + return jsdoc; +} + + } // namespace dom } // namespace w3c } // namespace org -- cgit v1.2.3