Fix for bug 817420 (new bindings api for element broke cloud9/apf) - don't register Element prototype yet, we need to convert plain elements to the new DOM binding first. r=bz.

This commit is contained in:
Peter Van der Beken 2012-12-03 15:26:44 +01:00
parent db4f2771da
commit 651e0b5988
4 changed files with 65 additions and 5 deletions

View File

@ -200,6 +200,7 @@ DOMInterfaces = {
# needed.
'prefable': True,
'hasXPConnectImpls': True,
'register': False,
'hasInstanceInterface': 'nsIDOMElement',
'resultNotAddRefed': [
'classList', 'attributes', 'children', 'firstElementChild',

View File

@ -155,13 +155,11 @@
"EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on document.doctype with too few arguments must throw TypeError": true,
"EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on document.doctype with too few arguments must throw TypeError": true,
"EventTarget interface: calling dispatchEvent(Event) on document.doctype with too few arguments must throw TypeError": true,
"Element interface: attribute namespaceURI": true,
"Element interface: attribute prefix": true,
"Element interface: attribute localName": true,
"Element interface: existence and properties of interface object": true,
"Element interface: existence and properties of interface prototype object": true,
"Element interface: existence and properties of interface prototype object's \"constructor\" property": true,
"Element interface: attribute className": true,
"Element interface: attribute attributes": true,
"Element interface: operation remove()": true,
"Element must be primary interface of element": true,
"Stringification of element": "debug",
"Element interface: element must inherit property \"className\" with the proper type (5)": true,
"Element interface: element must inherit property \"remove\" with the proper type (25)": true,

View File

@ -136,6 +136,7 @@ MOCHITEST_FILES = \
file_bug809290_c.html \
file_empty.html \
test_sizetocontent_clamp.html \
test_protochains.html \
$(NULL)
ifneq (Linux,$(OS_ARCH))

View File

@ -0,0 +1,60 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=817420
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 817420</title>
<script type="application/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=817420">Mozilla Bug 817420</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 817420 **/
is(Object.getPrototypeOf(HTMLElement.prototype), Element.prototype,
"Must have correct proto chain for HTMLElement.prototype");
is(Object.getPrototypeOf(document.createElementNS(null, "x")),
Element.prototype,
"Must have correct proto chain for random element");
// Todo because of HTMLUnknownElement
todo_is(Object.getPrototypeOf(document.createElement("noSuchElementName")),
HTMLElement.prototype,
"Must have correct proto chain for random HTML element");
// And check that it's really working as it should
function checkPropPresent(propName, objList, expected)
{
for (obj of objList) {
is(propName in obj,
expected,
obj + " should " + (expected ? "" : "not ") + "have the property");
}
}
var objList = [ Element.prototype,
HTMLElement.prototype,
document.createElementNS(null, "x"),
document.createElement("noSuchElementName"),
document.body ]
checkPropPresent("somePropertyThatBetterNeverExist", objList, false);
Element.prototype.somePropertyThatBetterNeverExist = 1;
checkPropPresent("somePropertyThatBetterNeverExist", objList, true);
objList = [ HTMLElement.prototype,
document.createElement("noSuchElementName"),
document.body ]
checkPropPresent("someOtherPropertyThatBetterNeverExist", objList, false);
HTMLElement.prototype.someOtherPropertyThatBetterNeverExist = 1;
checkPropPresent("someOtherPropertyThatBetterNeverExist", objList, true);
</script>
</pre>
</body>
</html>