1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "js/PropertyAndElement.h" // JS_DefineObject
9 #include "jsapi-tests/tests.h"
13 static bool CounterAdd(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
,
19 static const JSClassOps CounterClassOps
= {
20 CounterAdd
, // addProperty
21 nullptr, // delProperty
23 nullptr, // newEnumerate
25 nullptr, // mayResolve
32 static const JSClass CounterClass
= {
38 BEGIN_TEST(testPropCache_bug505798
) {
41 CHECK(JS_DefineObject(cx
, global
, "y", &CounterClass
, JSPROP_ENUMERATE
));
44 "for (var i = 0; i < arr.length; i++)\n"
46 CHECK_EQUAL(g_counter
, 1);
49 END_TEST(testPropCache_bug505798
)