mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
script: Create a debugger script for the SpiderMonkey Debugger API (#38331)
to use the [SpiderMonkey Debugger API](https://firefox-source-docs.mozilla.org/js/Debugger/), we need to call it from an internal debugger script that we will supply. this script must run in the same runtime as the debuggee(s), but in a separate [compartment](https://udn.realityripple.com/docs/Mozilla/Projects/SpiderMonkey/Compartments) ([more details](https://hacks.mozilla.org/2020/03/future-proofing-firefoxs-javascript-debugger-implementation/)). this patch defines a new DebuggerGlobalScope type and a new debugger script resource. when creating each script thread, we create a debugger global, load the debugger script from resources/debugger.js, and run that script in the global to initialise the Debugger API. subsequent patches will use the debugger script as an RPC mechanism for the Debugger API. Testing: no testable effects yet, but will be used in #37667 Fixes: part of #36027 --------- Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
parent
8e27fd48cc
commit
c09e117bfe
11 changed files with 184 additions and 6 deletions
|
@ -109,6 +109,8 @@ pub enum Resource {
|
|||
DirectoryListingHTML,
|
||||
/// A HTML page that is used for the about:memory url.
|
||||
AboutMemoryHTML,
|
||||
/// RPC script for the Debugger API on behalf of devtools.
|
||||
DebuggerJS,
|
||||
}
|
||||
|
||||
impl Resource {
|
||||
|
@ -123,6 +125,7 @@ impl Resource {
|
|||
Resource::CrashHTML => "crash.html",
|
||||
Resource::DirectoryListingHTML => "directory-listing.html",
|
||||
Resource::AboutMemoryHTML => "about-memory.html",
|
||||
Resource::DebuggerJS => "debugger.js",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,6 +170,7 @@ fn resources_for_tests() -> Box<dyn ResourceReaderMethods + Sync + Send> {
|
|||
Resource::AboutMemoryHTML => {
|
||||
&include_bytes!("../../../resources/about-memory.html")[..]
|
||||
},
|
||||
Resource::DebuggerJS => &include_bytes!("../../../resources/debugger.js")[..],
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue