()
| 432 | } |
| 433 | |
| 434 | function setupWebStorage() { |
| 435 | if (getEmbedderOptions().noBrowserGlobals || |
| 436 | !getOptionValue('--experimental-webstorage')) { |
| 437 | return; |
| 438 | } |
| 439 | |
| 440 | // https://html.spec.whatwg.org/multipage/webstorage.html#webstorage |
| 441 | exposeLazyInterfaces(globalThis, 'internal/webstorage', ['Storage']); |
| 442 | |
| 443 | // localStorage is non-enumerable when --localstorage-file is not provided |
| 444 | // to avoid breaking {...globalThis} operations. |
| 445 | const localStorageFile = getOptionValue('--localstorage-file'); |
| 446 | let lazyLocalStorage; |
| 447 | ObjectDefineProperty(globalThis, 'localStorage', { |
| 448 | __proto__: null, |
| 449 | enumerable: localStorageFile !== '', |
| 450 | configurable: true, |
| 451 | get() { |
| 452 | lazyLocalStorage ??= require('internal/webstorage').localStorage; |
| 453 | return lazyLocalStorage; |
| 454 | }, |
| 455 | set(value) { |
| 456 | lazyLocalStorage = value; |
| 457 | }, |
| 458 | }); |
| 459 | |
| 460 | defineReplaceableLazyAttribute(globalThis, 'internal/webstorage', [ |
| 461 | 'sessionStorage', |
| 462 | ]); |
| 463 | } |
| 464 | |
| 465 | function setupCodeCoverage() { |
| 466 | // Resolve the coverage directory to an absolute path, and |
no test coverage detected
searching dependent graphs…