servo: Merge #11875 - Integration and improvements of File API backends (from izgzhen:file-manager-backend); r=Manishearth

Basically three major changes:

1. More complete origin check in `FileManagerThreadMsg`
2. Add reference counting logic to file manage store and script API
3. Integrate the support of slicing

r? @Manishearth

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

Source-Repo: https://github.com/servo/servo
Source-Revision: 36974f0746261b971c93ed7dfb9bd726675ccf69
This commit is contained in:
Zhen Zhang
2016-07-04 09:15:23 -07:00
parent 7f239073a7
commit 10f6a54829
14 changed files with 543 additions and 244 deletions

View File

@@ -1152,6 +1152,7 @@ impl Activatable for HTMLInputElement {
InputType::InputFile => {
// https://html.spec.whatwg.org/multipage/#file-upload-state-(type=file)
let window = window_from_node(self);
let origin = window.get_url().origin().unicode_serialization();
let filemanager = window.resource_threads().sender();
let mut files: Vec<Root<File>> = vec![];
@@ -1162,7 +1163,7 @@ impl Activatable for HTMLInputElement {
if self.Multiple() {
let (chan, recv) = ipc::channel().expect("Error initializing channel");
let msg = FileManagerThreadMsg::SelectFiles(filter, chan);
let msg = FileManagerThreadMsg::SelectFiles(filter, chan, origin);
let _ = filemanager.send(msg).unwrap();
match recv.recv().expect("IpcSender side error") {
@@ -1182,7 +1183,7 @@ impl Activatable for HTMLInputElement {
};
} else {
let (chan, recv) = ipc::channel().expect("Error initializing channel");
let msg = FileManagerThreadMsg::SelectFile(filter, chan);
let msg = FileManagerThreadMsg::SelectFile(filter, chan, origin);
let _ = filemanager.send(msg).unwrap();
match recv.recv().expect("IpcSender side error") {