Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
[Merge chakra-core/ChakraCore@7b9c916c04] [MERGE #4217 @jackhorton] I…
Browse files Browse the repository at this point in the history
…ntl-ICU on release/1.7 fixups

Merge pull request #4217 from jackhorton:fix-mergeback-break

This pull supersedes #4187
  • Loading branch information
chakrabot authored and kfarnung committed Jan 9, 2018
1 parent 96bfc46 commit 8fc6b23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);

Expand All @@ -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, ...)
Expand Down
12 changes: 10 additions & 2 deletions deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1347,12 +1347,20 @@ namespace Js
EngineInterfaceObject* nativeEngineInterfaceObj = scriptContext->GetLibrary()->GetEngineInterfaceObject();
if (nativeEngineInterfaceObj)
{
IntlEngineInterfaceExtensionObject* intlExtensionObject = static_cast<IntlEngineInterfaceExtensionObject*>(nativeEngineInterfaceObj->GetEngineExtension(EngineInterfaceExtensionKind_Intl));
IntlEngineInterfaceExtensionObject* intlExtensionObject = static_cast<IntlEngineInterfaceExtensionObject*>(
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
{
Expand Down

0 comments on commit 8fc6b23

Please sign in to comment.