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

Commit

Permalink
deps: Updated chakracore to 1.1.0.2
Browse files Browse the repository at this point in the history
* Contains a fix where chakracore fail to load because of missing
globalization.dlls on Win7 machine that doesn't have `IE11`.
Refer chakra-core/ChakraCore#202 for more details
  • Loading branch information
kunalspathak committed Jan 29, 2016
1 parent 88ce3d5 commit 668b620
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 34 deletions.
38 changes: 23 additions & 15 deletions deps/chakrashim/core/lib/Parser/CharClassifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,28 +619,36 @@ void Js::CharClassifier::initClassifier(ScriptContext * scriptContext, CharClass
if (es6ModeNeeded)
{
HRESULT hr = globalizationAdapter->EnsureDataTextObjectsInitialized(globLibrary);
// Failed to load windows.globalization.dll or jsintl.dll. No unicodeStatics support
// in that case.
if (FAILED(hr))
{
AssertMsg(false, "Failed to initialize COM interfaces, verify correct version of globalization dll is used.");
JavascriptError::MapAndThrowError(scriptContext, hr);
}

this->winGlobCharApi = globalizationAdapter->GetUnicodeStatics();
if (this->winGlobCharApi == nullptr)
{
// No fallback mode, then assert
if (es6FallbackMode == CharClassifierModes::ES6)
{
AssertMsg(false, "Windows::Data::Text::IUnicodeCharactersStatics not initialized");
//Fallback to ES5 just in case for fre builds.
es6FallbackMode = CharClassifierModes::ES5;
}
if (isES6UnicodeVerboseEnabled)
{
Output::Print(L"Windows::Data::Text::IUnicodeCharactersStatics not initialized\r\n");
}
//Default to non-es6
es6Supported = false;
es6FallbackMode = CharClassifierModes::ES5;
}
else
{
this->winGlobCharApi = globalizationAdapter->GetUnicodeStatics();
if (this->winGlobCharApi == nullptr)
{
// No fallback mode, then assert
if (es6FallbackMode == CharClassifierModes::ES6)
{
AssertMsg(false, "Windows::Data::Text::IUnicodeCharactersStatics not initialized");
//Fallback to ES5 just in case for fre builds.
es6FallbackMode = CharClassifierModes::ES5;
}
if (isES6UnicodeVerboseEnabled)
{
Output::Print(L"Windows::Data::Text::IUnicodeCharactersStatics not initialized\r\n");
}
//Default to non-es6
es6Supported = false;
}
}
}
#else
Expand Down
10 changes: 10 additions & 0 deletions deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ namespace Js
return E_NOTIMPL;
}

bool DelayLoadWindowsGlobalization::HasGlobalizationDllLoaded()
{
return this->hasGlobalizationDllLoaded;
}

HRESULT DelayLoadWindowsGlobalization::DllGetActivationFactory(
__in HSTRING activatibleClassId,
__out IActivationFactory** factory)
Expand Down Expand Up @@ -268,6 +273,11 @@ namespace Js
m_hModule = LoadLibraryEx(GetWin7LibraryName(), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
}

// Set the flag depending on Windows.globalization.dll or jsintl.dll was loaded successfully or not
if (m_hModule != nullptr)
{
hasGlobalizationDllLoaded = true;
}
this->winRTStringLibrary = winRTStringLibrary;
this->winRTStringsPresent = GetFunction("WindowsDuplicateString") != nullptr;
}
Expand Down
7 changes: 5 additions & 2 deletions deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ namespace Js
PFNCWDllGetActivationFactory m_pfnFNCWDllGetActivationFactory;

Js::DelayLoadWinRtString *winRTStringLibrary;
BOOL winRTStringsPresent;
bool winRTStringsPresent;
bool hasGlobalizationDllLoaded;

public:
DelayLoadWindowsGlobalization() : DelayLoadWinRtString(),
m_pfnFNCWDllGetActivationFactory(nullptr),
winRTStringLibrary(nullptr),
winRTStringsPresent(false) { }
winRTStringsPresent(false),
hasGlobalizationDllLoaded(false) { }

virtual ~DelayLoadWindowsGlobalization() { }

Expand All @@ -187,6 +189,7 @@ namespace Js
void Ensure(Js::DelayLoadWinRtString *winRTStringLibrary);

HRESULT DllGetActivationFactory(__in HSTRING activatibleClassId, __out IActivationFactory** factory);
bool HasGlobalizationDllLoaded();

HRESULT WindowsCreateString(_In_reads_opt_(length) const WCHAR * sourceString, UINT32 length, _Outptr_result_maybenull_ _Result_nullonfailure_ HSTRING * string) override;
HRESULT WindowsCreateStringReference(_In_reads_opt_(length+1) const WCHAR * sourceString, UINT32 length, _Out_ HSTRING_HEADER * header, _Outptr_result_maybenull_ _Result_nullonfailure_ HSTRING * string) override;
Expand Down
11 changes: 11 additions & 0 deletions deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5239,6 +5239,17 @@ void ScriptContext::RegisterPrototypeChainEnsuredToHaveOnlyWritableDataPropertie
return false;
}

bool ScriptContext::IsIntlEnabled()
{
if (GetConfig()->IsIntlEnabled())
{
// This will try to load globalization dlls if not already loaded.
Js::DelayLoadWindowsGlobalization* globLibrary = GetThreadContext()->GetWindowsGlobalizationLibrary();
return globLibrary->HasGlobalizationDllLoaded();
}
return false;
}


#ifdef INLINE_CACHE_STATS
void ScriptContext::LogCacheUsage(Js::PolymorphicInlineCache *cache, bool isGetter, Js::PropertyId propertyId, bool hit, bool collision)
Expand Down
1 change: 1 addition & 0 deletions deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ namespace Js
void RestoreRegexStacks(UnifiedRegex::RegexStacks *const contStack);

void InitializeGlobalObject();
bool IsIntlEnabled();
JavascriptLibrary* GetLibrary() const { return javascriptLibrary; }
const JavascriptLibraryBase* GetLibraryBase() const { return javascriptLibrary->GetLibraryBase(); }
#if DBG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ using namespace Windows::Globalization;

#pragma warning(pop)

#define IfCOMFailAssertMsgAndThrowHr(op) \
IfFailAssertMsgAndThrowHr(op, "Failed to initialize COM interfaces, verify correct version of globalization dll is used.")
#define IfCOMFailIgnoreSilentlyAndReturn(op) \
if(FAILED(hr=(op))) \
{ \
return; \
} \

