Bug 1920009 - Fix fragment titles being read by talkback after dismissal from menu...
[gecko.git] / js / src / jsapi-tests / testPropCache.cpp
blob33a571f1a1b895fdd4496fd17ccad8f92945737f
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:
3 */
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"
11 static int g_counter;
13 static bool CounterAdd(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
14 JS::HandleValue v) {
15 g_counter++;
16 return true;
19 static const JSClassOps CounterClassOps = {
20 CounterAdd, // addProperty
21 nullptr, // delProperty
22 nullptr, // enumerate
23 nullptr, // newEnumerate
24 nullptr, // resolve
25 nullptr, // mayResolve
26 nullptr, // finalize
27 nullptr, // call
28 nullptr, // construct
29 nullptr, // trace
32 static const JSClass CounterClass = {
33 "Counter", /* name */
34 0, /* flags */
35 &CounterClassOps,
38 BEGIN_TEST(testPropCache_bug505798) {
39 g_counter = 0;
40 EXEC("var x = {};");
41 CHECK(JS_DefineObject(cx, global, "y", &CounterClass, JSPROP_ENUMERATE));
42 EXEC(
43 "var arr = [x, y];\n"
44 "for (var i = 0; i < arr.length; i++)\n"
45 " arr[i].p = 1;\n");
46 CHECK_EQUAL(g_counter, 1);
47 return true;
49 END_TEST(testPropCache_bug505798)