Skip to content

Commit

Permalink
Fixes #4164 Make file.rs Constructor and new functions take GlobalRef…
Browse files Browse the repository at this point in the history
… by value
  • Loading branch information
mattnenterprise authored and Matt McCoy committed Jan 8, 2015
1 parent 85df7f0 commit 5a54843
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions components/script/dom/file.rs
Expand Up @@ -17,20 +17,20 @@ pub struct File {
}

impl File {
fn new_inherited(global: &GlobalRef, type_: BlobTypeId,
fn new_inherited(global: GlobalRef, type_: BlobTypeId,
_file_bits: JSRef<Blob>, name: DOMString) -> File {
File {
//TODO: get type from the underlying filesystem instead of "".to_string()
blob: Blob::new_inherited(*global, type_, None, ""),
blob: Blob::new_inherited(global, type_, None, ""),
name: name,
}
// XXXManishearth Once Blob is able to store data
// the relevant subfields of file_bits should be copied over
}

pub fn new(global: &GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
pub fn new(global: GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
reflect_dom_object(box File::new_inherited(global, BlobTypeId::File, file_bits, name),
*global,
global,
FileBinding::Wrap)
}

Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/formdata.rs
Expand Up @@ -116,6 +116,6 @@ impl PrivateFormDataHelpers for FormData {
let global = self.global.root();
let f: Option<JSRef<File>> = FileCast::to_ref(value);
let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".into_string()));
File::new(&global.r(), value, name)
File::new(global.r(), value, name)
}
}

5 comments on commit 5a54843

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from Ms2ger
at mattnenterprise@5a54843

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging mattnenterprise/servo/globalref-by-value = 5a54843 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mattnenterprise/servo/globalref-by-value = 5a54843 merged ok, testing candidate = 7800d98

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 7800d98

Please sign in to comment.