25
25
26
26
// Platform specific code
27
27
#if defined(_WIN32 ) && defined(_MSC_VER )
28
- #include <oaidl .h>
28
+ #include <windows .h>
29
29
30
30
// Header macros
31
31
#define CHAKRA_CALLBACK CALLBACK
32
32
#define CHAKRA_API STDAPI_(JsErrorCode)
33
33
34
+ typedef unsigned char byte ;
34
35
typedef DWORD_PTR ChakraCookie ;
35
36
typedef BYTE * ChakraBytePtr ;
36
37
#else // Non-Windows VC++
@@ -41,6 +42,7 @@ typedef BYTE* ChakraBytePtr;
41
42
#define _In_z_
42
43
#define _In_opt_
43
44
#define _Inout_
45
+ #define _Inout_opt_
44
46
#define _Out_
45
47
#define _Out_opt_
46
48
#define _In_reads_ (x )
@@ -217,7 +219,7 @@ typedef unsigned short uint16_t;
217
219
/// </summary>
218
220
JsErrorInvalidContext ,
219
221
/// <summary>
220
- /// Module evaluation is called in wrong context .
222
+ /// The Module HostInfoKind provided was invalid .
221
223
/// </summary>
222
224
JsInvalidModuleHostInfoKind ,
223
225
/// <summary>
@@ -237,6 +239,7 @@ typedef unsigned short uint16_t;
237
239
/// Module was not yet evaluated when JsGetModuleNamespace was called.
238
240
/// </summary>
239
241
JsErrorModuleNotEvaluated ,
242
+
240
243
/// <summary>
241
244
/// Category of errors that relates to errors occurring within the engine itself.
242
245
/// </summary>
@@ -313,6 +316,18 @@ typedef unsigned short uint16_t;
313
316
/// VM was unable to perform the request action
314
317
/// </summary>
315
318
JsErrorDiagUnableToPerformAction ,
319
+ /// <summary>
320
+ /// Serializer/Deserializer does not support current data
321
+ /// </summary>
322
+ JsSerializerNotSupported ,
323
+ /// <summary>
324
+ /// Current object is not transferable during serialization
325
+ /// </summary>
326
+ JsTransferableNotSupported ,
327
+ /// <summary>
328
+ /// Current object is already detached when serialized
329
+ /// </summary>
330
+ JsTransferableAlreadyDetached ,
316
331
} JsErrorCode ;
317
332
318
333
/// <summary>
@@ -549,6 +564,10 @@ typedef unsigned short uint16_t;
549
564
/// This one needs to be set for Utf16
550
565
/// </summary>
551
566
JsParseScriptAttributeArrayBufferIsUtf16Encoded = 0x2 ,
567
+ /// <summary>
568
+ /// Script should be parsed in strict mode
569
+ /// </summary>
570
+ JsParseScriptAttributeStrictMode = 0x4 ,
552
571
} JsParseScriptAttributes ;
553
572
554
573
/// <summary>
@@ -624,6 +643,27 @@ typedef unsigned short uint16_t;
624
643
JsDataView = 12 ,
625
644
} JsValueType ;
626
645
646
+ typedef enum _JsScriptEncodingType
647
+ {
648
+ Utf8 ,
649
+ Utf16
650
+ } JsScriptEncodingType ;
651
+
652
+ typedef enum _JsScriptContainerType
653
+ {
654
+ HeapAllocatedBuffer
655
+ } JsScriptContainerType ;
656
+
657
+ typedef struct _JsScriptContents
658
+ {
659
+ void * container ;
660
+ JsScriptEncodingType encodingType ;
661
+ JsScriptContainerType containerType ;
662
+ JsSourceContext sourceContext ;
663
+ size_t contentLengthInBytes ;
664
+ WCHAR * fullPath ;
665
+ } JsScriptContents ;
666
+
627
667
/// <summary>
628
668
/// User implemented callback routine for memory allocation events
629
669
/// </summary>
@@ -922,7 +962,7 @@ typedef unsigned short uint16_t;
922
962
/// <remarks>
923
963
/// Removes a reference to a <c>JsRef</c> handle that was created by <c>JsAddRef</c>.
924
964
/// </remarks>
925
- /// <param name="ref">The object to add a reference to .</param>
965
+ /// <param name="ref">The object to remove the reference from .</param>
926
966
/// <param name="count">The object's new reference count (can pass in null).</param>
927
967
/// <returns>
928
968
/// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
@@ -996,7 +1036,7 @@ typedef unsigned short uint16_t;
996
1036
/// </returns>
997
1037
CHAKRA_API
998
1038
JsSetCurrentContext (
999
- _In_ JsContextRef context );
1039
+ _In_opt_ JsContextRef context );
1000
1040
1001
1041
/// <summary>
1002
1042
/// Gets the script context that the object belongs to.
@@ -1051,7 +1091,7 @@ typedef unsigned short uint16_t;
1051
1091
_Out_ JsRuntimeHandle * runtime );
1052
1092
1053
1093
/// <summary>
1054
- /// Tells the runtime to do any idle processing it need to do.
1094
+ /// Tells the runtime to do any idle processing it needs to do.
1055
1095
/// </summary>
1056
1096
/// <remarks>
1057
1097
/// <para>
@@ -2412,6 +2452,60 @@ typedef unsigned short uint16_t;
2412
2452
_In_opt_ JsPromiseContinuationCallback promiseContinuationCallback ,
2413
2453
_In_opt_ void * callbackState );
2414
2454
2455
+ /// <summary>
2456
+ /// Note: Experimental API
2457
+ /// Starts a request for background script parsing on another thread
2458
+ /// </summary>
2459
+ /// <param name="contents">ScriptContents struct with data needed to start parsing</param>
2460
+ /// <param name="dwBgParseCookie">Identifier for subsequent BGParse operations</param>
2461
+ /// <returns>
2462
+ /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
2463
+ /// </returns>
2464
+ CHAKRA_API
2465
+ JsQueueBackgroundParse_Experimental (
2466
+ _In_ JsScriptContents * contents ,
2467
+ _Out_ DWORD * dwBgParseCookie );
2468
+
2469
+ /// <summary>
2470
+ /// Note: Experimental API
2471
+ /// Appropriately frees resources associated with a previously queued background parse
2472
+ /// </summary>
2473
+ /// <param name="dwBgParseCookie">Identifier for BGParse operation</param>
2474
+ /// <param name="buffer">Pointer to script source buffer, used for validation</param>
2475
+ /// <param name="callerOwnsBuffer">When <c>true</c>, caller is responsible for freeing buffer</param>
2476
+ /// <returns>
2477
+ /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
2478
+ /// </returns>
2479
+ CHAKRA_API
2480
+ JsDiscardBackgroundParse_Experimental (
2481
+ _In_ DWORD dwBgParseCookie ,
2482
+ _In_ void * buffer ,
2483
+ _Out_ bool * callerOwnsBuffer );
2484
+
2485
+ /// <summary>
2486
+ /// Note: Experimental API
2487
+ /// Executes the background parsed script
2488
+ /// </summary>
2489
+ /// <param name="dwBgParseCookie">Identifier for subsequent BGParse operations</param>
2490
+ /// <param name="script">Pointer to script source</param>
2491
+ /// <param name="sourceContext">JsSourceContext identifier</param>
2492
+ /// <param name="url">Path to the parsed script</param>
2493
+ /// <param name="parseAttributes"></param>
2494
+ /// <param name="parserState">[May not be needed]</param>
2495
+ /// <param name="result">Result of script execution</param>
2496
+ /// <returns>
2497
+ /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
2498
+ /// </returns>
2499
+ CHAKRA_API
2500
+ JsExecuteBackgroundParse_Experimental (
2501
+ _In_ DWORD dwBgParseCookie ,
2502
+ _In_ JsValueRef script ,
2503
+ _In_ JsSourceContext sourceContext ,
2504
+ _In_ WCHAR * url ,
2505
+ _In_ JsParseScriptAttributes parseAttributes ,
2506
+ _In_ JsValueRef parserState ,
2507
+ _Out_ JsValueRef * result );
2508
+
2415
2509
#ifdef _WIN32
2416
2510
#include "ChakraCommonWindows.h"
2417
2511
#endif // _WIN32
0 commit comments