diff options
author | Connor Brewster <connor.brewster@eagles.oc.edu> | 2017-06-13 12:03:31 -0600 |
---|---|---|
committer | Connor Brewster <connor.brewster@eagles.oc.edu> | 2017-06-15 21:33:28 -0600 |
commit | 1f3fd77d8f8fc5820115db6f817ed9672c7c9259 (patch) | |
tree | 496d83c33017eb0f593990d0c2373f395d5fdc73 /components/script/dom | |
parent | 2333b39569a0cc598289c948aefea64aa9aa4858 (diff) | |
download | servo-1f3fd77d8f8fc5820115db6f817ed9672c7c9259.tar.gz servo-1f3fd77d8f8fc5820115db6f817ed9672c7c9259.zip |
Implement step 5 of HTMLConstructor
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/interface.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index 752917aa673..9900bf00e9a 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -257,22 +257,26 @@ pub unsafe fn html_constructor<T>(window: &Window, call_args: &CallArgs) -> Fall { let _ac = JSAutoCompartment::new(window.get_cx(), callee.get()); + rooted!(in(window.get_cx()) let mut constructor = ptr::null_mut()); + rooted!(in(window.get_cx()) let global_object = CurrentGlobalOrNull(window.get_cx())); if definition.is_autonomous() { // Step 4 // Since this element is autonomous, its active function object must be the HTMLElement // Retrieve the constructor object for HTMLElement - rooted!(in(window.get_cx()) let mut constructor = ptr::null_mut()); - rooted!(in(window.get_cx()) let global_object = CurrentGlobalOrNull(window.get_cx())); HTMLElementBinding::GetConstructorObject(window.get_cx(), global_object.handle(), constructor.handle_mut()); - // Callee must be the same constructor object as HTMLElement - if constructor.get() != callee.get() { - return Err(Error::Type("Active function object is not HTMLElement".to_owned())); - } } else { - // TODO: Step 5 + // Step 5 + get_constructor_object_from_local_name(definition.local_name.clone(), + window.get_cx(), + global_object.handle(), + constructor.handle_mut()); + } + // Callee must be the same as the element interface's constructor object. + if constructor.get() != callee.get() { + return Err(Error::Type("Custom element does not extend the proper interface".to_owned())); } } |