mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 1176757 - Throw a DataCloneError when attempting to invoke 'cloneNode' on a 'ShadowRoot' and associated mochitest. r=wchen
This commit is contained in:
parent
2c2295d295
commit
e9068b5f19
@ -712,6 +712,13 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
ShadowRoot::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
{
|
||||
*aResult = nullptr;
|
||||
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
||||
}
|
||||
|
||||
void
|
||||
ShadowRoot::DestroyContent()
|
||||
{
|
||||
|
@ -183,6 +183,8 @@ protected:
|
||||
// mark whether it is in the composed document, but we have run out of flags
|
||||
// so instead we track it here.
|
||||
bool mIsComposedDocParticipant;
|
||||
|
||||
nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
||||
};
|
||||
|
||||
class ShadowRootStyleSheetList : public StyleSheetList
|
||||
|
@ -4,6 +4,7 @@ support-files =
|
||||
|
||||
[test_bug900724.html]
|
||||
[test_bug1017896.html]
|
||||
[test_bug1176757.html]
|
||||
[test_content_element.html]
|
||||
[test_custom_element_adopt_callbacks.html]
|
||||
[test_custom_element_callback_innerhtml.html]
|
||||
|
40
dom/tests/mochitest/webcomponents/test_bug1176757.html
Normal file
40
dom/tests/mochitest/webcomponents/test_bug1176757.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1176757
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1176757</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1176757">Mozilla Bug 1176757</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 1176757 **/
|
||||
var element = document.createElement("a");
|
||||
var shadowRoot = element.createShadowRoot();
|
||||
var thrownException = false;
|
||||
|
||||
try {
|
||||
shadowRoot.cloneNode();
|
||||
} catch(err) {
|
||||
thrownException = err;
|
||||
}
|
||||
|
||||
ok(thrownException !== false, "An exception should've been thrown");
|
||||
is(thrownException.name, "DataCloneError", "A DataCloneError exception should've been thrown");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,5 +0,0 @@
|
||||
[test-010.html]
|
||||
type: testharness
|
||||
[A_10_01_02_09_T01]
|
||||
expected: FAIL
|
||||
|
Loading…
x
Reference in New Issue
Block a user