mirror of
https://github.com/servo/servo
synced 2026-05-12 09:56:50 +02:00
to debug workers in a page with the [SpiderMonkey Debugger API](https://firefox-source-docs.mozilla.org/js/Debugger/), we need to pass the worker’s global object to [Debugger.prototype.**addDebuggee()**](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.html#adddebuggee-global). we could pick up the global via the [onNewGlobalObject() hook](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.html#onnewglobalobject-global), but if our script system passes the global to the debugger script instead, we can later add details like the PipelineId that will help servo identify debuggees that the API is notifying us about (#38334). this patch creates a debugger global in worker threads, runs the debugger script in those new globals, and plumbs new worker globals from those threads into addDebuggee() via the debugger script. since worker threads can’t generate PipelineId values, but they only ever run workers on behalf of one pipeline, we use that pipeline’s PipelineId as the PipelineId of the debugger global, rather than generating a unique PipelineId like we do in script threads. Testing: will undergo many automated tests in #38334 Fixes: part of #36027 Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: atbrakhi <atbrakhi@igalia.com>
165 KiB
165 KiB