mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
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>
47 lines
1.9 KiB
Rust
47 lines
1.9 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
use std::path::PathBuf;
|
|
|
|
use servo::resources::{Resource, ResourceReaderMethods};
|
|
|
|
pub(crate) struct ResourceReaderInstance;
|
|
|
|
impl ResourceReaderInstance {
|
|
pub(crate) fn new() -> ResourceReaderInstance {
|
|
ResourceReaderInstance
|
|
}
|
|
}
|
|
|
|
impl ResourceReaderMethods for ResourceReaderInstance {
|
|
fn read(&self, res: Resource) -> Vec<u8> {
|
|
Vec::from(match res {
|
|
Resource::HstsPreloadList => {
|
|
&include_bytes!("../../../../resources/hsts_preload.fstmap")[..]
|
|
},
|
|
Resource::BadCertHTML => &include_bytes!("../../../../resources/badcert.html")[..],
|
|
Resource::NetErrorHTML => &include_bytes!("../../../../resources/neterror.html")[..],
|
|
Resource::RippyPNG => &include_bytes!("../../../../resources/rippy.png")[..],
|
|
Resource::DomainList => &include_bytes!("../../../../resources/public_domains.txt")[..],
|
|
Resource::BluetoothBlocklist => {
|
|
&include_bytes!("../../../../resources/gatt_blocklist.txt")[..]
|
|
},
|
|
Resource::CrashHTML => &include_bytes!("../../../../resources/crash.html")[..],
|
|
Resource::DirectoryListingHTML => {
|
|
&include_bytes!("../../../../resources/directory-listing.html")[..]
|
|
},
|
|
Resource::AboutMemoryHTML => {
|
|
&include_bytes!("../../../../resources/about-memory.html")[..]
|
|
},
|
|
Resource::DebuggerJS => &include_bytes!("../../../../resources/debugger.js")[..],
|
|
})
|
|
}
|
|
|
|
fn sandbox_access_files(&self) -> Vec<PathBuf> {
|
|
vec![]
|
|
}
|
|
|
|
fn sandbox_access_files_dirs(&self) -> Vec<PathBuf> {
|
|
vec![]
|
|
}
|
|
}
|