Closed Bug 1323655 Opened 3 years ago Closed 3 years ago

stylo: several tests panic with "called `Option::unwrap()` on a `None` value"

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: heycam, Assigned: bholley)

References

Details

Attachments

(1 file)

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:323
stack backtrace:
   1:     0x7fffea9ba11f - std::sys::backtrace::tracing::imp::write::hd6ece0fd16ebfe06
   2:     0x7fffea9c967d - std::panicking::default_hook::{{closure}}::h523f1cb7f97bbc83
   3:     0x7fffea9c6bda - std::panicking::default_hook::hc3c81c24cdcc8c31
   4:     0x7fffea9c71d8 - std::panicking::rust_panic_with_hook::hf4b937f570e0ba05
   5:     0x7fffea9c7032 - std::panicking::begin_panic::h4a0c5d0b7e602ca9
   6:     0x7fffea9c6fb0 - std::panicking::begin_panic_fmt::h76753862db1b73c1
   7:     0x7fffea9c6f31 - rust_begin_unwind
   8:     0x7fffea9d92af - core::panicking::panic_fmt::h01b74bf8a81c45ca
   9:     0x7fffea9d91db - core::panicking::panic::h8d653d6ee4e39eea
  10:     0x7fffea0c0e21 - <core::option::Option<T>>::unwrap::h454ae9379a3325d5
                        at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libcore/macros.rs:21
  11:     0x7fffea6b7b29 - style::matching::MatchMethods::cascade_node::{{closure}}::h7692bbb6cfd6ee0b
                        at /z/stylo/hg-incubator/servo/components/style/matching.rs:738
  12:     0x7fffea0bbe51 - <core::option::Option<T>>::map::hf8d02e17ea359e3b
                        at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libcore/option.rs:383
  13:     0x7fffea3e21de - style::matching::MatchMethods::cascade_node::hae7d8ab6b984ea1f
                        at /z/stylo/hg-incubator/servo/components/style/matching.rs:738
  14:     0x7fffea3f70fb - style::traversal::compute_style::h154d4a07c099dda0
                        at /z/stylo/hg-incubator/servo/components/style/traversal.rs:477
  15:     0x7fffea3f6820 - style::traversal::recalc_style_at::hac1f02916e311070
                        at /z/stylo/hg-incubator/servo/components/style/traversal.rs:393
  16:     0x7fffea3b35b6 - <style::gecko::traversal::RecalcStyleOnly<'lc> as style::traversal::DomTraversalContext<style::gecko::wrapper::GeckoNode<'ln>>>::process_preorder::h37f76aea0973e89b
                        at /z/stylo/hg-incubator/servo/components/style/gecko/traversal.rs:34
  17:     0x7fffe9df0b44 - style::parallel::traverse_nodes::h5d49a88ab6d4a8f9
                        at /z/stylo/hg-incubator/servo/components/style/parallel.rs:89
                        at /z/stylo/hg-incubator/servo/components/style/parallel.rs:137
  18:     0x7fffe9eb1ef0 - style::parallel::traverse_dom::{{closure}}::{{closure}}::hca22b69b1c1f4e5f
                        at /z/stylo/hg-incubator/servo/components/style/parallel.rs:54
  19:     0x7fffe9eb1e27 - rayon::scope::Scope::execute_job_closure::{{closure}}::he64c67318a81e3ea
                        at /z/stylo/hg-incubator/third_party/rust/rayon/src/scope/mod.rs:316
  20:     0x7fffe9e87f39 - <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once::hfed8ec2dcf5d02fd
                        at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libstd/panic.rs:255
  21:     0x7fffe9d4f179 - std::panicking::try::do_call::h988e295b5a726e88
                        at /buildslave/rust-buildbot/slave/beta-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:356
dom/html/crashtests/580507-1.xhtml (the comment 0 backtrace)
editor/libeditor/crashtests/580151-1.xhtml
Summary: stylo: dom/html/crashtests/580507-1.xhtml panics with "called `Option::unwrap()` on a `None` value" → stylo: several tests panic with "called `Option::unwrap()` on a `None` value"
I see a crash on test_value_storage.html with the same description line, but I couldn't get the stack somehow.
Assignee: nobody → bobbyholley
Comment on attachment 8823904 [details] [diff] [review]
Handle unstyled elements when applying XBL bindings. v1

Review of attachment 8823904 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/xbl/nsXBLService.cpp
@@ +424,5 @@
> +      // XML pretty printer) _can_ apply bindings without having styled the bound
> +      // element. We could assert against this and require the callers manually
> +      // resolve the style first, but it's easy enough to just handle here.
> +      if (MOZ_UNLIKELY(!mElement->HasServoData())) {
> +        servoSet->StyleNewSubtree(mElement);

For these programmatic consumers, I guess we never have mElement's parent unstyled as well?
Attachment #8823904 - Flags: review?(cam) → review+
(In reply to Cameron McCormack (:heycam) from comment #5)
> Comment on attachment 8823904 [details] [diff] [review]
> Handle unstyled elements when applying XBL bindings. v1
> 
> Review of attachment 8823904 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/xbl/nsXBLService.cpp
> @@ +424,5 @@
> > +      // XML pretty printer) _can_ apply bindings without having styled the bound
> > +      // element. We could assert against this and require the callers manually
> > +      // resolve the style first, but it's easy enough to just handle here.
> > +      if (MOZ_UNLIKELY(!mElement->HasServoData())) {
> > +        servoSet->StyleNewSubtree(mElement);
> 
> For these programmatic consumers, I guess we never have mElement's parent
> unstyled as well?

XML pretty printer is the only in-tree consumer, and it operates on the root element. So I think we're ok, and we'll fail safely at runtime if somebody ever messes it up.
Pushed by bholley@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9c2d956e2018
Handle unstyled elements when applying XBL bindings. r=heycam
https://hg.mozilla.org/mozilla-central/rev/9c2d956e2018
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.