Skip to content

Commit

Permalink
Remove useless parameter from TextEncoder constructor
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D167488

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1811347
gecko-commit: b8d5cc5c223ff571b04163dfd91a0d09c0e0b599
gecko-reviewers: emk, webdriver-reviewers, extension-reviewers, credential-management-reviewers, dimi, jdescottes, willdurand
  • Loading branch information
gregorypappas authored and moz-wptsync-bot committed Feb 21, 2023
1 parent b4a568e commit bbea8dc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion resources/chromium/nfc-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function toByteArray(data) {
tmpData = JSON.stringify(tmpData);

if (typeof tmpData === 'string')
byteArray = new TextEncoder('utf-8').encode(tmpData);
byteArray = new TextEncoder().encode(tmpData);

return byteArray;
}
Expand Down
4 changes: 2 additions & 2 deletions web-nfc/resources/nfc-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function nfc_test(func, name, properties) {
}

const test_text_data = 'Test text data.';
const test_text_byte_array = new TextEncoder('utf-8').encode(test_text_data);
const test_text_byte_array = new TextEncoder().encode(test_text_data);
const test_number_data = 42;
const test_json_data = {level: 1, score: 100, label: 'Game'};
const test_url_data = 'https://w3c.github.io/web-nfc/';
Expand Down Expand Up @@ -124,7 +124,7 @@ function createTextRecord(data, encoding, lang) {

function createMimeRecordFromJson(json) {
return createRecord(
'mime', new TextEncoder('utf-8').encode(JSON.stringify(json)),
'mime', new TextEncoder().encode(JSON.stringify(json)),
test_record_id, 'application/json');
}

Expand Down
2 changes: 1 addition & 1 deletion webauthn/createcredential-minpinlength.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// The extension results will be in the authenticator outputs.
assert_true(new Uint8Array(credential.response.getAuthenticatorData())
.toString()
.includes(new TextEncoder("utf-8")
.includes(new TextEncoder()
.encode("minPinLength")
.toString()));
}, "navigator.credentials.create() with minPinLength requested");
Expand Down
2 changes: 1 addition & 1 deletion webauthn/resources/common-inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const AUTHENTICATOR_SELECTION_CRITERIA = {
};

const MAKE_CREDENTIAL_OPTIONS = {
challenge: new TextEncoder("utf-8").encode(CHALLENGE),
challenge: new TextEncoder().encode(CHALLENGE),
rp: PUBLIC_KEY_RP,
user: PUBLIC_KEY_USER,
pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
Expand Down
6 changes: 3 additions & 3 deletions webauthn/webauthn-testdriver-basic.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
new Cbor(credential.response.attestationObject).getCBOR();

let rpIdHash = new Uint8Array(await crypto.subtle.digest(
{ name: "SHA-256" }, new TextEncoder("utf-8").encode(PUBLIC_KEY_RP.id)));
{ name: "SHA-256" }, new TextEncoder().encode(PUBLIC_KEY_RP.id)));

let authenticatorData = parseAuthenticatorData(attestationObject.authData);

Expand All @@ -59,7 +59,7 @@
promise_test(async t => {
let assertion = await navigator.credentials.get({
publicKey: {
challenge: new TextEncoder("utf-8").encode(CHALLENGE),
challenge: new TextEncoder().encode(CHALLENGE),
rpId: PUBLIC_KEY_RP.id,
allowCredentials: [{
type: "public-key",
Expand Down Expand Up @@ -87,7 +87,7 @@
let authenticatorData = parseAuthenticatorData(binaryAuthenticatorData);

let rpIdHash = new Uint8Array(await crypto.subtle.digest(
{ name: "SHA-256" }, new TextEncoder("utf-8").encode(PUBLIC_KEY_RP.id)));
{ name: "SHA-256" }, new TextEncoder().encode(PUBLIC_KEY_RP.id)));

assert_array_equals(authenticatorData.rpIdHash, rpIdHash)
assert_true(authenticatorData.flags.up);
Expand Down

0 comments on commit bbea8dc

Please sign in to comment.