Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / js / src / jsapi-tests / testIsInsideNursery.cpp
blob301d7780d359f829076fd64a071324b68666bf77
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 "jsapi-tests/tests.h"
10 #include "vm/JSContext-inl.h"
12 BEGIN_TEST(testIsInsideNursery) {
13 /* Non-GC things are never inside the nursery. */
14 CHECK(!cx->nursery().isInside(cx));
15 CHECK(!cx->nursery().isInside((void*)nullptr));
17 JS_GC(cx);
19 JS::RootedObject object(cx, JS_NewPlainObject(cx));
21 /* Objects are initially allocated in the nursery. */
22 CHECK(js::gc::IsInsideNursery(object));
24 JS_GC(cx);
26 /* And are tenured if still live after a GC. */
27 CHECK(!js::gc::IsInsideNursery(object));
29 return true;
31 END_TEST(testIsInsideNursery)