Bug 824917. Add hasInstanceInterface to the DOM element classes we've converted that people use instanceof with. r=peterv

This commit is contained in:
Boris Zbarsky 2012-12-31 10:37:22 -08:00
parent 2ef94b78ac
commit c158a1e913
4 changed files with 84 additions and 1 deletions

View File

@ -297,6 +297,10 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'gain' ],
}],
'HTMLBodyElement': {
'hasInstanceInterface': 'nsIDOMHTMLBodyElement',
},
'HTMLCollection': {
'nativeType': 'nsIHTMLCollection',
'resultNotAddRefed': [ 'item' ]
@ -308,6 +312,10 @@ DOMInterfaces = {
]
},
'HTMLDivElement': {
'hasInstanceInterface': 'nsIDOMHTMLDivElement',
},
'HTMLDocument': {
'nativeType': 'nsHTMLDocument',
'register': False,
@ -328,10 +336,19 @@ DOMInterfaces = {
]
},
'HTMLFrameSetElement': {
'hasInstanceInterface': 'nsIDOMHTMLFrameSetElement',
},
'HTMLHeadingElement': {
'hasInstanceInterface': 'nsIDOMHTMLHeadingElement',
},
'HTMLLabelElement': {
'resultNotAddRefed': [
'form', 'control'
]
],
'hasInstanceInterface': 'nsIDOMHTMLLabelElement',
},
'HTMLOptionsCollection': {

View File

@ -54,6 +54,8 @@ MOCHITEST_CHROME_FILES = \
test_subscript_bindings.xul \
file_subscript_bindings.js \
test_sandbox_eventhandler.xul \
test_DOM_element_instanceof.xul \
file_DOM_element_instanceof.xul \
$(NULL)
ifeq (WINNT,$(OS_ARCH))

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<window title="Mozilla Bug 824917"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<iframe type="content"></iframe>
<script type="application/javascript">
<![CDATA[
/** Test for Bug 799299 **/
var SimpleTest = opener.wrappedJSObject.SimpleTest;
var ok = opener.wrappedJSObject.ok;
var doc = frames[0].document;
ok(doc.createElement("body") instanceof HTMLBodyElement,
"Should be instance of HTMLBodyElement");
ok(doc.createElement("div") instanceof HTMLDivElement,
"Should be instance of HTMLDivElement");
ok(doc.createElement("frameset") instanceof HTMLFrameSetElement,
"Should be instance of HTMLFrameSetElement");
ok(doc.createElement("h1") instanceof HTMLHeadingElement,
"Should be instance of HTMLHeadingElement");
ok(doc.createElement("label") instanceof HTMLLabelElement,
"Should be instance of HTMLLabelElement");
window.close();
opener.wrappedJSObject.SimpleTest.finish();
]]>
</script>
</window>

View File

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=824917
-->
<window title="Mozilla Bug 824917"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=824917"
target="_blank">Mozilla Bug 824917</a>
</body>
<iframe type="content"></iframe>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 824917 **/
function runTests() {
window.open("file_DOM_element_instanceof.xul", "_blank", "chrome,width=600,height=550");
}
addLoadEvent(runTests);
SimpleTest.waitForExplicitFinish();
]]>
</script>
</window>