diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-09-19 04:07:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-19 04:07:14 -0500 |
commit | fe426f65b912dc091d0349c167086e19c72bbd25 (patch) | |
tree | f877115425d254e1ad6cb314ca9e38ce8cbb0f45 /components/script/dom | |
parent | d76091ef0f9b1e4fc1a55db6ecf04f9c50606cb3 (diff) | |
parent | 9adda6e38da0988c8898a690fed46066608ab08d (diff) | |
download | servo-fe426f65b912dc091d0349c167086e19c72bbd25.tar.gz servo-fe426f65b912dc091d0349c167086e19c72bbd25.zip |
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 -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/dedicatedworkerglobalscope.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index 2314d94f15b..589489debce 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -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)); |