|
20 | 20 | #include "jsfriendapi.h" |
21 | 21 | #pragma clang diagnostic pop |
22 | 22 |
|
23 | | -#include "debugger.h" |
| 23 | +#ifdef JS_DEBUGGER |
| 24 | + #include "debugger.h" |
| 25 | +#endif |
24 | 26 | #include "script_loader.h" |
25 | 27 |
|
26 | 28 | #include <decode.h> |
@@ -443,11 +445,13 @@ Engine::Engine(std::unique_ptr<EngineConfig> config) { |
443 | 445 | // Debugging isn't supported during wizening, so only try it when doing runtime evaluation. |
444 | 446 | // The debugger can be initialized at runtime by whatever export is invoked on the |
445 | 447 | // resumed wizer snapshot. |
446 | | - content_debugger::maybe_init_debugger(this, false); |
| 448 | +#ifdef JS_DEBUGGER |
| 449 | + content_debugger::maybe_init_debugger(this, false); |
447 | 450 | if (auto replacement_script_path = content_debugger::replacement_script_path()) { |
448 | 451 | TRACE("Using replacement script path received from debugger: " << *replacement_script_path); |
449 | 452 | content_script_path = replacement_script_path; |
450 | 453 | } |
| 454 | +#endif |
451 | 455 | } |
452 | 456 |
|
453 | 457 | if (content_script_path) { |
@@ -538,10 +542,14 @@ bool Engine::run_initialization_script() { |
538 | 542 |
|
539 | 543 | JSAutoRealm ar(cx, global); |
540 | 544 |
|
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)) { |
543 | 546 | return false; |
544 | 547 | } |
| 548 | +#ifdef JS_DEBUGGER |
| 549 | + if (!JS_DefineFunction(cx, global, "print", content_debugger::dbg_print, 1, 0)) { |
| 550 | + return false; |
| 551 | + } |
| 552 | +#endif |
545 | 553 |
|
546 | 554 | auto path = config_->initializer_script_path.value(); |
547 | 555 | TRACE("Running initialization script from file " << path); |
|
0 commit comments