tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

testNullRoot.cpp (666B)


      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/. */
      7 
      8 #include "jsapi-tests/tests.h"
      9 
     10 BEGIN_TEST(testNullRoot) {
     11  obj.init(cx, nullptr);
     12  str.init(cx, nullptr);
     13  script.init(cx, nullptr);
     14 
     15  // This used to crash because obj was nullptr.
     16  JS_GC(cx);
     17 
     18  return true;
     19 }
     20 
     21 JS::PersistentRootedObject obj;
     22 JS::PersistentRootedString str;
     23 JS::PersistentRootedScript script;
     24 END_TEST(testNullRoot)