LCOV - code coverage report
Current view: top level - widget - GfxInfoCollector.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 24 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* vim: se cin sw=2 ts=2 et : */
       2             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       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 "GfxInfoCollector.h"
       9             : #include "jsapi.h"
      10             : #include "nsString.h"
      11             : 
      12             : using namespace mozilla;
      13             : using namespace widget;
      14             : 
      15             : void
      16           0 : InfoObject::DefineProperty(const char *name, int value)
      17             : {
      18           0 :   if (!mOk)
      19           0 :     return;
      20             : 
      21           0 :   mOk = JS_DefineProperty(mCx, mObj, name, value, JSPROP_ENUMERATE);
      22             : }
      23             : 
      24             : void
      25           0 : InfoObject::DefineProperty(const char *name, nsAString &value)
      26             : {
      27           0 :   if (!mOk)
      28           0 :     return;
      29             : 
      30           0 :   const nsString &flat = PromiseFlatString(value);
      31           0 :   JS::Rooted<JSString*> string(mCx, JS_NewUCStringCopyN(mCx, static_cast<const char16_t*>(flat.get()),
      32           0 :                                                         flat.Length()));
      33           0 :   if (!string)
      34           0 :     mOk = false;
      35             : 
      36           0 :   if (!mOk)
      37           0 :     return;
      38             : 
      39           0 :   mOk = JS_DefineProperty(mCx, mObj, name, string, JSPROP_ENUMERATE);
      40             : }
      41             : 
      42             : void
      43           0 : InfoObject::DefineProperty(const char *name, const char *value)
      44             : {
      45           0 :   nsAutoString string = NS_ConvertASCIItoUTF16(value);
      46           0 :   DefineProperty(name, string);
      47           0 : }
      48             : 
      49           0 : InfoObject::InfoObject(JSContext *aCx) : mCx(aCx), mObj(aCx), mOk(true)
      50             : {
      51           0 :   mObj = JS_NewPlainObject(aCx);
      52           0 :   if (!mObj)
      53           0 :     mOk = false;
      54           0 : }

Generated by: LCOV version 1.13