зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1724152: Replace GkRustUtils::GenerateUUID with nsID::GenerateUUID. r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D129633
This commit is contained in:
Родитель
97ef6c5f31
Коммит
21b2b112f4
|
@ -1964,7 +1964,6 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"nsstring",
|
||||
"semver",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -85,17 +85,11 @@ already_AddRefed<nsIURI> NullPrincipal::CreateURI(
|
|||
iMutator = new mozilla::net::nsSimpleURI::Mutator();
|
||||
}
|
||||
|
||||
nsAutoCStringN<NSID_LENGTH> uuid;
|
||||
if (aNullPrincipalID) {
|
||||
// FIXME: When D119267 lands, clean this up on top of those changes.
|
||||
aNullPrincipalID->ToProvidedString(*reinterpret_cast<char(*)[NSID_LENGTH]>(
|
||||
uuid.GetMutableData(NSID_LENGTH - 1).data()));
|
||||
} else {
|
||||
GkRustUtils::GenerateUUID(uuid);
|
||||
}
|
||||
nsID uuid = aNullPrincipalID ? *aNullPrincipalID : nsID::GenerateUUID();
|
||||
|
||||
NS_MutateURI mutator(iMutator);
|
||||
mutator.SetSpec(NS_NULLPRINCIPAL_SCHEME ":"_ns + uuid);
|
||||
mutator.SetSpec(NS_NULLPRINCIPAL_SCHEME ":"_ns +
|
||||
nsDependentCString(nsIDToCString(uuid).get()));
|
||||
|
||||
// If there's a precursor URI, encode it in the null principal URI's query.
|
||||
if (aPrecursor) {
|
||||
|
|
|
@ -5,16 +5,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "gk_rust_utils_ffi_generated.h"
|
||||
#include "nsString.h"
|
||||
#include "GkRustUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/* static */
|
||||
void GkRustUtils::GenerateUUID(nsACString& aResult) {
|
||||
GkRustUtils_GenerateUUID(&aResult);
|
||||
};
|
||||
|
||||
/* static */
|
||||
bool GkRustUtils::ParseSemVer(const nsACString& aVersion, uint64_t& aOutMajor,
|
||||
uint64_t& aOutMinor, uint64_t& aOutPatch) {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
class GkRustUtils {
|
||||
public:
|
||||
static void GenerateUUID(nsACString& aResult);
|
||||
static bool ParseSemVer(const nsACString& aVersion, uint64_t& aOutMajor,
|
||||
uint64_t& aOutMinor, uint64_t& aOutPatch);
|
||||
};
|
||||
|
|
|
@ -4,6 +4,5 @@ version = "0.1.0"
|
|||
authors = ["Jonathan Kingston <jkt@mozilla.com>"]
|
||||
|
||||
[dependencies]
|
||||
uuid = { version = "0.8", features = ["v4"] }
|
||||
semver = "0.9"
|
||||
nsstring = { path = "../nsstring" }
|
||||
|
|
|
@ -4,17 +4,7 @@
|
|||
|
||||
extern crate nsstring;
|
||||
extern crate semver;
|
||||
extern crate uuid;
|
||||
use nsstring::nsACString;
|
||||
use uuid::Uuid;
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn GkRustUtils_GenerateUUID(res: &mut nsACString) {
|
||||
let uuid = Uuid::new_v4();
|
||||
write!(res, "{{{}}}", uuid.to_hyphenated_ref()).expect("Unexpected uuid generated");
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn GkRustUtils_ParseSemVer(
|
||||
|
|
Загрузка…
Ссылка в новой задаче