@@ -9,7 +9,6 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
9
9
use std:: collections:: { HashMap , HashSet , VecDeque } ;
10
10
use std:: default:: Default ;
11
11
use std:: mem;
12
- use std:: ptr:: NonNull ;
13
12
use std:: rc:: Rc ;
14
13
use std:: slice:: from_ref;
15
14
use std:: time:: { Duration , Instant } ;
@@ -26,7 +25,6 @@ use euclid::default::{Point2D, Rect, Size2D};
26
25
use html5ever:: { local_name, namespace_url, ns, LocalName , Namespace , QualName } ;
27
26
use hyper_serde:: Serde ;
28
27
use ipc_channel:: ipc:: { self , IpcSender } ;
29
- use js:: jsapi:: JSObject ;
30
28
use js:: rust:: HandleObject ;
31
29
use keyboard_types:: { Code , Key , KeyState } ;
32
30
use lazy_static:: lazy_static;
@@ -80,7 +78,7 @@ use crate::dom::bindings::callback::ExceptionHandling;
80
78
use crate :: dom:: bindings:: cell:: { ref_filter_map, DomRefCell , Ref , RefMut } ;
81
79
use crate :: dom:: bindings:: codegen:: Bindings :: BeforeUnloadEventBinding :: BeforeUnloadEvent_Binding :: BeforeUnloadEventMethods ;
82
80
use crate :: dom:: bindings:: codegen:: Bindings :: DocumentBinding :: {
83
- DocumentMethods , DocumentReadyState ,
81
+ DocumentMethods , DocumentReadyState , NamedPropertyValue ,
84
82
} ;
85
83
use crate :: dom:: bindings:: codegen:: Bindings :: EventBinding :: Event_Binding :: EventMethods ;
86
84
use crate :: dom:: bindings:: codegen:: Bindings :: HTMLIFrameElementBinding :: HTMLIFrameElement_Binding :: HTMLIFrameElementMethods ;
@@ -176,7 +174,7 @@ use crate::dom::window::{ReflowReason, Window};
176
174
use crate :: dom:: windowproxy:: WindowProxy ;
177
175
use crate :: fetch:: FetchCanceller ;
178
176
use crate :: realms:: { AlreadyInRealm , InRealm } ;
179
- use crate :: script_runtime:: { CommonScriptMsg , JSContext , ScriptThreadEventCategory } ;
177
+ use crate :: script_runtime:: { CommonScriptMsg , ScriptThreadEventCategory } ;
180
178
use crate :: script_thread:: { MainThreadScriptMsg , ScriptThread } ;
181
179
use crate :: stylesheet_set:: StylesheetSetRef ;
182
180
use crate :: task:: TaskBox ;
@@ -4860,8 +4858,8 @@ impl DocumentMethods for Document {
4860
4858
}
4861
4859
4862
4860
#[ allow( unsafe_code) ]
4863
- // https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
4864
- fn NamedGetter ( & self , _cx : JSContext , name : DOMString ) -> Option < NonNull < JSObject > > {
4861
+ /// < https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter>
4862
+ fn NamedGetter ( & self , name : DOMString ) -> Option < NamedPropertyValue > {
4865
4863
if name. is_empty ( ) {
4866
4864
return None ;
4867
4865
}
@@ -4886,19 +4884,11 @@ impl DocumentMethods for Document {
4886
4884
. downcast :: < HTMLIFrameElement > ( )
4887
4885
. and_then ( |iframe| iframe. GetContentWindow ( ) )
4888
4886
{
4889
- unsafe {
4890
- return Some ( NonNull :: new_unchecked (
4891
- nested_window_proxy. reflector ( ) . get_jsobject ( ) . get ( ) ,
4892
- ) ) ;
4893
- }
4887
+ return Some ( NamedPropertyValue :: WindowProxy ( nested_window_proxy) ) ;
4894
4888
}
4895
4889
4896
4890
// Step 3.
4897
- unsafe {
4898
- return Some ( NonNull :: new_unchecked (
4899
- first. reflector ( ) . get_jsobject ( ) . get ( ) ,
4900
- ) ) ;
4901
- }
4891
+ return Some ( NamedPropertyValue :: Element ( DomRoot :: from_ref ( first) ) ) ;
4902
4892
}
4903
4893
4904
4894
// Step 4.
@@ -4933,11 +4923,7 @@ impl DocumentMethods for Document {
4933
4923
self . upcast ( ) ,
4934
4924
Box :: new ( DocumentNamedGetter { name } ) ,
4935
4925
) ;
4936
- unsafe {
4937
- Some ( NonNull :: new_unchecked (
4938
- collection. reflector ( ) . get_jsobject ( ) . get ( ) ,
4939
- ) )
4940
- }
4926
+ Some ( NamedPropertyValue :: HTMLCollection ( collection) )
4941
4927
}
4942
4928
4943
4929
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names
0 commit comments