utils.js (952B)
1 // META: script=/fenced-frame/resources/utils.js 2 3 // Generate a list of URLs to use as input to sharedStorage.selectURL. 4 // @param {integer} size - The number of URLs to generate 5 // @param {string} pathPrefix - Prefix of the relative URL to use 6 // @param {string list} keylist - The list of key UUIDs to be used. Note that 7 // order matters when extracting the keys 8 // @return {SharedStorageUrlWithMetadata list} - A list of 9 // SharedStorageUrlWithMetadata 10 // dictionaries whose "url" 11 // values have `keylist` appended 12 // to their `searchParams` 13 function generateUrls(size, pathPrefix, keylist) { 14 return new Array(size).fill(0).map((e, i) => { 15 return { 16 url: generateURL(pathPrefix + i.toString() + '.html', keylist) 17 } 18 }); 19 }