Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/security/manager/ssl/nsKeygenHandlerContent.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
 * vim: set ts=2 sw=2 sts=2 et tw=80:
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 "nsKeygenHandlerContent.h"
9
10
#include "nsIFormProcessor.h"
11
#include "nsString.h"
12
13
#include "mozilla/dom/ContentChild.h"
14
#include "mozilla/dom/Element.h"
15
#include "mozilla/Unused.h"
16
17
#include "keythi.h"
18
#include "nss.h"
19
#include "secmodt.h"
20
#include "nsKeygenHandler.h"
21
22
using mozilla::dom::ContentChild;
23
using mozilla::dom::Element;
24
using mozilla::Unused;
25
26
NS_IMPL_ISUPPORTS(nsKeygenFormProcessorContent, nsIFormProcessor)
27
28
nsKeygenFormProcessorContent::nsKeygenFormProcessorContent()
29
0
{
30
0
}
31
32
nsKeygenFormProcessorContent::~nsKeygenFormProcessorContent()
33
0
{
34
0
}
35
36
nsresult
37
nsKeygenFormProcessorContent::ProcessValue(Element* aElement,
38
                                           const nsAString& aName,
39
                                           nsAString& aValue)
40
0
{
41
0
  nsAutoString challengeValue;
42
0
  nsAutoString keyTypeValue;
43
0
  nsAutoString keyParamsValue;
44
0
  nsKeygenFormProcessor::ExtractParams(aElement, challengeValue, keyTypeValue, keyParamsValue);
45
0
46
0
  ContentChild* child = ContentChild::GetSingleton();
47
0
48
0
  nsString oldValue(aValue);
49
0
  nsString newValue;
50
0
  Unused << child->SendKeygenProcessValue(oldValue, challengeValue,
51
0
                                          keyTypeValue, keyParamsValue,
52
0
                                          &newValue);
53
0
54
0
  aValue.Assign(newValue);
55
0
  return NS_OK;
56
0
}
57
58
nsresult
59
nsKeygenFormProcessorContent::ProcessValueIPC(const nsAString& aOldValue,
60
                                              const nsAString& aChallenge,
61
                                              const nsAString& aKeyType,
62
                                              const nsAString& aKeyParams,
63
                                              nsAString& aNewValue)
64
0
{
65
0
  MOZ_ASSERT(false, "should never be called in the child process");
66
0
  return NS_ERROR_UNEXPECTED;
67
0
}
68
69
nsresult
70
nsKeygenFormProcessorContent::ProvideContent(const nsAString& aFormType,
71
                                             nsTArray<nsString>& aContent,
72
                                             nsAString& aAttribute)
73
0
{
74
0
  nsString attribute;
75
0
  Unused <<
76
0
    ContentChild::GetSingleton()->SendKeygenProvideContent(&attribute,
77
0
                                                           &aContent);
78
0
  aAttribute.Assign(attribute);
79
0
  return NS_OK;
80
0
}