From 8fc6b2373f11659b15152fb464f4cb3f8fc61da4 Mon Sep 17 00:00:00 2001 From: chakrabot Date: Tue, 14 Nov 2017 10:00:42 -0800 Subject: [PATCH] [Merge Microsoft/Chakracore@7b9c916c04] [MERGE #4217 @jackhorton] Intl-ICU on release/1.7 fixups Merge pull request #4217 from jackhorton:fix-mergeback-break This pull supersedes #4187 --- .../IntlEngineInterfaceExtensionObject.cpp | 17 ++++++++++------- .../lib/Runtime/Library/JavascriptString.cpp | 12 ++++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp b/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp index a1fbe660f6d..83be5a987b8 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp +++ b/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp @@ -681,7 +681,7 @@ namespace Js return scriptContext->GetLibrary()->GetUndefined(); } - JavascriptString* toReturn = nullptr; + Var toReturn = nullptr; ENTER_PINNED_SCOPE(JavascriptString, localeStrings); localeStrings = JavascriptString::FromVar(args.Values[1]); PCWSTR passedLocale = localeStrings->GetSz(); @@ -690,14 +690,16 @@ namespace Js char16 resolvedLocaleName[ULOC_FULLNAME_CAPACITY] = { 0 }; if (ResolveLocaleBestFit(passedLocale, resolvedLocaleName)) { - return JavascriptString::NewCopySz(resolvedLocaleName, scriptContext); + toReturn = JavascriptString::NewCopySz(resolvedLocaleName, scriptContext); } - + else + { #ifdef INTL_ICU_DEBUG - Output::Print(_u("Intl::ResolveLocaleBestFit returned false: EntryIntl_ResolveLocaleBestFit returning null to fallback to JS\n")); + Output::Print(_u("Intl::ResolveLocaleBestFit returned false: EntryIntl_ResolveLocaleBestFit returning null to fallback to JS\n")); #endif - return scriptContext->GetLibrary()->GetNull(); -#else + toReturn = scriptContext->GetLibrary()->GetNull(); + } +#else // !INTL_ICU DelayLoadWindowsGlobalization* wgl = scriptContext->GetThreadContext()->GetWindowsGlobalizationLibrary(); WindowsGlobalizationAdapter* wga = GetWindowsGlobalizationAdapter(scriptContext); @@ -718,10 +720,11 @@ namespace Js toReturn = JavascriptString::NewCopySz(wgl->WindowsGetStringRawBuffer(*locale, NULL), scriptContext); +#endif + LEAVE_PINNED_SCOPE(); // localeStrings return toReturn; -#endif } Var IntlEngineInterfaceExtensionObject::EntryIntl_GetDefaultLocale(RecyclableObject* function, CallInfo callInfo, ...) diff --git a/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp b/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp index 926d4d4394c..5c13d3677a8 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp +++ b/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp @@ -1347,12 +1347,20 @@ namespace Js EngineInterfaceObject* nativeEngineInterfaceObj = scriptContext->GetLibrary()->GetEngineInterfaceObject(); if (nativeEngineInterfaceObj) { - IntlEngineInterfaceExtensionObject* intlExtensionObject = static_cast(nativeEngineInterfaceObj->GetEngineExtension(EngineInterfaceExtensionKind_Intl)); + IntlEngineInterfaceExtensionObject* intlExtensionObject = static_cast( + nativeEngineInterfaceObj->GetEngineExtension(EngineInterfaceExtensionKind_Intl)); if (args.Info.Count == 2) { auto undefined = scriptContext->GetLibrary()->GetUndefined(); CallInfo toPass(callInfo.Flags, 7); - return intlExtensionObject->EntryIntl_CompareString(function, toPass, undefined, pThis, pThat, undefined, undefined, undefined, undefined); + ThreadContext *threadContext = scriptContext->GetThreadContext(); + return threadContext->ExecuteImplicitCall(function, ImplicitCall_Accessor, + [threadContext, intlExtensionObject, function, toPass, undefined, pThis, pThat]() -> Var + { + return CALL_ENTRYPOINT(threadContext, intlExtensionObject->EntryIntl_CompareString, + function, toPass, undefined, pThis, pThat, undefined, undefined, undefined, undefined); + } + ); } else {