#define IfFailAssertMsgAndThrowHr(op, msg) \
if (FAILED(hr=(op))) \
Expand Down Expand Up @@ -233,7 +236,7 @@ namespace Js
}
JavascriptLibrary* library = scriptContext->GetLibrary();
DynamicObject* commonObject = library->GetEngineInterfaceObject()->GetCommonNativeInterfaces();
if (scriptContext->GetConfig()->IsIntlEnabled())
if (scriptContext->IsIntlEnabled())
{
Assert(library->GetEngineInterfaceObject() != nullptr);
this->intlNativeInterfaces = DynamicObject::New(library->GetRecycler(),
Expand Down Expand Up @@ -383,28 +386,28 @@ namespace Js
JavascriptString* initType = nullptr;

//Ensure we have initialized all appropriate COM objects for the adapter (we will be using them now)
IfCOMFailAssertMsgAndThrowHr(GetWindowsGlobalizationAdapter(scriptContext)->EnsureCommonObjectsInitialized(library));
IfCOMFailIgnoreSilentlyAndReturn(globAdapter->EnsureCommonObjectsInitialized(library));
switch (intlInitializationType)
{
default:
AssertMsg(false, "Not a valid intlInitializationType.");
// fall thru
case IntlInitializationType::Intl:

IfCOMFailAssertMsgAndThrowHr(globAdapter->EnsureNumberFormatObjectsInitialized(library));
IfCOMFailAssertMsgAndThrowHr(globAdapter->EnsureDateTimeFormatObjectsInitialized(library));
IfCOMFailIgnoreSilentlyAndReturn(globAdapter->EnsureNumberFormatObjectsInitialized(library));
IfCOMFailIgnoreSilentlyAndReturn(globAdapter->EnsureDateTimeFormatObjectsInitialized(library));
initType = scriptContext->GetLibrary()->CreateStringFromCppLiteral(L"Intl");
break;
case IntlInitializationType::StringPrototype:
// No other windows globalization adapter needed. Common adapter should suffice
initType = scriptContext->GetLibrary()->CreateStringFromCppLiteral(L"String");
break;
case IntlInitializationType::DatePrototype:
IfCOMFailAssertMsgAndThrowHr(globAdapter->EnsureDateTimeFormatObjectsInitialized(library));
IfCOMFailIgnoreSilentlyAndReturn(globAdapter->EnsureDateTimeFormatObjectsInitialized(library));
initType = scriptContext->GetLibrary()->CreateStringFromCppLiteral(L"Date");
break;
case IntlInitializationType::NumberPrototype:
IfCOMFailAssertMsgAndThrowHr(globAdapter->EnsureNumberFormatObjectsInitialized(library));
IfCOMFailIgnoreSilentlyAndReturn(globAdapter->EnsureNumberFormatObjectsInitialized(library));
initType = scriptContext->GetLibrary()->CreateStringFromCppLiteral(L"Number");
break;
}
Expand Down
6 changes: 3 additions & 3 deletions deps/chakrashim/core/lib/Runtime/Library/JavascriptDate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ namespace Js
JavascriptDate* date = JavascriptDate::FromVar(args[0]);

#ifdef ENABLE_INTL_OBJECT
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->GetConfig()->IsIntlEnabled()){
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->IsIntlEnabled()){

EngineInterfaceObject* nativeEngineInterfaceObj = scriptContext->GetLibrary()->GetEngineInterfaceObject();
if (nativeEngineInterfaceObj)
Expand Down Expand Up @@ -1357,7 +1357,7 @@ namespace Js
JavascriptDate* date = JavascriptDate::FromVar(args[0]);

#ifdef ENABLE_INTL_OBJECT
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->GetConfig()->IsIntlEnabled()){
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->IsIntlEnabled()){

EngineInterfaceObject* nativeEngineInterfaceObj = scriptContext->GetLibrary()->GetEngineInterfaceObject();
if (nativeEngineInterfaceObj)
Expand Down Expand Up @@ -1416,7 +1416,7 @@ namespace Js
JavascriptDate* date = JavascriptDate::FromVar(args[0]);

#ifdef ENABLE_INTL_OBJECT
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->GetConfig()->IsIntlEnabled()){
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->IsIntlEnabled()){

EngineInterfaceObject* nativeEngineInterfaceObj = scriptContext->GetLibrary()->GetEngineInterfaceObject();
if (nativeEngineInterfaceObj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ namespace Js
AddMember(globalObject, PropertyIds::JSON, JSONObject);

#ifdef ENABLE_INTL_OBJECT
if (scriptContext->GetConfig()->IsIntlEnabled())
if (scriptContext->IsIntlEnabled())
{
IntlObject = DynamicObject::New(recycler,
DynamicType::New(scriptContext, TypeIds_Object, objectPrototype, nullptr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ namespace Js
}

#ifdef ENABLE_INTL_OBJECT
if(CONFIG_FLAG(IntlBuiltIns) && scriptContext->GetConfig()->IsIntlEnabled()){
if(CONFIG_FLAG(IntlBuiltIns) && scriptContext->IsIntlEnabled()){

EngineInterfaceObject* nativeEngineInterfaceObj = scriptContext->GetLibrary()->GetEngineInterfaceObject();
if (nativeEngineInterfaceObj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ namespace Js
GetThisAndSearchStringArguments(args, scriptContext, L"String.prototype.localeCompare", &pThis, &pThat, true);

#ifdef ENABLE_INTL_OBJECT
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->GetConfig()->IsIntlEnabled())
if (CONFIG_FLAG(IntlBuiltIns) && scriptContext->IsIntlEnabled())
{
EngineInterfaceObject* nativeEngineInterfaceObj = scriptContext->GetLibrary()->GetEngineInterfaceObject();
if (nativeEngineInterfaceObj)
Expand Down
2 changes: 1 addition & 1 deletion deps/chakrashim/core/lib/common/CommonDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define CHAKRA_CORE_MINOR_VERSION 1
#define CHAKRA_CORE_VERSION_RELEASE 1
#define CHAKRA_CORE_VERSION_PRERELEASE 0
#define CHAKRA_CORE_VERSION_RELEASE_QFE 1
#define CHAKRA_CORE_VERSION_RELEASE_QFE 2

#define CHAKRA_VERSION_RELEASE 0
#define CHAKRA_VERSION_PRERELEASE 1
Expand Down
4 changes: 2 additions & 2 deletions deps/chakrashim/core/test/es6/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
<files>unicode_6_identifiers.js</files>
<baseline>unicode_6_identifiers.baseline</baseline>
<compile-flags> -ES6Unicode</compile-flags>
<tags>exclude_ship</tags>
<tags>exclude_win7,exclude_ship</tags>
</default>
</test>
<test>
Expand Down Expand Up @@ -1005,7 +1005,7 @@
<test>
<default>
<files>bug_OS_2553885.js</files>
<tags>BugFix</tags>
<tags>exclude_win7,BugFix</tags>
</default>
</test>
<test>
Expand Down

0 comments on commit 668b620

Please sign in to comment.