Factor out a helper for eagerly creating JS wrappers

This commit is contained in:
Keegan McAllister 2013-10-21 13:31:48 -07:00
parent 797143a1d3
commit 30a9fb2f45
4 changed files with 21 additions and 27 deletions

View file

@ -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)
}
}