Skip to content

Commit be53255

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[cleanup] Use crypto.randomUUID
Bug: none Change-Id: I172dd8d32dc8eaa4e8cd10a2df85c6d0e8d5b4ee Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6439153 Reviewed-by: Philip Pfaffe <pfaffe@chromium.org> Commit-Queue: Philip Pfaffe <pfaffe@chromium.org> Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
1 parent 7c29389 commit be53255

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

test/e2e/helpers/extension-helpers.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@ const globalThis: any = global;
1919

2020
let loadExtensionPromise: Promise<unknown> = Promise.resolve();
2121

22-
// FIXME(chromium:1248945): Replace with crypto.randomUUID() once Chromium updates its version of node.js
23-
function guid() {
24-
const digits = '0123456789abcdef';
25-
const rnd = () => digits[Math.floor(Math.random() * (digits.length - 1))];
26-
const eight = new Array(8).fill('0').map(rnd).join('');
27-
const four = new Array(4).fill('0').map(rnd).join('');
28-
const version = new Array(3).fill('0').map(rnd).join('');
29-
const variant = new Array(3).fill('0').map(rnd).join('');
30-
const twelve = new Array(12).fill('0').map(rnd).join('');
31-
return `${eight}-${four}-4${version}-8${variant}-${twelve}`;
32-
}
33-
3422
export function getResourcesPathWithDevToolsHostname() {
3523
return getResourcesPath(getDevToolsFrontendHostname());
3624
}
@@ -56,7 +44,7 @@ export async function loadExtension(name: string, startPage?: string, allowFileA
5644
window.chrome = window.chrome || {};
5745
}
5846

59-
const extensionScriptId = guid();
47+
const extensionScriptId = crypto.randomUUID();
6048
const injectedScriptId = await session.send(
6149
'Page.addScriptToEvaluateOnNewDocument',
6250
{source: `(${declareChrome})();${injectedAPI}('${extensionScriptId}')`});

0 commit comments

Comments
 (0)