servo: Merge #17189 - Add pref to force WebGL context creation failure (from bd339:iss17038); r=emilio

<!-- Please describe your changes on the following line: -->
Introduces the pref `webgl.testing.context_creation_error`, to force creation of a new WebGLRenderingContext to fail.

---
<!-- 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 #17038 (github issue number if applicable).

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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: 3db7f5d556d85ff6af9bb81f693a2c65e6e791fa

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 19078df81cf2bd36ab232a25d7c68976ffc7c673
This commit is contained in:
Benjamin Dahse 2017-06-07 02:27:29 -07:00
Родитель aaabd56ab2
Коммит 1cc7429f72
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -51,6 +51,7 @@ use net_traits::image::base::PixelFormat;
use net_traits::image_cache::ImageResponse;
use offscreen_gl_context::{GLContextAttributes, GLLimits};
use script_traits::ScriptMsg as ConstellationMsg;
use servo_config::prefs::PREFS;
use std::cell::Cell;
use std::collections::HashMap;
use webrender_traits;
@ -166,6 +167,10 @@ impl WebGLRenderingContext {
size: Size2D<i32>,
attrs: GLContextAttributes)
-> Result<WebGLRenderingContext, String> {
if let Some(true) = PREFS.get("webgl.testing.context_creation_error").as_boolean() {
return Err("WebGL context creation error forced by pref `webgl.testing.context_creation_error`".into());
}
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = window.upcast::<GlobalScope>().constellation_chan();
constellation_chan.send(ConstellationMsg::CreateWebGLPaintThread(size, attrs, sender))

Просмотреть файл

@ -66,5 +66,6 @@
"shell.homepage": "https://servo.org",
"shell.keep_screen_on.enabled": false,
"shell.native-orientation": "both",
"shell.native-titlebar.enabled": true
"shell.native-titlebar.enabled": true,
"webgl.testing.context_creation_error": false
}