Skip to content

Commit

Permalink
Pluralize Sec-CH-UA-Form-Factor/formFactor
Browse files Browse the repository at this point in the history
Per WICG/ua-client-hints#355, this hint should
be plural since it contains a list of form factors.

Bug: 328490271
Change-Id: I36062ade29b59c38199f54e29b8ec43795c4a7d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5353828
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Reviewed-by: danakj <[email protected]>
Reviewed-by: Mike Taylor <[email protected]>
Reviewed-by: Victor Tan <[email protected]>
Reviewed-by: Bo Liu <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Dustin Mitchell <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1271919}
  • Loading branch information
djmitche authored and chromium-wpt-export-bot committed Mar 13, 2024
1 parent fe171e2 commit 9e29a80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
assert_equals(typeof uaData.mobile, "boolean", "mobile should be a boolean");

const highEntropyData = await uaData.getHighEntropyValues([
"platformVersion", "architecture", "model", "uaFullVersion", "fullVersionList", "formFactor"]);
"platformVersion", "architecture", "model", "uaFullVersion", "fullVersionList", "formFactors"]);
assert_equals(typeof highEntropyData["platform"], "string", "Platform brand should be a string");
assert_equals(typeof highEntropyData["platformVersion"], "string", "Platform version should be a string");
assert_equals(typeof highEntropyData["architecture"], "string", "Architecture should be a string");
assert_equals(typeof highEntropyData["model"], "string", "Model should be a string");
assert_equals(typeof highEntropyData["uaFullVersion"], "string", "UAFullVersion should be a string");
for (formFactor of highEntropyData['formFactor']) {
assert_equals(typeof formFactor, "string", "Each FormFactor should be a string");
for (formFactor of highEntropyData['formFactors']) {
assert_equals(typeof formFactor, "string", "Each FormFactors value should be a string");
}
for (brandVersionPair of highEntropyData['fullVersionList']) {
assert_equals(typeof brandVersionPair.brand, "string", "brand should be a string");
Expand All @@ -40,7 +40,7 @@
assert_false("architecture" in highEntropyData2, "Architecture should be an empty string");
assert_false("model" in highEntropyData2, "Model should be an empty string");
assert_false("uaFullVersion" in highEntropyData2, "UAFullVersion should be an empty string");
assert_false("formFactor" in highEntropyData2, "FormFactor should be an empty string");
assert_false("formFactors" in highEntropyData2, "FormFactors should be an empty array");
assert_false("fullVersionList" in highEntropyData2, "fullVersionList should not be present");
let finalPromise = uaData.getHighEntropyValues([]).then(() => {
assert_true(didMicrotaskRun, "getHighEntropyValues queued on a task");
Expand Down
4 changes: 2 additions & 2 deletions workers/WorkerNavigator_userAgentData.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
assert_equals(e.data.platform, navigator.userAgentData.platform);
const highEntropyValues = await navigator.userAgentData.getHighEntropyValues([
"architecture", "bitness", "fullVersionList", "model",
"platformVersion", "uaFullVersion", "wow64", "formFactor",
"platformVersion", "uaFullVersion", "wow64", "formFactors",
]);

assert_equals(e.data.fullVersionList.length,
Expand All @@ -39,7 +39,7 @@
assert_equals(e.data.platformVersion, highEntropyValues.platformVersion);
assert_equals(e.data.uaFullVersion, highEntropyValues.uaFullVersion);
assert_equals(e.data.wow64, highEntropyValues.wow64);
assert_equals(e.data.formFactor.join(','), highEntropyValues.formFactor.join(','));
assert_equals(e.data.formFactors.join(','), highEntropyValues.formFactors.join(','));
assert_equals(e.data.NavigatorUADataExposed, true);

// Architecture should be one of two permitted values.
Expand Down
4 changes: 2 additions & 2 deletions workers/support/WorkerNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
obj.platform = navigator.userAgentData.platform;
const highEntropyValues = await navigator.userAgentData.getHighEntropyValues([
"architecture", "bitness", "fullVersionList", "model",
"platformVersion", "uaFullVersion", "wow64", "formFactor",
"platformVersion", "uaFullVersion", "wow64", "formFactors",
]);
obj.architecture = highEntropyValues.architecture;
obj.bitness = highEntropyValues.bitness;
Expand All @@ -20,7 +20,7 @@
obj.platformVersion = highEntropyValues.platformVersion;
obj.uaFullVersion = highEntropyValues.uaFullVersion;
obj.wow64 = highEntropyValues.wow64;
obj.formFactor = highEntropyValues.formFactor;
obj.formFactors = highEntropyValues.formFactors;
obj.NavigatorUADataExposed = (typeof self.NavigatorUAData != "undefined");
}
postMessage(obj);
Expand Down

0 comments on commit 9e29a80

Please sign in to comment.