mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Decode UTF-8 with from_utf8_lossy in DedicatedWorkerGlobalScope
This commit is contained in:
parent
83f687a7be
commit
9adda6e38d
2 changed files with 7 additions and 11 deletions
|
@ -173,20 +173,20 @@ impl DedicatedWorkerGlobalScope {
|
||||||
|
|
||||||
let roots = RootCollection::new();
|
let roots = RootCollection::new();
|
||||||
let _stack_roots_tls = StackRootTLS::new(&roots);
|
let _stack_roots_tls = StackRootTLS::new(&roots);
|
||||||
let (url, source) = match load_whole_resource(LoadContext::Script,
|
let (metadata, bytes) = match load_whole_resource(LoadContext::Script,
|
||||||
&init.resource_threads.sender(),
|
&init.resource_threads.sender(),
|
||||||
worker_url,
|
worker_url,
|
||||||
&worker_load_origin) {
|
&worker_load_origin) {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
println!("error loading script {}", serialized_worker_url);
|
println!("error loading script {}", serialized_worker_url);
|
||||||
parent_sender.send(CommonScriptMsg::RunnableMsg(WorkerEvent,
|
parent_sender.send(CommonScriptMsg::RunnableMsg(WorkerEvent,
|
||||||
box SimpleWorkerErrorHandler::new(worker))).unwrap();
|
box SimpleWorkerErrorHandler::new(worker))).unwrap();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ok((metadata, bytes)) => {
|
Ok((metadata, bytes)) => (metadata, bytes)
|
||||||
(metadata.final_url, String::from_utf8(bytes).unwrap())
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
let url = metadata.final_url;
|
||||||
|
let source = String::from_utf8_lossy(&bytes);
|
||||||
|
|
||||||
let runtime = unsafe { new_rt_and_cx() };
|
let runtime = unsafe { new_rt_and_cx() };
|
||||||
*worker_rt_for_mainthread.lock().unwrap() = Some(SharedRt::new(&runtime));
|
*worker_rt_for_mainthread.lock().unwrap() = Some(SharedRt::new(&runtime));
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[004.worker]
|
|
||||||
type: testharness
|
|
||||||
bug: https://github.com/servo/servo/issues/13247
|
|
||||||
expected: CRASH
|
|
Loading…
Add table
Add a link
Reference in a new issue