1
0
Fork 0
firefox/testing/web-platform/tests/webstorage/resources/partitioning-utils.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

20 lines
515 B
JavaScript

function getOrCreateID(key) {
if (!localStorage.getItem(key)) {
const newID = +new Date() + "-" + Math.random();
localStorage.setItem(key, newID);
}
return localStorage.getItem(key);
}
function addIframePromise(url) {
return new Promise(resolve => {
const iframe = document.createElement("iframe");
iframe.style.display = "none";
iframe.src = url;
iframe.addEventListener("load", (e) => {
resolve(iframe);
}, {once: true});
document.body.appendChild(iframe);
});
}