mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -2,10 +2,11 @@
|
|||
* 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 crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUOutOfMemoryError {
|
||||
|
@ -20,12 +21,16 @@ impl GPUOutOfMemoryError {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(GPUOutOfMemoryError::new_inherited()), global)
|
||||
Self::new_with_proto(global, None)
|
||||
}
|
||||
|
||||
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<Self> {
|
||||
reflect_dom_object2(Box::new(GPUOutOfMemoryError::new_inherited()), global, proto)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuoutofmemoryerror-gpuoutofmemoryerror
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(global: &GlobalScope) -> DomRoot<Self> {
|
||||
GPUOutOfMemoryError::new(global)
|
||||
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<Self> {
|
||||
GPUOutOfMemoryError::new_with_proto(global, proto)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue