-
Notifications
You must be signed in to change notification settings - Fork 1
/
ChakraCore.cs
3835 lines (3435 loc) · 260 KB
/
ChakraCore.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace ChakraSharp
{
public enum JsParseModuleSourceFlags
{
JsParseModuleSourceFlagsDataIsUTF16LE = 0,
JsParseModuleSourceFlagsDataIsUTF8 = 1
}
public enum JsModuleHostInfoKind
{
JsModuleHostInfoException = 1,
JsModuleHostInfoHostDefined = 2,
JsModuleHostInfoNotifyModuleReadyCallback = 3,
JsModuleHostInfoFetchImportedModuleCallback = 4,
JsModuleHostInfoFetchImportedModuleFromScriptCallback = 5,
JsModuleHostInfoUrl = 6
}
public class JsModuleRecord { }
// <summary>A reference to an object owned by the SharedArrayBuffer.</summary>
// <remarks>This represents SharedContents which is heap allocated object, it can be passed through different runtimes to share the underlying buffer.</remarks>
public class JsSharedArrayBufferContentHandle { }
// <summary>User implemented callback to fetch additional imported modules.</summary>
// <remarks>Notify the host to fetch the dependent module. This is the "import" part before HostResolveImportedModule in ES6 spec. 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 specifier coming from the module source code.</param>
// <param name="dependentModuleRecord">The ModuleRecord of the dependent module. If the module was requested before from other source, return the existing ModuleRecord, otherwise return a newly created ModuleRecord.</param>
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(global::System.Runtime.InteropServices.CallingConvention.Cdecl)]
public unsafe delegate global::ChakraSharp.JsErrorCode FetchImportedModuleCallBack(global::System.IntPtr referencingModule, global::System.IntPtr specifier, global::System.IntPtr* dependentModuleRecord);
// <summary>User implemented callback to get notification when the module is ready.</summary>
// <remarks>Notify the host after ModuleDeclarationInstantiation step (15.2.1.1.6.4) is finished. If there was error in the process, exceptionVar holds the exception. Otherwise the referencingModule is ready and the host should schedule execution afterwards.</remarks>
// <param name="referencingModule">The referencing module that have finished running ModuleDeclarationInstantiation step.</param>
// <param name="exceptionVar">If nullptr, the module is successfully initialized and host should queue the execution job otherwise it's the exception object.</param>
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(global::System.Runtime.InteropServices.CallingConvention.Cdecl)]
public unsafe delegate global::ChakraSharp.JsErrorCode FetchImportedModuleFromScriptCallBack(ulong dwReferencingSourceContext, global::System.IntPtr specifier, global::System.IntPtr* dependentModuleRecord);
// <summary>User implemented callback to get notification when the module is ready.</summary>
// <remarks>Notify the host after ModuleDeclarationInstantiation step (15.2.1.1.6.4) is finished. If there was error in the process, exceptionVar holds the exception. Otherwise the referencingModule is ready and the host should schedule execution afterwards.</remarks>
// <param name="dwReferencingSourceContext">The referencing script that calls import()</param>
// <param name="exceptionVar">If nullptr, the module is successfully initialized and host should queue the execution job otherwise it's the exception object.</param>
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(global::System.Runtime.InteropServices.CallingConvention.Cdecl)]
public unsafe delegate global::ChakraSharp.JsErrorCode NotifyModuleReadyCallback(global::System.IntPtr referencingModule, global::System.IntPtr exceptionVar);
// <summary>Called by the runtime to load the source code of the serialized script.</summary>
// <param name="sourceContext">The context passed to Js[Parse|Run]SerializedScriptCallback</param>
// <param name="script">The script returned.</param>
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(global::System.Runtime.InteropServices.CallingConvention.Cdecl)]
public unsafe delegate bool JsSerializedLoadScriptCallback(ulong sourceContext, global::System.IntPtr* value, global::ChakraSharp.JsParseScriptAttributes* parseAttributes);
// <summary>A weak reference to a JavaScript value.</summary>
// <remarks>A value with only weak references is available for garbage-collection. A strong reference to the value (JsValueRef) may be obtained from a weak reference if the value happens to still be available.</remarks>
public unsafe partial class ChakraCore
{
public partial struct __Internal
{
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsInitializeModuleRecord")]
internal static extern global::ChakraSharp.JsErrorCode JsInitializeModuleRecord_0(global::System.IntPtr referencingModule, global::System.IntPtr normalizedSpecifier, global::System.IntPtr* moduleRecord);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsParseModuleSource")]
internal static extern global::ChakraSharp.JsErrorCode JsParseModuleSource_0(global::System.IntPtr requestModule, ulong sourceContext, byte* script, uint scriptLength, global::ChakraSharp.JsParseModuleSourceFlags sourceFlag, global::System.IntPtr* exceptionValueRef);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsModuleEvaluation")]
internal static extern global::ChakraSharp.JsErrorCode JsModuleEvaluation_0(global::System.IntPtr requestModule, global::System.IntPtr* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsSetModuleHostInfo")]
internal static extern global::ChakraSharp.JsErrorCode JsSetModuleHostInfo_0(global::System.IntPtr requestModule, global::ChakraSharp.JsModuleHostInfoKind moduleHostInfo, global::System.IntPtr hostInfo);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsGetModuleHostInfo")]
internal static extern global::ChakraSharp.JsErrorCode JsGetModuleHostInfo_0(global::System.IntPtr requestModule, global::ChakraSharp.JsModuleHostInfoKind moduleHostInfo, global::System.IntPtr* hostInfo);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsGetAndClearExceptionWithMetadata")]
internal static extern global::ChakraSharp.JsErrorCode JsGetAndClearExceptionWithMetadata_0(global::System.IntPtr* metadata);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCreateString")]
internal static extern global::ChakraSharp.JsErrorCode JsCreateString_0([MarshalAs(UnmanagedType.LPStr)] string content, ulong length, global::System.IntPtr* value);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCreateStringUtf16")]
internal static extern global::ChakraSharp.JsErrorCode JsCreateStringUtf16_0(uint* content, ulong length, global::System.IntPtr* value);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCopyString")]
internal static extern global::ChakraSharp.JsErrorCode JsCopyString_0(global::System.IntPtr value, sbyte* buffer, ulong bufferSize, uint* length);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCopyStringUtf16")]
internal static extern global::ChakraSharp.JsErrorCode JsCopyStringUtf16_0(global::System.IntPtr value, int start, int length, uint* buffer, uint* written);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsParse")]
internal static extern global::ChakraSharp.JsErrorCode JsParse_0(global::System.IntPtr script, ulong sourceContext, global::System.IntPtr sourceUrl, global::ChakraSharp.JsParseScriptAttributes parseAttributes, global::System.IntPtr* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsRun")]
internal static extern global::ChakraSharp.JsErrorCode JsRun_0(global::System.IntPtr script, ulong sourceContext, global::System.IntPtr sourceUrl, global::ChakraSharp.JsParseScriptAttributes parseAttributes, global::System.IntPtr* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCreatePropertyId")]
internal static extern global::ChakraSharp.JsErrorCode JsCreatePropertyId_0([MarshalAs(UnmanagedType.LPStr)] string name, ulong length, global::System.IntPtr* propertyId);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCopyPropertyId")]
internal static extern global::ChakraSharp.JsErrorCode JsCopyPropertyId_0(global::System.IntPtr propertyId, sbyte* buffer, ulong bufferSize, uint* length);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsSerialize")]
internal static extern global::ChakraSharp.JsErrorCode JsSerialize_0(global::System.IntPtr script, global::System.IntPtr* buffer, global::ChakraSharp.JsParseScriptAttributes parseAttributes);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsParseSerialized")]
internal static extern global::ChakraSharp.JsErrorCode JsParseSerialized_0(global::System.IntPtr buffer, global::System.IntPtr scriptLoadCallback, ulong sourceContext, global::System.IntPtr sourceUrl, global::System.IntPtr* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsRunSerialized")]
internal static extern global::ChakraSharp.JsErrorCode JsRunSerialized_0(global::System.IntPtr buffer, global::System.IntPtr scriptLoadCallback, ulong sourceContext, global::System.IntPtr sourceUrl, global::System.IntPtr* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCreatePromise")]
internal static extern global::ChakraSharp.JsErrorCode JsCreatePromise_0(global::System.IntPtr* promise, global::System.IntPtr* resolveFunction, global::System.IntPtr* rejectFunction);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCreateWeakReference")]
internal static extern global::ChakraSharp.JsErrorCode JsCreateWeakReference_0(global::System.IntPtr value, global::System.IntPtr* weakRef);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsGetWeakReferenceValue")]
internal static extern global::ChakraSharp.JsErrorCode JsGetWeakReferenceValue_0(global::System.IntPtr weakRef, global::System.IntPtr* value);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCreateSharedArrayBufferWithSharedContent")]
internal static extern global::ChakraSharp.JsErrorCode JsCreateSharedArrayBufferWithSharedContent_0(global::System.IntPtr sharedContents, global::System.IntPtr* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsGetSharedArrayBufferContent")]
internal static extern global::ChakraSharp.JsErrorCode JsGetSharedArrayBufferContent_0(global::System.IntPtr sharedArrayBuffer, global::System.IntPtr* sharedContents);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsReleaseSharedArrayBufferContentHandle")]
internal static extern global::ChakraSharp.JsErrorCode JsReleaseSharedArrayBufferContentHandle_0(global::System.IntPtr sharedContents);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsHasOwnProperty")]
internal static extern global::ChakraSharp.JsErrorCode JsHasOwnProperty_0(global::System.IntPtr targetObject, global::System.IntPtr propertyId, bool* hasOwnProperty);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsCopyStringOneByte")]
internal static extern global::ChakraSharp.JsErrorCode JsCopyStringOneByte_0(global::System.IntPtr value, int start, int length, sbyte* buffer, uint* written);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsGetDataViewInfo")]
internal static extern global::ChakraSharp.JsErrorCode JsGetDataViewInfo_0(global::System.IntPtr dataView, global::System.IntPtr* arrayBuffer, uint* byteOffset, uint* byteLength);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsLessThan")]
internal static extern global::ChakraSharp.JsErrorCode JsLessThan_0(global::System.IntPtr object1, global::System.IntPtr object2, bool* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsLessThanOrEqual")]
internal static extern global::ChakraSharp.JsErrorCode JsLessThanOrEqual_0(global::System.IntPtr object1, global::System.IntPtr object2, bool* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsObjectGetProperty")]
internal static extern global::ChakraSharp.JsErrorCode JsObjectGetProperty_0(global::System.IntPtr targetObject, global::System.IntPtr key, global::System.IntPtr* value);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsObjectSetProperty")]
internal static extern global::ChakraSharp.JsErrorCode JsObjectSetProperty_0(global::System.IntPtr targetObject, global::System.IntPtr key, global::System.IntPtr value, bool useStrictRules);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsObjectHasProperty")]
internal static extern global::ChakraSharp.JsErrorCode JsObjectHasProperty_0(global::System.IntPtr targetObject, global::System.IntPtr key, bool* hasProperty);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsObjectDefineProperty")]
internal static extern global::ChakraSharp.JsErrorCode JsObjectDefineProperty_0(global::System.IntPtr targetObject, global::System.IntPtr key, global::System.IntPtr propertyDescriptor, bool* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsObjectDeleteProperty")]
internal static extern global::ChakraSharp.JsErrorCode JsObjectDeleteProperty_0(global::System.IntPtr targetObject, global::System.IntPtr key, bool useStrictRules, global::System.IntPtr* result);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsObjectGetOwnPropertyDescriptor")]
internal static extern global::ChakraSharp.JsErrorCode JsObjectGetOwnPropertyDescriptor_0(global::System.IntPtr targetObject, global::System.IntPtr key, global::System.IntPtr* propertyDescriptor);
[SuppressUnmanagedCodeSecurity]
[DllImport("ChakraCore", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="JsObjectHasOwnProperty")]
internal static extern global::ChakraSharp.JsErrorCode JsObjectHasOwnProperty_0(global::System.IntPtr targetObject, global::System.IntPtr key, bool* hasOwnProperty);
}
// <summary>Initialize a ModuleRecord from host</summary>
// <remarks>Bootstrap the module loading process by creating a new module record.</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="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>
public static global::ChakraSharp.JsErrorCode JsInitializeModuleRecord(global::System.IntPtr referencingModule, global::System.IntPtr normalizedSpecifier, out global::System.IntPtr moduleRecord)
{
global::System.IntPtr _moduleRecord;
var __arg2 = &_moduleRecord;
var __ret = __Internal.JsInitializeModuleRecord_0(referencingModule, normalizedSpecifier, __arg2);
moduleRecord = _moduleRecord;
return __ret;
}
// <summary>Parse the module source</summary>
// <remarks>This is basically ParseModule operation in ES6 spec. It is slightly different in that the ModuleRecord was initialized earlier, and passed in as an argument.</remarks>
// <param name="requestModule">The ModuleRecord that holds the parse tree of the source code.</param>
// <param name="sourceContext">A cookie identifying the script that can be used by debuggable script contexts.</param>
// <param name="script">The source script to be parsed, but not executed in this code.</param>
// <param name="scriptLength">The source length of sourceText. The input might contain embedded null.</param>
// <param name="sourceFlag">The type of the source code passed in. It could be UNICODE or utf8 at this time.</param>
// <param name="exceptionValueRef">The error object if there is parse error.</param>
public static global::ChakraSharp.JsErrorCode JsParseModuleSource(global::System.IntPtr requestModule, ulong sourceContext, byte* script, uint scriptLength, global::ChakraSharp.JsParseModuleSourceFlags sourceFlag, out global::System.IntPtr exceptionValueRef)
{
global::System.IntPtr _exceptionValueRef;
var __arg5 = &_exceptionValueRef;
var __ret = __Internal.JsParseModuleSource_0(requestModule, sourceContext, script, scriptLength, sourceFlag, __arg5);
exceptionValueRef = _exceptionValueRef;
return __ret;
}
// <summary>Execute module code.</summary>
// <remarks>This method implements 15.2.1.1.6.5, "ModuleEvaluation" concrete method. When this methid is called, the chakra engine should have notified the host that the module and all its dependent are ready to be executed. One moduleRecord will be executed only once. Additional execution call on the same moduleRecord will fail.</remarks>
// <param name="requestModule">The module to be executed.</param>
// <param name="result">The return value of the module.</param>
public static global::ChakraSharp.JsErrorCode JsModuleEvaluation(global::System.IntPtr requestModule, out global::System.IntPtr result)
{
global::System.IntPtr _result;
var __arg1 = &_result;
var __ret = __Internal.JsModuleEvaluation_0(requestModule, __arg1);
result = _result;
return __ret;
}
// <summary>Set the host info for the specified module.</summary>
// <param name="requestModule">The request module.</param>
// <param name="moduleHostInfo">The type of host info to be set.</param>
// <param name="hostInfo">The host info to be set.</param>
public static global::ChakraSharp.JsErrorCode JsSetModuleHostInfo(global::System.IntPtr requestModule, global::ChakraSharp.JsModuleHostInfoKind moduleHostInfo, global::System.IntPtr hostInfo)
{
var __ret = __Internal.JsSetModuleHostInfo_0(requestModule, moduleHostInfo, hostInfo);
return __ret;
}
// <summary>Retrieve the host info for the specified module.</summary>
// <param name="requestModule">The request module.</param>
// <param name="moduleHostInfo">The type of host info to get.</param>
// <param name="hostInfo">The host info to be retrieved.</param>
public static global::ChakraSharp.JsErrorCode JsGetModuleHostInfo(global::System.IntPtr requestModule, global::ChakraSharp.JsModuleHostInfoKind moduleHostInfo, out global::System.IntPtr hostInfo)
{
global::System.IntPtr _hostInfo;
var __arg2 = &_hostInfo;
var __ret = __Internal.JsGetModuleHostInfo_0(requestModule, moduleHostInfo, __arg2);
hostInfo = _hostInfo;
return __ret;
}
// <summary>Returns metadata relating to the exception that caused the runtime of the current context to be in the exception state and resets the exception state for that runtime. The metadata includes a reference to the exception itself.</summary>
// <remarks>If the runtime of the current context is not in an exception state, this API will return JsErrorInvalidArgument. If the runtime is disabled, this will return an exception indicating that the script was terminated, but it will not clear the exception (the exception will be cleared if the runtime is re-enabled using JsEnableRuntimeExecution). The metadata value is a javascript object with the following properties: exception, the thrown exception object; line, the 0 indexed line number where the exception was thrown; column, the 0 indexed column number where the exception was thrown; length, the source-length of the cause of the exception; source, a string containing the line of source code where the exception was thrown; and url, a string containing the name of the script file containing the code that threw the exception. Requires an active script context.</remarks>
// <param name="metadata">The exception metadata for the runtime of the current context.</param>
public static global::ChakraSharp.JsErrorCode JsGetAndClearExceptionWithMetadata(out global::System.IntPtr metadata)
{
global::System.IntPtr _metadata;
var __arg0 = &_metadata;
var __ret = __Internal.JsGetAndClearExceptionWithMetadata_0(__arg0);
metadata = _metadata;
return __ret;
}
// <summary>Create JavascriptString variable from ASCII or Utf8 string</summary>
// <remarks>Requires an active script context. Input string can be either ASCII or Utf8</remarks>
// <param name="content">Pointer to string memory.</param>
// <param name="length">Number of bytes within the string</param>
// <param name="value">JsValueRef representing the JavascriptString</param>
public static global::ChakraSharp.JsErrorCode JsCreateString(string content, ulong length, out global::System.IntPtr value)
{
global::System.IntPtr _value;
var __arg2 = &_value;
var __ret = __Internal.JsCreateString_0(content, length, __arg2);
value = _value;
return __ret;
}
// <summary>Create JavascriptString variable from Utf16 string</summary>
// <remarks>Requires an active script context. Expects Utf16 string</remarks>
// <param name="content">Pointer to string memory.</param>
// <param name="length">Number of characters within the string</param>
// <param name="value">JsValueRef representing the JavascriptString</param>
public static global::ChakraSharp.JsErrorCode JsCreateStringUtf16(ref uint content, ulong length, out global::System.IntPtr value)
{
fixed (uint* __refParamPtr0 = &content)
{
var __arg0 = __refParamPtr0;
global::System.IntPtr _value;
var __arg2 = &_value;
var __ret = __Internal.JsCreateStringUtf16_0(__arg0, length, __arg2);
value = _value;
return __ret;
}
}
// <summary>Write JavascriptString value into C string buffer (Utf8)</summary>
// <remarks>When size of the `buffer` is unknown, `buffer` argument can be nullptr. In that case, `length` argument will return the length needed.</remarks>
// <param name="value">JavascriptString value</param>
// <param name="buffer">Pointer to buffer</param>
// <param name="bufferSize">Buffer size</param>
// <param name="length">Total number of characters needed or written</param>
public static global::ChakraSharp.JsErrorCode JsCopyString(global::System.IntPtr value, sbyte* buffer, ulong bufferSize, out uint length)
{
fixed (uint* __refParamPtr3 = &length)
{
var __arg3 = __refParamPtr3;
var __ret = __Internal.JsCopyString_0(value, buffer, bufferSize, __arg3);
return __ret;
}
}
// <summary>Write string value into Utf16 string buffer</summary>
// <remarks>When size of the `buffer` is unknown, `buffer` argument can be nullptr. In that case, `written` argument will return the length needed. when start is out of range or < 0, returns JsErrorInvalidArgument and `written` will be equal to 0. If calculated length is 0 (It can be due to string length or `start` and length combination), then `written` will be equal to 0 and call returns JsNoError</remarks>
// <param name="value">JavascriptString value</param>
// <param name="start">start offset of buffer</param>
// <param name="length">length to be written</param>
// <param name="buffer">Pointer to buffer</param>
// <param name="written">Total number of characters written</param>
public static global::ChakraSharp.JsErrorCode JsCopyStringUtf16(global::System.IntPtr value, int start, int length, out uint buffer, out uint written)
{
fixed (uint* __refParamPtr3 = &buffer)
{
var __arg3 = __refParamPtr3;
fixed (uint* __refParamPtr4 = &written)
{
var __arg4 = __refParamPtr4;
var __ret = __Internal.JsCopyStringUtf16_0(value, start, length, __arg3, __arg4);
return __ret;
}
}
}
// <summary>Parses a script and returns a function representing the script.</summary>
// <remarks>Requires an active script context. Script source can be either JavascriptString or JavascriptExternalArrayBuffer. In case it is an ExternalArrayBuffer, and the encoding of the buffer is Utf16, JsParseScriptAttributeArrayBufferIsUtf16Encoded is expected on parseAttributes. Use JavascriptExternalArrayBuffer with Utf8/ASCII script source for better performance and smaller memory footprint.</remarks>
// <param name="script">The script to run.</param>
// <param name="sourceContext">A cookie identifying the script that can be used by debuggable script contexts.</param>
// <param name="sourceUrl">The location the script came from.</param>
// <param name="parseAttributes">Attribute mask for parsing the script</param>
// <param name="result">The result of the compiled script.</param>
public static global::ChakraSharp.JsErrorCode JsParse(global::System.IntPtr script, ulong sourceContext, global::System.IntPtr sourceUrl, global::ChakraSharp.JsParseScriptAttributes parseAttributes, out global::System.IntPtr result)
{
global::System.IntPtr _result;
var __arg4 = &_result;
var __ret = __Internal.JsParse_0(script, sourceContext, sourceUrl, parseAttributes, __arg4);
result = _result;
return __ret;
}
// <summary>Executes a script.</summary>
// <remarks>Requires an active script context. Script source can be either JavascriptString or JavascriptExternalArrayBuffer. In case it is an ExternalArrayBuffer, and the encoding of the buffer is Utf16, JsParseScriptAttributeArrayBufferIsUtf16Encoded is expected on parseAttributes. Use JavascriptExternalArrayBuffer with Utf8/ASCII script source for better performance and smaller memory footprint.</remarks>
// <param name="script">The script to run.</param>
// <param name="sourceContext">A cookie identifying the script that can be used by debuggable script contexts.</param>
// <param name="sourceUrl">The location the script came from</param>
// <param name="parseAttributes">Attribute mask for parsing the script</param>
// <param name="result">The result of the script, if any. This parameter can be null.</param>
public static global::ChakraSharp.JsErrorCode JsRun(global::System.IntPtr script, ulong sourceContext, global::System.IntPtr sourceUrl, global::ChakraSharp.JsParseScriptAttributes parseAttributes, out global::System.IntPtr result)
{
global::System.IntPtr _result;
var __arg4 = &_result;
var __ret = __Internal.JsRun_0(script, sourceContext, sourceUrl, parseAttributes, __arg4);
result = _result;
return __ret;
}
// <summary>Creates the property ID associated with the name.</summary>
// <remarks>Property IDs are specific to a context and cannot be used across contexts. Requires an active script context.</remarks>
// <param name="name">The name of the property ID to get or create. The name may consist of only digits. The string is expected to be ASCII / utf8 encoded.</param>
// <param name="length">length of the name in bytes</param>
// <param name="propertyId">The property ID in this runtime for the given name.</param>
public static global::ChakraSharp.JsErrorCode JsCreatePropertyId(string name, ulong length, out global::System.IntPtr propertyId)
{
global::System.IntPtr _propertyId;
var __arg2 = &_propertyId;
var __ret = __Internal.JsCreatePropertyId_0(name, length, __arg2);
propertyId = _propertyId;
return __ret;
}
// <summary>Copies the name associated with the property ID into a buffer.</summary>
// <remarks>Requires an active script context. When size of the `buffer` is unknown, `buffer` argument can be nullptr. `length` argument will return the size needed.</remarks>
// <param name="propertyId">The property ID to get the name of.</param>
// <param name="buffer">The buffer holding the name associated with the property ID, encoded as utf8</param>
// <param name="bufferSize">Size of the buffer.</param>
// <param name="written">Total number of characters written or to be written</param>
public static global::ChakraSharp.JsErrorCode JsCopyPropertyId(global::System.IntPtr propertyId, sbyte* buffer, ulong bufferSize, out uint length)
{
fixed (uint* __refParamPtr3 = &length)
{
var __arg3 = __refParamPtr3;
var __ret = __Internal.JsCopyPropertyId_0(propertyId, buffer, bufferSize, __arg3);
return __ret;
}
}
// <summary>Serializes a parsed script to a buffer than can be reused.</summary>
// <remarks>JsSerializeScript parses a script and then stores the parsed form of the script in a runtime-independent format. The serialized script then can be deserialized in any runtime without requiring the script to be re-parsed. Requires an active script context. Script source can be either JavascriptString or JavascriptExternalArrayBuffer. In case it is an ExternalArrayBuffer, and the encoding of the buffer is Utf16, JsParseScriptAttributeArrayBufferIsUtf16Encoded is expected on parseAttributes. Use JavascriptExternalArrayBuffer with Utf8/ASCII script source for better performance and smaller memory footprint.</remarks>
// <param name="script">The script to serialize</param>
// <param name="buffer">ArrayBuffer</param>
// <param name="parseAttributes">Encoding for the script.</param>
public static global::ChakraSharp.JsErrorCode JsSerialize(global::System.IntPtr script, out global::System.IntPtr buffer, global::ChakraSharp.JsParseScriptAttributes parseAttributes)
{
global::System.IntPtr _buffer;
var __arg1 = &_buffer;
var __ret = __Internal.JsSerialize_0(script, __arg1, parseAttributes);
buffer = _buffer;
return __ret;
}
// <summary>Parses a serialized script and returns a function representing the script. Provides the ability to lazy load the script source only if/when it is needed.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="buffer">The serialized script as an ArrayBuffer (preferably ExternalArrayBuffer).</param>
// <param name="scriptLoadCallback">Callback called when the source code of the script needs to be loaded. This is an optional parameter, set to null if not needed.</param>
// <param name="sourceContext">A cookie identifying the script that can be used by debuggable script contexts. This context will passed into scriptLoadCallback.</param>
// <param name="sourceUrl">The location the script came from.</param>
// <param name="result">A function representing the script code.</param>
public static global::ChakraSharp.JsErrorCode JsParseSerialized(global::System.IntPtr buffer, global::ChakraSharp.JsSerializedLoadScriptCallback scriptLoadCallback, ulong sourceContext, global::System.IntPtr sourceUrl, out global::System.IntPtr result)
{
var __arg1 = scriptLoadCallback == null ? global::System.IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(scriptLoadCallback);
global::System.IntPtr _result;
var __arg4 = &_result;
var __ret = __Internal.JsParseSerialized_0(buffer, __arg1, sourceContext, sourceUrl, __arg4);
result = _result;
return __ret;
}
// <summary>Runs a serialized script. Provides the ability to lazy load the script source only if/when it is needed.</summary>
// <remarks>Requires an active script context. The runtime will hold on to the buffer until all instances of any functions created from the buffer are garbage collected.</remarks>
// <param name="buffer">The serialized script as an ArrayBuffer (preferably ExternalArrayBuffer).</param>
// <param name="scriptLoadCallback">Callback called when the source code of the script needs to be loaded.</param>
// <param name="sourceContext">A cookie identifying the script that can be used by debuggable script contexts. This context will passed into scriptLoadCallback.</param>
// <param name="sourceUrl">The location the script came from.</param>
// <param name="result">The result of running the script, if any. This parameter can be null.</param>
public static global::ChakraSharp.JsErrorCode JsRunSerialized(global::System.IntPtr buffer, global::ChakraSharp.JsSerializedLoadScriptCallback scriptLoadCallback, ulong sourceContext, global::System.IntPtr sourceUrl, out global::System.IntPtr result)
{
var __arg1 = scriptLoadCallback == null ? global::System.IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(scriptLoadCallback);
global::System.IntPtr _result;
var __arg4 = &_result;
var __ret = __Internal.JsRunSerialized_0(buffer, __arg1, sourceContext, sourceUrl, __arg4);
result = _result;
return __ret;
}
// <summary>Creates a new JavaScript Promise object.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="promise">The new Promise object.</param>
// <param name="resolveFunction">The function called to resolve the created Promise object.</param>
// <param name="rejectFunction">The function called to reject the created Promise object.</param>
public static global::ChakraSharp.JsErrorCode JsCreatePromise(out global::System.IntPtr promise, out global::System.IntPtr resolveFunction, out global::System.IntPtr rejectFunction)
{
global::System.IntPtr _promise;
var __arg0 = &_promise;
global::System.IntPtr _resolveFunction;
var __arg1 = &_resolveFunction;
global::System.IntPtr _rejectFunction;
var __arg2 = &_rejectFunction;
var __ret = __Internal.JsCreatePromise_0(__arg0, __arg1, __arg2);
promise = _promise;
resolveFunction = _resolveFunction;
rejectFunction = _rejectFunction;
return __ret;
}
// <summary>Creates a weak reference to a value.</summary>
// <param name="value">The value to be referenced.</param>
// <param name="weakRef">Weak reference to the value.</param>
public static global::ChakraSharp.JsErrorCode JsCreateWeakReference(global::System.IntPtr value, out global::System.IntPtr weakRef)
{
global::System.IntPtr _weakRef;
var __arg1 = &_weakRef;
var __ret = __Internal.JsCreateWeakReference_0(value, __arg1);
weakRef = _weakRef;
return __ret;
}
// <summary>Gets a strong reference to the value referred to by a weak reference.</summary>
// <param name="weakRef">A weak reference.</param>
// <param name="value">Reference to the value, or JS_INVALID_REFERENCE if the value is no longer available.</param>
public static global::ChakraSharp.JsErrorCode JsGetWeakReferenceValue(global::System.IntPtr weakRef, out global::System.IntPtr value)
{
global::System.IntPtr _value;
var __arg1 = &_value;
var __ret = __Internal.JsGetWeakReferenceValue_0(weakRef, __arg1);
value = _value;
return __ret;
}
// <summary>Creates a Javascript SharedArrayBuffer object with shared content get from JsGetSharedArrayBufferContent.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="sharedContents">The storage object of a SharedArrayBuffer which can be shared between multiple thread.</param>
// <param name="result">The new SharedArrayBuffer object.</param>
public static global::ChakraSharp.JsErrorCode JsCreateSharedArrayBufferWithSharedContent(global::System.IntPtr sharedContents, out global::System.IntPtr result)
{
global::System.IntPtr _result;
var __arg1 = &_result;
var __ret = __Internal.JsCreateSharedArrayBufferWithSharedContent_0(sharedContents, __arg1);
result = _result;
return __ret;
}
// <summary>Get the storage object from a SharedArrayBuffer.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="sharedArrayBuffer">The SharedArrayBuffer object.</param>
// <param name="sharedContents">The storage object of a SharedArrayBuffer which can be shared between multiple thread. User should call JsReleaseSharedArrayBufferContentHandle after finished using it.</param>
public static global::ChakraSharp.JsErrorCode JsGetSharedArrayBufferContent(global::System.IntPtr sharedArrayBuffer, out global::System.IntPtr sharedContents)
{
global::System.IntPtr _sharedContents;
var __arg1 = &_sharedContents;
var __ret = __Internal.JsGetSharedArrayBufferContent_0(sharedArrayBuffer, __arg1);
sharedContents = _sharedContents;
return __ret;
}
// <summary>Decrease the reference count on a SharedArrayBuffer storage object.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="sharedContents">The storage object of a SharedArrayBuffer which can be shared between multiple thread.</param>
public static global::ChakraSharp.JsErrorCode JsReleaseSharedArrayBufferContentHandle(global::System.IntPtr sharedContents)
{
var __ret = __Internal.JsReleaseSharedArrayBufferContentHandle_0(sharedContents);
return __ret;
}
// <summary>Determines whether an object has a non-inherited property.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that may contain the property.</param>
// <param name="propertyId">The ID of the property.</param>
// <param name="hasOwnProperty">Whether the object has the non-inherited property.</param>
public static global::ChakraSharp.JsErrorCode JsHasOwnProperty(global::System.IntPtr targetObject, global::System.IntPtr propertyId, out bool hasOwnProperty)
{
fixed (bool* __refParamPtr2 = &hasOwnProperty)
{
var __arg2 = __refParamPtr2;
var __ret = __Internal.JsHasOwnProperty_0(targetObject, propertyId, __arg2);
return __ret;
}
}
// <summary>Write JS string value into char string buffer without a null terminator</summary>
// <remarks>When size of the `buffer` is unknown, `buffer` argument can be nullptr. In that case, `written` argument will return the length needed. When start is out of range or < 0, returns JsErrorInvalidArgument and `written` will be equal to 0. If calculated length is 0 (It can be due to string length or `start` and length combination), then `written` will be equal to 0 and call returns JsNoError The JS string `value` will be converted one utf16 code point at a time, and if it has code points that do not fit in one byte, those values will be truncated.</remarks>
// <param name="value">JavascriptString value</param>
// <param name="start">Start offset of buffer</param>
// <param name="length">Number of characters to be written</param>
// <param name="buffer">Pointer to buffer</param>
// <param name="written">Total number of characters written</param>
public static global::ChakraSharp.JsErrorCode JsCopyStringOneByte(global::System.IntPtr value, int start, int length, sbyte* buffer, out uint written)
{
fixed (uint* __refParamPtr4 = &written)
{
var __arg4 = __refParamPtr4;
var __ret = __Internal.JsCopyStringOneByte_0(value, start, length, buffer, __arg4);
return __ret;
}
}
// <summary>Obtains frequently used properties of a data view.</summary>
// <param name="dataView">The data view instance.</param>
// <param name="arrayBuffer">The ArrayBuffer backstore of the view.</param>
// <param name="byteOffset">The offset in bytes from the start of arrayBuffer referenced by the array.</param>
// <param name="byteLength">The number of bytes in the array.</param>
public static global::ChakraSharp.JsErrorCode JsGetDataViewInfo(global::System.IntPtr dataView, out global::System.IntPtr arrayBuffer, out uint byteOffset, out uint byteLength)
{
global::System.IntPtr _arrayBuffer;
var __arg1 = &_arrayBuffer;
fixed (uint* __refParamPtr2 = &byteOffset)
{
var __arg2 = __refParamPtr2;
fixed (uint* __refParamPtr3 = &byteLength)
{
var __arg3 = __refParamPtr3;
var __ret = __Internal.JsGetDataViewInfo_0(dataView, __arg1, __arg2, __arg3);
arrayBuffer = _arrayBuffer;
return __ret;
}
}
}
// <summary>Determine if one JavaScript value is less than another JavaScript value.</summary>
// <remarks>This function is equivalent to the < operator in Javascript. Requires an active script context.</remarks>
// <param name="object1">The first object to compare.</param>
// <param name="object2">The second object to compare.</param>
// <param name="result">Whether object1 is less than object2.</param>
public static global::ChakraSharp.JsErrorCode JsLessThan(global::System.IntPtr object1, global::System.IntPtr object2, out bool result)
{
fixed (bool* __refParamPtr2 = &result)
{
var __arg2 = __refParamPtr2;
var __ret = __Internal.JsLessThan_0(object1, object2, __arg2);
return __ret;
}
}
// <summary>Determine if one JavaScript value is less than or equal to another JavaScript value.</summary>
// <remarks>This function is equivalent to the <= operator in Javascript. Requires an active script context.</remarks>
// <param name="object1">The first object to compare.</param>
// <param name="object2">The second object to compare.</param>
// <param name="result">Whether object1 is less than or equal to object2.</param>
public static global::ChakraSharp.JsErrorCode JsLessThanOrEqual(global::System.IntPtr object1, global::System.IntPtr object2, out bool result)
{
fixed (bool* __refParamPtr2 = &result)
{
var __arg2 = __refParamPtr2;
var __ret = __Internal.JsLessThanOrEqual_0(object1, object2, __arg2);
return __ret;
}
}
// <summary>Gets an object's property.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that contains the property.</param>
// <param name="key">The key (JavascriptString) to the property.</param>
// <param name="value">The value of the property.</param>
public static global::ChakraSharp.JsErrorCode JsObjectGetProperty(global::System.IntPtr targetObject, global::System.IntPtr key, out global::System.IntPtr value)
{
global::System.IntPtr _value;
var __arg2 = &_value;
var __ret = __Internal.JsObjectGetProperty_0(targetObject, key, __arg2);
value = _value;
return __ret;
}
// <summary>Puts an object's property.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that contains the property.</param>
// <param name="key">The key (JavascriptString) to the property.</param>
// <param name="value">The new value of the property.</param>
// <param name="useStrictRules">The property set should follow strict mode rules.</param>
public static global::ChakraSharp.JsErrorCode JsObjectSetProperty(global::System.IntPtr targetObject, global::System.IntPtr key, global::System.IntPtr value, bool useStrictRules)
{
var __ret = __Internal.JsObjectSetProperty_0(targetObject, key, value, useStrictRules);
return __ret;
}
// <summary>Determines whether an object has a property.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that may contain the property.</param>
// <param name="key">The key (JavascriptString) to the property.</param>
// <param name="hasProperty">Whether the object (or a prototype) has the property.</param>
public static global::ChakraSharp.JsErrorCode JsObjectHasProperty(global::System.IntPtr targetObject, global::System.IntPtr key, out bool hasProperty)
{
fixed (bool* __refParamPtr2 = &hasProperty)
{
var __arg2 = __refParamPtr2;
var __ret = __Internal.JsObjectHasProperty_0(targetObject, key, __arg2);
return __ret;
}
}
// <summary>Defines a new object's own property from a property descriptor.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that has the property.</param>
// <param name="key">The key (JavascriptString) to the property.</param>
// <param name="propertyDescriptor">The property descriptor.</param>
// <param name="result">Whether the property was defined.</param>
public static global::ChakraSharp.JsErrorCode JsObjectDefineProperty(global::System.IntPtr targetObject, global::System.IntPtr key, global::System.IntPtr propertyDescriptor, out bool result)
{
fixed (bool* __refParamPtr3 = &result)
{
var __arg3 = __refParamPtr3;
var __ret = __Internal.JsObjectDefineProperty_0(targetObject, key, propertyDescriptor, __arg3);
return __ret;
}
}
// <summary>Deletes an object's property.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that contains the property.</param>
// <param name="key">The key (JavascriptString) to the property.</param>
// <param name="useStrictRules">The property set should follow strict mode rules.</param>
// <param name="result">Whether the property was deleted.</param>
public static global::ChakraSharp.JsErrorCode JsObjectDeleteProperty(global::System.IntPtr targetObject, global::System.IntPtr key, bool useStrictRules, out global::System.IntPtr result)
{
global::System.IntPtr _result;
var __arg3 = &_result;
var __ret = __Internal.JsObjectDeleteProperty_0(targetObject, key, useStrictRules, __arg3);
result = _result;
return __ret;
}
// <summary>Gets a property descriptor for an object's own property.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that has the property.</param>
// <param name="key">The key (JavascriptString) to the property.</param>
// <param name="propertyDescriptor">The property descriptor.</param>
public static global::ChakraSharp.JsErrorCode JsObjectGetOwnPropertyDescriptor(global::System.IntPtr targetObject, global::System.IntPtr key, out global::System.IntPtr propertyDescriptor)
{
global::System.IntPtr _propertyDescriptor;
var __arg2 = &_propertyDescriptor;
var __ret = __Internal.JsObjectGetOwnPropertyDescriptor_0(targetObject, key, __arg2);
propertyDescriptor = _propertyDescriptor;
return __ret;
}
// <summary>Determines whether an object has a non-inherited property.</summary>
// <remarks>Requires an active script context.</remarks>
// <param name="object">The object that may contain the property.</param>
// <param name="key">The key (JavascriptString) to the property.</param>
// <param name="hasOwnProperty">Whether the object has the non-inherited property.</param>
public static global::ChakraSharp.JsErrorCode JsObjectHasOwnProperty(global::System.IntPtr targetObject, global::System.IntPtr key, out bool hasOwnProperty)
{
fixed (bool* __refParamPtr2 = &hasOwnProperty)
{
var __arg2 = __refParamPtr2;
var __ret = __Internal.JsObjectHasOwnProperty_0(targetObject, key, __arg2);
return __ret;
}
}
}
// <summary>An error code returned from a Chakra hosting API.</summary>
public enum JsErrorCode
{
// <summary>Success error code.</summary>
JsNoError = 0,
// <summary>Category of errors that relates to incorrect usage of the API itself.</summary>
JsErrorCategoryUsage = 65536,
// <summary>An argument to a hosting API was invalid.</summary>
JsErrorInvalidArgument = 65537,
// <summary>An argument to a hosting API was null in a context where null is not allowed.</summary>
JsErrorNullArgument = 65538,
// <summary>The hosting API requires that a context be current, but there is no current context.</summary>
JsErrorNoCurrentContext = 65539,
// <summary>The engine is in an exception state and no APIs can be called until the exception is cleared.</summary>
JsErrorInExceptionState = 65540,
// <summary>A hosting API is not yet implemented.</summary>
JsErrorNotImplemented = 65541,
// <summary>A hosting API was called on the wrong thread.</summary>
JsErrorWrongThread = 65542,
// <summary>A runtime that is still in use cannot be disposed.</summary>
JsErrorRuntimeInUse = 65543,
// <summary>A bad serialized script was used, or the serialized script was serialized by a different version of the Chakra engine.</summary>
JsErrorBadSerializedScript = 65544,
// <summary>The runtime is in a disabled state.</summary>
JsErrorInDisabledState = 65545,
// <summary>Runtime does not support reliable script interruption.</summary>
JsErrorCannotDisableExecution = 65546,
// <summary>A heap enumeration is currently underway in the script context.</summary>
JsErrorHeapEnumInProgress = 65547,
// <summary>A hosting API that operates on object values was called with a non-object value.</summary>
JsErrorArgumentNotObject = 65548,
// <summary>A script context is in the middle of a profile callback.</summary>
JsErrorInProfileCallback = 65549,
// <summary>A thread service callback is currently underway.</summary>
JsErrorInThreadServiceCallback = 65550,
// <summary>Scripts cannot be serialized in debug contexts.</summary>
JsErrorCannotSerializeDebugScript = 65551,
// <summary>The context cannot be put into a debug state because it is already in a debug state.</summary>
JsErrorAlreadyDebuggingContext = 65552,
// <summary>The context cannot start profiling because it is already profiling.</summary>
JsErrorAlreadyProfilingContext = 65553,
// <summary>Idle notification given when the host did not enable idle processing.</summary>
JsErrorIdleNotEnabled = 65554,
// <summary>The context did not accept the enqueue callback.</summary>
JsCannotSetProjectionEnqueueCallback = 65555,
// <summary>Failed to start projection.</summary>
JsErrorCannotStartProjection = 65556,
// <summary>The operation is not supported in an object before collect callback.</summary>
JsErrorInObjectBeforeCollectCallback = 65557,
// <summary>Object cannot be unwrapped to IInspectable pointer.</summary>
JsErrorObjectNotInspectable = 65558,
// <summary>A hosting API that operates on symbol property ids but was called with a non-symbol property id. The error code is returned by JsGetSymbolFromPropertyId if the function is called with non-symbol property id.</summary>
JsErrorPropertyNotSymbol = 65559,
// <summary>A hosting API that operates on string property ids but was called with a non-string property id. The error code is returned by existing JsGetPropertyNamefromId if the function is called with non-string property id.</summary>
JsErrorPropertyNotString = 65560,
// <summary>Module evaluation is called in wrong context.</summary>
JsErrorInvalidContext = 65561,
// <summary>Module evaluation is called in wrong context.</summary>
JsInvalidModuleHostInfoKind = 65562,
// <summary>Module was parsed already when JsParseModuleSource is called.</summary>
JsErrorModuleParsed = 65563,
// <summary>Argument passed to JsCreateWeakReference is a primitive that is not managed by the GC. No weak reference is required, the value will never be collected.</summary>
JsNoWeakRefRequired = 65564,
// <summary>Category of errors that relates to errors occurring within the engine itself.</summary>
JsErrorCategoryEngine = 131072,
// <summary>The Chakra engine has run out of memory.</summary>
JsErrorOutOfMemory = 131073,
// <summary>The Chakra engine failed to set the Floating Point Unit state.</summary>
JsErrorBadFPUState = 131074,
// <summary>Category of errors that relates to errors in a script.</summary>
JsErrorCategoryScript = 196608,
// <summary>A JavaScript exception occurred while running a script.</summary>
JsErrorScriptException = 196609,
// <summary>JavaScript failed to compile.</summary>
JsErrorScriptCompile = 196610,
// <summary>A script was terminated due to a request to suspend a runtime.</summary>
JsErrorScriptTerminated = 196611,
// <summary>A script was terminated because it tried to use eval or function and eval was disabled.</summary>
JsErrorScriptEvalDisabled = 196612,
// <summary>Category of errors that are fatal and signify failure of the engine.</summary>
JsErrorCategoryFatal = 262144,
// <summary>A fatal error in the engine has occurred.</summary>
JsErrorFatal = 262145,
// <summary>A hosting API was called with object created on different javascript runtime.</summary>
JsErrorWrongRuntime = 262146,
// <summary>Category of errors that are related to failures during diagnostic operations.</summary>
JsErrorCategoryDiagError = 327680,
// <summary>The object for which the debugging API was called was not found</summary>
JsErrorDiagAlreadyInDebugMode = 327681,
// <summary>The debugging API can only be called when VM is in debug mode</summary>
JsErrorDiagNotInDebugMode = 327682,
// <summary>The debugging API can only be called when VM is at a break</summary>
JsErrorDiagNotAtBreak = 327683,
// <summary>Debugging API was called with an invalid handle.</summary>
JsErrorDiagInvalidHandle = 327684,
// <summary>The object for which the debugging API was called was not found</summary>
JsErrorDiagObjectNotFound = 327685,
// <summary>VM was unable to perform the request action</summary>
JsErrorDiagUnableToPerformAction = 327686
}
// <summary>Attributes of a runtime.</summary>
[Flags]
public enum JsRuntimeAttributes
{
// <summary>No special attributes.</summary>
JsRuntimeAttributeNone = 0,
// <summary>The runtime will not do any work (such as garbage collection) on background threads.</summary>
JsRuntimeAttributeDisableBackgroundWork = 1,
// <summary>The runtime should support reliable script interruption. This increases the number of places where the runtime will check for a script interrupt request at the cost of a small amount of runtime performance.</summary>
JsRuntimeAttributeAllowScriptInterrupt = 2,
// <summary>Host will call JsIdle, so enable idle processing. Otherwise, the runtime will manage memory slightly more aggressively.</summary>
JsRuntimeAttributeEnableIdleProcessing = 4,
// <summary>Runtime will not generate native code.</summary>
JsRuntimeAttributeDisableNativeCodeGeneration = 8,
// <summary>Using eval or function constructor will throw an exception.</summary>
JsRuntimeAttributeDisableEval = 16,
// <summary>Runtime will enable all experimental features.</summary>
JsRuntimeAttributeEnableExperimentalFeatures = 32,
// <summary>Calling JsSetException will also dispatch the exception to the script debugger (if any) giving the debugger a chance to break on the exception.</summary>
JsRuntimeAttributeDispatchSetExceptionsToDebugger = 64,
// <summary>Disable Failfast fatal error on OOM</summary>
JsRuntimeAttributeDisableFatalOnOOM = 128
}
// <summary>The type of a typed JavaScript array.</summary>
public enum JsTypedArrayType
{
// <summary>An int8 array.</summary>
JsArrayTypeInt8 = 0,
// <summary>An uint8 array.</summary>
JsArrayTypeUint8 = 1,
// <summary>An uint8 clamped array.</summary>
JsArrayTypeUint8Clamped = 2,
// <summary>An int16 array.</summary>
JsArrayTypeInt16 = 3,
// <summary>An uint16 array.</summary>
JsArrayTypeUint16 = 4,
// <summary>An int32 array.</summary>
JsArrayTypeInt32 = 5,
// <summary>An uint32 array.</summary>
JsArrayTypeUint32 = 6,
// <summary>A float32 array.</summary>
JsArrayTypeFloat32 = 7,
// <summary>A float64 array.</summary>
JsArrayTypeFloat64 = 8
}
// <summary>Allocation callback event type.</summary>
public enum JsMemoryEventType
{
// <summary>Indicates a request for memory allocation.</summary>
JsMemoryAllocate = 0,
// <summary>Indicates a memory freeing event.</summary>
JsMemoryFree = 1,
// <summary>Indicates a failed allocation event.</summary>
JsMemoryFailure = 2
}
// <summary>Attribute mask for JsParseScriptWithAttributes</summary>
public enum JsParseScriptAttributes
{
// <summary>Default attribute</summary>
JsParseScriptAttributeNone = 0,
// <summary>Specified script is internal and non-user code. Hidden from debugger</summary>
JsParseScriptAttributeLibraryCode = 1,
// <summary>ChakraCore assumes ExternalArrayBuffer is Utf8 by default. This one needs to be set for Utf16</summary>
JsParseScriptAttributeArrayBufferIsUtf16Encoded = 2
}
// <summary>Type enumeration of a JavaScript property</summary>
public enum JsPropertyIdType
{
// <summary>Type enumeration of a JavaScript string property</summary>
JsPropertyIdTypeString = 0,
// <summary>Type enumeration of a JavaScript symbol property</summary>
JsPropertyIdTypeSymbol = 1
}
// <summary>The JavaScript type of a JsValueRef.</summary>
public enum JsValueType
{
// <summary>The value is the undefined value.</summary>
JsUndefined = 0,
// <summary>The value is the null value.</summary>
JsNull = 1,
// <summary>The value is a JavaScript number value.</summary>
JsNumber = 2,
// <summary>The value is a JavaScript string value.</summary>
JsString = 3,
// <summary>The value is a JavaScript Boolean value.</summary>
JsBoolean = 4,
// <summary>The value is a JavaScript object value.</summary>
JsObject = 5,
// <summary>The value is a JavaScript function object value.</summary>
JsFunction = 6,
// <summary>The value is a JavaScript error object value.</summary>
JsError = 7,
// <summary>The value is a JavaScript array object value.</summary>
JsArray = 8,
// <summary>The value is a JavaScript symbol value.</summary>
JsSymbol = 9,
// <summary>The value is a JavaScript ArrayBuffer object value.</summary>
JsArrayBuffer = 10,
// <summary>The value is a JavaScript typed array object value.</summary>
JsTypedArray = 11,
// <summary>The value is a JavaScript DataView object value.</summary>
JsDataView = 12
}
// <summary>A handle to a Chakra runtime.</summary>
// <remarks>Each Chakra runtime has its own independent execution engine, JIT compiler, and garbage collected heap. As such, each runtime is completely isolated from other runtimes. Runtimes can be used on any thread, but only one thread can call into a runtime at any time. NOTE: A JsRuntimeHandle, unlike other object references in the Chakra hosting API, is not garbage collected since it contains the garbage collected heap itself. A runtime will continue to exist until JsDisposeRuntime is called.</remarks>
public class JsRuntimeHandle { }
// <summary>A reference to an object owned by the Chakra garbage collector.</summary>
// <remarks>A Chakra runtime will automatically track JsRef references as long as they are stored in local variables or in parameters (i.e. on the stack). Storing a JsRef somewhere other than on the stack requires calling JsAddRef and JsRelease to manage the lifetime of the object, otherwise the garbage collector may free the object while it is still in use.</remarks>
public class JsRef { }
// <summary>A reference to a script context.</summary>
// <remarks>Each script context contains its own global object, distinct from the global object in other script contexts. Many Chakra hosting APIs require an "active" script context, which can be set using JsSetCurrentContext. Chakra hosting APIs that require a current context to be set will note that explicitly in their documentation.</remarks>
// <summary>A reference to a JavaScript value.</summary>
// <remarks>A JavaScript value is one of the following types of values: undefined, null, Boolean, string, number, or object.</remarks>
// <summary>A cookie that identifies a script for debugging purposes.</summary>
// <summary>A property identifier.</summary>
// <remarks>Property identifiers are used to refer to properties of JavaScript objects instead of using strings.</remarks>
// <summary>User implemented callback routine for memory allocation events</summary>
// <remarks>Use JsSetRuntimeMemoryAllocationCallback to register this callback.</remarks>
// <param name="callbackState">The state passed to JsSetRuntimeMemoryAllocationCallback.</param>
// <param name="allocationEvent">The type of type allocation event.</param>
// <param name="allocationSize">The size of the allocation.</param>
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(global::System.Runtime.InteropServices.CallingConvention.Cdecl)]
public unsafe delegate bool JsMemoryAllocationCallback(global::System.IntPtr callbackState, global::ChakraSharp.JsMemoryEventType allocationEvent, ulong allocationSize);