Skip to content

Commit 660a95d

Browse files
author
Guy Bedford
committed
fix: debugger disabling
1 parent 315c240 commit 660a95d

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ if (ENABLE_WPT)
5555
include("tests/wpt-harness/wpt.cmake")
5656
endif()
5757

58-
add_executable(starling-raw.wasm
58+
if (ENABLE_JS_DEBUGGER)
59+
add_executable(starling-raw.wasm
5960
runtime/js.cpp
6061
runtime/allocator.cpp
6162
runtime/encode.cpp
@@ -65,7 +66,19 @@ add_executable(starling-raw.wasm
6566
runtime/builtin.cpp
6667
runtime/script_loader.cpp
6768
runtime/debugger.cpp
68-
)
69+
)
70+
else()
71+
add_executable(starling-raw.wasm
72+
runtime/js.cpp
73+
runtime/allocator.cpp
74+
runtime/encode.cpp
75+
runtime/decode.cpp
76+
runtime/engine.cpp
77+
runtime/event_loop.cpp
78+
runtime/builtin.cpp
79+
runtime/script_loader.cpp
80+
)
81+
endif()
6982

7083
target_link_libraries(starling-raw.wasm PRIVATE host_api extension_api builtins spidermonkey rust-crates)
7184

runtime/engine.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#include "jsfriendapi.h"
2121
#pragma clang diagnostic pop
2222

23-
#include "debugger.h"
23+
#ifdef JS_DEBUGGER
24+
#include "debugger.h"
25+
#endif
2426
#include "script_loader.h"
2527

2628
#include <decode.h>
@@ -443,11 +445,13 @@ Engine::Engine(std::unique_ptr<EngineConfig> config) {
443445
// Debugging isn't supported during wizening, so only try it when doing runtime evaluation.
444446
// The debugger can be initialized at runtime by whatever export is invoked on the
445447
// resumed wizer snapshot.
446-
content_debugger::maybe_init_debugger(this, false);
448+
#ifdef JS_DEBUGGER
449+
content_debugger::maybe_init_debugger(this, false);
447450
if (auto replacement_script_path = content_debugger::replacement_script_path()) {
448451
TRACE("Using replacement script path received from debugger: " << *replacement_script_path);
449452
content_script_path = replacement_script_path;
450453
}
454+
#endif
451455
}
452456

453457
if (content_script_path) {
@@ -538,10 +542,14 @@ bool Engine::run_initialization_script() {
538542

539543
JSAutoRealm ar(cx, global);
540544

541-
if (!JS_DefineFunction(cx, global, "defineBuiltinModule", ::define_builtin_module, 2, 0) ||
542-
!JS_DefineFunction(cx, global, "print", content_debugger::dbg_print, 1, 0)) {
545+
if (!JS_DefineFunction(cx, global, "defineBuiltinModule", ::define_builtin_module, 2, 0)) {
543546
return false;
544547
}
548+
#ifdef JS_DEBUGGER
549+
if (!JS_DefineFunction(cx, global, "print", content_debugger::dbg_print, 1, 0)) {
550+
return false;
551+
}
552+
#endif
545553

546554
auto path = config_->initializer_script_path.value();
547555
TRACE("Running initialization script from file " << path);

0 commit comments

Comments
 (0)