mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #13306 - Jenselme:13247-decode-utf8-with-utf8-lossy, r=Ms2ger
Decode UTF-8 with from_utf8_lossy in DedicatedWorkerGlobalScope <!-- 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 - [X] These changes fix #13247 <!-- Either: --> - [X] There are tests for these changes: `./mach test-wpt /workers/semantics/encodings/004.worker` passes <!-- 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/13306) <!-- Reviewable:end -->
This commit is contained in:
commit
fe426f65b9
2 changed files with 7 additions and 11 deletions
|
@ -173,20 +173,20 @@ impl DedicatedWorkerGlobalScope {
|
|||
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots_tls = StackRootTLS::new(&roots);
|
||||
let (url, source) = match load_whole_resource(LoadContext::Script,
|
||||
&init.resource_threads.sender(),
|
||||
worker_url,
|
||||
&worker_load_origin) {
|
||||
let (metadata, bytes) = match load_whole_resource(LoadContext::Script,
|
||||
&init.resource_threads.sender(),
|
||||
worker_url,
|
||||
&worker_load_origin) {
|
||||
Err(_) => {
|
||||
println!("error loading script {}", serialized_worker_url);
|
||||
parent_sender.send(CommonScriptMsg::RunnableMsg(WorkerEvent,
|
||||
box SimpleWorkerErrorHandler::new(worker))).unwrap();
|
||||
return;
|
||||
}
|
||||
Ok((metadata, bytes)) => {
|
||||
(metadata.final_url, String::from_utf8(bytes).unwrap())
|
||||
}
|
||||
Ok((metadata, bytes)) => (metadata, bytes)
|
||||
};
|
||||
let url = metadata.final_url;
|
||||
let source = String::from_utf8_lossy(&bytes);
|
||||
|
||||
let runtime = unsafe { new_rt_and_cx() };
|
||||
*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