tor-browser

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

Object-inl.h (1404B)


      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 * This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef debugger_Object_inl_h
      8 #define debugger_Object_inl_h
      9 
     10 #include "debugger/Object.h"  // for DebuggerObject
     11 
     12 #include "mozilla/Assertions.h"  // for AssertionConditionType, MOZ_ASSERT
     13 
     14 #include "NamespaceImports.h"  // for Value
     15 
     16 #include "debugger/Debugger.h"  // for Debugger
     17 #include "js/Wrapper.h"         // for CheckedUnwrapStatic
     18 #include "vm/JSObject.h"        // for JSObject
     19 #include "vm/PromiseObject.h"   // for js::PromiseObject
     20 
     21 #include "debugger/Debugger-inl.h"  // for Debugger::fromJSObject
     22 
     23 inline js::Debugger* js::DebuggerObject::owner() const {
     24  JSObject* dbgobj = &getReservedSlot(OWNER_SLOT).toObject();
     25  return Debugger::fromJSObject(dbgobj);
     26 }
     27 
     28 inline js::PromiseObject* js::DebuggerObject::promise() const {
     29  MOZ_ASSERT(isPromise());
     30 
     31  JSObject* referent = this->referent();
     32  if (IsCrossCompartmentWrapper(referent)) {
     33    // We know we have a Promise here, so CheckedUnwrapStatic is fine.
     34    referent = CheckedUnwrapStatic(referent);
     35    MOZ_ASSERT(referent);
     36  }
     37 
     38  return &referent->as<PromiseObject>();
     39 }
     40 
     41 #endif /* debugger_Object_inl_h */