mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Remove unnecessary MutNullableDom
Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
e2eabd41c9
commit
11d5a2ef51
1 changed files with 3 additions and 8 deletions
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::default::Default;
|
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
@ -13,7 +12,7 @@ use script_bindings::reflector::DomObject;
|
||||||
use crate::dom::bindings::codegen::Bindings::DebuggerEventBinding::DebuggerEventMethods;
|
use crate::dom::bindings::codegen::Bindings::DebuggerEventBinding::DebuggerEventMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventMethods;
|
use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventMethods;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
use crate::dom::types::GlobalScope;
|
use crate::dom::types::GlobalScope;
|
||||||
use crate::script_runtime::CanGc;
|
use crate::script_runtime::CanGc;
|
||||||
|
@ -22,7 +21,7 @@ use crate::script_runtime::CanGc;
|
||||||
/// Event for Rust → JS calls in [`crate::dom::DebuggerGlobalScope`].
|
/// Event for Rust → JS calls in [`crate::dom::DebuggerGlobalScope`].
|
||||||
pub(crate) struct DebuggerEvent {
|
pub(crate) struct DebuggerEvent {
|
||||||
event: Event,
|
event: Event,
|
||||||
global: MutNullableDom<GlobalScope>,
|
global: Dom<GlobalScope>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DebuggerEvent {
|
impl DebuggerEvent {
|
||||||
|
@ -33,10 +32,8 @@ impl DebuggerEvent {
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
let result = Box::new(Self {
|
let result = Box::new(Self {
|
||||||
event: Event::new_inherited(),
|
event: Event::new_inherited(),
|
||||||
global: Default::default(),
|
global: Dom::from_ref(global),
|
||||||
});
|
});
|
||||||
// TODO: make these fields not optional somehow?
|
|
||||||
result.global.set(Some(global));
|
|
||||||
|
|
||||||
result.event.init_event("addDebuggee".into(), false, false);
|
result.event.init_event("addDebuggee".into(), false, false);
|
||||||
|
|
||||||
|
@ -51,8 +48,6 @@ impl DebuggerEventMethods<crate::DomTypeHolder> for DebuggerEvent {
|
||||||
// into the active realm (debugger realm) so that it can be passed across compartments.
|
// into the active realm (debugger realm) so that it can be passed across compartments.
|
||||||
rooted!(in(*cx) let mut result: Value);
|
rooted!(in(*cx) let mut result: Value);
|
||||||
self.global
|
self.global
|
||||||
.get()
|
|
||||||
.expect("Guaranteed by new")
|
|
||||||
.reflector()
|
.reflector()
|
||||||
.safe_to_jsval(cx, result.handle_mut());
|
.safe_to_jsval(cx, result.handle_mut());
|
||||||
NonNull::new(result.to_object()).unwrap()
|
NonNull::new(result.to_object()).unwrap()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue