LCOV - code coverage report
Current view: top level - js/ductwork/debugger - JSDebugger.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 20 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*-  Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "JSDebugger.h"
       7             : #include "nsIXPConnect.h"
       8             : #include "nsThreadUtils.h"
       9             : #include "jsapi.h"
      10             : #include "jsfriendapi.h"
      11             : #include "jswrapper.h"
      12             : #include "mozilla/ModuleUtils.h"
      13             : #include "nsServiceManagerUtils.h"
      14             : #include "nsMemory.h"
      15             : 
      16             : #define JSDEBUGGER_CONTRACTID \
      17             :   "@mozilla.org/jsdebugger;1"
      18             : 
      19             : #define JSDEBUGGER_CID \
      20             : { 0x0365cbd5, 0xd46e, 0x4e94, { 0xa3, 0x9f, 0x83, 0xb6, 0x3c, 0xd1, 0xa9, 0x63 } }
      21             : 
      22             : namespace mozilla {
      23             : namespace jsdebugger {
      24             : 
      25           0 : NS_GENERIC_FACTORY_CONSTRUCTOR(JSDebugger)
      26             : 
      27           0 : NS_IMPL_ISUPPORTS(JSDebugger, IJSDebugger)
      28             : 
      29           0 : JSDebugger::JSDebugger()
      30             : {
      31           0 : }
      32             : 
      33           0 : JSDebugger::~JSDebugger()
      34             : {
      35           0 : }
      36             : 
      37             : NS_IMETHODIMP
      38           0 : JSDebugger::AddClass(JS::Handle<JS::Value> global, JSContext* cx)
      39             : {
      40             :   nsresult rv;
      41           0 :   nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID(), &rv);
      42             : 
      43           0 :   if (!global.isObject()) {
      44           0 :     return NS_ERROR_INVALID_ARG;
      45             :   }
      46             : 
      47           0 :   JS::RootedObject obj(cx, &global.toObject());
      48           0 :   obj = js::UncheckedUnwrap(obj, /* stopAtWindowProxy = */ false);
      49           0 :   if (!obj) {
      50           0 :     return NS_ERROR_FAILURE;
      51             :   }
      52             : 
      53           0 :   JSAutoCompartment ac(cx, obj);
      54           0 :   if (JS_GetGlobalForObject(cx, obj) != obj) {
      55           0 :     return NS_ERROR_INVALID_ARG;
      56             :   }
      57             : 
      58           0 :   if (!JS_DefineDebuggerObject(cx, obj)) {
      59           0 :     return NS_ERROR_FAILURE;
      60             :   }
      61             : 
      62           0 :   return NS_OK;
      63             : }
      64             : 
      65             : } // namespace jsdebugger
      66             : } // namespace mozilla
      67             : 
      68             : NS_DEFINE_NAMED_CID(JSDEBUGGER_CID);
      69             : 
      70             : static const mozilla::Module::CIDEntry kJSDebuggerCIDs[] = {
      71             :   { &kJSDEBUGGER_CID, false, nullptr, mozilla::jsdebugger::JSDebuggerConstructor },
      72             :   { nullptr }
      73             : };
      74             : 
      75             : static const mozilla::Module::ContractIDEntry kJSDebuggerContracts[] = {
      76             :   { JSDEBUGGER_CONTRACTID, &kJSDEBUGGER_CID },
      77             :   { nullptr }
      78             : };
      79             : 
      80             : static const mozilla::Module kJSDebuggerModule = {
      81             :   mozilla::Module::kVersion,
      82             :   kJSDebuggerCIDs,
      83             :   kJSDebuggerContracts
      84             : };
      85             : 
      86             : NSMODULE_DEFN(jsdebugger) = &kJSDebuggerModule;

Generated by: LCOV version 1.13