Title: `localStorage`'s behaviour when no or invalid `--localstorage-file` provided · Issue #60303 · nodejs/node · GitHub
Open Graph Title: `localStorage`'s behaviour when no or invalid `--localstorage-file` provided · Issue #60303 · nodejs/node
X Title: `localStorage`'s behaviour when no or invalid `--localstorage-file` provided · Issue #60303 · nodejs/node
Description: Prior to #57666, accessing the global localStorage would throw an error if --localstorage-file was invalid at the point of lazy initialisation. Now, it provides an empty proxy object which responds undefined to all property access. This ...
Open Graph Description: Prior to #57666, accessing the global localStorage would throw an error if --localstorage-file was invalid at the point of lazy initialisation. Now, it provides an empty proxy object which responds...
X Description: Prior to #57666, accessing the global localStorage would throw an error if --localstorage-file was invalid at the point of lazy initialisation. Now, it provides an empty proxy object which responds...
Opengraph URL: https://github.com/nodejs/node/issues/60303
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`localStorage`'s behaviour when no or invalid `--localstorage-file` provided","articleBody":"Prior to #57666, accessing the global `localStorage` would throw an error if `--localstorage-file` was invalid at the point of lazy initialisation.\n\nNow, it provides an empty proxy object which responds `undefined` to all property access. This is neither spec-compliant nor straightforwardly observable.\n\nLooking at the PR, it seems like this was an attempt to avoid throwing warnings in the test suite if simply testing for the presence of the global variable. It seems to me like the better approach would be for the tests to be changed (eg. by checking for the flag instead), and for the implementation to be kept sane.\n\nA couple of options would be:\n- Implement [mcollina's original proposal](https://github.com/nodejs/node/pull/57666#issuecomment-2762069815), and have the getter warn and return `undefined` if the storage cannot be initialised.\n- The `localStorage` global getter is allowed to throw a DOMException in the spec if the storage cannot be safely initialised, which is more abrupt, but arguably more consistent with the web.","author":{"url":"https://github.com/Renegade334","@type":"Person","name":"Renegade334"},"datePublished":"2025-10-17T23:11:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":27},"url":"https://github.com/60303/node/issues/60303"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0ab3ceb3-0886-79ea-ad83-acb4470eb66b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9EF2:7CA5C:12571FC:1A19E37:6A4CC169 |
| html-safe-nonce | e8fff4c1c643a177c814d7bd3d060ce87f491a91c3f56da01566b5fb154672e5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUYyOjdDQTVDOjEyNTcxRkM6MUExOUUzNzo2QTRDQzE2OSIsInZpc2l0b3JfaWQiOiI0NDAxODQ3NzYwODA3ODM4MDU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 04f39639398b251534355d9731236f26c3866bfa03923aa8a97897212dd8fc2f |
| hovercard-subject-tag | issue:3527786014 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/60303/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e61acf08813c2c8d03f991ed61c6bd56e15b3f74ad7dcc49673d3ae6f59da452/nodejs/node/issues/60303 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e61acf08813c2c8d03f991ed61c6bd56e15b3f74ad7dcc49673d3ae6f59da452/nodejs/node/issues/60303 |
| og:image:alt | Prior to #57666, accessing the global localStorage would throw an error if --localstorage-file was invalid at the point of lazy initialisation. Now, it provides an empty proxy object which responds... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Renegade334 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c03e7e569190bc89b638cdd4acb4b6c6b38a170a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width