From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- devtools/server/actors/tracer.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'devtools/server/actors/tracer.js') diff --git a/devtools/server/actors/tracer.js b/devtools/server/actors/tracer.js index bf759cee5f..d98749ceb1 100644 --- a/devtools/server/actors/tracer.js +++ b/devtools/server/actors/tracer.js @@ -4,16 +4,14 @@ "use strict"; -// Bug 1827382, as this module can be used from the worker thread, -// the following JSM may be loaded by the worker loader until -// we have proper support for ESM from workers. -const { - startTracing, - stopTracing, - addTracingListener, - removeTracingListener, - NEXT_INTERACTION_MESSAGE, -} = require("resource://devtools/server/tracer/tracer.jsm"); +const lazy = {}; +ChromeUtils.defineESModuleGetters( + lazy, + { + JSTracer: "resource://devtools/server/tracer/tracer.sys.mjs", + }, + { global: "contextual" } +); const { Actor } = require("resource://devtools/shared/protocol.js"); const { tracerSpec } = require("resource://devtools/shared/specs/tracer.js"); @@ -136,10 +134,10 @@ class TracerActor extends Actor { onTracingPending: this.onTracingPending.bind(this), onTracingDOMMutation: this.onTracingDOMMutation.bind(this), }; - addTracingListener(this.tracingListener); + lazy.JSTracer.addTracingListener(this.tracingListener); this.traceValues = !!options.traceValues; try { - startTracing({ + lazy.JSTracer.startTracing({ global: this.targetActor.window || this.targetActor.workerGlobal, prefix: options.prefix || "", // Enable receiving the `currentDOMEvent` being passed to `onTracingFrame` @@ -170,10 +168,10 @@ class TracerActor extends Actor { return; } // Remove before stopping to prevent receiving the stop notification - removeTracingListener(this.tracingListener); + lazy.JSTracer.removeTracingListener(this.tracingListener); this.tracingListener = null; - stopTracing(); + lazy.JSTracer.stopTracing(); this.logMethod = null; } @@ -230,7 +228,7 @@ class TracerActor extends Actor { if (consoleMessageWatcher) { consoleMessageWatcher.emitMessages([ { - arguments: [NEXT_INTERACTION_MESSAGE], + arguments: [lazy.JSTracer.NEXT_INTERACTION_MESSAGE], styles: [], level: "jstracer", chromeContext: false, @@ -510,7 +508,7 @@ class TracerActor extends Actor { * A string to be displayed as a prefix of any logged frame. * @param {String} options.why * A string to explain why the function stopped. - * See tracer.jsm's FRAME_EXIT_REASONS. + * See tracer.sys.mjs's FRAME_EXIT_REASONS. * @param {Debugger.Object|primitive} options.rv * The returned value. It can be the returned value, or the thrown exception. * It is either a primitive object, otherwise it is a Debugger.Object for any other JS Object type. -- cgit v1.2.3