servo: Merge #6637 - Don't crash when Firefox doesn't send autoMargins (from notriddle:master); r=jdm

Firefox Developer Tools doesn't always send autoMargins, as seen in this message:

    {"type":"getLayout","node":"node14","to":"pageStyle9"}

So don't use unwrap.

Source-Repo: https://github.com/servo/servo
Source-Revision: 10f3a89313464c98f11ff64fed741abcba6352a6
This commit is contained in:
Michael Howell 2015-07-15 15:36:25 -06:00
Родитель f2de86fd3c
Коммит 42d8e855bf
1 изменённых файлов: 2 добавлений и 1 удалений

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

@ -459,7 +459,8 @@ impl Actor for PageStyleActor {
.unwrap(); .unwrap();
let (width, height) = rx.recv().unwrap(); let (width, height) = rx.recv().unwrap();
let auto_margins = msg.get(&"autoMargins".to_string()).unwrap().as_boolean().unwrap(); let auto_margins = msg.get(&"autoMargins".to_string())
.and_then(&Json::as_boolean).unwrap_or(false);
//TODO: the remaining layout properties (margin, border, padding, position) //TODO: the remaining layout properties (margin, border, padding, position)
// as specified in getLayout in // as specified in getLayout in