Bug 1168593 - Make AutoStableStringChars::init use MOZ_WARN_UNUSED_RESULT. r=jandem

This commit is contained in:
Tom Tromey 2015-05-28 11:57:00 -04:00
parent 2facd36063
commit e4610dcf14
2 changed files with 6 additions and 3 deletions

View File

@ -590,7 +590,10 @@ AutoEntryScript::DocshellEntryMonitor::Entry(JSContext* aCx, JSFunction* aFuncti
if (rootedFunction) {
JS::Rooted<JSString*> displayId(aCx, JS_GetFunctionDisplayId(rootedFunction));
if (displayId) {
functionName.initTwoByte(aCx, displayId);
if (!functionName.initTwoByte(aCx, displayId)) {
JS_ClearPendingException(aCx);
return;
}
}
}

View File

@ -1327,10 +1327,10 @@ class MOZ_STACK_CLASS AutoStableStringChars
{}
~AutoStableStringChars();
bool init(JSContext* cx, JSString* s);
bool init(JSContext* cx, JSString* s) MOZ_WARN_UNUSED_RESULT;
/* Like init(), but Latin1 chars are inflated to TwoByte. */
bool initTwoByte(JSContext* cx, JSString* s);
bool initTwoByte(JSContext* cx, JSString* s) MOZ_WARN_UNUSED_RESULT;
bool isLatin1() const { return state_ == Latin1; }
bool isTwoByte() const { return state_ == TwoByte; }