servo: Merge #17920 - geckolib: Add friendly panic message to Servo_HasAuthorSpecifiedRules (from heycam:hasr-assertion); r=emilio
authorCameron McCormack <cam@mcc.id.au>
Sun, 30 Jul 2017 06:53:19 -0500
changeset 420633 01d50dd5d2921d3a88416dc4375d94190fc520de
parent 420632 f1c1543f046e53aefdb7562a57182169bf345ae8
child 420634 7cf63ef9ba7bc873fe69705ce98a7d332ba96f15
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17920 - geckolib: Add friendly panic message to Servo_HasAuthorSpecifiedRules (from heycam:hasr-assertion); r=emilio This just adds a friendlier panic message when `Servo_HasAuthorSpecifiedRules` is called with an unstyled element. Source-Repo: https://github.com/servo/servo Source-Revision: 0c9abac373e82b25f2162ddcc3e077c96682a3d7
servo/ports/geckolib/glue.rs
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -1605,17 +1605,20 @@ pub extern "C" fn Servo_SetExplicitStyle
 #[no_mangle]
 pub extern "C" fn Servo_HasAuthorSpecifiedRules(element: RawGeckoElementBorrowed,
                                                 rule_type_mask: u32,
                                                 author_colors_allowed: bool)
     -> bool
 {
     let element = GeckoElement(element);
 
-    let data = element.borrow_data().unwrap();
+    let data =
+        element.borrow_data()
+        .expect("calling Servo_HasAuthorSpecifiedRules on an unstyled element");
+
     let primary_style = data.styles.primary();
 
     let guard = (*GLOBAL_STYLE_DATA).shared_lock.read();
     let guards = StylesheetGuards::same(&guard);
 
     primary_style.rules().has_author_specified_rules(element,
                                                      &guards,
                                                      rule_type_mask,