LCOV - code coverage report
Current view: top level - security/manager/pki - nsNSSDialogHelper.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 12 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 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             :  *
       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             : #include "nsNSSDialogHelper.h"
       8             : 
       9             : #include "mozilla/dom/ScriptSettings.h"
      10             : #include "nsCOMPtr.h"
      11             : #include "nsIDOMWindow.h"
      12             : #include "nsIServiceManager.h"
      13             : #include "nsIWindowWatcher.h"
      14             : 
      15             : static const char kOpenDialogParam[] = "centerscreen,chrome,modal,titlebar";
      16             : static const char kOpenWindowParam[] = "centerscreen,chrome,titlebar";
      17             : 
      18             : nsresult
      19           0 : nsNSSDialogHelper::openDialog(mozIDOMWindowProxy* window, const char* url,
      20             :                               nsISupports* params, bool modal)
      21             : {
      22             : #ifdef MOZ_WIDGET_GONK
      23             :   // On b2g devices, we need to proxy the dialog creation & management
      24             :   // to Gaia.
      25             :   return NS_ERROR_NOT_IMPLEMENTED;
      26             : #endif
      27             : 
      28             :   nsresult rv;
      29             :   nsCOMPtr<nsIWindowWatcher> windowWatcher =
      30           0 :            do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
      31           0 :   if (NS_FAILED(rv)) return rv;
      32             : 
      33           0 :   nsCOMPtr<mozIDOMWindowProxy> parent = window;
      34             : 
      35           0 :   if (!parent) {
      36           0 :     windowWatcher->GetActiveWindow(getter_AddRefs(parent));
      37             :   }
      38             : 
      39             :   // We're loading XUL into this window, and it's happening on behalf of the
      40             :   // system, not on behalf of content. Make sure the initial about:blank window
      41             :   // gets a system principal, otherwise we'll bork when trying to wrap the
      42             :   // nsIKeyGenThread |arguments| property into the unprivileged scoope.
      43           0 :   MOZ_ASSERT(!strncmp("chrome://", url, strlen("chrome://")));
      44           0 :   mozilla::dom::AutoNoJSAPI nojsapi;
      45             : 
      46           0 :   nsCOMPtr<mozIDOMWindowProxy> newWindow;
      47           0 :   rv = windowWatcher->OpenWindow(parent,
      48             :                                  url,
      49             :                                  "_blank",
      50             :                                  modal
      51             :                                  ? kOpenDialogParam
      52             :                                  : kOpenWindowParam,
      53             :                                  params,
      54           0 :                                  getter_AddRefs(newWindow));
      55           0 :   return rv;
      56             : }

Generated by: LCOV version 1.13