forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1782083 - Create skeleton IdentityCredential, r=dveditz,emilio
This patch creates a do-nothing IdentityCredential that gives errors when it is used. The IdentityCredential webidl is defined here: https://fedidcg.github.io/FedCM/#browser-api-identity-credential-interface Accomplished here: - IdentityCredential class defined, including isupports and cycle-counting macros - Empty test added to hold the place of a mochitest folder - webidl of CredentialsContainer updated and IdentityCredential added - Logic to parse `identity` key from navigator.credentials.get() - Adding all of this to the build, including membership to the new bugzilla component DOM: Credential Management Differential Revision: https://phabricator.services.mozilla.com/D153588
- Loading branch information
1 parent
dca1e21
commit abad258
Showing
9 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "mozilla/dom/Promise.h" | ||
#include "mozilla/dom/IdentityCredential.h" | ||
#include "nsCycleCollectionParticipant.h" | ||
|
||
namespace mozilla::dom { | ||
|
||
NS_IMPL_ADDREF_INHERITED(IdentityCredential, Credential) | ||
NS_IMPL_RELEASE_INHERITED(IdentityCredential, Credential) | ||
|
||
NS_IMPL_CYCLE_COLLECTION_INHERITED(IdentityCredential, Credential) | ||
|
||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdentityCredential) | ||
NS_INTERFACE_MAP_END_INHERITING(Credential) | ||
|
||
JSObject* IdentityCredential::WrapObject(JSContext* aCx, | ||
JS::Handle<JSObject*> aGivenProto) { | ||
return IdentityCredential_Binding::Wrap(aCx, this, aGivenProto); | ||
} | ||
|
||
void IdentityCredential::GetToken(nsAString& aToken) const { | ||
aToken.Assign(mToken); | ||
} | ||
void IdentityCredential::SetToken(const nsAString& aToken) { | ||
mToken.Assign(aToken); | ||
} | ||
|
||
} // namespace mozilla::dom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef mozilla_dom_IdentityCredential_h | ||
#define mozilla_dom_IdentityCredential_h | ||
|
||
#include "js/TypeDecls.h" | ||
#include "mozilla/Attributes.h" | ||
#include "mozilla/dom/BindingDeclarations.h" | ||
#include "mozilla/dom/Credential.h" | ||
#include "nsCycleCollectionParticipant.h" | ||
#include "nsWrapperCache.h" | ||
|
||
namespace mozilla::dom { | ||
|
||
class IdentityCredential final : public Credential { | ||
public: | ||
NS_DECL_ISUPPORTS_INHERITED | ||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(IdentityCredential, | ||
Credential) | ||
|
||
explicit IdentityCredential(nsPIDOMWindowInner* aParent); | ||
|
||
protected: | ||
~IdentityCredential() override; | ||
|
||
public: | ||
virtual JSObject* WrapObject(JSContext* aCx, | ||
JS::Handle<JSObject*> aGivenProto) override; | ||
|
||
void GetToken(nsAString& aToken) const; | ||
void SetToken(const nsAString& aToken); | ||
|
||
private: | ||
nsAutoString mToken; | ||
}; | ||
|
||
} // namespace mozilla::dom | ||
|
||
#endif // mozilla_dom_IdentityCredential_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
|
||
with Files("**"): | ||
BUG_COMPONENT = ("Core", "DOM: Credential Management") | ||
|
||
EXPORTS.mozilla.dom += [ | ||
"IdentityCredential.h", | ||
] | ||
|
||
UNIFIED_SOURCES += [ | ||
"IdentityCredential.cpp", | ||
] | ||
|
||
include("/ipc/chromium/chromium-config.mozbuild") | ||
|
||
FINAL_LIBRARY = "xul" | ||
|
||
MOCHITEST_MANIFESTS += ["tests/mochitest/mochitest.ini"] |
2 changes: 2 additions & 0 deletions
2
dom/credentialmanagement/identity/tests/mochitest/mochitest.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[DEFAULT] | ||
[test_identity_noop.html] |
17 changes: 17 additions & 0 deletions
17
dom/credentialmanagement/identity/tests/mochitest/test_identity_noop.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title><!-- TODO: insert title here --></title> | ||
<script src="/tests/SimpleTest/SimpleTest.js"></script> | ||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/> | ||
<script> | ||
ok(true, "TODO: implement the test"); | ||
</script> | ||
</head> | ||
<body> | ||
<p id="display"></p> | ||
<div id="content" style="display: none"></div> | ||
<pre id="test"></pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
[Exposed=Window, SecureContext, | ||
Pref="dom.security.credentialmanagement.identity.enabled"] | ||
interface IdentityCredential : Credential { | ||
readonly attribute USVString? token; | ||
}; | ||
|
||
dictionary IdentityCredentialRequestOptions { | ||
sequence<IdentityProvider> providers; | ||
}; | ||
|
||
dictionary IdentityProvider { | ||
required USVString configURL; | ||
required USVString clientId; | ||
USVString nonce; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters