Skip to content

Commit 14bcecc

Browse files
committed
Bug 1330138 - Divide U2F and WebAuthn into separate directories; r=jcj
MozReview-Commit-ID: FCCSL6XWhTf --HG-- rename : dom/u2f/NSSU2FTokenRemote.cpp => dom/webauthn/NSSU2FTokenRemote.cpp rename : dom/u2f/NSSU2FTokenRemote.h => dom/webauthn/NSSU2FTokenRemote.h rename : dom/u2f/ScopedCredential.cpp => dom/webauthn/ScopedCredential.cpp rename : dom/u2f/ScopedCredential.h => dom/webauthn/ScopedCredential.h rename : dom/u2f/ScopedCredentialInfo.cpp => dom/webauthn/ScopedCredentialInfo.cpp rename : dom/u2f/ScopedCredentialInfo.h => dom/webauthn/ScopedCredentialInfo.h rename : dom/u2f/WebAuthnAssertion.cpp => dom/webauthn/WebAuthnAssertion.cpp rename : dom/u2f/WebAuthnAssertion.h => dom/webauthn/WebAuthnAssertion.h rename : dom/u2f/WebAuthnAttestation.cpp => dom/webauthn/WebAuthnAttestation.cpp rename : dom/u2f/WebAuthnAttestation.h => dom/webauthn/WebAuthnAttestation.h rename : dom/u2f/tests/test_webauthn_get_assertion.html => dom/webauthn/tests/test_webauthn_get_assertion.html rename : dom/u2f/tests/test_webauthn_loopback.html => dom/webauthn/tests/test_webauthn_loopback.html rename : dom/u2f/tests/test_webauthn_make_credential.html => dom/webauthn/tests/test_webauthn_make_credential.html rename : dom/u2f/tests/test_webauthn_no_token.html => dom/webauthn/tests/test_webauthn_no_token.html rename : dom/u2f/tests/test_webauthn_sameorigin.html => dom/webauthn/tests/test_webauthn_sameorigin.html
1 parent 4fca259 commit 14bcecc

31 files changed

+16475
-42
lines changed

