mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
Factor out a helper for eagerly creating JS wrappers
This commit is contained in:
parent
797143a1d3
commit
30a9fb2f45
4 changed files with 21 additions and 27 deletions
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::bindings::utils::Fallible;
|
||||
use dom::bindings::codegen::BlobBinding;
|
||||
use dom::window::Window;
|
||||
|
@ -23,14 +23,7 @@ impl Blob {
|
|||
}
|
||||
|
||||
pub fn new(window: @mut Window) -> @mut Blob {
|
||||
let blob = @mut Blob::new_inherited(window);
|
||||
let cx = window.get_cx();
|
||||
let scope = window.reflector().get_jsobject();
|
||||
if BlobBinding::Wrap(cx, scope, blob).is_null() {
|
||||
fail!("BlobBinding::Wrap failed");
|
||||
}
|
||||
assert!(blob.reflector().get_jsobject().is_not_null());
|
||||
blob
|
||||
reflect_dom_object(@mut Blob::new_inherited(window), window, BlobBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue