From 83c820e5b106a368155082f58c0c3c85b50d4a28 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 8 Mar 2017 16:50:34 +0100 Subject: [PATCH 1/2] Add test for https://bugzilla.mozilla.org/show_bug.cgi?id=1345483 --- tests/wpt/mozilla/meta/MANIFEST.json | 10 ++++++++++ tests/wpt/mozilla/meta/css/bug_1345483.html.ini | 3 +++ tests/wpt/mozilla/tests/css/bug_1345483.html | 15 +++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tests/wpt/mozilla/meta/css/bug_1345483.html.ini create mode 100644 tests/wpt/mozilla/tests/css/bug_1345483.html diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 38d378f9e93..a20dffa1557 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -11024,6 +11024,12 @@ {} ] ], + "css/bug_1345483.html": [ + [ + "/_mozilla/css/bug_1345483.html", + {} + ] + ], "css/empty-keyframes.html": [ [ "/_mozilla/css/empty-keyframes.html", @@ -20613,6 +20619,10 @@ "2ebf9c8f963a2f3971a3c1b64b6b01825eacdedc", "support" ], + "css/bug_1345483.html": [ + "d5e1649c88102f27da5fe1ac16715cfee7f70f84", + "testharness" + ], "css/button_css_width.html": [ "bb88fcb6c5856a1f5199599938e1b9c84aa8ea77", "reftest" diff --git a/tests/wpt/mozilla/meta/css/bug_1345483.html.ini b/tests/wpt/mozilla/meta/css/bug_1345483.html.ini new file mode 100644 index 00000000000..9d7d959bdc7 --- /dev/null +++ b/tests/wpt/mozilla/meta/css/bug_1345483.html.ini @@ -0,0 +1,3 @@ +[bug_1345483.html] + type: testharness + expected: CRASH diff --git a/tests/wpt/mozilla/tests/css/bug_1345483.html b/tests/wpt/mozilla/tests/css/bug_1345483.html new file mode 100644 index 00000000000..595a799c9b7 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/bug_1345483.html @@ -0,0 +1,15 @@ + + + + + + From 765be69780868960915786447e35725c0b3fa3eb Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 8 Mar 2017 16:53:21 +0100 Subject: [PATCH 2/2] Fix debug assertion failure https://bugzilla.mozilla.org/show_bug.cgi?id=1345483 --- components/style/properties/declaration_block.rs | 10 +++++++--- tests/wpt/mozilla/meta/MANIFEST.json | 2 +- tests/wpt/mozilla/meta/css/bug_1345483.html.ini | 3 --- tests/wpt/mozilla/tests/css/bug_1345483.html | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 tests/wpt/mozilla/meta/css/bug_1345483.html.ini diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 2cb5cba4874..f10da7a7cb4 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -288,10 +288,15 @@ impl PropertyDeclarationBlock { } let important_count = &mut self.important_count; let mut removed_at_least_one = false; + let longhands = &mut self.longhands; self.declarations.retain(|&(ref declaration, importance)| { - let remove = declaration.id().is_or_is_longhand_of(property); + let id = declaration.id(); + let remove = id.is_or_is_longhand_of(property); if remove { removed_at_least_one = true; + if let PropertyDeclarationId::Longhand(id) = id { + longhands.remove(id) + } if importance.important() { *important_count -= 1 } @@ -299,9 +304,8 @@ impl PropertyDeclarationBlock { !remove }); - if let PropertyId::Longhand(id) = *property { + if let PropertyId::Longhand(_) = *property { debug_assert!(removed_at_least_one); - self.longhands.remove(id); } removed_at_least_one } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index a20dffa1557..d554b574926 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -20620,7 +20620,7 @@ "support" ], "css/bug_1345483.html": [ - "d5e1649c88102f27da5fe1ac16715cfee7f70f84", + "41b55af9d5c95910b1af74c0fbffb24e20bbe869", "testharness" ], "css/button_css_width.html": [ diff --git a/tests/wpt/mozilla/meta/css/bug_1345483.html.ini b/tests/wpt/mozilla/meta/css/bug_1345483.html.ini deleted file mode 100644 index 9d7d959bdc7..00000000000 --- a/tests/wpt/mozilla/meta/css/bug_1345483.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[bug_1345483.html] - type: testharness - expected: CRASH diff --git a/tests/wpt/mozilla/tests/css/bug_1345483.html b/tests/wpt/mozilla/tests/css/bug_1345483.html index 595a799c9b7..87d0d357c63 100644 --- a/tests/wpt/mozilla/tests/css/bug_1345483.html +++ b/tests/wpt/mozilla/tests/css/bug_1345483.html @@ -8,8 +8,8 @@ test(function() { var style = document.documentElement.style; style.marginTop = "0"; assert_equals(style.marginTop, "0px"); - style.margin = null; // This fails to unset a bit in a LonghandIdSet + style.margin = null; // This used to fail to unset a bit in a LonghandIdSet assert_equals(style.marginTop, ""); - style.marginTop = null; // This finds the bit and expect to find a corresponding declarations. + style.marginTop = null; // This would find the bit and expect to find a corresponding declarations. }, "regression for bug 1345483")