dom/moz.build

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ DIRS += [
8585
'promise',
8686
'smil',
8787
'url',
88+
'webauthn',
8889
'webidl',
8990
'xbl',
9091
'xml',

dom/u2f/U2F.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(U2F)
4242

4343
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(U2F, mParent)
4444

45-
static mozilla::LazyLogModule gWebauthLog("webauth_u2f");
45+
static mozilla::LazyLogModule gU2FLog("u2f");
4646

4747
static nsresult
4848
AssembleClientData(const nsAString& aOrigin, const nsAString& aTyp,
@@ -81,7 +81,7 @@ U2FStatus::WaitGroupAdd()
8181
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
8282

8383
mCount += 1;
84-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
84+
MOZ_LOG(gU2FLog, LogLevel::Debug,
8585
("U2FStatus::WaitGroupAdd, now %d", mCount));
8686
}
8787

@@ -92,7 +92,7 @@ U2FStatus::WaitGroupDone()
9292

9393
MOZ_ASSERT(mCount > 0);
9494
mCount -= 1;
95-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
95+
MOZ_LOG(gU2FLog, LogLevel::Debug,
9696
("U2FStatus::WaitGroupDone, now %d", mCount));
9797
if (mCount == 0) {
9898
mReentrantMonitor.NotifyAll();
@@ -103,15 +103,15 @@ void
103103
U2FStatus::WaitGroupWait()
104104
{
105105
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
106-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
106+
MOZ_LOG(gU2FLog, LogLevel::Debug,
107107
("U2FStatus::WaitGroupWait, now %d", mCount));
108108

109109
while (mCount > 0) {
110110
mReentrantMonitor.Wait();
111111
}
112112

113113
MOZ_ASSERT(mCount == 0);
114-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
114+
MOZ_LOG(gU2FLog, LogLevel::Debug,
115115
("U2FStatus::Wait completed, now count=%d stopped=%d", mCount,
116116
mIsStopped));
117117
}
@@ -627,7 +627,7 @@ U2FRegisterRunnable::Run()
627627
U2FPrepPromise::All(AbstractThread::MainThread(), prepPromiseList)
628628
->Then(AbstractThread::MainThread(), __func__,
629629
[status] (const nsTArray<Authenticator>& aTokens) {
630-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
630+
MOZ_LOG(gU2FLog, LogLevel::Debug,
631631
("ALL: None of the RegisteredKeys were recognized. n=%d",
632632
aTokens.Length()));
633633

@@ -784,7 +784,7 @@ U2FSignRunnable::U2FSignRunnable(const nsAString& aOrigin,
784784
nsresult rv = AssembleClientData(aOrigin, kGetAssertion, aChallenge,
785785
mClientData);
786786
if (NS_WARN_IF(NS_FAILED(rv))) {
787-
MOZ_LOG(gWebauthLog, LogLevel::Warning,
787+
MOZ_LOG(gU2FLog, LogLevel::Warning,
788788
("Failed to AssembleClientData for the U2FSignRunnable."));
789789
return;
790790
}
@@ -976,15 +976,15 @@ U2F::Init(nsPIDOMWindowInner* aParent, ErrorResult& aRv)
976976
}
977977

978978
if (!EnsureNSSInitializedChromeOrContent()) {
979-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
979+
MOZ_LOG(gU2FLog, LogLevel::Debug,
980980
("Failed to get NSS context for U2F"));
981981
aRv.Throw(NS_ERROR_FAILURE);
982982
return;
983983
}
984984

985985
// This only functions in e10s mode
986986
if (XRE_IsParentProcess()) {
987-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
987+
MOZ_LOG(gU2FLog, LogLevel::Debug,
988988
("Is non-e10s Process, U2F not available"));
989989
aRv.Throw(NS_ERROR_FAILURE);
990990
return;

dom/u2f/moz.build

-13
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,14 @@
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

77
EXPORTS.mozilla.dom += [
8-
'NSSU2FTokenRemote.h',
9-
'ScopedCredential.h',
10-
'ScopedCredentialInfo.h',
118
'U2F.h',
129
'U2FAuthenticator.h',
1310
'USBToken.h',
14-
'WebAuthentication.h',
15-
'WebAuthnAssertion.h',
16-
'WebAuthnAttestation.h',
17-
'WebAuthnRequest.h',
1811
]
1912

2013
UNIFIED_SOURCES += [
21-
'NSSU2FTokenRemote.cpp',
22-
'ScopedCredential.cpp',
23-
'ScopedCredentialInfo.cpp',
2414
'U2F.cpp',
2515
'USBToken.cpp',
26-
'WebAuthentication.cpp',
27-
'WebAuthnAssertion.cpp',
28-
'WebAuthnAttestation.cpp',
2916
]
3017

3118
include('/ipc/chromium/chromium-config.mozbuild')

dom/u2f/tests/mochitest.ini

-15
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,3 @@ skip-if = !e10s
2727
skip-if = !e10s
2828
[test_appid_facet_subdomain.html]
2929
skip-if = !e10s
30-
[test_webauthn_loopback.html]
31-
skip-if = !e10s
32-
scheme = https
33-
[test_webauthn_no_token.html]
34-
skip-if = !e10s
35-
scheme = https
36-
[test_webauthn_make_credential.html]
37-
skip-if = !e10s
38-
scheme = https
39-
[test_webauthn_get_assertion.html]
40-
skip-if = !e10s
41-
scheme = https
42-
[test_webauthn_sameorigin.html]
43-
skip-if = !e10s
44-
scheme = https
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dom/u2f/WebAuthentication.cpp renamed to dom/webauthn/WebAuthentication.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
#include "pkix/Input.h"
1414
#include "pkixutil.h"
1515

16+
#define PREF_U2F_SOFTTOKEN_ENABLED "security.webauth.u2f_enable_softtoken"
17+
#define PREF_U2F_USBTOKEN_ENABLED "security.webauth.u2f_enable_usbtoken"
18+
1619
namespace mozilla {
1720
namespace dom {
1821

19-
extern mozilla::LazyLogModule gWebauthLog; // defined in U2F.cpp
22+
static mozilla::LazyLogModule gWebauthLog("webauthn");
2023

2124
// Only needed for refcounted objects.
2225
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebAuthentication, mParent)

dom/u2f/WebAuthentication.h renamed to dom/webauthn/WebAuthentication.h

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef mozilla_dom_WebAuthentication_h
88
#define mozilla_dom_WebAuthentication_h
99

10+
#include "hasht.h"
1011
#include "js/TypeDecls.h"
1112
#include "mozilla/Attributes.h"
1213
#include "mozilla/dom/BindingDeclarations.h"
@@ -18,6 +19,7 @@
1819
#include "mozilla/ReentrantMonitor.h"
1920
#include "mozilla/SharedThreadPool.h"
2021
#include "nsCycleCollectionParticipant.h"
22+
#include "nsNetCID.h"
2123
#include "nsWrapperCache.h"
2224

2325
#include "U2FAuthenticator.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.

dom/u2f/WebAuthnRequest.h renamed to dom/webauthn/WebAuthnRequest.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace mozilla {
1616
namespace dom {
1717

18-
extern mozilla::LazyLogModule gWebauthLog; // defined in U2F.cpp
18+
//extern mozilla::LazyLogModule gWebauthLog; // defined in U2F.cpp
1919

2020
// WebAuthnRequest tracks the completion of a single WebAuthn request that
2121
// may run on multiple kinds of authenticators, and be subject to a deadline.
@@ -32,9 +32,9 @@ class WebAuthnRequest {
3232

3333
void AddActiveToken(const char* aCallSite)
3434
{
35-
MOZ_LOG(gWebauthLog, LogLevel::Debug,
36-
("WebAuthnRequest is tracking a new token, called from [%s]",
37-
aCallSite));
35+
// MOZ_LOG(gWebauthLog, LogLevel::Debug,
36+
// ("WebAuthnRequest is tracking a new token, called from [%s]",
37+
// aCallSite));
3838
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
3939
MOZ_ASSERT(!IsComplete());
4040
mCountTokens += 1;

dom/webauthn/moz.build

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2+
# vim: set filetype=python:
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+
EXPORTS.mozilla.dom += [
8+
'NSSU2FTokenRemote.h',
9+
'ScopedCredential.h',
10+
'ScopedCredentialInfo.h',
11+
'WebAuthentication.h',
12+
'WebAuthnAssertion.h',
13+
'WebAuthnAttestation.h',
14+
'WebAuthnRequest.h',
15+
]
16+
17+
UNIFIED_SOURCES += [
18+
'NSSU2FTokenRemote.cpp',
19+
'ScopedCredential.cpp',
20+
'ScopedCredentialInfo.cpp',
21+
'WebAuthentication.cpp',
22+
'WebAuthnAssertion.cpp',
23+
'WebAuthnAttestation.cpp',
24+
]
25+
26+
include('/ipc/chromium/chromium-config.mozbuild')
27+
28+
FINAL_LIBRARY = 'xul'
29+
30+
LOCAL_INCLUDES += [
31+
'/dom/base',
32+
'/dom/crypto',
33+
'/security/manager/ssl',
34+
'/security/pkix/include',
35+
'/security/pkix/lib',
36+
]
37+
38+
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']

dom/webauthn/tests/mochitest.ini

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[DEFAULT]
2+
support-files =
3+
pkijs/asn1.js
4+
pkijs/common.js
5+
pkijs/x509_schema.js
6+
pkijs/x509_simpl.js
7+
u2futil.js
8+
9+
[test_webauthn_loopback.html]
10+
skip-if = !e10s
11+
scheme = https
12+
[test_webauthn_no_token.html]
13+
skip-if = !e10s
14+
scheme = https
15+
[test_webauthn_make_credential.html]
16+
skip-if = !e10s
17+
scheme = https
18+
[test_webauthn_get_assertion.html]
19+
skip-if = !e10s
20+
scheme = https
21+
[test_webauthn_sameorigin.html]
22+
skip-if = !e10s
23+
scheme = https

dom/webauthn/tests/pkijs/LICENSE

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 2014, GMO GlobalSign
2+
Copyright (c) 2015, Peculiar Ventures
3+
All rights reserved.
4+
5+
Author 2014-2015, Yury Strozhevsky
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
* Redistributions in binary form must reproduce the above copyright notice, this
14+
list of conditions and the following disclaimer in the documentation and/or
15+
other materials provided with the distribution.
16+
17+
* Neither the name of the copyright holder nor the names of its
18+
contributors may be used to endorse or promote products derived from
19+
this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

dom/webauthn/tests/pkijs/README

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PKIjs and ASN1js are from https://pkijs.org/ and https://asn1js.org/.

0 commit comments

Comments
 (0)