From 668b620a02f91f0373f8ad0786bc1da6687c5dbb Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 29 Jan 2016 10:46:00 -0800 Subject: [PATCH] deps: Updated chakracore to 1.1.0.2 * Contains a fix where chakracore fail to load because of missing globalization.dlls on Win7 machine that doesn't have `IE11`. Refer Microsoft/chakracore#202 for more details --- .../core/lib/Parser/CharClassifier.cpp | 38 +++++++++++-------- .../lib/Runtime/Base/DelayLoadLibrary.cpp | 10 +++++ .../core/lib/Runtime/Base/DelayLoadLibrary.h | 7 +++- .../core/lib/Runtime/Base/ScriptContext.cpp | 11 ++++++ .../core/lib/Runtime/Base/ScriptContext.h | 1 + .../IntlEngineInterfaceExtensionObject.cpp | 19 ++++++---- .../lib/Runtime/Library/JavascriptDate.cpp | 6 +-- .../lib/Runtime/Library/JavascriptLibrary.cpp | 2 +- .../lib/Runtime/Library/JavascriptNumber.cpp | 2 +- .../lib/Runtime/Library/JavascriptString.cpp | 2 +- .../core/lib/common/CommonDefines.h | 2 +- deps/chakrashim/core/test/es6/rlexe.xml | 4 +- 12 files changed, 70 insertions(+), 34 deletions(-) diff --git a/deps/chakrashim/core/lib/Parser/CharClassifier.cpp b/deps/chakrashim/core/lib/Parser/CharClassifier.cpp index ceca04eba1d..9e3a291c9d7 100644 --- a/deps/chakrashim/core/lib/Parser/CharClassifier.cpp +++ b/deps/chakrashim/core/lib/Parser/CharClassifier.cpp @@ -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 diff --git a/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.cpp b/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.cpp index d780ddf327e..a5e61042a38 100644 --- a/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.cpp +++ b/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.cpp @@ -176,6 +176,11 @@ namespace Js return E_NOTIMPL; } + bool DelayLoadWindowsGlobalization::HasGlobalizationDllLoaded() + { + return this->hasGlobalizationDllLoaded; + } + HRESULT DelayLoadWindowsGlobalization::DllGetActivationFactory( __in HSTRING activatibleClassId, __out IActivationFactory** factory) @@ -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; } diff --git a/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.h b/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.h index c6c294bf3b2..2dfc42807a5 100644 --- a/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.h +++ b/deps/chakrashim/core/lib/Runtime/Base/DelayLoadLibrary.h @@ -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() { } @@ -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; diff --git a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp index a82504e6f73..3a0334287f9 100644 --- a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp +++ b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp @@ -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) diff --git a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h index 28fa9140321..832cfb943ab 100644 --- a/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h +++ b/deps/chakrashim/core/lib/Runtime/Base/ScriptContext.h @@ -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 diff --git a/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp b/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp index e7f4bf4be0d..4861639e574 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp +++ b/deps/chakrashim/core/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp @@ -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))) \ @@ -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(), @@ -383,7 +386,7 @@ 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: @@ -391,8 +394,8 @@ namespace Js // 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: @@ -400,11 +403,11 @@ namespace Js 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; } diff --git a/deps/chakrashim/core/lib/Runtime/Library/JavascriptDate.cpp b/deps/chakrashim/core/lib/Runtime/Library/JavascriptDate.cpp index 64433e7c7ef..aabb77c7d81 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/JavascriptDate.cpp +++ b/deps/chakrashim/core/lib/Runtime/Library/JavascriptDate.cpp @@ -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) @@ -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) @@ -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) diff --git a/deps/chakrashim/core/lib/Runtime/Library/JavascriptLibrary.cpp b/deps/chakrashim/core/lib/Runtime/Library/JavascriptLibrary.cpp index e1fdf868b18..f2f543ace7a 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/JavascriptLibrary.cpp +++ b/deps/chakrashim/core/lib/Runtime/Library/JavascriptLibrary.cpp @@ -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, diff --git a/deps/chakrashim/core/lib/Runtime/Library/JavascriptNumber.cpp b/deps/chakrashim/core/lib/Runtime/Library/JavascriptNumber.cpp index 4a687efbe37..8a8593bfc18 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/JavascriptNumber.cpp +++ b/deps/chakrashim/core/lib/Runtime/Library/JavascriptNumber.cpp @@ -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) diff --git a/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp b/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp index f37d23124b8..4652e2532ae 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp +++ b/deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp @@ -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) diff --git a/deps/chakrashim/core/lib/common/CommonDefines.h b/deps/chakrashim/core/lib/common/CommonDefines.h index 1d9fd6783c3..673051e69f5 100644 --- a/deps/chakrashim/core/lib/common/CommonDefines.h +++ b/deps/chakrashim/core/lib/common/CommonDefines.h @@ -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 diff --git a/deps/chakrashim/core/test/es6/rlexe.xml b/deps/chakrashim/core/test/es6/rlexe.xml index 68b5a7bbdd0..b7bb4d3ca07 100644 --- a/deps/chakrashim/core/test/es6/rlexe.xml +++ b/deps/chakrashim/core/test/es6/rlexe.xml @@ -507,7 +507,7 @@ unicode_6_identifiers.js unicode_6_identifiers.baseline -ES6Unicode - exclude_ship + exclude_win7,exclude_ship @@ -1005,7 +1005,7 @@ bug_OS_2553885.js - BugFix + exclude_win7,BugFix