mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Fix for bug 827546 (|non editable element|.QueryInterface(Components.interfaces.nsIDOMNSEditableElement) does not throw anymore) - throw on QI failure. r=bz.
This commit is contained in:
parent
806c76d9f1
commit
0bf1bbaec2
@ -592,7 +592,12 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
|
|||||||
return WrapObject(cx, origObj, ci, &NS_GET_IID(nsIClassInfo), vp);
|
return WrapObject(cx, origObj, ci, &NS_GET_IID(nsIClassInfo), vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lie, otherwise we need to check classinfo or QI
|
nsCOMPtr<nsISupports> unused;
|
||||||
|
nsresult rv = native->QueryInterface(*iid->GetID(), getter_AddRefs(unused));
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return Throw<true>(cx, rv);
|
||||||
|
}
|
||||||
|
|
||||||
*vp = thisv;
|
*vp = thisv;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ MOCHITEST_FILES := \
|
|||||||
test_bug742191.html \
|
test_bug742191.html \
|
||||||
test_namedNoIndexed.html \
|
test_namedNoIndexed.html \
|
||||||
test_bug759621.html \
|
test_bug759621.html \
|
||||||
|
test_queryInterface.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MOCHITEST_CHROME_FILES = \
|
MOCHITEST_CHROME_FILES = \
|
||||||
|
41
dom/bindings/test/test_queryInterface.html
Normal file
41
dom/bindings/test/test_queryInterface.html
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=827546
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test for Bug 827546</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
/** Test for Bug 827546 **/
|
||||||
|
|
||||||
|
var notEditable = document.createElement("div");
|
||||||
|
var thrown;
|
||||||
|
try {
|
||||||
|
thrown = false;
|
||||||
|
SpecialPowers.do_QueryInterface(notEditable, "nsIDOMNSEditableElement");
|
||||||
|
} catch (e) {
|
||||||
|
thrown = true;
|
||||||
|
}
|
||||||
|
ok(thrown,
|
||||||
|
"QI to nsIDOMNSEditableElement on a non-editable element should fail");
|
||||||
|
|
||||||
|
var editable = document.createElement("input");
|
||||||
|
ok(SpecialPowers.do_QueryInterface(editable, "nsIDOMNSEditableElement"),
|
||||||
|
"Editable element needs to support QI to nsIDOMNSEditableElement");
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827546">Mozilla Bug 827546</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user