1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sw=4 et tw=99:
4 * This tests user-specified (via JSExtendedClass) equality operations on
12 my_Equality(JSContext *cx, JSObject *obj, const jsval *, JSBool *bp)
18 js::Class TestExtendedEq_JSClass = {
21 js::PropertyStub, /* addProperty */
22 js::PropertyStub, /* delProperty */
23 js::PropertyStub, /* getProperty */
24 js::StrictPropertyStub, /* setProperty */
30 NULL, /* checkAccess */
34 NULL, /* hasInstance */
37 js::Valueify(my_Equality),
38 NULL, /* outerObject */
39 NULL, /* innerObject */
40 NULL, /* iteratorObject */
41 NULL, /* wrappedObject */
45 BEGIN_TEST(testExtendedEq_bug530489)
47 JSClass *clasp = (JSClass *) &TestExtendedEq_JSClass;
49 CHECK(JS_InitClass(cx, global, global, clasp, NULL, 0, NULL, NULL, NULL, NULL));
51 CHECK(JS_DefineObject(cx, global, "obj1", clasp, NULL, 0));
52 CHECK(JS_DefineObject(cx, global, "obj2", clasp, NULL, 0));
55 EVAL("(function() { var r; for (var i = 0; i < 10; ++i) r = obj1 == obj2; return r; })()", &v);
56 CHECK_SAME(v, JSVAL_TRUE);
59 END_TEST(testExtendedEq_bug530489)