Bug 712649 - Components.utils.getWeakReference(null) should fail silently; r=bholley

This commit is contained in:
Ms2ger 2011-12-24 09:20:04 +01:00
parent 0989117a2f
commit 84ddd624f8
2 changed files with 9 additions and 1 deletions

View File

@ -49,7 +49,7 @@ nsresult xpcJSWeakReference::Init(JSContext* cx, const JS::Value& object)
JSAutoRequest ar(cx);
if (!object.isObject())
return NS_ERROR_FAILURE;
return NS_OK;
JSObject& obj = object.toObject();

View File

@ -38,6 +38,14 @@
function run_test()
{
// Bug 712649: Calling getWeakReference(null) should work.
try {
var nullWeak = Components.utils.getWeakReference(null);
do_check_true(nullWeak.get() === null);
} catch (e) {
do_check_true(false);
}
var obj = { num: 5, str: 'foo' };
var weak = Components.utils.getWeakReference(obj);