Explorar el Código

code review feedback; pass in linux
Disable module tests in linux for now while I figure out why the import entries
don't get resolved correctly in ch.

Yong Qu hace 9 años
padre
commit
28f2bb17bd

+ 3 - 3
bin/ch/WScriptJsrt.cpp

@@ -240,7 +240,7 @@ JsValueRef WScriptJsrt::LoadScriptHelper(JsValueRef callee, bool isConstructCall
 
         if (!freeFileName)
         {
-            sprintf_s(fileNameBuffer, "script%i.js", (int)sourceContext);
+            sprintf_s(fileNameBuffer, MAX_PATH, "script%i.js", (int)sourceContext);
             fileNameNarrow = fileNameBuffer;
         }
 
@@ -278,10 +278,10 @@ Error:
 JsErrorCode WScriptJsrt::InitializeModuleInfo(JsValueRef specifier, JsModuleRecord moduleRecord)
 {
     JsErrorCode errorCode = JsNoError;
-    errorCode = ChakraRTInterface::JsSetModuleHostInfo(moduleRecord, JsModuleHostInfo_FetchImportedModuleCallback, WScriptJsrt::FetchImportedModule);
+    errorCode = ChakraRTInterface::JsSetModuleHostInfo(moduleRecord, JsModuleHostInfo_FetchImportedModuleCallback, (void*)WScriptJsrt::FetchImportedModule);
     if (errorCode == JsNoError)
     {
-        errorCode = ChakraRTInterface::JsSetModuleHostInfo(moduleRecord, JsModuleHostInfo_NotifyModuleReadyCallback, WScriptJsrt::NotifyModuleReadyCallback);
+        errorCode = ChakraRTInterface::JsSetModuleHostInfo(moduleRecord, JsModuleHostInfo_NotifyModuleReadyCallback, (void*)WScriptJsrt::NotifyModuleReadyCallback);
     }
     if (errorCode == JsNoError)
     {

+ 6 - 1
bin/ch/stdafx.h

@@ -25,6 +25,9 @@
 
 #define ENABLE_TEST_HOOKS 1
 #include "CommonDefines.h"
+#include <map>
+
+#include <map>
 
 #ifdef _WIN32
 #include <windows.h>
@@ -63,6 +66,9 @@
 #if defined(DBG)
 
 #define _STRINGIZE_(x) #x
+#if !defined(_STRINGIZE)
+#define _STRINGIZE(x) _STRINGIZE_(x)
+#endif
 
 #define AssertMsg(exp, comment)   \
 do { \
@@ -82,7 +88,6 @@ if (!(exp)) \
 #include "ChakraCore.h"
 #include "Core/CommonTypedefs.h"
 #include "TestHooksRt.h"
-#include <map>
 
 typedef void * Var;
 

+ 2 - 3
lib/Jsrt/ChakraCore.h

@@ -46,7 +46,7 @@ typedef enum JsModuleHostInfoKind
 /// </summary>
 /// <remarks>
 /// Notify the host of the dependent module, the "import" part before HostResolveImportedModule.
-/// This notify the host that the refererncing module has the specified module dependency, and the host need to retrieve the module back
+/// This notifies the host that the referencing module has the specified module dependency, and the host need to retrieve the module back.
 /// </remarks>
 /// <param name="referencingModule">The referencing module that is requesting the dependency modules</param>
 /// <param name="specifier">The speceifier coming from the module source code.</param>
@@ -63,8 +63,8 @@ typedef JsErrorCode(CHAKRA_CALLBACK * FetchImportedModuleCallBack)(_In_ JsModule
 /// <remarks>
 /// Notify the host after ModuleDeclarationInstantiation step (15.2.1.1.6.4) is finished. If there were error in the process, exceptionVar
 /// holds the exception. otherwise the referencingModule is ready and the host should schedule execution afterwards.
-/// referencingModule       : the referencing module that have finished running ModuleDeclarationInstantiation step.
 /// </remarks>
+/// <param name="referencingModule</param>the referencing module that have finished running ModuleDeclarationInstantiation step.
 /// <param name="exceptionVar">If nullptr, the module is successfully initialized and host should queue the execution job
 ///                           otherwise it's the exception object.</param>
 /// <returns>
@@ -80,7 +80,6 @@ typedef JsErrorCode(CHAKRA_CALLBACK * NotifyModuleReadyCallback)(_In_opt_ JsModu
 /// </remarks>
 /// <param name="referencingModule">The referencingModule as in HostResolveImportedModule (15.2.1.17). nullptr if this is the top level module.</param>
 /// <param name="normalizedSpecifier">The host normalized specifier. This is the key to a unique ModuleRecord.</param>
-/// <param name="specifierLength">The length of normalizedSpecifier.</param>
 /// <param name="moduleRecord">The new ModuleRecord created. The host should not try to call this API twice with the same normalizedSpecifier.
 ///                           chakra will return an existing ModuleRecord if the specifier was passed in before.</param>
 /// <returns>

+ 6 - 1
lib/Jsrt/Core/JsrtCore.cpp

@@ -110,6 +110,10 @@ JsModuleEvaluation(
     {
         return JsErrorModuleEvaluated;
     }
+    if (result != nullptr)
+    {
+        *result = JS_INVALID_REFERENCE;
+    }
     Js::ScriptContext* scriptContext = moduleRecord->GetScriptContext();
     JsrtContext* jsrtContext = (JsrtContext*)scriptContext->GetLibrary()->GetPinnedJsrtContextObject();
     JsErrorCode errorCode = SetContextAPIWrapper(jsrtContext, [&](Js::ScriptContext *scriptContext) -> JsErrorCode {
@@ -171,10 +175,11 @@ JsGetModuleHostInfo(
     _In_ JsModuleHostInfoKind moduleHostInfo,
     _Outptr_result_maybenull_ void** hostInfo)
 {
-    if (!Js::SourceTextModuleRecord::Is(requestModule))
+    if (!Js::SourceTextModuleRecord::Is(requestModule) || (hostInfo == nullptr))
     {
         return JsErrorInvalidArgument;
     }
+    *hostInfo = nullptr;
     Js::SourceTextModuleRecord* moduleRecord = Js::SourceTextModuleRecord::FromHost(requestModule);
     Js::ScriptContext* scriptContext = moduleRecord->GetScriptContext();
     JsrtContext* jsrtContext = (JsrtContext*)scriptContext->GetLibrary()->GetPinnedJsrtContextObject();

+ 5 - 1
lib/Jsrt/JsrtCommonExports.inc

@@ -11,7 +11,11 @@
     JsGetContextData
     JsSetContextData
     JsRunScript
-    JsExperimentalApiRunModule
+    JsInitializeModuleRecord
+    JsParseModuleSource
+    JsModuleEvaluation
+    JsSetModuleHostInfo
+    JsGetModuleHostInfo
     JsGetUndefinedValue
     JsGetNullValue
     JsGetTrueValue

+ 1 - 1
test/es6/moduletest1.js

@@ -2,4 +2,4 @@
 // Copyright (C) Microsoft. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
-WScript.LoadScriptFile("passModule.JS", "module");
+WScript.LoadScriptFile("passmodule.js", "module");

+ 8 - 3
test/es6/rlexe.xml

@@ -1243,32 +1243,35 @@
   <default>
     <files>await-futreserved-only-in-modules.js</files>
     <compile-flags>-ES6Module</compile-flags>
-    <tags>exclude_dynapogo</tags>
+    <tags>exclude_dynapogo, exclude_xplat</tags>
   </default>
 </test>
   <test>
     <default>
       <files>moduletest1.js</files>
       <compile-flags>-ES6Module</compile-flags>
-      <tags>exclude_dynapogo</tags>
+      <tags>exclude_dynapogo, exclude_xplat</tags>
     </default>
   </test>
 <test>
     <default>
         <files>module-syntax.js</files>
         <compile-flags>-ES6Module -args summary -endargs</compile-flags>
+        <tags>exclude_xplat</tags>
     </default>
 </test>
 <test>
     <default>
         <files>module-syntax1.js</files>
         <compile-flags>-ES6Module -args summary -endargs</compile-flags>
+        <tags>exclude_xplat</tags>
     </default>
 </test>
 <test>
     <default>
         <files>module-functionality.js</files>
         <compile-flags>-ES6Module  -ES7AsyncAwait -args summary -endargs</compile-flags>
+        <tags>exclude_xplat</tags>
     </default>
 </test>
 <test>
@@ -1276,19 +1279,21 @@
         <files>ModuleLateSyntaxErrors.js</files>
         <baseline>ModuleLateSyntaxErrors.baseline</baseline>
         <compile-flags>-ES6Module -ES7AsyncAwait</compile-flags>
-        <tags>exclude_dynapogo</tags>
+        <tags>exclude_dynapogo,exclude_xplat</tags>
     </default>
 </test>
 <test>
     <default>
         <files>module-syntax.js</files>
         <compile-flags>-ES6Module -force:deferparse -args summary -endargs</compile-flags>
+        <tags>exclude_xplat</tags>
     </default>
 </test>
 <test>
     <default>
         <files>module-syntax1.js</files>
         <compile-flags>-ES6Module -force:deferparse -args summary -endargs</compile-flags>
+        <tags>exclude_xplat</tags>
     </default>
 </test>
 <test>