Skip to content

Commit

Permalink
[MERGE #4217 @jackhorton] Intl-ICU on release/1.7 fixups
Browse files Browse the repository at this point in the history
Merge pull request #4217 from jackhorton:fix-mergeback-break

This pull supersedes #4187
  • Loading branch information
jackhorton committed Nov 14, 2017
2 parents 42789b2 + dc0869f commit 7b9c916
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
17 changes: 10 additions & 7 deletions lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp
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 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 7b9c916

Please sign in to comment.