mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Put Blob URL online
This commit is contained in:
parent
4b78b9adab
commit
fdc3a8e3ac
17 changed files with 260 additions and 191 deletions
|
@ -52,12 +52,12 @@ fn test_filemanager() {
|
|||
// Test by reading, expecting same content
|
||||
{
|
||||
let (tx2, rx2) = ipc::channel().unwrap();
|
||||
chan.send(FileManagerThreadMsg::ReadFile(tx2, selected.id.clone(), origin.clone())).unwrap();
|
||||
chan.send(FileManagerThreadMsg::ReadFile(tx2, selected.id.clone(), false, origin.clone())).unwrap();
|
||||
|
||||
let msg = rx2.recv().expect("Broken channel");
|
||||
|
||||
let vec = msg.expect("File manager reading failure is unexpected");
|
||||
assert_eq!(test_file_content, vec, "Read content differs");
|
||||
let blob_buf = msg.expect("File manager reading failure is unexpected");
|
||||
assert_eq!(test_file_content, blob_buf.bytes, "Read content differs");
|
||||
}
|
||||
|
||||
// Delete the id
|
||||
|
@ -72,7 +72,7 @@ fn test_filemanager() {
|
|||
// Test by reading again, expecting read error because we invalidated the id
|
||||
{
|
||||
let (tx2, rx2) = ipc::channel().unwrap();
|
||||
chan.send(FileManagerThreadMsg::ReadFile(tx2, selected.id.clone(), origin.clone())).unwrap();
|
||||
chan.send(FileManagerThreadMsg::ReadFile(tx2, selected.id.clone(), false, origin.clone())).unwrap();
|
||||
|
||||
let msg = rx2.recv().expect("Broken channel");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use ipc_channel::ipc;
|
||||
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
|
||||
use net::filemanager_thread::{FileManagerThreadFactory, TFDProvider};
|
||||
use net::resource_thread::new_core_resource_thread;
|
||||
use net_traits::hosts::{parse_hostsfile, host_replacement};
|
||||
use net_traits::{CoreResourceMsg, LoadData, LoadConsumer, LoadContext};
|
||||
|
@ -15,6 +16,8 @@ use std::net::IpAddr;
|
|||
use std::sync::mpsc::channel;
|
||||
use url::Url;
|
||||
|
||||
const TFD_PROVIDER: &'static TFDProvider = &TFDProvider;
|
||||
|
||||
fn ip(s: &str) -> IpAddr {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
|
@ -40,7 +43,8 @@ impl LoadOrigin for ResourceTest {
|
|||
fn test_exit() {
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (resource_thread, _) = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx));
|
||||
let filemanager_chan = FileManagerThreadFactory::new(TFD_PROVIDER);
|
||||
let (resource_thread, _) = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx), filemanager_chan);
|
||||
resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap();
|
||||
receiver.recv().unwrap();
|
||||
}
|
||||
|
@ -49,7 +53,8 @@ fn test_exit() {
|
|||
fn test_bad_scheme() {
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (resource_thread, _) = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx));
|
||||
let filemanager_chan = FileManagerThreadFactory::new(TFD_PROVIDER);
|
||||
let (resource_thread, _) = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx), filemanager_chan);
|
||||
let (start_chan, start) = ipc::channel().unwrap();
|
||||
let url = Url::parse("bogus://whatever").unwrap();
|
||||
resource_thread.send(CoreResourceMsg::Load(LoadData::new(LoadContext::Browsing, url, &ResourceTest),
|
||||
|
@ -228,7 +233,8 @@ fn test_cancelled_listener() {
|
|||
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (exit_sender, exit_receiver) = ipc::channel().unwrap();
|
||||
let (resource_thread, _) = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx));
|
||||
let filemanager_chan = FileManagerThreadFactory::new(TFD_PROVIDER);
|
||||
let (resource_thread, _) = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx), filemanager_chan);
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (id_sender, id_receiver) = ipc::channel().unwrap();
|
||||
let (sync_sender, sync_receiver) = ipc::channel().unwrap();
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[url_xmlhttprequest_img.html]
|
||||
type: reftest
|
||||
reftype: ==
|
||||
refurl: /FileAPI/url/url_xmlhttprequest_img-ref.html
|
||||
expected: FAIL
|
|
@ -1,6 +0,0 @@
|
|||
[Blob-url.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[Worker supports Blob url]
|
||||
expected: TIMEOUT
|
||||
|
|
@ -5782,6 +5782,18 @@
|
|||
"url": "/_mozilla/css/word_break_a.html"
|
||||
}
|
||||
],
|
||||
"mozilla/blob_url_upload.html": [
|
||||
{
|
||||
"path": "mozilla/blob_url_upload.html",
|
||||
"references": [
|
||||
[
|
||||
"/_mozilla/mozilla/blob_url_upload_ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
"url": "/_mozilla/mozilla/blob_url_upload.html"
|
||||
}
|
||||
],
|
||||
"mozilla/canvas/drawimage_html_image_1.html": [
|
||||
{
|
||||
"path": "mozilla/canvas/drawimage_html_image_1.html",
|
||||
|
@ -14852,6 +14864,18 @@
|
|||
"url": "/_mozilla/css/word_break_a.html"
|
||||
}
|
||||
],
|
||||
"mozilla/blob_url_upload.html": [
|
||||
{
|
||||
"path": "mozilla/blob_url_upload.html",
|
||||
"references": [
|
||||
[
|
||||
"/_mozilla/mozilla/blob_url_upload_ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
"url": "/_mozilla/mozilla/blob_url_upload.html"
|
||||
}
|
||||
],
|
||||
"mozilla/canvas/drawimage_html_image_1.html": [
|
||||
{
|
||||
"path": "mozilla/canvas/drawimage_html_image_1.html",
|
||||
|
|
3
tests/wpt/mozilla/meta/mozilla/blob_url_upload.html.ini
Normal file
3
tests/wpt/mozilla/meta/mozilla/blob_url_upload.html.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[blob_url_upload.html]
|
||||
type: reftest
|
||||
prefs: [dom.testing.htmlinputelement.select_files.enabled:true]
|
22
tests/wpt/mozilla/tests/mozilla/blob_url_upload.html
Normal file
22
tests/wpt/mozilla/tests/mozilla/blob_url_upload.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Blob URL with File Upload</title>
|
||||
<link rel="match" href="blob_url_upload_ref.html">
|
||||
<body>
|
||||
<img src="" id="image">
|
||||
<input type="file" id="file-input"">
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
var image = document.getElementById("image");
|
||||
|
||||
var inputElem = document.getElementById("file-input");
|
||||
|
||||
inputElem.selectFiles(["./tests/wpt/mozilla/tests/mozilla/test.jpg"]);
|
||||
|
||||
var f = inputElem.files[0];
|
||||
|
||||
var url = URL.createObjectURL(f);
|
||||
|
||||
image.src = url;
|
||||
|
||||
</script>
|
7
tests/wpt/mozilla/tests/mozilla/blob_url_upload_ref.html
Normal file
7
tests/wpt/mozilla/tests/mozilla/blob_url_upload_ref.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Reference: Blob URL with File Upload</title>
|
||||
<body>
|
||||
<img src="test.jpg" id="image">
|
||||
<input type="file" id="file-input"">
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue