mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
script: Remove some proprietary Servo-only testing methods from Window (#42728)
These three methods date back from the very early history of Servo and
are no longer necessary:
1. `Window.debug`: `console.log` is a better replacement for this method
now. A manual test that tests the very basics of JavaScript used
this. This test is removed as well.
2. `Window.gc`: This can be replaced with `TestUtils.gc`, which is part
of a W3C specification.
3. `Window.js_backtrace`: This method is moved to `ServoTestUtils`.
Testing: Tests are updated to reflect these changes.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
@@ -15,7 +15,6 @@ use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use app_units::Au;
|
||||
use backtrace::Backtrace;
|
||||
use base::cross_process_instant::CrossProcessInstant;
|
||||
use base::generic_channel::{self, GenericCallback, GenericSender};
|
||||
use base::id::{BrowsingContextId, PipelineId, WebViewId};
|
||||
@@ -942,6 +941,13 @@ impl Window {
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
#[expect(unsafe_code)]
|
||||
pub(crate) fn gc(&self) {
|
||||
unsafe {
|
||||
JS_GC(*self.get_cx(), GCReason::API);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -1771,27 +1777,6 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
||||
}
|
||||
|
||||
// check-tidy: no specs after this line
|
||||
fn Debug(&self, message: DOMString) {
|
||||
debug!("{}", message);
|
||||
}
|
||||
|
||||
#[expect(unsafe_code)]
|
||||
fn Gc(&self) {
|
||||
unsafe {
|
||||
JS_GC(*self.get_cx(), GCReason::API);
|
||||
}
|
||||
}
|
||||
|
||||
#[expect(unsafe_code)]
|
||||
fn Js_backtrace(&self) {
|
||||
unsafe {
|
||||
println!("Current JS stack:");
|
||||
dump_js_stack(*self.get_cx());
|
||||
let rust_stack = Backtrace::new();
|
||||
println!("Current Rust stack:\n{:?}", rust_stack);
|
||||
}
|
||||
}
|
||||
|
||||
fn WebdriverCallback(&self, realm: &mut CurrentRealm, value: HandleValue) {
|
||||
let webdriver_script_sender = self.webdriver_script_chan.borrow_mut().take();
|
||||
if let Some(webdriver_script_sender) = webdriver_script_sender {
|
||||
@@ -3358,7 +3343,7 @@ impl Window {
|
||||
// GC any unreachable objects generated by user script,
|
||||
// or unattached DOM nodes. Attached DOM nodes can't be GCd yet,
|
||||
// as the document might be reactivated later.
|
||||
self.Gc();
|
||||
self.gc();
|
||||
}
|
||||
|
||||
pub(crate) fn resume(&self, can_gc: CanGc) {
|
||||
|
||||
Reference in New Issue
Block a user