-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement file related functionalities in htmlinputelement and related #11225
Conversation
Heads up! This PR modifies the following files:
|
@Manishearth yet another piece of code :P |
(Ok(epoch), Some(filename)) => Some((id, Path::new(filename).to_path_buf(), epoch)), | ||
(Ok(epoch), Some(filename)) => { | ||
let filename_path = Path::new(filename); | ||
let mime = guess_mime_type_opt(filename_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be guessing the MIME here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://w3c.github.io/FileAPI/#dfn-type it said that:
User agents can also determine the type of a Blob, especially if the byte sequence is from an on-disk file
And also, I can't image other source of type instead of determining it at the time of reading.
☔ The latest upstream changes (presumably #11270) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #11293) made this pull request unmergeable. Please resolve the merge conflicts. |
pub filename: PathBuf, | ||
pub modified: u64, | ||
// https://w3c.github.io/FileAPI/#dfn-type | ||
pub type_string: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for an option, type is ""
if there is no type (according to the spec)
@bors-servo delegate+ r=me after you remove that comment on the cast (feel free to replace it with a non-xxx comment explaining that the cast is okay) |
✌️ @izgzhen can now approve this pull request |
Changes include: - Implement file selection and other DOM behaviours in htmlinputelement - Integrate IpcSender<FileManagerThreadMsg> into ResourceThreads - Improve filemanager_thread, including adding type_string field to SelectedFile - Improve interfaces in FileList/File/Blob to accommodate the above changes
@bors-servo r=Manishearth |
📌 Commit dd590d0 has been approved by |
Implement file related functionalities in htmlinputelement and related - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy --faster` does not report any errors - [x] These changes is related to #11131 - [x] These changes do not require tests because it is a partial implementation 1. Improve the `filemanager_thread` by adding type string and create `SelectedFile` 2. Fill several gaps in `htmlinputelement` implementation related to file type 3. Improve the `File` interface to accommodate the above changes 4. Integrate changes introduced by PR #11189 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11225) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows |
./mach build -d
does not report any errors./mach test-tidy --faster
does not report any errorsMajor changes
filemanager_thread
by adding type string and createSelectedFile
htmlinputelement
implementation related to file typeFile
interface to accommodate the above changesThis change is