From a52b6c9714042d3d6093c00b8fbd03c3543b2d4e Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Fri, 2 Dec 2016 14:01:06 -0800 Subject: [PATCH] Bug 1319740 - Rearrange a few lines. r=arai --HG-- extra : rebase_source : 9ab57e091abfd0cbbed84224add9d335794c2019 --- js/src/builtin/Intl.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 21e0291e46cb..92ab9e7f4fba 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -3044,21 +3044,22 @@ js::intl_ComputeDisplayNames(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); MOZ_ASSERT(args.length() == 3); + + RootedString str(cx); + // 1. Assert: locale is a string. - MOZ_ASSERT(args[0].isString()); + str = args[0].toString(); + JSAutoByteString locale; + if (!locale.encodeUtf8(cx, str)) + return false; + // 2. Assert: style is a string. - MOZ_ASSERT(args[1].isString()); + str = args[1].toString(); + JSAutoByteString style; + if (!style.encodeUtf8(cx, str)) + return false; + // 3. Assert: keys is an Array. - MOZ_ASSERT(args[2].isObject()); - - JSAutoByteString locale(cx, args[0].toString()); - if (!locale) - return false; - - JSAutoByteString style(cx, args[1].toString()); - if (!style) - return false; - RootedArrayObject keys(cx, &args[2].toObject().as()); if (!keys) return false;