diff --git a/browser/extensions/screenshots/background/auth.js b/browser/extensions/screenshots/background/auth.js index ef879b97c8de..a6b554ad0163 100644 --- a/browser/extensions/screenshots/background/auth.js +++ b/browser/extensions/screenshots/background/auth.js @@ -3,7 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ /* globals log */ -/* globals main, makeUuid, deviceInfo, analytics, catcher, communication, browser */ +/* globals main, deviceInfo, analytics, catcher, communication, browser */ "use strict"; @@ -30,7 +30,7 @@ this.auth = (function() { function generateRegistrationInfo() { const info = { - secret: makeUuid(), + secret: crypto.randomUUID(), registered: false, }; return info; diff --git a/browser/extensions/screenshots/background/main.js b/browser/extensions/screenshots/background/main.js index 9cbc429d1b84..50a437ce3161 100644 --- a/browser/extensions/screenshots/background/main.js +++ b/browser/extensions/screenshots/background/main.js @@ -2,7 +2,7 @@ * 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/. */ -/* globals browser, getStrings, selectorLoader, analytics, communication, catcher, log, makeUuid, auth, senderror, startBackground, blobConverters, startSelectionWithOnboarding */ +/* globals browser, getStrings, selectorLoader, analytics, communication, catcher, log, auth, senderror, startBackground, blobConverters, startSelectionWithOnboarding */ "use strict"; @@ -153,7 +153,7 @@ this.main = (function() { communication.register("openShot", async (sender, { url, copied }) => { if (copied) { - const id = makeUuid(); + const id = crypto.randomUUID(); const [title, message] = await getStrings([ { id: "screenshots-notification-link-copied-title" }, { id: "screenshots-notification-link-copied-details" }, diff --git a/browser/extensions/screenshots/background/selectorLoader.js b/browser/extensions/screenshots/background/selectorLoader.js index d8e9d896fbb2..347b29deb87a 100644 --- a/browser/extensions/screenshots/background/selectorLoader.js +++ b/browser/extensions/screenshots/background/selectorLoader.js @@ -27,7 +27,6 @@ this.selectorLoader = (function() { const selectorScripts = [ "clipboard.js", - "makeUuid.js", "build/selection.js", "build/shot.js", "randomString.js", diff --git a/browser/extensions/screenshots/background/senderror.js b/browser/extensions/screenshots/background/senderror.js index 7d01c262b155..387c7b01f528 100644 --- a/browser/extensions/screenshots/background/senderror.js +++ b/browser/extensions/screenshots/background/senderror.js @@ -2,7 +2,7 @@ * 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/. */ -/* globals startBackground, analytics, communication, makeUuid, Raven, catcher, auth, log, browser, getStrings */ +/* globals startBackground, analytics, communication, Raven, catcher, auth, log, browser, getStrings */ "use strict"; @@ -60,7 +60,7 @@ this.senderror = (function() { return; } lastErrorTime = Date.now(); - const id = makeUuid(); + const id = crypto.randomUUID(); let popupMessage = error.popupMessage || "generic"; if (!messages[popupMessage]) { popupMessage = "generic"; diff --git a/browser/extensions/screenshots/background/startBackground.js b/browser/extensions/screenshots/background/startBackground.js index ff21ba00e375..176838b5fbfc 100644 --- a/browser/extensions/screenshots/background/startBackground.js +++ b/browser/extensions/screenshots/background/startBackground.js @@ -47,7 +47,6 @@ this.startBackground = (function() { const backgroundScripts = [ "log.js", - "makeUuid.js", "catcher.js", "blobConverters.js", "background/selectorLoader.js", diff --git a/browser/extensions/screenshots/makeUuid.js b/browser/extensions/screenshots/makeUuid.js deleted file mode 100644 index b4b635ad5787..000000000000 --- a/browser/extensions/screenshots/makeUuid.js +++ /dev/null @@ -1,22 +0,0 @@ -/* 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/. */ - -"use strict"; - -this.makeUuid = (function() { - // generates a v4 UUID - return function makeUuid() { - // eslint-disable-line no-unused-vars - // get sixteen unsigned 8 bit random values - const randomValues = window.crypto.getRandomValues(new Uint8Array(36)); - - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { - const i = Array.prototype.slice.call(arguments).slice(-2)[0]; // grab the `offset` parameter - const r = randomValues[i] % 16 | 0, - v = c === "x" ? r : (r & 0x3) | 0x8; - return v.toString(16); - }); - }; -})(); -null; diff --git a/browser/extensions/screenshots/moz.build b/browser/extensions/screenshots/moz.build index 46949e6339ad..d1ddaa7b3afa 100644 --- a/browser/extensions/screenshots/moz.build +++ b/browser/extensions/screenshots/moz.build @@ -18,7 +18,6 @@ FINAL_TARGET_FILES.features["screenshots@mozilla.org"] += [ "clipboard.js", "domainFromUrl.js", "log.js", - "makeUuid.js", "manifest.json", "moz.build", "randomString.js",