Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patches of File API #12544

Merged
merged 1 commit into from Jul 22, 2016
Merged

Patches of File API #12544

merged 1 commit into from Jul 22, 2016

Conversation

izgzhen
Copy link
Contributor

@izgzhen izgzhen commented Jul 21, 2016

r? @Manishearth


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes OR

This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/file.rs, components/script/dom/blob.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 21, 2016
@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 21, 2016

Two simple fixes addressing:

  1. The / in file name passed to File constructor.
  2. Dummy FileID returned when the operation is invalid (e.g. https://w3c.github.io/FileAPI/#createRevokeMethodsParams)

The first fix is no problem; For the second one, I used an empty string before because first I am lazy and second it is easier to debug if something goes wrong. But that doesn't quite fit in with spec, though either an empty string or a random ID would have the same actual effect.

@@ -73,7 +73,8 @@ impl File {
let ref typeString = blobPropertyBag.type_;

let modified = filePropertyBag.lastModified;
Ok(File::new(global, BlobImpl::new_from_bytes(bytes), filename, modified, typeString))
let replaced_filename = DOMString::from_string(filename.replace("/", ":"));
Copy link
Member

Choose a reason for hiding this comment

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

Link to the spec bug here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by "spec bug"? Regarding link, this tiny replace operation is specified in the url above this function pub fn Constructor (which I unfortunately neglected at first)

Copy link
Member

Choose a reason for hiding this comment

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

Oh sorry, I was talking about w3c/FileAPI#41 (the bug that wishes to remove this behavior)

@Manishearth
Copy link
Member

r=me with the link

@@ -73,7 +73,10 @@ impl File {
let ref typeString = blobPropertyBag.type_;

let modified = filePropertyBag.lastModified;
Ok(File::new(global, BlobImpl::new_from_bytes(bytes), filename, modified, typeString))
// NOTE: Following behaviour might be removed in future,
// see https://github.com/w3c/FileAPI/issues/41
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Manishearth added

@Manishearth
Copy link
Member

@bors-servo r+ thanks!

@bors-servo
Copy link
Contributor

📌 Commit f598b5f has been approved by Manishearth

@bors-servo
Copy link
Contributor

⌛ Testing commit f598b5f with merge 9c0e7b1...

bors-servo pushed a commit that referenced this pull request Jul 22, 2016
Patches of File API

r? @Manishearth

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12544)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 22, 2016
@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jul 22, 2016
@bors-servo
Copy link
Contributor

⚡ Previous build results for android, arm32, arm64, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows-dev are reusable. Rebuilding only linux-rel...

@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows-dev

@bors-servo bors-servo merged commit f598b5f into servo:master Jul 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-tests-failed The changes caused existing tests to fail.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants