Skip to content

Commit

Permalink
Initial pass at appending style
Browse files Browse the repository at this point in the history
  • Loading branch information
craftytrickster committed Jan 22, 2016
1 parent 9118b64 commit 2ac7708
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions components/script/dom/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! Element nodes.
use app_units::Au;
use core::ops::Deref;
use cssparser::Color;
use devtools_traits::AttrInfo;
use dom::activation::Activatable;
Expand Down Expand Up @@ -670,6 +671,30 @@ impl Element {
pub fn update_inline_style(&self,
property_decl: PropertyDeclaration,
style_priority: StylePriority) {

let style_to_append = format!("{}: {}; ", property_decl.name(), property_decl.value());
if let Some(style_attr) = self.attrs.borrow().iter().find(|a| a.name() == &atom!("style")) {
let mut style_string = DOMString::from(style_attr.deref().value().deref().deref());
style_string.push_str(&style_to_append);

let new_value = AttrValue::String(style_string);
style_attr.set_value(new_value, self);
}
else {
let style_string = DOMString::from_string(style_to_append);
let window = window_from_node(self);

let attr = Attr::new(&window,

This comment has been minimized.

Copy link
@craftytrickster

craftytrickster Jan 22, 2016

Author Owner

I also tried to call push_new_attribute directly, but it still called a panic.

atom!("style"),
AttrValue::String(style_string),
atom!("style"),
ns!(),
Some(atom!("style")),
Some(self));

self.attrs.borrow_mut().push(JS::from_rooted(&attr));
}

let mut inline_declarations = self.style_attribute().borrow_mut();
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
let existing_declarations = if style_priority == StylePriority::Important {
Expand Down

3 comments on commit 2ac7708

@craftytrickster
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thread 'ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(0) }' panicked at 'DOMRefCell already borrowed', ../src/libcore/option.rs:298
stack backtrace:
1: 0x7fce16ff5ad0 - sys::backtrace::tracing::imp::write::hd273f86d5325347aweu
2: 0x7fce16ff89f5 - panicking::default_handler::::closure.42335
3: 0x7fce16ff849f - panicking::default_handler::h907ce0af740f5f06spy
4: 0x7fce16fe14e6 - sys_common::unwind::begin_unwind_inner::ha417239bcab1f2ff56s
5: 0x7fce16fe1c48 - sys_common::unwind::begin_unwind_fmt::hac4637ed0b5bb49eb6s
6: 0x7fce16ff5131 - rust_begin_unwind
7: 0x7fce1702c0df - panicking::panic_fmt::he5f9c513e9167673LnK
8: 0x7fce15866fbb - option::Option::expect::h4248389772591209977
at ../src/libcore/macros.rs:29
9: 0x7fce15866dd5 - dom::bindings::cell::DOMRefCell::borrow_mut::h4539319508708057868
at /home/divad/Rust/servo/components/script/dom/bindings/cell.rs:150
10: 0x7fce1575ec4a - dom::element::Element::update_inline_style::hc1220ba376b10bc84qH
at /home/divad/Rust/servo/components/script/dom/element.rs:695
11: 0x7fce152e81e4 - dom::cssstyledeclaration::CSSStyleDeclaration.CSSStyleDeclarationMethods::SetProperty::hff6b602ba6dba965eWz
at /home/divad/Rust/servo/components/script/dom/cssstyledeclaration.rs:257
12: 0x7fce152e8c1f - dom::cssstyledeclaration::CSSStyleDeclaration.CSSStyleDeclarationMethods::SetPropertyValue::h0942244815b52181q0z
at /home/divad/Rust/servo/components/script/dom/cssstyledeclaration.rs:303
13: 0x7fce152eb55f - dom::cssstyledeclaration::CSSStyleDeclaration.CSSStyleDeclarationMethods::SetBackgroundColor::hbdf1ef945c886739GYA
at /home/divad/Rust/servo/components/script/dom/cssstyledeclaration.rs:46
14: 0x7fce152eb261 - dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::set_backgroundColor::__rust_abi
at /home/divad/Rust/servo/target/debug/build/script-e566a6469c040583/out/Bindings/CSSStyleDeclarationBinding.rs:609
15: 0x7fce152eb0e0 - dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::set_backgroundColor::h6427aa8d1db0f64c4ej
16: 0x7fce165f7187 - CallJitSetterOp
17: 0x7fce152d46e1 - dom::bindings::utils::call_setter::__rust_abi
at /home/divad/Rust/servo/components/script/dom/bindings/utils.rs:539
18: 0x7fce152d4634 - dom::bindings::utils::call_setter::h0ffa15d6851f39353eg
19: 0x7fce152d3611 - dom::bindings::utils::generic_call::hd1da9a8e4bd015b6nag
at /home/divad/Rust/servo/components/script/dom/bindings/utils.rs:505
20: 0x7fce152d47c7 - dom::bindings::utils::generic_setter::__rust_abi
at /home/divad/Rust/servo/components/script/dom/bindings/utils.rs:551
21: 0x7fce152d4782 - dom::bindings::utils::generic_setter::he0f6cc60c36102ccPfg
22: 0x7fce16712e4c - ZN2js6InvokeEP9JSContextN2JS8CallArgsENS_14MaybeConstructE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/jscntxtinlines.h:235
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:502
23: 0x7fce1671433e - ZN2js6InvokeEP9JSContextRKN2JS5ValueES5_jPS4_NS2_13MutableHandleIS3_EE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:558
24: 0x7fce16717a59 - ZN2js20InvokeGetterOrSetterEP9JSContextP8JSObjectN2JS5ValueEjPS5_NS4_13MutableHandleIS5_EE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:628
25: 0x7fce1675e1cc - ZN2js17NativeSetPropertyEP9JSContextN2JS6HandleIPNS_12NativeObjectEEENS3_IP8JSObjectEENS3_I4jsidEENS_13QualifiedBoolENS2_13MutableHandleINS2_5ValueEEERNS2_14ObjectOpResultE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Shape-inl.h:51
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/NativeObject.cpp:2194
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/NativeObject.cpp:2230
26: 0x7fce16a9ba9f - ZN2js30SetPropertyIgnoringNamedGetterEP9JSContextN2JS6HandleIP8JSObjectEENS3_I4jsidEENS2_13MutableHandleINS2_5ValueEEES6_NS9_I20JSPropertyDescriptorEERNS2_14ObjectOpResultE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/NativeObject.h:1451
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/proxy/BaseProxyHandler.cpp:108
27: 0x7fce16a9bb8a - ZNK2js16BaseProxyHandler3setEP9JSContextN2JS6HandleIP8JSObjectEES7_NS4_I4jsidEENS3_13MutableHandleINS3_5ValueEEERNS3_14ObjectOpResultE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/proxy/BaseProxyHandler.cpp:91
28: 0x7fce165f8e82 - ZNK22ForwardingProxyHandler3setEP9JSContextN2JS6HandleIP8JSObjectEES6_NS3_I4jsidEENS2_13MutableHandleINS2_5ValueEEERNS2_14ObjectOpResultE
29: 0x7fce16ab51a0 - ZN2js5Proxy3setEP9JSContextN2JS6HandleIP8JSObjectEES7_NS4_I4jsidEENS3_13MutableHandleINS3_5ValueEEERNS3_14ObjectOpResultE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/proxy/Proxy.cpp:326
30: 0x7fce166d8442 - ZL17SetObjectPropertyP9JSContext4JSOpN2JS6HandleINS2_5ValueEEENS3_I4jsidEENS2_13MutableHandleIS4_EE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:330
31: 0x7fce167074f2 - ZL9InterpretP9JSContextRN2js8RunStateE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:361
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:2492
32: 0x7fce16712b2c - ZN2js9RunScriptEP9JSContextRNS_8RunStateE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:452
33: 0x7fce16718bff - ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_11ExecuteTypeENS_16AbstractFramePtrEPS9
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:660
34: 0x7fce1671a90c - ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/Interpreter.cpp:703
35: 0x7fce169dc2d7 - ZL8EvaluateP9JSContextN2JS6HandleIP8JSObjectEERKNS1_22ReadOnlyCompileOptionsERNS1_18SourceBufferHolderENS1_13MutableHandleINS1_5ValueEEE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/jsapi.cpp:4184
36: 0x7fce169dc5bf - ZN2JS8EvaluateEP9JSContextRKNS_22ReadOnlyCompileOptionsEPKDsmNS_13MutableHandleINS_5ValueEEE
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/jsapi.cpp:4218
at /home/divad/Rust/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/jsapi.cpp:4272
37: 0x7fce152b992b - dom::window::
&'a T.ScriptHelpers::evaluate_script_on_global_with_result::h15369056617150762074
at /home/divad/Rust/servo/components/script/dom/window.rs:816
38: 0x7fce157fde2d - dom::htmlscriptelement::HTMLScriptElement::execute::hd820d00a090ebc54u4T
at /home/divad/Rust/servo/components/script/dom/htmlscriptelement.rs:417
39: 0x7fce159422a7 - dom::htmlscriptelement::HTMLScriptElement::prepare::hdf4a27ee8b6ffe51YTT
at /home/divad/Rust/servo/components/script/dom/htmlscriptelement.rs:344
40: 0x7fce159cd1bf - parse::html::servohtmlparser..Sink.TreeSink::complete_script::he40fdf910a4859cc8Ce
at /home/divad/Rust/servo/components/script/parse/html.rs:156
41: 0x7fce159b37cc - tree_builder::rules::super..TreeBuilder<Handle, Sink>.TreeBuilderStep::step::h11281135998388019670
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tree_builder/rules.expanded.rs:1461
42: 0x7fce1599a039 - tree_builder::TreeBuilder<Handle, Sink>::process_to_completion::h6465385879961674149
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tree_builder/mod.rs:327
43: 0x7fce1599580e - tree_builder::TreeBuilder<Handle, Sink>.TokenSink::process_token::h14073795346578288465
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tree_builder/mod.rs:425
44: 0x7fce15994a91 - tokenizer::Tokenizer::process_token::h1142806760397791138
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:233
45: 0x7fce159de007 - tokenizer::Tokenizer::emit_current_tag::h12032453629681101526
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:392
46: 0x7fce159d621a - tokenizer::Tokenizer::step::h17000905979645303138
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:795
47: 0x7fce159d35fb - tokenizer::Tokenizer::run::h9347854623409678734
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:334
48: 0x7fce159f3ed2 - tokenizer::Tokenizer::feed::h11122150034214555435
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:221
49: 0x7fce1598b858 - dom::servohtmlparser::ServoHTMLParser::parse_sync::h9e1bf7a0c9447631w72
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:470
50: 0x7fce1598af92 - dom::servohtmlparser::
&'a ServoHTMLParser.Parser::parse_chunk::h24a49f06855bcb41Y02
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:355
51: 0x7fce1598ad73 - dom::servohtmlparser::ParserRef<'a>::parse_chunk::hdb1c7549f7a040c8sM2
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:141
52: 0x7fce1598f053 - dom::servohtmlparser::ParserContext.AsyncResponseListener::data_available::h100afa4737423bafNU2
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:306
53: 0x7fce15eb8021 - ResponseAction::process::hc5e234e7d4322f71jMd
at /home/divad/Rust/servo/components/net_traits/lib.rs:136
54: 0x7fce15b9e835 - network_listener::ListenerRunnable.Runnable::handler::h13439789093495147791
at /home/divad/Rust/servo/components/script/network_listener.rs:48
55: 0x7fce15b02685 - script_thread::ScriptThread::handle_msg_from_script::hefd7cdb2573bf9e3bjg
at /home/divad/Rust/servo/components/script/script_thread.rs:1149
56: 0x7fce15b7db62 - script_thread::ScriptThread::handle_msgs::
::closure.171647
at /home/divad/Rust/servo/components/script/script_thread.rs:1001
57: 0x7fce15b7d782 - script_thread::ScriptThread::profile_event::h15525301070989550331
at /home/divad/Rust/servo/components/script/script_thread.rs:1083
58: 0x7fce15b512cb - script_thread::ScriptThread::handle_msgs::h8d3c2378aac8698e44f
at /home/divad/Rust/servo/components/script/script_thread.rs:993
59: 0x7fce15afed90 - script_thread::ScriptThread::start::he5c522eecb9402a4U4f
at /home/divad/Rust/servo/components/script/script_thread.rs:851
60: 0x7fce15afed44 - script_thread::ScriptThread.ScriptThreadFactory::create::::::closure.170374
at /home/divad/Rust/servo/components/script/script_thread.rs:641
61: 0x7fce15afea74 - mem::ProfilerChan::run_with_memory_reporting::h14646429605872663705
at /home/divad/Rust/servo/components/profile_traits/mem.rs:60
62: 0x7fce15ae912d - script_thread::ScriptThread.ScriptThreadFactory::create::::closure.169754
at /home/divad/Rust/servo/components/script/script_thread.rs:640
63: 0x7fce15ae8587 - util::thread::spawn_named_with_send_on_failure::::closure.169741
at /home/divad/Rust/servo/components/util/thread.rs:52
64: 0x7fce15ae7f73 - std::thread::Builder::spawn::::::closure.169730
at ../src/libstd/thread/mod.rs:277
65: 0x7fce15ae7ee8 - sys_common::unwind::try::try_fn::h15441903801498570928
at ../src/libstd/sys/common/unwind/mod.rs:153
66: 0x7fce16ff4f78 - __rust_try
67: 0x7fce16ff124b - sys_common::unwind::try::inner_try::h62f00e3d34dbb509D3s
68: 0x7fce15ae7e25 - sys_common::unwind::try::h2826455607981404404
at ../src/libstd/sys/common/unwind/mod.rs:123
69: 0x7fce15ae7c6b - std::thread::Builder::spawn::::closure.169727
at ../src/libstd/thread/mod.rs:277
70: 0x7fce15ae8797 - boxed::F.FnBox::call_box::h11407286024432784320
at ../src/liballoc/boxed.rs:541
71: 0x7fce16ff7263 - sys::thread::Thread::new::thread_start::hb3a0514b9d87669e1mx
72: 0x7fce1187c181 - start_thread
73: 0x7fce13a9347c - __clone
74: 0x0 -
thread 'ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(0) }' panicked at 'assertion failed: self.stack == mem::transmute(&self)', /home/divad/Rust/servo/.cargo/git/checkouts/rust-mozjs-ebb4917e843c0a11/master/src/rust.rs:334
stack backtrace:
1: 0x7fce16ff5ad0 - sys::backtrace::tracing::imp::write::hd273f86d5325347aweu
2: 0x7fce16ff89f5 - panicking::default_handler::
::closure.42335
3: 0x7fce16ff849f - panicking::default_handler::h907ce0af740f5f06spy
4: 0x7fce16fe14e6 - sys_common::unwind::begin_unwind_inner::ha417239bcab1f2ff56s
5: 0x7fce15206b17 - sys_common::unwind::begin_unwind::h14435761367766209739
at ../src/libstd/sys/common/unwind/mod.rs:227
6: 0x7fce15259600 - rust::Rooted.Drop::drop::h10148855915066515977
at /home/divad/Rust/servo/components/servo/:3
7: 0x7fce1525955c - js..jsapi_linux_64..Rooted<js..jsapi_linux_64..Value>::drop.130360::hbea65b6ec5622d8e
8: 0x7fce157fdcc9 - dom::htmlscriptelement::HTMLScriptElement::execute::hd820d00a090ebc54u4T
at /home/divad/Rust/servo/components/script/dom/htmlscriptelement.rs:443
9: 0x7fce159422a7 - dom::htmlscriptelement::HTMLScriptElement::prepare::hdf4a27ee8b6ffe51YTT
at /home/divad/Rust/servo/components/script/dom/htmlscriptelement.rs:344
10: 0x7fce159cd1bf - parse::html::servohtmlparser..Sink.TreeSink::complete_script::he40fdf910a4859cc8Ce
at /home/divad/Rust/servo/components/script/parse/html.rs:156
11: 0x7fce159b37cc - tree_builder::rules::super..TreeBuilder<Handle, Sink>.TreeBuilderStep::step::h11281135998388019670
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tree_builder/rules.expanded.rs:1461
12: 0x7fce1599a039 - tree_builder::TreeBuilder<Handle, Sink>::process_to_completion::h6465385879961674149
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tree_builder/mod.rs:327
13: 0x7fce1599580e - tree_builder::TreeBuilder<Handle, Sink>.TokenSink::process_token::h14073795346578288465
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tree_builder/mod.rs:425
14: 0x7fce15994a91 - tokenizer::Tokenizer::process_token::h1142806760397791138
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:233
15: 0x7fce159de007 - tokenizer::Tokenizer::emit_current_tag::h12032453629681101526
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:392
16: 0x7fce159d621a - tokenizer::Tokenizer::step::h17000905979645303138
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:795
17: 0x7fce159d35fb - tokenizer::Tokenizer::run::h9347854623409678734
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:334
18: 0x7fce159f3ed2 - tokenizer::Tokenizer::feed::h11122150034214555435
at /home/divad/Rust/servo/.cargo/registry/src/github.com-0a35038f75765ae4/html5ever-0.2.11/src/tokenizer/mod.rs:221
19: 0x7fce1598b858 - dom::servohtmlparser::ServoHTMLParser::parse_sync::h9e1bf7a0c9447631w72
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:470
20: 0x7fce1598af92 - dom::servohtmlparser::
&'a ServoHTMLParser.Parser::parse_chunk::h24a49f06855bcb41Y02
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:355
21: 0x7fce1598ad73 - dom::servohtmlparser::ParserRef<'a>::parse_chunk::hdb1c7549f7a040c8sM2
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:141
22: 0x7fce1598f053 - dom::servohtmlparser::ParserContext.AsyncResponseListener::data_available::h100afa4737423bafNU2
at /home/divad/Rust/servo/components/script/dom/servohtmlparser.rs:306
23: 0x7fce15eb8021 - ResponseAction::process::hc5e234e7d4322f71jMd
at /home/divad/Rust/servo/components/net_traits/lib.rs:136
24: 0x7fce15b9e835 - network_listener::ListenerRunnable.Runnable::handler::h13439789093495147791
at /home/divad/Rust/servo/components/script/network_listener.rs:48
25: 0x7fce15b02685 - script_thread::ScriptThread::handle_msg_from_script::hefd7cdb2573bf9e3bjg
at /home/divad/Rust/servo/components/script/script_thread.rs:1149
26: 0x7fce15b7db62 - script_thread::ScriptThread::handle_msgs::::closure.171647
at /home/divad/Rust/servo/components/script/script_thread.rs:1001
27: 0x7fce15b7d782 - script_thread::ScriptThread::profile_event::h15525301070989550331
at /home/divad/Rust/servo/components/script/script_thread.rs:1083
28: 0x7fce15b512cb - script_thread::ScriptThread::handle_msgs::h8d3c2378aac8698e44f
at /home/divad/Rust/servo/components/script/script_thread.rs:993
29: 0x7fce15afed90 - script_thread::ScriptThread::start::he5c522eecb9402a4U4f
at /home/divad/Rust/servo/components/script/script_thread.rs:851
30: 0x7fce15afed44 - script_thread::ScriptThread.ScriptThreadFactory::create::::::closure.170374
at /home/divad/Rust/servo/components/script/script_thread.rs:641
31: 0x7fce15afea74 - mem::ProfilerChan::run_with_memory_reporting::h14646429605872663705
at /home/divad/Rust/servo/components/profile_traits/mem.rs:60
32: 0x7fce15ae912d - script_thread::ScriptThread.ScriptThreadFactory::create::::closure.169754
at /home/divad/Rust/servo/components/script/script_thread.rs:640
33: 0x7fce15ae8587 - util::thread::spawn_named_with_send_on_failure::::closure.169741
at /home/divad/Rust/servo/components/util/thread.rs:52
34: 0x7fce15ae7f73 - std::thread::Builder::spawn::::::closure.169730
at ../src/libstd/thread/mod.rs:277
35: 0x7fce15ae7ee8 - sys_common::unwind::try::try_fn::h15441903801498570928
at ../src/libstd/sys/common/unwind/mod.rs:153
36: 0x7fce16ff4f78 - __rust_try
37: 0x7fce16ff124b - sys_common::unwind::try::inner_try::h62f00e3d34dbb509D3s
38: 0x7fce15ae7e25 - sys_common::unwind::try::h2826455607981404404
at ../src/libstd/sys/common/unwind/mod.rs:123
39: 0x7fce15ae7c6b - std::thread::Builder::spawn::_::closure.169727
at ../src/libstd/thread/mod.rs:277
40: 0x7fce15ae8797 - boxed::F.FnBox::call_box::h11407286024432784320
at ../src/liballoc/boxed.rs:541
41: 0x7fce16ff7263 - sys::thread::Thread::new::thread_start::hb3a0514b9d87669e1mx
42: 0x7fce1187c181 - start_thread
43: 0x7fce13a9347c - __clone
44: 0x0 -

@jdm
Copy link

@jdm jdm commented on 2ac7708 Jan 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The panic is caused by self.attrs.borrow() in the if let, and the else uses self.attrs.borrow_mut().

@craftytrickster
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdm thank you very much for the pointer, I know what to do now. It looks like I'm not the first person to assume that the borrow ends after the first if block! - rust-lang/rust#6393

Please sign in to comment.