Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unflag --experimental-webstorage #57658

Open
mcollina opened this issue Mar 28, 2025 · 7 comments · May be fixed by #57666
Open

Unflag --experimental-webstorage #57658

mcollina opened this issue Mar 28, 2025 · 7 comments · May be fixed by #57666
Labels
feature request Issues that request new features to be added to Node.js. good first issue Issues that are suitable for first-time contributors.

Comments

@mcollina
Copy link
Member

I think we could start shipping with localStorage enabled by default in v25.

@mcollina mcollina added the feature request Issues that request new features to be added to Node.js. label Mar 28, 2025
@mcollina
Copy link
Member Author

cc @cjihrig

@cjihrig
Copy link
Contributor

cjihrig commented Mar 28, 2025

SGTM

@mcollina mcollina added the good first issue Issues that are suitable for first-time contributors. label Mar 28, 2025
@danielmbrasil
Copy link
Contributor

danielmbrasil commented Mar 28, 2025

Hey, could you give some guidance on what needs to be done to unflag --experimental-webstorage? I tried setting this option as the default in node_options.cc and node_options.h as shown in the diff:

diff --git a/src/node_options.cc b/src/node_options.cc
index 16cce0df0e..d30b0b87b6 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -456,7 +456,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
   AddOption("--experimental-webstorage",
             "experimental Web Storage API",
             &EnvironmentOptions::experimental_webstorage,
-            kAllowedInEnvvar);
+            kAllowedInEnvvar,
+            true);
   AddOption("--localstorage-file",
             "file used to persist localStorage data",
             &EnvironmentOptions::localstorage_file,
diff --git a/src/node_options.h b/src/node_options.h
index baa615e310..07cda97d71 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -126,7 +126,7 @@ class EnvironmentOptions : public Options {
   bool experimental_fetch = true;
   bool experimental_websocket = true;
   bool experimental_sqlite = true;
-  bool experimental_webstorage = false;
+  bool experimental_webstorage = true;
 #ifdef NODE_OPENSSL_HAS_QUIC
   bool experimental_quic = false;
 #endif

This change works when running node directly:

Image

But the tests in test/parallel/test-webstorage.js are failing and I'm not sure why. I'd appreciate it if you could give me a hint on what I'm missing, thanks!

EDIT:

The tests fail with the following error:

node:internal/webstorage:30
          throw new ERR_INVALID_ARG_VALUE('--localstorage-file',
          ^

TypeError [ERR_INVALID_ARG_VALUE]: The argument '--localstorage-file' is an invalid localStorage location. Received ''
    at Object.get [as localStorage] (node:internal/webstorage:30:17)
    at get localStorage (node:internal/util:629:20)
    at /home/daniel/open_source/node/test/common/index.js:318:17
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/daniel/open_source/node/test/common/index.js:317:3)
    at Module._compile (node:internal/modules/cjs/loader:1734:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1899:10)
    at Module.load (node:internal/modules/cjs/loader:1469:32)
    at Module._load (node:internal/modules/cjs/loader:1286:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14) {
  code: 'ERR_INVALID_ARG_VALUE'
}

Node.js v24.0.0-pre

@mcollina
Copy link
Member Author

Probably there is something else to fix.

@mcollina
Copy link
Member Author

Can you push what you have in a draft PR?

@geeksilva97
Copy link
Contributor

geeksilva97 commented Mar 28, 2025

In test/common/index.js it adds localStorage to the globalThis, but this requires the localStorage file.

seems like it has the same effect as ./node -e 'localStorage'

@danielmbrasil
Copy link
Contributor

Can you push what you have in a draft PR?

@mcollina That's been pushed (#57666)

@bjohansebas bjohansebas moved this from Awaiting Triage to In Progress in Node.js feature requests Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. good first issue Issues that are suitable for first-time contributors.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants