mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 1282894 - Propagate exception on setting HTMLTableElement.caption. r=bz
--HG-- extra : rebase_source : ea1aff21fb0b410c1076775cd76d7569d0f6c695
This commit is contained in:
parent
61e4473134
commit
b99dc5856a
@ -32,12 +32,11 @@ public:
|
||||
{
|
||||
return static_cast<HTMLTableCaptionElement*>(GetChild(nsGkAtoms::caption));
|
||||
}
|
||||
void SetCaption(HTMLTableCaptionElement* aCaption)
|
||||
void SetCaption(HTMLTableCaptionElement* aCaption, ErrorResult& aError)
|
||||
{
|
||||
DeleteCaption();
|
||||
if (aCaption) {
|
||||
mozilla::ErrorResult rv;
|
||||
nsINode::AppendChild(*aCaption, rv);
|
||||
nsINode::AppendChild(*aCaption, aError);
|
||||
}
|
||||
}
|
||||
|
||||
|
17
dom/html/crashtests/1282894.html
Normal file
17
dom/html/crashtests/1282894.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
|
||||
function boom() {
|
||||
var table = document.createElement("table");
|
||||
var cap = document.createElement("caption");
|
||||
cap.appendChild(table)
|
||||
table.caption = cap;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boom();"></body>
|
||||
</html>
|
@ -76,3 +76,4 @@ load 1228876.html
|
||||
load 1230110.html
|
||||
load 1237633.html
|
||||
load 1281972-1.html
|
||||
load 1282894.html
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
interface HTMLTableElement : HTMLElement {
|
||||
[SetterThrows]
|
||||
attribute HTMLTableCaptionElement? caption;
|
||||
HTMLElement createCaption();
|
||||
void deleteCaption();
|
||||
|
@ -36,6 +36,8 @@
|
||||
</table>
|
||||
<table id="table4" style="display:none">
|
||||
</table>
|
||||
<table id="table5" style="display:none">
|
||||
</table>
|
||||
<script>
|
||||
test(function () {
|
||||
var table0 = document.getElementById('table0');
|
||||
@ -81,6 +83,18 @@
|
||||
table4.deleteCaption();
|
||||
assert_equals(caption.parentNode, table4);
|
||||
}, "deleteCaption method not remove caption that is not in html namespace")
|
||||
test(function() {
|
||||
var table5 = document.getElementById('table5');
|
||||
var caption = document.createElement('caption');
|
||||
caption.appendChild(table5)
|
||||
|
||||
// Node cannot be inserted at the specified point in the hierarchy
|
||||
assert_throws("HierarchyRequestError", function() {
|
||||
table5.caption = caption;
|
||||
});
|
||||
|
||||
assert_not_equals(table5.caption, caption);
|
||||
}, "Setting caption rethrows exception");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user