Bug 920840 - Crash when JS-implemented WebIDL's init method returns a value other than undefined. r=bz

This commit is contained in:
Andrew McCreight 2013-09-26 16:46:42 -07:00
parent 51b40471b2
commit 232783c6e4

View File

@ -2040,8 +2040,13 @@ ConstructJSImplementation(JSContext* aCx, const char* aContractId,
aRv.Throw(rv);
return nullptr;
}
MOZ_ASSERT(initReturn.isUndefined(),
"nsIDOMGlobalPropertyInitializer should return undefined");
// With JS-implemented WebIDL, the return value of init() is not used to determine
// if init() failed, so init() should only return undefined. Any kind of permission
// or pref checking must happen by adding an attribute to the WebIDL interface.
if (!initReturn.isUndefined()) {
MOZ_ASSERT(false, "The init() method for JS-implemented WebIDL should not return anything");
MOZ_CRASH();
}
}
// Extract the JS implementation from the XPCOM object.
nsCOMPtr<nsIXPConnectWrappedJS> implWrapped =