--- /dev/null
+typedef long unsigned int size_t;
+typedef long int ptrdiff_t;
+typedef unsigned int uint32_t;
+typedef unsigned long int uint64_t;
+typedef uint32_t JSUint32;
+typedef uint64_t JSUint64;
+typedef int JSIntn;
+typedef unsigned int JSUintn;
+typedef JSIntn JSBool;
+typedef JSUint64 uint64;
+typedef JSUint32 uint32;
+typedef JSUintn uintN;
+extern "C" {
+ typedef struct JSString JSString;
+ typedef struct JSObject JSObject;
+ typedef union jsval_layout {
+ uint64 asBits;
+ } jsval_layout;
+ static jsval_layout STRING_TO_JSVAL_IMPL(JSString * str) {
+ } typedef __attribute__ ((aligned(8))) uint64 jsval;
+ typedef ptrdiff_t jsid;
+ typedef JSUint32 jsuint;
+ typedef enum JSType {
+ JSTYPE_VOID, JSTYPE_OBJECT, JSTYPE_FUNCTION, JSTYPE_STRING,
+ JSTYPE_NUMBER, JSTYPE_BOOLEAN, JSTYPE_NULL, JSTYPE_XML,
+ JSTYPE_LIMIT
+ } JSType;
+ typedef enum JSAccessMode {
+ JSACC_PROTO = 0, JSACC_PARENT = 1, JSACC_WATCH = 3, JSACC_READ =
+ 4, JSACC_WRITE = 8, JSACC_LIMIT
+ } JSIterateOp;
+ typedef struct JSContext JSContext;
+ typedef struct JSTracer JSTracer;
+ typedef struct JSXDRState JSXDRState;
+ typedef JSBool(*JSEnumerateOp) (JSContext * cx, JSObject * obj);
+ typedef JSBool(*JSResolveOp) (JSContext * cx, JSObject * obj, jsid id);
+ typedef void (*JSFinalizeOp) (JSContext * cx, JSObject * obj);
+ typedef JSBool(*JSXDRObjectOp) (JSXDRState * xdr, JSObject ** objp);
+ typedef uint32(*JSMarkOp) (JSContext * cx, JSObject * obj, void *arg);
+ static JSBool JSID_IS_STRING(jsid iden) {
+ }
+ static JSString *JSID_TO_STRING(jsid iden) {
+ }
+ typedef void (*JSClassInternal) ();
+ extern JSBool JS_PropertyStub(JSContext * cx, JSObject * obj, jsid id,
+ jsval * vp);
+ extern JSBool JS_StrictPropertyStub(JSContext * cx, JSObject * obj,
+ jsid id, JSBool strict, jsval * vp);
+ extern JSBool JS_EnumerateStub(JSContext * cx, JSObject * obj);
+ extern JSBool JS_ResolveStub(JSContext * cx, JSObject * obj, jsid id);
+ extern JSBool JS_ConvertStub(JSContext * cx, JSObject * obj,
+ JSType type, jsval * vp);
+ extern void JS_FinalizeStub(JSContext * cx, JSObject * obj);
+ typedef struct JSProperty JSProperty;
+ typedef struct JSLinearString JSLinearString;
+ typedef JSObject *(*JSObjectOp) (JSContext * cx, JSObject * obj);
+ typedef JSObject *(*JSIteratorOp) (JSContext * cx, JSObject * obj,
+ JSBool keysonly);
+}
+
+namespace js {
+ class Value {
+ public:void setNull() {
+ } void setString(JSString * str) {
+ data = STRING_TO_JSVAL_IMPL(str);
+ } jsval_layout data;
+ }
+ __attribute__ ((aligned(8)));
+ static Value StringValue(JSString * str) {
+ Value v;
+ v.setString(str);
+ return v;
+ }
+ static inline const jsval & Jsvalify(const Value & v) {
+ return (const jsval &)v;
+ }
+ static inline Value *Valueify(jsval * v) {
+ return (Value *) v;
+ }
+ typedef JSBool(*Native) (JSContext * cx, uintN argc, Value * vp);
+ typedef JSBool(*PropertyOp) (JSContext * cx, JSObject * obj, jsid id,
+ Value * vp);
+ typedef JSBool(*StrictPropertyOp) (JSContext * cx, JSObject * obj,
+ jsid id, JSBool strict, Value * vp);
+ typedef JSBool(*ConvertOp) (JSContext * cx, JSObject * obj, JSType type,
+ Value * vp);
+ typedef JSBool(*NewEnumerateOp) (JSContext * cx, JSObject * obj,
+ JSIterateOp enum_op, Value * statep,
+ jsid * idp);
+ typedef JSBool(*HasInstanceOp) (JSContext * cx, JSObject * obj,
+ const Value * v, JSBool * bp);
+ typedef JSBool(*CheckAccessOp) (JSContext * cx, JSObject * obj, jsid id,
+ JSAccessMode mode, Value * vp);
+ typedef JSBool(*EqualityOp) (JSContext * cx, JSObject * obj,
+ const Value * v, JSBool * bp);
+ typedef JSBool(*DefinePropOp) (JSContext * cx, JSObject * obj, jsid id,
+ const Value * value, PropertyOp getter,
+ StrictPropertyOp setter, uintN attrs);
+ typedef JSBool(*PropertyIdOp) (JSContext * cx, JSObject * obj,
+ JSObject * receiver, jsid id,
+ Value * vp);
+ typedef JSBool(*StrictPropertyIdOp) (JSContext * cx, JSObject * obj,
+ jsid id, Value * vp,
+ JSBool strict);
+ typedef JSBool(*DeleteIdOp) (JSContext * cx, JSObject * obj, jsid id,
+ Value * vp, JSBool strict);
+ typedef JSBool(*LookupPropOp) (JSContext * cx, JSObject * obj, jsid id,
+ JSObject ** objp, JSProperty ** propp);
+ typedef JSBool(*AttributesOp) (JSContext * cx, JSObject * obj, jsid id,
+ uintN * attrsp);
+ typedef JSType(*TypeOfOp) (JSContext * cx, JSObject * obj);
+ typedef void (*TraceOp) (JSTracer * trc, JSObject * obj);
+ typedef JSObject *(*ObjectOp) (JSContext * cx, JSObject * obj);
+ typedef void (*FinalizeOp) (JSContext * cx, JSObject * obj);
+ class AutoIdVector;
+ typedef JSBool(*FixOp) (JSContext * cx, JSObject * obj, bool * fixed,
+ AutoIdVector * props);
+ static const PropertyOp PropertyStub = (PropertyOp) JS_PropertyStub;
+ static const StrictPropertyOp StrictPropertyStub =
+ (StrictPropertyOp) JS_StrictPropertyStub;
+ static const JSEnumerateOp EnumerateStub = JS_EnumerateStub;
+ static const JSResolveOp ResolveStub = JS_ResolveStub;
+ static const ConvertOp ConvertStub = (ConvertOp) JS_ConvertStub;
+ static const JSFinalizeOp FinalizeStub = JS_FinalizeStub;
+ struct ClassExtension {
+ EqualityOp equality;
+ JSObjectOp outerObject;
+ JSObjectOp innerObject;
+ JSIteratorOp iteratorObject;
+ void *unused;
+ };
+ struct ObjectOps {
+ js::LookupPropOp lookupProperty;
+ js::DefinePropOp defineProperty;
+ js::PropertyIdOp getProperty;
+ js::StrictPropertyIdOp setProperty;
+ js::AttributesOp getAttributes;
+ js::AttributesOp setAttributes;
+ js::DeleteIdOp deleteProperty;
+ js::NewEnumerateOp enumerate;
+ js::TypeOfOp typeOf;
+ js::TraceOp trace;
+ js::FixOp fix;
+ js::ObjectOp thisObject;
+ js::FinalizeOp clear;
+ };
+ struct Class {
+ const char *name;
+ uint32 flags;
+ PropertyOp addProperty;
+ PropertyOp delProperty;
+ PropertyOp getProperty;
+ StrictPropertyOp setProperty;
+ JSEnumerateOp enumerate;
+ JSResolveOp resolve;
+ ConvertOp convert;
+ JSFinalizeOp finalize;
+ JSClassInternal reserved0;
+ CheckAccessOp checkAccess;
+ Native call;
+ Native construct;
+ JSXDRObjectOp xdrObject;
+ HasInstanceOp hasInstance;
+ JSMarkOp mark;
+ ClassExtension ext;
+ ObjectOps ops;
+ };
+ namespace gc {
+ struct Cell {
+ };
+}} struct JSObject:js::gc::Cell {
+ js::Class * getClass() const {
+ } static const uint32 QNAME_CLASS_RESERVED_SLOTS = 3;
+ inline JSLinearString *getNamePrefix() const;
+ inline JSLinearString *getNameURI() const;
+ inline JSLinearString *getQNameLocalName() const;
+};
+namespace js {
+ static Value IdToValue(jsid id) {
+ if (JSID_IS_STRING(id))
+ return StringValue(JSID_TO_STRING(id));
+ } static jsval IdToJsval(jsid id) {
+ return Jsvalify(IdToValue(id));
+ }
+}
+
+extern const char js_AnyName_str[];
+inline JSBool js_IdIsIndex(jsid id, jsuint * indexp)
+{
+}
+
+namespace js {
+ class AutoGCRooter;
+} struct JSContext {
+ js::AutoGCRooter * autoGCRooters;
+};
+namespace js {
+ class AutoGCRooter {
+ public:AutoGCRooter(JSContext * cx,
+ ptrdiff_t tag):down(cx->autoGCRooters), tag(tag),
+ context(cx) {
+ cx->autoGCRooters = this;
+ } protected:AutoGCRooter * const down;
+ ptrdiff_t tag;
+ JSContext *const context;
+ };
+ class AutoArrayRooter:private AutoGCRooter {
+ public:AutoArrayRooter(JSContext * cx, size_t len,
+ Value * vec):AutoGCRooter(cx, len),
+ array(vec) {
+ } Value *array;
+ private:};
+}
+
+typedef enum JSXMLClass {
+ JSXML_CLASS_LIST, JSXML_CLASS_ELEMENT, JSXML_CLASS_ATTRIBUTE,
+ JSXML_CLASS_PROCESSING_INSTRUCTION, JSXML_CLASS_TEXT,
+ JSXML_CLASS_COMMENT, JSXML_CLASS_LIMIT
+} JSXMLElemVar;
+struct JSXML:js::gc::Cell {
+ uint32 xml_class;
+};
+using namespace js;
+Class js_AttributeNameClass = {
+__null,
+0,
+__null,
+__null,
+__null,
+__null,
+__null,
+__null,
+__null,
+__null
+};
+
+static JSObject *NewXMLAttributeName(JSContext * cx, JSLinearString * uri,
+ JSLinearString * prefix,
+ JSLinearString * localName)
+{
+}
+
+static JSBool PutProperty(JSContext * cx, JSObject * obj, jsid id,
+ JSBool strict, jsval * vp)
+{
+ enum {
+ OBJ_ROOT, ID_ROOT, VAL_ROOT
+ };
+ JSXML *xml, *vxml, *rxml, *kid, *attr, *parent, *copy, *kid2, *match;
+ JSObject *vobj, *nameobj, *attrobj, *parentobj, *kidobj, *copyobj;
+ uint32 index, i, j, k, n, q, matchIndex;
+ jsval roots[3];
+ roots[ID_ROOT] = IdToJsval(id);
+ roots[VAL_ROOT] = *vp;
+ AutoArrayRooter tvr(cx, (sizeof(roots) / sizeof(roots)[0]),
+ Valueify(roots));
+ if (js_IdIsIndex(id, &index)) {
+ if (kid->xml_class == JSXML_CLASS_ATTRIBUTE) {
+ if (nameobj->getClass() != &js_AttributeNameClass) {
+ nameobj =
+ NewXMLAttributeName(cx,
+ nameobj->getNameURI(),
+ nameobj->
+ getNamePrefix(),
+ nameobj->
+ getQNameLocalName());
+ }
+ }
+ }
+}
+
+static JSBool xml_defineProperty(JSContext * cx, JSObject * obj, jsid id,
+ const Value * v, PropertyOp getter,
+ StrictPropertyOp setter, uintN attrs)
+{
+ jsval tmp = Jsvalify(*v);
+ return PutProperty(cx, obj, id, false, &tmp);
+}
+
+static void xml_trace(JSTracer * trc, JSObject * obj)
+{
+}
+
+Class js_XMLClass = {
+ __null, 0, __null, __null, __null, __null, __null, __null, __null,
+ __null, __null, __null, __null, __null, __null, __null,
+__null,
+ { __null, __null, __null, __null, __null}
+ , {
+ __null, xml_defineProperty, __null, __null, __null, __null, __null,
+ __null, __null, __null, __null, __null, __null}
+};