LCOV - code coverage report
Current view: top level - dom/xhr - XMLHttpRequest.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 3 12 25.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "XMLHttpRequest.h"
       8             : #include "XMLHttpRequestMainThread.h"
       9             : #include "XMLHttpRequestWorker.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace dom {
      13             : 
      14             : /* static */ already_AddRefed<XMLHttpRequest>
      15           3 : XMLHttpRequest::Constructor(const GlobalObject& aGlobal,
      16             :                             const MozXMLHttpRequestParameters& aParams,
      17             :                             ErrorResult& aRv)
      18             : {
      19           3 :   if (NS_IsMainThread()) {
      20           0 :     nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
      21             :     nsCOMPtr<nsIScriptObjectPrincipal> principal =
      22           0 :       do_QueryInterface(aGlobal.GetAsSupports());
      23           0 :     if (!global || ! principal) {
      24           0 :       aRv.Throw(NS_ERROR_FAILURE);
      25           0 :       return nullptr;
      26             :     }
      27             : 
      28           0 :     RefPtr<XMLHttpRequestMainThread> req = new XMLHttpRequestMainThread();
      29           0 :     req->Construct(principal->GetPrincipal(), global);
      30           0 :     req->InitParameters(aParams.mMozAnon, aParams.mMozSystem);
      31           0 :     return req.forget();
      32             :   }
      33             : 
      34           3 :   return XMLHttpRequestWorker::Construct(aGlobal, aParams, aRv);
      35             : }
      36             : 
      37             : } // dom namespace
      38             : } // mozilla namespace

Generated by: LCOV version 1.13