Commit be0f17cfe4c for nodejs
commit be0f17cfe4ce585af0f30375b6f3a3736666e1a8
Author: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Date: Tue Nov 24 23:03:11 2026 -0300
inspector: fix builds without SQLite
dom_storage_agent.h includes node_webstorage.h, which needs sqlite3.h,
so `./configure --without-sqlite` only compiles together with
`--without-inspector`. Forward-declare webstorage::Storage there and
build the agent's web storage fallback only with SQLite. Without it,
getDOMStorageItems reports unregistered storage as unavailable.
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67722
Refs: https://github.com/nodejs/node/pull/62145
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
diff --git a/src/inspector/dom_storage_agent.cc b/src/inspector/dom_storage_agent.cc
index 7d3ce9dc5d0..04614dcea40 100644
--- a/src/inspector/dom_storage_agent.cc
+++ b/src/inspector/dom_storage_agent.cc
@@ -5,6 +5,9 @@
#include "util.h"
#include "v8-exception.h"
#include "v8-isolate.h"
+#if HAVE_SQLITE
+#include "node_webstorage.h"
+#endif // HAVE_SQLITE
namespace node {
namespace inspector {
@@ -98,6 +101,7 @@ protocol::DispatchResponse DOMStorageAgent::getDOMStorageItems(
bool is_local_storage = storageId->getIsLocalStorage();
const StorageMap* storage_map =
is_local_storage ? &local_storage_map_ : &session_storage_map_;
+#if HAVE_SQLITE
std::optional<StorageMap> storage_map_fallback;
if (storage_map->empty()) {
auto web_storage_obj = getWebStorage(is_local_storage);
@@ -139,6 +143,12 @@ protocol::DispatchResponse DOMStorageAgent::getDOMStorageItems(
}
storage_map = &storage_map_fallback.value();
}
+#else
+ if (storage_map->empty()) {
+ return protocol::DispatchResponse::ServerError(
+ "Could not read DOM storage items: storage is unavailable");
+ }
+#endif // HAVE_SQLITE
auto result =
std::make_unique<protocol::Array<protocol::Array<protocol::String>>>();
@@ -317,6 +327,7 @@ void DOMStorageAgent::registerStorage(Local<Context> context,
}
}
+#if HAVE_SQLITE
std::optional<node::webstorage::Storage*> DOMStorageAgent::getWebStorage(
bool is_local_storage) {
v8::Isolate* isolate = env_->isolate();
@@ -339,6 +350,7 @@ std::optional<node::webstorage::Storage*> DOMStorageAgent::getWebStorage(
return storage;
}
}
+#endif // HAVE_SQLITE
bool DOMStorageAgent::canEmit(const std::string& domain) {
return domain == "DOMStorage";
diff --git a/src/inspector/dom_storage_agent.h b/src/inspector/dom_storage_agent.h
index a6eecbb8d37..e1f955a1d85 100644
--- a/src/inspector/dom_storage_agent.h
+++ b/src/inspector/dom_storage_agent.h
@@ -5,11 +5,14 @@
#include <string>
#include "env.h"
#include "node/inspector/protocol/DOMStorage.h"
-#include "node_webstorage.h"
#include "notification_emitter.h"
#include "v8.h"
namespace node {
+namespace webstorage {
+class Storage;
+} // namespace webstorage
+
namespace inspector {
class DOMStorageAgent : public protocol::DOMStorage::Backend,