react-native-windows 0.66.3 → 0.66.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +22 -1
- package/CHANGELOG.md +14 -5
- package/Chakra/Chakra.vcxitems +0 -1
- package/Chakra/Chakra.vcxitems.filters +0 -3
- package/Chakra/ChakraHelpers.cpp +0 -267
- package/Chakra/ChakraInstanceArgs.h +0 -5
- package/Chakra/ChakraPlatform.h +0 -4
- package/Chakra/ChakraTracing.cpp +0 -33
- package/Chakra/ChakraValue.h +0 -4
- package/Chakra/Utf8DebugExtensions.cpp +0 -5
- package/Chakra/Utf8DebugExtensions.h +0 -6
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +0 -2
- package/PropertySheets/React.Cpp.props +2 -0
- package/Shared/JSI/ChakraApi.cpp +1 -37
- package/Shared/JSI/ChakraApi.h +0 -4
- package/Shared/JSI/ChakraJsiRuntime_edgemode.cpp +1 -5
- package/Shared/JSI/ChakraRuntime.cpp +0 -12
- package/Shared/JSI/ChakraRuntimeFactory.h +0 -2
- package/Shared/OInstance.cpp +6 -19
- package/Shared/Shared.vcxitems +0 -1
- package/Shared/Shared.vcxitems.filters +0 -3
- package/package.json +2 -2
- package/Chakra/ChakraCoreDebugger.h +0 -147
- package/Scripts/Microsoft.ChakraCore.ARM64.nuspec +0 -50
- package/Scripts/Microsoft.ChakraCore.ARM64.targets +0 -15
- package/Shared/JSI/ChakraCoreRuntime.h +0 -59
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "react-native-windows",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Mon,
|
|
5
|
+
"date": "Mon, 15 Nov 2021 16:09:26 GMT",
|
|
6
|
+
"tag": "react-native-windows_v0.66.4",
|
|
7
|
+
"version": "0.66.4",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Fix crash loading bundle in win32",
|
|
12
|
+
"author": "julio.rocha@microsoft.com",
|
|
13
|
+
"commit": "9fded4d64856fc7ab1df0040a79466afff3d52fd",
|
|
14
|
+
"package": "react-native-windows"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Drop ChakraCore dependency (#9056)",
|
|
18
|
+
"author": "julio.rocha@microsoft.com",
|
|
19
|
+
"commit": "ba708e10314005ab6a59b1b17cb58675e80729f9",
|
|
20
|
+
"package": "react-native-windows"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Mon, 01 Nov 2021 19:10:27 GMT",
|
|
6
27
|
"tag": "react-native-windows_v0.66.3",
|
|
7
28
|
"version": "0.66.3",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
# Change Log - react-native-windows
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 15 Nov 2021 16:09:26 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.66.
|
|
7
|
+
## 0.66.4
|
|
8
8
|
|
|
9
|
-
Mon,
|
|
9
|
+
Mon, 15 Nov 2021 16:09:26 GMT
|
|
10
10
|
|
|
11
11
|
### Patches
|
|
12
12
|
|
|
13
|
-
- Fix
|
|
14
|
-
-
|
|
13
|
+
- Fix crash loading bundle in win32 (julio.rocha@microsoft.com)
|
|
14
|
+
- Drop ChakraCore dependency (#9056) (julio.rocha@microsoft.com)
|
|
15
15
|
|
|
16
|
+
## 0.66.3
|
|
17
|
+
|
|
18
|
+
Mon, 01 Nov 2021 19:10:27 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- Fix Microsoft.ReactNative.dll version string (asklar@microsoft.com)
|
|
23
|
+
- Fix crash when using TextInput.blur() (30809111+acoates-ms@users.noreply.github.com)
|
|
24
|
+
|
|
16
25
|
## 0.66.2
|
|
17
26
|
|
|
18
27
|
Mon, 25 Oct 2021 15:07:26 GMT
|
package/Chakra/Chakra.vcxitems
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
<ClCompile Include="$(MSBuildThisFileDirectory)Utf8DebugExtensions.cpp" />
|
|
22
22
|
</ItemGroup>
|
|
23
23
|
<ItemGroup>
|
|
24
|
-
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraCoreDebugger.h" />
|
|
25
24
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraHelpers.h" />
|
|
26
25
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraInstanceArgs.h" />
|
|
27
26
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraPlatform.h" />
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
</ClCompile>
|
|
22
22
|
</ItemGroup>
|
|
23
23
|
<ItemGroup>
|
|
24
|
-
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraCoreDebugger.h">
|
|
25
|
-
<Filter>Header Files</Filter>
|
|
26
|
-
</ClInclude>
|
|
27
24
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraHelpers.h">
|
|
28
25
|
<Filter>Header Files</Filter>
|
|
29
26
|
</ClInclude>
|
package/Chakra/ChakraHelpers.cpp
CHANGED
|
@@ -32,198 +32,6 @@
|
|
|
32
32
|
namespace facebook {
|
|
33
33
|
namespace react {
|
|
34
34
|
|
|
35
|
-
#if !defined(USE_EDGEMODE_JSRT)
|
|
36
|
-
namespace {
|
|
37
|
-
|
|
38
|
-
template <class T>
|
|
39
|
-
size_t fwrite(T *p, size_t count, FILE *file) noexcept {
|
|
40
|
-
static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable to be serialized into a file");
|
|
41
|
-
return fwrite(p, sizeof(*p), count, file);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
template <class T>
|
|
45
|
-
bool fwrite(const T &val, FILE *file) noexcept {
|
|
46
|
-
return fwrite(&val, 1, file) == 1;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
#if !defined(CHAKRACORE_UWP)
|
|
50
|
-
struct FileVersionInfoResource {
|
|
51
|
-
uint16_t len;
|
|
52
|
-
uint16_t valLen;
|
|
53
|
-
uint16_t type;
|
|
54
|
-
wchar_t key[_countof(L"VS_VERSION_INFO")];
|
|
55
|
-
uint16_t padding1;
|
|
56
|
-
VS_FIXEDFILEINFO fixedFileInfo;
|
|
57
|
-
uint32_t padding2;
|
|
58
|
-
};
|
|
59
|
-
#endif
|
|
60
|
-
class ChakraVersionInfo {
|
|
61
|
-
public:
|
|
62
|
-
ChakraVersionInfo() noexcept : m_fileVersionMS{0}, m_fileVersionLS{0}, m_productVersionMS{0}, m_productVersionLS{0} {}
|
|
63
|
-
|
|
64
|
-
bool initialize() noexcept {
|
|
65
|
-
#if !defined(CHAKRACORE_UWP)
|
|
66
|
-
auto freeLibraryWrapper = [](void *p) { FreeLibrary((HMODULE)p); };
|
|
67
|
-
HMODULE moduleHandle;
|
|
68
|
-
// This code is win32 only at the moment. We will need to change these
|
|
69
|
-
// lines if we want to support UWP.
|
|
70
|
-
if (!GetModuleHandleExW(
|
|
71
|
-
0,
|
|
72
|
-
Microsoft::React::GetRuntimeOptionBool("JSI.ForceSystemChakra") ? L"Chakra.dll" : L"ChakraCore.dll",
|
|
73
|
-
&moduleHandle)) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
std::unique_ptr<void, decltype(freeLibraryWrapper)> moduleHandleWrapper(
|
|
77
|
-
moduleHandle, std::move(freeLibraryWrapper));
|
|
78
|
-
|
|
79
|
-
HRSRC versionResourceHandle = FindResourceW(moduleHandle, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
|
|
80
|
-
if (!versionResourceHandle ||
|
|
81
|
-
SizeofResource(static_cast<HMODULE>(moduleHandleWrapper.get()), versionResourceHandle) <
|
|
82
|
-
sizeof(FileVersionInfoResource)) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
HGLOBAL versionResourcePtrHandle = LoadResource(moduleHandle, versionResourceHandle);
|
|
87
|
-
if (!versionResourcePtrHandle) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
FileVersionInfoResource *chakraVersionInfo =
|
|
92
|
-
static_cast<FileVersionInfoResource *>(LockResource(versionResourcePtrHandle));
|
|
93
|
-
if (!chakraVersionInfo) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
m_fileVersionMS = chakraVersionInfo->fixedFileInfo.dwFileVersionMS;
|
|
98
|
-
m_fileVersionLS = chakraVersionInfo->fixedFileInfo.dwFileVersionLS;
|
|
99
|
-
m_productVersionMS = chakraVersionInfo->fixedFileInfo.dwProductVersionMS;
|
|
100
|
-
m_productVersionLS = chakraVersionInfo->fixedFileInfo.dwProductVersionLS;
|
|
101
|
-
#endif
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
bool operator==(const ChakraVersionInfo &rhs) const noexcept {
|
|
106
|
-
return (m_fileVersionMS == rhs.m_fileVersionMS) && (m_fileVersionLS == rhs.m_fileVersionLS) &&
|
|
107
|
-
(m_productVersionMS == rhs.m_productVersionMS) && (m_productVersionLS == rhs.m_productVersionLS);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
bool operator!=(const ChakraVersionInfo &rhs) const noexcept {
|
|
111
|
-
return !(*this == rhs);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private:
|
|
115
|
-
uint32_t m_fileVersionMS;
|
|
116
|
-
uint32_t m_fileVersionLS;
|
|
117
|
-
uint32_t m_productVersionMS;
|
|
118
|
-
uint32_t m_productVersionLS;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
class BytecodePrefix {
|
|
122
|
-
public:
|
|
123
|
-
static std::pair<bool, BytecodePrefix> getBytecodePrefix(uint64_t bundleVersion) noexcept {
|
|
124
|
-
std::pair<bool, BytecodePrefix> result{false, BytecodePrefix{bundleVersion}};
|
|
125
|
-
result.first = result.second.m_chakraVersionInfo.initialize();
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
bool operator==(const BytecodePrefix &rhs) const noexcept {
|
|
130
|
-
return (m_bytecodeFileFormatVersion == rhs.m_bytecodeFileFormatVersion) &&
|
|
131
|
-
(m_bundleVersion == rhs.m_bundleVersion) && (m_chakraVersionInfo == rhs.m_chakraVersionInfo);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
bool operator!=(const BytecodePrefix &rhs) const noexcept {
|
|
135
|
-
return !(*this == rhs);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private:
|
|
139
|
-
uint64_t m_bytecodeFileFormatVersion;
|
|
140
|
-
uint64_t m_bundleVersion;
|
|
141
|
-
ChakraVersionInfo m_chakraVersionInfo;
|
|
142
|
-
|
|
143
|
-
static constexpr uint32_t s_bytecodeFileFormatVersion = 2;
|
|
144
|
-
|
|
145
|
-
BytecodePrefix(uint64_t bundleVersion) noexcept
|
|
146
|
-
: m_bytecodeFileFormatVersion{s_bytecodeFileFormatVersion},
|
|
147
|
-
m_bundleVersion{bundleVersion},
|
|
148
|
-
m_chakraVersionInfo{} {}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
void serializeBytecodeToFileCore(
|
|
152
|
-
const std::shared_ptr<const JSBigString> &script,
|
|
153
|
-
const BytecodePrefix &bytecodePrefix,
|
|
154
|
-
const std::string &bytecodeFileName) {
|
|
155
|
-
FILE *bytecodeFilePtr;
|
|
156
|
-
// bytecode is a binary representation, so we need to pass in the "b" flag to
|
|
157
|
-
// fopen_s
|
|
158
|
-
if (_wfopen_s(&bytecodeFilePtr, Microsoft::Common::Unicode::Utf8ToUtf16(bytecodeFileName).c_str(), L"wb")) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
std::unique_ptr<FILE, decltype(&fclose)> bytecodeFilePtrWrapper(bytecodeFilePtr, fclose);
|
|
162
|
-
|
|
163
|
-
const std::wstring scriptUTF16 = Microsoft::Common::Unicode::Utf8ToUtf16(script->c_str(), script->size());
|
|
164
|
-
|
|
165
|
-
unsigned int bytecodeSize = 0;
|
|
166
|
-
if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) != JsNoError) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
std::unique_ptr<uint8_t[]> bytecode(std::make_unique<uint8_t[]>(bytecodeSize));
|
|
171
|
-
if (JsSerializeScript(scriptUTF16.c_str(), bytecode.get(), &bytecodeSize) != JsNoError) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
constexpr size_t bytecodePrefixSize = sizeof(bytecodePrefix);
|
|
176
|
-
uint8_t zeroArray[sizeof(bytecodePrefix)]{};
|
|
177
|
-
|
|
178
|
-
if (fwrite(zeroArray, bytecodePrefixSize, bytecodeFilePtrWrapper.get()) != bytecodePrefixSize ||
|
|
179
|
-
fwrite(bytecode.get(), bytecodeSize, bytecodeFilePtrWrapper.get()) != bytecodeSize ||
|
|
180
|
-
fflush(bytecodeFilePtrWrapper.get())) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
fseek(bytecodeFilePtrWrapper.get(), 0, SEEK_SET);
|
|
185
|
-
if (!fwrite(bytecodePrefix, bytecodeFilePtrWrapper.get()) || fflush(bytecodeFilePtrWrapper.get())) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
std::unique_ptr<JSBigString> tryGetBytecode(const BytecodePrefix &bytecodePrefix, const std::string &bytecodeFileName) {
|
|
191
|
-
auto bytecodeBigStringPtr =
|
|
192
|
-
std::make_unique<FileMappingBigString>(bytecodeFileName, static_cast<uint32_t>(sizeof(BytecodePrefix)));
|
|
193
|
-
|
|
194
|
-
if (!bytecodeBigStringPtr->file_data() || bytecodeBigStringPtr->file_size() < sizeof(bytecodePrefix) ||
|
|
195
|
-
*reinterpret_cast<const BytecodePrefix *>(bytecodeBigStringPtr->file_data()) != bytecodePrefix) {
|
|
196
|
-
return nullptr;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return bytecodeBigStringPtr;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
void serializeBytecodeToFile(
|
|
203
|
-
const std::shared_ptr<const JSBigString> &script,
|
|
204
|
-
const BytecodePrefix &bytecodePrefix,
|
|
205
|
-
std::string &&bytecodeFileName,
|
|
206
|
-
bool async) {
|
|
207
|
-
std::future<void> bytecodeSerializationFuture = std::async(
|
|
208
|
-
std::launch::async,
|
|
209
|
-
[](const std::shared_ptr<const JSBigString> &script,
|
|
210
|
-
const BytecodePrefix &bytecodePrefix,
|
|
211
|
-
const std::string &bytecodeFileName) {
|
|
212
|
-
MinimalChakraRuntime chakraRuntime(false /* multithreaded */);
|
|
213
|
-
serializeBytecodeToFileCore(script, bytecodePrefix, bytecodeFileName);
|
|
214
|
-
},
|
|
215
|
-
script,
|
|
216
|
-
bytecodePrefix,
|
|
217
|
-
std::move(bytecodeFileName));
|
|
218
|
-
|
|
219
|
-
if (!async) {
|
|
220
|
-
bytecodeSerializationFuture.wait();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
} // namespace
|
|
225
|
-
#endif
|
|
226
|
-
|
|
227
35
|
MinimalChakraRuntime::MinimalChakraRuntime(bool multithreaded)
|
|
228
36
|
: runtime{new JsRuntimeHandle,
|
|
229
37
|
[](JsRuntimeHandle *h) {
|
|
@@ -355,7 +163,6 @@ JsValueRef evaluateScript(JsValueRef script, JsValueRef source) {
|
|
|
355
163
|
JsValueRef exn = nullptr;
|
|
356
164
|
JsValueRef value = nullptr;
|
|
357
165
|
|
|
358
|
-
#if defined(USE_EDGEMODE_JSRT)
|
|
359
166
|
const wchar_t *scriptRaw;
|
|
360
167
|
size_t scriptRawLength;
|
|
361
168
|
JsStringToPointer(script, &scriptRaw, &scriptRawLength);
|
|
@@ -365,11 +172,6 @@ JsValueRef evaluateScript(JsValueRef script, JsValueRef source) {
|
|
|
365
172
|
JsStringToPointer(source, &sourceRaw, &sourceRawLength);
|
|
366
173
|
|
|
367
174
|
auto result = JsRunScript(scriptRaw, JS_SOURCE_CONTEXT_NONE /*sourceContext*/, sourceRaw, &value);
|
|
368
|
-
#else
|
|
369
|
-
JsSourceContext sourceContext = getNextSourceContext();
|
|
370
|
-
auto result = JsRun(script, sourceContext, source, JsParseScriptAttributeNone, &value);
|
|
371
|
-
#endif
|
|
372
|
-
|
|
373
175
|
bool hasException = false;
|
|
374
176
|
if (result == JsErrorInExceptionState || (JsHasException(&hasException), hasException)) {
|
|
375
177
|
JsGetAndClearException(&exn);
|
|
@@ -385,18 +187,10 @@ JsValueRef evaluateScript(JsValueRef script, JsValueRef source) {
|
|
|
385
187
|
|
|
386
188
|
JsValueRef evaluateScript(std::unique_ptr<const JSBigString> &&script, JsValueRef sourceURL) {
|
|
387
189
|
ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_START);
|
|
388
|
-
#if defined(USE_EDGEMODE_JSRT)
|
|
389
190
|
JsValueRef jsScript = jsStringFromBigString(*script.get());
|
|
390
|
-
#else
|
|
391
|
-
JsValueRefUniquePtr jsScript = jsArrayBufferFromBigString(std::move(script));
|
|
392
|
-
#endif
|
|
393
191
|
ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP);
|
|
394
192
|
|
|
395
|
-
#if defined(USE_EDGEMODE_JSRT)
|
|
396
193
|
return evaluateScript(jsScript, sourceURL);
|
|
397
|
-
#else
|
|
398
|
-
return evaluateScript(jsScript.get(), sourceURL);
|
|
399
|
-
#endif
|
|
400
194
|
}
|
|
401
195
|
|
|
402
196
|
JsValueRef evaluateScriptWithBytecode(
|
|
@@ -405,72 +199,11 @@ JsValueRef evaluateScriptWithBytecode(
|
|
|
405
199
|
JsValueRef scriptFileName,
|
|
406
200
|
[[maybe_unused]] std::string &&bytecodeFileName,
|
|
407
201
|
[[maybe_unused]] bool asyncBytecodeGeneration) {
|
|
408
|
-
#if defined(WINRT)
|
|
409
202
|
// TODO:
|
|
410
203
|
// ChakraRT does not support the JsRunSerialized() API.
|
|
411
204
|
// Hence for UWP implementation, we fall back to using the original source
|
|
412
205
|
// code right now.
|
|
413
206
|
return evaluateScript(std::move(script), scriptFileName);
|
|
414
|
-
#else
|
|
415
|
-
auto bytecodePrefixOptional = BytecodePrefix::getBytecodePrefix(scriptVersion);
|
|
416
|
-
if (!bytecodePrefixOptional.first) {
|
|
417
|
-
return evaluateScript(std::move(script), scriptFileName);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
auto &bytecodePrefix = bytecodePrefixOptional.second;
|
|
421
|
-
std::unique_ptr<const JSBigString> bytecode = tryGetBytecode(bytecodePrefix, bytecodeFileName);
|
|
422
|
-
if (!bytecode) {
|
|
423
|
-
std::shared_ptr<const JSBigString> sharedScript(script.release());
|
|
424
|
-
serializeBytecodeToFile(sharedScript, bytecodePrefix, std::move(bytecodeFileName), asyncBytecodeGeneration);
|
|
425
|
-
ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_START);
|
|
426
|
-
JsValueRefUniquePtr jsScript = jsArrayBufferFromBigString(sharedScript);
|
|
427
|
-
ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP);
|
|
428
|
-
return evaluateScript(jsScript.get(), scriptFileName);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_START);
|
|
432
|
-
JsValueRefUniquePtr jsScript = jsArrayBufferFromBigString(std::move(script));
|
|
433
|
-
ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP);
|
|
434
|
-
JsValueRef exn = nullptr;
|
|
435
|
-
JsValueRef value = nullptr;
|
|
436
|
-
JsErrorCode result = JsRunSerialized(
|
|
437
|
-
jsArrayBufferFromBigString(std::move(bytecode)).get(),
|
|
438
|
-
[](JsSourceContext sourceContext, JsValueRef *value, JsParseScriptAttributes *parseAttributes) {
|
|
439
|
-
*value = reinterpret_cast<JsValueRef>(sourceContext);
|
|
440
|
-
*parseAttributes = JsParseScriptAttributeNone;
|
|
441
|
-
return true;
|
|
442
|
-
},
|
|
443
|
-
reinterpret_cast<JsSourceContext>(jsScript.get()),
|
|
444
|
-
scriptFileName,
|
|
445
|
-
&value);
|
|
446
|
-
|
|
447
|
-
// Currently, when the existing bundle.bytecode is incompatible with the
|
|
448
|
-
// ChakraCore.dll used, we do not update it. This is because we memory mapped
|
|
449
|
-
// bundle.bytecode into a JsExternalArrayBuffer, whose lifetime is controlled
|
|
450
|
-
// by the JS engine. Hence we cannot remove/rename/modify bytecode.bundle
|
|
451
|
-
// until the JS garbage collector deletes the corresponding
|
|
452
|
-
// JsExternalArrayBuffer.
|
|
453
|
-
if (result == JsErrorBadSerializedScript) {
|
|
454
|
-
JsGetAndClearException(&exn);
|
|
455
|
-
return evaluateScript(jsScript.get(), scriptFileName);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
// This code is duplicated from evaluateScript.
|
|
459
|
-
// TODO (task 1977635) get rid of this duplicated code.
|
|
460
|
-
bool hasException = false;
|
|
461
|
-
if (result == JsErrorInExceptionState || (JsHasException(&hasException), hasException)) {
|
|
462
|
-
JsGetAndClearException(&exn);
|
|
463
|
-
std::string exceptionDescription = "JavaScriptException in " + ChakraValue(scriptFileName).toString().str();
|
|
464
|
-
|
|
465
|
-
throw ChakraJSException(exn, exceptionDescription.c_str());
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
if (value == nullptr) {
|
|
469
|
-
formatAndThrowJSException(exn, scriptFileName);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
return value;
|
|
473
|
-
#endif
|
|
474
207
|
}
|
|
475
208
|
|
|
476
209
|
void formatAndThrowJSException(JsValueRef exn, JsValueRef source) {
|
package/Chakra/ChakraPlatform.h
CHANGED
package/Chakra/ChakraTracing.cpp
CHANGED
|
@@ -50,15 +50,6 @@ static JsValueRef __stdcall nativeTraceBeginSectionJNF(
|
|
|
50
50
|
if (argumentType == JsValueType::JsString) {
|
|
51
51
|
CHAKRA_ASSERTDO(JsGetStringLength(arguments[2], &profileNameLength));
|
|
52
52
|
profileName.resize(profileNameLength);
|
|
53
|
-
|
|
54
|
-
// TODO: CharkaRT doesn't have JsCopyString, implement alternative.
|
|
55
|
-
#if !defined(USE_EDGEMODE_JSRT)
|
|
56
|
-
CHAKRA_ASSERTDO(JsCopyString(
|
|
57
|
-
arguments[2],
|
|
58
|
-
const_cast<char *>(profileName.data()),
|
|
59
|
-
profileNameLength + 1 /* length */,
|
|
60
|
-
nullptr /* written */));
|
|
61
|
-
#endif
|
|
62
53
|
}
|
|
63
54
|
#ifndef NDEBUG
|
|
64
55
|
else {
|
|
@@ -73,12 +64,6 @@ static JsValueRef __stdcall nativeTraceBeginSectionJNF(
|
|
|
73
64
|
if (argumentType == JsValueType::JsString) {
|
|
74
65
|
CHAKRA_ASSERTDO(JsGetStringLength(arguments[3], &argsLength));
|
|
75
66
|
argsStr.resize(argsLength + 1);
|
|
76
|
-
|
|
77
|
-
// TODO: CharkaRT doesn't have JsCopyString, implement alternative.
|
|
78
|
-
#if !defined(USE_EDGEMODE_JSRT)
|
|
79
|
-
CHAKRA_ASSERTDO(JsCopyString(
|
|
80
|
-
arguments[3], const_cast<char *>(argsStr.data()), argsLength + 1 /* length */, nullptr /* written */));
|
|
81
|
-
#endif
|
|
82
67
|
}
|
|
83
68
|
#ifndef NDEBUG
|
|
84
69
|
else {
|
|
@@ -149,15 +134,6 @@ static void beginOrEndAsync(bool isEnd, JsValueRef arguments[], unsigned short a
|
|
|
149
134
|
if (argumentType == JsValueType::JsString) {
|
|
150
135
|
CHAKRA_ASSERTDO(JsGetStringLength(arguments[2], &profileNameLength));
|
|
151
136
|
profileName.resize(profileNameLength);
|
|
152
|
-
|
|
153
|
-
// TODO: CharkaRT doesn't have JsCopyString, implement alternative.
|
|
154
|
-
#if !defined(USE_EDGEMODE_JSRT)
|
|
155
|
-
CHAKRA_ASSERTDO(JsCopyString(
|
|
156
|
-
arguments[2],
|
|
157
|
-
const_cast<char *>(profileName.data()),
|
|
158
|
-
profileNameLength + 1 /* length */,
|
|
159
|
-
nullptr /* written */));
|
|
160
|
-
#endif
|
|
161
137
|
}
|
|
162
138
|
#ifndef NDEBUG
|
|
163
139
|
else {
|
|
@@ -240,15 +216,6 @@ static JsValueRef __stdcall nativeTraceCounterJNF(
|
|
|
240
216
|
if (argumentType == JsValueType::JsString) {
|
|
241
217
|
CHAKRA_ASSERTDO(JsGetStringLength(arguments[2], &profileNameLength));
|
|
242
218
|
profileName.resize(profileNameLength);
|
|
243
|
-
|
|
244
|
-
// TODO: CharkaRT doesn't have JsCopyString, implement alternative.
|
|
245
|
-
#if !defined(USE_EDGEMODE_JSRT)
|
|
246
|
-
CHAKRA_ASSERTDO(JsCopyString(
|
|
247
|
-
arguments[2],
|
|
248
|
-
const_cast<char *>(profileName.data()),
|
|
249
|
-
profileNameLength + 1 /* length */,
|
|
250
|
-
nullptr /* written */));
|
|
251
|
-
#endif
|
|
252
219
|
}
|
|
253
220
|
#ifndef NDEBUG
|
|
254
221
|
else {
|
package/Chakra/ChakraValue.h
CHANGED
|
@@ -38,16 +38,11 @@ JsErrorCode JsPointerToStringUtf8(
|
|
|
38
38
|
if (stringValue == nullptr) {
|
|
39
39
|
return JsErrorNullArgument;
|
|
40
40
|
}
|
|
41
|
-
#if defined(USE_EDGEMODE_JSRT)
|
|
42
41
|
// JsCreateString is not supported in universal chakra engine
|
|
43
42
|
// So we convert the utf8 string to utf16 first and call JsPointerToString to
|
|
44
43
|
// convert the string to JsValueRef
|
|
45
44
|
std::wstring wstr = Microsoft::Common::Unicode::Utf8ToUtf16(stringValue, stringLength);
|
|
46
45
|
return JsPointerToString(wstr.c_str(), wstr.size(), string);
|
|
47
|
-
|
|
48
|
-
#else
|
|
49
|
-
return JsCreateString(stringValue, stringLength, string);
|
|
50
|
-
#endif
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
JsErrorCode JsStringToStdStringUtf8(_In_ JsValueRef stringValue, std::string &string) {
|
|
@@ -118,8 +118,6 @@
|
|
|
118
118
|
REACTWINDOWS_BUILD - building with REACTWINDOWS_API as dll exports
|
|
119
119
|
OLD_CPPWINRT is a workaround to make target version to 19H1
|
|
120
120
|
-->
|
|
121
|
-
<PreprocessorDefinitions Condition="'$(CHAKRACOREUWP)'=='true'">CHAKRACORE;CHAKRACORE_UWP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
122
|
-
<PreprocessorDefinitions Condition="'$(CHAKRACOREUWP)'!='true'">USE_EDGEMODE_JSRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
123
121
|
<PreprocessorDefinitions>
|
|
124
122
|
REACTWINDOWS_BUILD;
|
|
125
123
|
RN_PLATFORM=windows;
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
BOOST_NO_TYPEID - Configure boost not to check typeid (not to use RTTI)
|
|
86
86
|
BOOST_SYSTEM_SOURCE - Build boost::system symbols from sources (drop dependency on boost_system.lib).
|
|
87
87
|
GTEST_HAS_RTTI - Let GTest know not to use RTTI
|
|
88
|
+
USE_EDGEMODE_JSRT When using Chakra, enforce System Chakra instead of JS9.
|
|
88
89
|
WIN32_LEAN_AND_MEAN - Reduce the Windows API included surface.
|
|
89
90
|
WINRT_LEAN_AND_MEAN - Disable rarely used cppwinrt templates that impact compile-time/PCH size.
|
|
90
91
|
-->
|
|
@@ -96,6 +97,7 @@
|
|
|
96
97
|
BOOST_NO_TYPEID;
|
|
97
98
|
BOOST_SYSTEM_SOURCE;
|
|
98
99
|
GTEST_HAS_RTTI=0;
|
|
100
|
+
USE_EDGEMODE_JSRT;
|
|
99
101
|
WIN32_LEAN_AND_MEAN;
|
|
100
102
|
%(PreprocessorDefinitions)
|
|
101
103
|
</PreprocessorDefinitions>
|
package/Shared/JSI/ChakraApi.cpp
CHANGED
|
@@ -144,17 +144,9 @@ ChakraApi::JsRefHolder::~JsRefHolder() noexcept {
|
|
|
144
144
|
JsPropertyIdRef propertyId{JS_INVALID_REFERENCE};
|
|
145
145
|
// We use a #ifdef here because we can avoid a UTF-8 to UTF-16 conversion
|
|
146
146
|
// using ChakraCore's JsCreatePropertyId API.
|
|
147
|
-
#ifdef CHAKRACORE
|
|
148
|
-
if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
|
|
149
|
-
std::wstring utf16 = Common::Unicode::Utf8ToUtf16(name.data(), name.length());
|
|
150
|
-
ChakraVerifyJsErrorElseThrow(JsGetPropertyIdFromName(utf16.data(), &propertyId));
|
|
151
|
-
} else {
|
|
152
|
-
ChakraVerifyJsErrorElseThrow(JsCreatePropertyId(name.data(), name.length(), &propertyId));
|
|
153
|
-
}
|
|
154
|
-
#else
|
|
155
147
|
std::wstring utf16 = Common::Unicode::Utf8ToUtf16(name.data(), name.length());
|
|
156
148
|
ChakraVerifyJsErrorElseThrow(JsGetPropertyIdFromName(utf16.data(), &propertyId));
|
|
157
|
-
|
|
149
|
+
|
|
158
150
|
return propertyId;
|
|
159
151
|
}
|
|
160
152
|
|
|
@@ -275,18 +267,7 @@ ChakraApi::JsRefHolder::~JsRefHolder() noexcept {
|
|
|
275
267
|
/*static*/ JsValueRef ChakraApi::PointerToString(std::string_view value) {
|
|
276
268
|
ChakraVerifyElseThrow(value.data(), "Cannot convert a nullptr to a JS string.");
|
|
277
269
|
|
|
278
|
-
// ChakraCore API helps to reduce cost of UTF-8 to UTF-16 conversion.
|
|
279
|
-
#ifdef CHAKRACORE
|
|
280
|
-
if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
|
|
281
|
-
return PointerToString(Common::Unicode::Utf8ToUtf16(value));
|
|
282
|
-
} else {
|
|
283
|
-
JsValueRef result{JS_INVALID_REFERENCE};
|
|
284
|
-
ChakraVerifyJsErrorElseThrow(JsCreateString(value.data(), value.length(), &result));
|
|
285
|
-
return result;
|
|
286
|
-
}
|
|
287
|
-
#else
|
|
288
270
|
return PointerToString(Common::Unicode::Utf8ToUtf16(value));
|
|
289
|
-
#endif
|
|
290
271
|
}
|
|
291
272
|
|
|
292
273
|
/*static*/ std::wstring_view ChakraApi::StringToPointer(JsValueRef string) {
|
|
@@ -300,24 +281,7 @@ ChakraApi::JsRefHolder::~JsRefHolder() noexcept {
|
|
|
300
281
|
ChakraVerifyElseThrow(
|
|
301
282
|
GetValueType(string) == JsString, "Cannot convert a non JS string ChakraObjectRef to a std::string.");
|
|
302
283
|
|
|
303
|
-
// We use a #ifdef here because we can avoid a UTF-8 to UTF-16 conversion
|
|
304
|
-
// using ChakraCore's JsCopyString API.
|
|
305
|
-
#ifdef CHAKRACORE
|
|
306
|
-
if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
|
|
307
|
-
return Common::Unicode::Utf16ToUtf8(StringToPointer(string));
|
|
308
|
-
} else {
|
|
309
|
-
size_t length{0};
|
|
310
|
-
ChakraVerifyJsErrorElseThrow(JsCopyString(string, nullptr, 0, &length));
|
|
311
|
-
|
|
312
|
-
std::string result(length, 'a');
|
|
313
|
-
ChakraVerifyJsErrorElseThrow(JsCopyString(string, result.data(), result.length(), &length));
|
|
314
|
-
|
|
315
|
-
ChakraVerifyElseThrow(length == result.length(), "Failed to convert a JS string to a std::string.");
|
|
316
|
-
return result;
|
|
317
|
-
}
|
|
318
|
-
#else
|
|
319
284
|
return Common::Unicode::Utf16ToUtf8(StringToPointer(string));
|
|
320
|
-
#endif
|
|
321
285
|
}
|
|
322
286
|
|
|
323
287
|
/*static*/ JsValueRef ChakraApi::ConvertValueToString(JsValueRef value) {
|
package/Shared/JSI/ChakraApi.h
CHANGED
|
@@ -15,7 +15,7 @@ JsStartDebugging();
|
|
|
15
15
|
|
|
16
16
|
namespace Microsoft::JSI {
|
|
17
17
|
|
|
18
|
-
#if defined(USE_EDGEMODE_JSRT)
|
|
18
|
+
#if defined(USE_EDGEMODE_JSRT)
|
|
19
19
|
/*static*/ void ChakraRuntime::initRuntimeVersion() noexcept {}
|
|
20
20
|
#endif
|
|
21
21
|
|
|
@@ -42,11 +42,7 @@ std::unique_ptr<const facebook::jsi::Buffer> SystemChakraRuntime::generatePrepar
|
|
|
42
42
|
const std::wstring scriptUTF16 =
|
|
43
43
|
Microsoft::Common::Unicode::Utf8ToUtf16(reinterpret_cast<const char *>(sourceBuffer.data()), sourceBuffer.size());
|
|
44
44
|
|
|
45
|
-
#ifdef CHAKRACORE
|
|
46
|
-
unsigned int bytecodeSize = 0;
|
|
47
|
-
#else
|
|
48
45
|
unsigned long bytecodeSize = 0;
|
|
49
|
-
#endif
|
|
50
46
|
if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) == JsNoError) {
|
|
51
47
|
std::unique_ptr<ByteArrayBuffer> bytecodeBuffer(std::make_unique<ByteArrayBuffer>(bytecodeSize));
|
|
52
48
|
if (JsSerializeScript(scriptUTF16.c_str(), bytecodeBuffer->data(), &bytecodeSize) == JsNoError) {
|
|
@@ -16,14 +16,10 @@
|
|
|
16
16
|
#include <sstream>
|
|
17
17
|
#include <unordered_set>
|
|
18
18
|
|
|
19
|
-
#ifdef CHAKRACORE
|
|
20
|
-
#include <ChakraCore.h>
|
|
21
|
-
#else
|
|
22
19
|
#ifndef USE_EDGEMODE_JSRT
|
|
23
20
|
#define USE_EDGEMODE_JSRT
|
|
24
21
|
#endif
|
|
25
22
|
#include <jsrt.h>
|
|
26
|
-
#endif
|
|
27
23
|
|
|
28
24
|
namespace Microsoft::JSI {
|
|
29
25
|
|
|
@@ -1011,15 +1007,7 @@ std::once_flag ChakraRuntime::s_runtimeVersionInitFlag;
|
|
|
1011
1007
|
uint64_t ChakraRuntime::s_runtimeVersion = 0;
|
|
1012
1008
|
|
|
1013
1009
|
std::unique_ptr<facebook::jsi::Runtime> makeChakraRuntime(ChakraRuntimeArgs &&args) noexcept {
|
|
1014
|
-
#ifdef CHAKRACORE
|
|
1015
|
-
if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
|
|
1016
|
-
return MakeSystemChakraRuntime(std::move(args));
|
|
1017
|
-
} else {
|
|
1018
|
-
return MakeChakraCoreRuntime(std::move(args));
|
|
1019
|
-
}
|
|
1020
|
-
#else
|
|
1021
1010
|
return MakeSystemChakraRuntime(std::move(args));
|
|
1022
|
-
#endif // CHAKRACORE
|
|
1023
1011
|
}
|
|
1024
1012
|
|
|
1025
1013
|
} // namespace Microsoft::JSI
|
|
@@ -11,7 +11,5 @@ struct ChakraRuntimeArgs;
|
|
|
11
11
|
|
|
12
12
|
std::unique_ptr<facebook::jsi::Runtime> makeChakraRuntime(ChakraRuntimeArgs &&args) noexcept;
|
|
13
13
|
|
|
14
|
-
std::unique_ptr<facebook::jsi::Runtime> MakeChakraCoreRuntime(ChakraRuntimeArgs &&args) noexcept;
|
|
15
|
-
|
|
16
14
|
std::unique_ptr<facebook::jsi::Runtime> MakeSystemChakraRuntime(ChakraRuntimeArgs &&args) noexcept;
|
|
17
15
|
} // namespace Microsoft::JSI
|
package/Shared/OInstance.cpp
CHANGED
|
@@ -379,12 +379,6 @@ InstanceImpl::InstanceImpl(
|
|
|
379
379
|
[[fallthrough]];
|
|
380
380
|
#endif
|
|
381
381
|
}
|
|
382
|
-
case JSIEngineOverride::Chakra:
|
|
383
|
-
// Applies only to ChakraCore-linked binaries.
|
|
384
|
-
Microsoft::React::SetRuntimeOptionBool("JSI.ForceSystemChakra", true);
|
|
385
|
-
m_devSettings->jsiRuntimeHolder =
|
|
386
|
-
std::make_shared<Microsoft::JSI::ChakraRuntimeHolder>(m_devSettings, m_jsThread, nullptr, nullptr);
|
|
387
|
-
break;
|
|
388
382
|
case JSIEngineOverride::V8NodeApi: {
|
|
389
383
|
#if defined(USE_V8)
|
|
390
384
|
std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore;
|
|
@@ -412,6 +406,7 @@ InstanceImpl::InstanceImpl(
|
|
|
412
406
|
[[fallthrough]];
|
|
413
407
|
#endif
|
|
414
408
|
}
|
|
409
|
+
case JSIEngineOverride::Chakra:
|
|
415
410
|
case JSIEngineOverride::ChakraCore:
|
|
416
411
|
default: // TODO: Add other engines once supported
|
|
417
412
|
m_devSettings->jsiRuntimeHolder =
|
|
@@ -500,7 +495,7 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
|
|
|
500
495
|
}
|
|
501
496
|
|
|
502
497
|
int64_t currentTimeInMilliSeconds =
|
|
503
|
-
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono
|
|
498
|
+
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch())
|
|
504
499
|
.count();
|
|
505
500
|
m_devManager->UpdateBundleStatus(true, currentTimeInMilliSeconds);
|
|
506
501
|
|
|
@@ -571,11 +566,7 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
|
|
|
571
566
|
// Otherwise all bundles (User and Platform) are loaded through
|
|
572
567
|
// platformBundles.
|
|
573
568
|
if (PathFileExistsA(fullBundleFilePath.c_str())) {
|
|
574
|
-
#if defined(_CHAKRACORE_H_)
|
|
575
569
|
auto bundleString = FileMappingBigString::fromPath(fullBundleFilePath);
|
|
576
|
-
#else
|
|
577
|
-
auto bundleString = JSBigFileString::fromPath(fullBundleFilePath);
|
|
578
|
-
#endif
|
|
579
570
|
m_innerInstance->loadScriptFromString(std::move(bundleString), std::move(fullBundleFilePath), synchronously);
|
|
580
571
|
}
|
|
581
572
|
|
|
@@ -586,10 +577,6 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
|
|
|
586
577
|
m_innerInstance->loadScriptFromString(std::move(bundleString), jsBundleRelativePath, synchronously);
|
|
587
578
|
#endif
|
|
588
579
|
}
|
|
589
|
-
#if defined(_CHAKRACORE_H_)
|
|
590
|
-
} catch (const facebook::react::ChakraJSException &e) {
|
|
591
|
-
m_devSettings->errorCallback(std::string{e.what()} + "\r\n" + e.getStack());
|
|
592
|
-
#endif
|
|
593
580
|
} catch (const std::exception &e) {
|
|
594
581
|
m_devSettings->errorCallback(e.what());
|
|
595
582
|
} catch (const winrt::hresult_error &hrerr) {
|
|
@@ -620,10 +607,10 @@ std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules
|
|
|
620
607
|
},
|
|
621
608
|
nativeQueue));
|
|
622
609
|
|
|
623
|
-
// TODO: This is not included for UWP because we have a different module which
|
|
624
|
-
// is added later. However, this one is designed
|
|
625
|
-
// so that we can base a UWP version on it. We need to do that but is not high
|
|
626
|
-
// priority.
|
|
610
|
+
// TODO: This is not included for UWP because we have a different module which
|
|
611
|
+
// is added later. However, this one is designed
|
|
612
|
+
// so that we can base a UWP version on it. We need to do that but is not high
|
|
613
|
+
// priority.
|
|
627
614
|
#if (defined(_MSC_VER) && !defined(WINRT))
|
|
628
615
|
modules.push_back(std::make_unique<CxxNativeModule>(
|
|
629
616
|
m_innerInstance,
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
<ClInclude Include="$(MSBuildThisFileDirectory)HermesShim.h" />
|
|
78
78
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ByteArrayBuffer.h" />
|
|
79
79
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraApi.h" />
|
|
80
|
-
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraCoreRuntime.h" />
|
|
81
80
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraRuntime.h" />
|
|
82
81
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraRuntimeArgs.h" />
|
|
83
82
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraRuntimeFactory.h" />
|
|
@@ -366,9 +366,6 @@
|
|
|
366
366
|
<Filter>Header Files\JSI</Filter>
|
|
367
367
|
</ClInclude>
|
|
368
368
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\include\Shared\cdebug.h" />
|
|
369
|
-
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraCoreRuntime.h">
|
|
370
|
-
<Filter>Header Files\JSI</Filter>
|
|
371
|
-
</ClInclude>
|
|
372
369
|
<ClInclude Include="$(MSBuildThisFileDirectory)InspectorPackagerConnection.h">
|
|
373
370
|
<Filter>Header Files</Filter>
|
|
374
371
|
</ClInclude>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@react-native-community/cli": "^6.0.0",
|
|
27
27
|
"@react-native-community/cli-platform-android": "^6.0.0",
|
|
28
28
|
"@react-native-community/cli-platform-ios": "^6.0.0",
|
|
29
|
-
"@react-native-windows/cli": "0.66.
|
|
29
|
+
"@react-native-windows/cli": "0.66.1",
|
|
30
30
|
"@react-native-windows/virtualized-list": "0.66.0",
|
|
31
31
|
"@react-native/assets": "1.0.0",
|
|
32
32
|
"@react-native/normalize-color": "1.0.0",
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
#pragma once
|
|
4
|
-
|
|
5
|
-
#include <exception>
|
|
6
|
-
#include <stdexcept>
|
|
7
|
-
|
|
8
|
-
#include <ChakraDebugProtocolHandler.h>
|
|
9
|
-
#include <ChakraDebugService.h>
|
|
10
|
-
|
|
11
|
-
class DebugProtocolHandler {
|
|
12
|
-
private:
|
|
13
|
-
JsDebugProtocolHandler m_protocolHandler{nullptr};
|
|
14
|
-
|
|
15
|
-
public:
|
|
16
|
-
DebugProtocolHandler(JsRuntimeHandle runtime) {
|
|
17
|
-
JsDebugProtocolHandler protocolHandler;
|
|
18
|
-
|
|
19
|
-
JsErrorCode result = JsDebugProtocolHandlerCreate(runtime, &protocolHandler);
|
|
20
|
-
|
|
21
|
-
if (result != JsNoError) {
|
|
22
|
-
throw new std::runtime_error("Unable to create debug protocol handler.");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
m_protocolHandler = protocolHandler;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
~DebugProtocolHandler() {
|
|
29
|
-
Destroy();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
JsErrorCode Connect(bool breakOnNextLine, JsDebugProtocolHandlerSendResponseCallback callback, void *callbackState) {
|
|
33
|
-
JsErrorCode result = JsDebugProtocolHandlerConnect(m_protocolHandler, breakOnNextLine, callback, callbackState);
|
|
34
|
-
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
JsErrorCode Destroy() {
|
|
39
|
-
JsErrorCode result = JsNoError;
|
|
40
|
-
|
|
41
|
-
if (m_protocolHandler != nullptr) {
|
|
42
|
-
result = JsDebugProtocolHandlerDestroy(m_protocolHandler);
|
|
43
|
-
|
|
44
|
-
if (result == JsNoError) {
|
|
45
|
-
m_protocolHandler = nullptr;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
JsErrorCode Disconnect() {
|
|
53
|
-
JsErrorCode result = JsDebugProtocolHandlerDisconnect(m_protocolHandler);
|
|
54
|
-
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
JsDebugProtocolHandler GetHandle() {
|
|
59
|
-
return m_protocolHandler;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
JsErrorCode ProcessCommandQueue() {
|
|
63
|
-
JsErrorCode result = JsDebugProtocolHandlerProcessCommandQueue(m_protocolHandler);
|
|
64
|
-
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
JsErrorCode SetCommandQueueCallback(JsDebugProtocolHandlerCommandQueueCallback callback, void *callbackState) {
|
|
69
|
-
JsErrorCode result = JsDebugProtocolHandlerSetCommandQueueCallback(m_protocolHandler, callback, callbackState);
|
|
70
|
-
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
JsErrorCode WaitForDebugger() {
|
|
75
|
-
JsErrorCode result = JsDebugProtocolHandlerWaitForDebugger(m_protocolHandler);
|
|
76
|
-
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
JsErrorCode GetConsoleObject(JsValueRef *consoleObject) {
|
|
81
|
-
JsErrorCode result = JsDebugProtocolHandlerCreateConsoleObject(m_protocolHandler, consoleObject);
|
|
82
|
-
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
class DebugService {
|
|
88
|
-
private:
|
|
89
|
-
JsDebugService m_service{nullptr};
|
|
90
|
-
|
|
91
|
-
public:
|
|
92
|
-
DebugService(JsRuntimeHandle runtime) {
|
|
93
|
-
JsDebugService service;
|
|
94
|
-
|
|
95
|
-
JsErrorCode result = JsDebugServiceCreate(&service);
|
|
96
|
-
|
|
97
|
-
if (result != JsNoError) {
|
|
98
|
-
throw new std::exception("Unable to create debug service.");
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
m_service = service;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
~DebugService() {
|
|
105
|
-
Destroy();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
JsErrorCode Close() {
|
|
109
|
-
JsErrorCode result = JsDebugServiceClose(m_service);
|
|
110
|
-
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
JsErrorCode Destroy() {
|
|
115
|
-
JsErrorCode result = JsNoError;
|
|
116
|
-
|
|
117
|
-
if (m_service != nullptr) {
|
|
118
|
-
result = JsDebugServiceDestroy(m_service);
|
|
119
|
-
|
|
120
|
-
if (result == JsNoError) {
|
|
121
|
-
m_service = nullptr;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return result;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
JsErrorCode Listen(uint16_t port) {
|
|
129
|
-
JsErrorCode result = JsDebugServiceListen(m_service, port);
|
|
130
|
-
|
|
131
|
-
return result;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
JsErrorCode
|
|
135
|
-
RegisterHandler(std::string const &runtimeName, DebugProtocolHandler &protocolHandler, bool breakOnNextLine) {
|
|
136
|
-
JsErrorCode result =
|
|
137
|
-
JsDebugServiceRegisterHandler(m_service, runtimeName.c_str(), protocolHandler.GetHandle(), breakOnNextLine);
|
|
138
|
-
|
|
139
|
-
return result;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
JsErrorCode UnregisterHandler(std::string const &runtimeName) {
|
|
143
|
-
JsErrorCode result = JsDebugServiceUnregisterHandler(m_service, runtimeName.c_str());
|
|
144
|
-
|
|
145
|
-
return result;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
|
|
3
|
-
<!--
|
|
4
|
-
Sample usage:
|
|
5
|
-
|
|
6
|
-
nuget pack Microsoft.ChakraCore.ARM64.nuspec `
|
|
7
|
-
-Properties "id=ReactWindows.ChakraCore.ARM64;targetRoot=D:\chakra;repoUrl=https://github.com/microsoft/ChakraCore;repoBranch=master;repoCommit=$(git rev-parse HEAD)" `
|
|
8
|
-
-Version 1.11.20.0
|
|
9
|
-
-->
|
|
10
|
-
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
11
|
-
<metadata>
|
|
12
|
-
<!-- i.e.: Microsoft.ChakraCore.vc140.ARM64 -->
|
|
13
|
-
<id>$id$</id>
|
|
14
|
-
<version>$version$</version>
|
|
15
|
-
<authors>Microsoft</authors>
|
|
16
|
-
<owners>Chakra Team</owners>
|
|
17
|
-
<licenseUrl>https://github.com/Microsoft/ChakraCore/blob/master/LICENSE.txt</licenseUrl>
|
|
18
|
-
<projectUrl>https://github.com/Microsoft/ChakraCore</projectUrl>
|
|
19
|
-
<repository type="git" url="$repoUrl$" branch="$repoBranch$" commit="$repoCommit$" />
|
|
20
|
-
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
|
21
|
-
<developmentDependency>true</developmentDependency>
|
|
22
|
-
<description>ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge.</description>
|
|
23
|
-
<releaseNotes>https://github.com/Microsoft/ChakraCore/wiki/Roadmap#release-notes</releaseNotes>
|
|
24
|
-
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
|
25
|
-
<language>en-US</language>
|
|
26
|
-
<tags>Chakra,ChakraCore,javascript,js,ecmascript,compiler,platform,oss,opensource,native,nativepackage,C++,vc140</tags>
|
|
27
|
-
<dependencies>
|
|
28
|
-
<group targetFramework="native" />
|
|
29
|
-
</dependencies>
|
|
30
|
-
</metadata>
|
|
31
|
-
<files>
|
|
32
|
-
<!--Build-->
|
|
33
|
-
<file src="Microsoft.ChakraCore.ARM64.targets" target="build\native\$id$.targets"/>
|
|
34
|
-
|
|
35
|
-
<!--Lib-->
|
|
36
|
-
<file src="$targetroot$\arm64_release\ChakraCore.dll" target="lib\native\v140\arm64\release\ChakraCore.dll" />
|
|
37
|
-
<file src="$targetroot$\arm64_release\ChakraCore.lib" target="lib\native\v140\arm64\release\ChakraCore.lib" />
|
|
38
|
-
<file src="$targetroot$\arm64_release\ChakraCore.pdb" target="lib\native\v140\arm64\release\ChakraCore.pdb" />
|
|
39
|
-
<file src="$targetroot$\arm64_release\ch.exe" target="lib\native\v140\arm64\release\ch.exe" />
|
|
40
|
-
<file src="$targetroot$\arm64_release\ch.pdb" target="lib\native\v140\arm64\release\ch.pdb" />
|
|
41
|
-
|
|
42
|
-
<!--Copying Release to Debug for now-->
|
|
43
|
-
<file src="$targetroot$\arm64_release\ChakraCore.dll" target="lib\native\v140\arm64\debug\ChakraCore.dll" />
|
|
44
|
-
<file src="$targetroot$\arm64_release\ChakraCore.lib" target="lib\native\v140\arm64\debug\ChakraCore.lib" />
|
|
45
|
-
<file src="$targetroot$\arm64_release\ChakraCore.pdb" target="lib\native\v140\arm64\debug\ChakraCore.pdb" />
|
|
46
|
-
<file src="$targetroot$\arm64_release\ch.exe" target="lib\native\v140\arm64\debug\ch.exe" />
|
|
47
|
-
<file src="$targetroot$\arm64_release\ch.pdb" target="lib\native\v140\arm64\debug\ch.pdb" />
|
|
48
|
-
|
|
49
|
-
</files>
|
|
50
|
-
</package>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
-
<ItemDefinitionGroup>
|
|
4
|
-
<Link>
|
|
5
|
-
<AdditionalDependencies>$(MSBuildThisFileDirectory)..\..\lib\native\v140\$(Platform)\$(Configuration)\ChakraCore.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
6
|
-
</Link>
|
|
7
|
-
<!-- <ClCompile>
|
|
8
|
-
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
9
|
-
</ClCompile> -->
|
|
10
|
-
</ItemDefinitionGroup>
|
|
11
|
-
<ItemGroup>
|
|
12
|
-
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\lib\native\v140\$(Platform)\$(Configuration)\ChakraCore.dll" />
|
|
13
|
-
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\lib\native\v140\$(Platform)\$(Configuration)\ChakraCore.pdb" />
|
|
14
|
-
</ItemGroup>
|
|
15
|
-
</Project>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
#pragma once
|
|
5
|
-
|
|
6
|
-
#include "ChakraRuntime.h"
|
|
7
|
-
|
|
8
|
-
#include "ChakraCore.h"
|
|
9
|
-
#include "ChakraCoreDebugger.h"
|
|
10
|
-
|
|
11
|
-
namespace Microsoft::JSI {
|
|
12
|
-
|
|
13
|
-
class ChakraCoreRuntime : public ChakraRuntime {
|
|
14
|
-
public:
|
|
15
|
-
ChakraCoreRuntime(ChakraRuntimeArgs &&args) noexcept;
|
|
16
|
-
|
|
17
|
-
~ChakraCoreRuntime() noexcept;
|
|
18
|
-
|
|
19
|
-
#pragma region ChakraRuntime
|
|
20
|
-
|
|
21
|
-
void setupNativePromiseContinuation() noexcept override;
|
|
22
|
-
|
|
23
|
-
void startDebuggingIfNeeded() override;
|
|
24
|
-
|
|
25
|
-
void stopDebuggingIfNeeded() override;
|
|
26
|
-
|
|
27
|
-
std::unique_ptr<const facebook::jsi::Buffer> generatePreparedScript(
|
|
28
|
-
const std::string &sourceURL,
|
|
29
|
-
const facebook::jsi::Buffer &sourceBuffer) noexcept override;
|
|
30
|
-
|
|
31
|
-
facebook::jsi::Value evaluateJavaScriptSimple(const facebook::jsi::Buffer &buffer, const std::string &sourceURL)
|
|
32
|
-
override;
|
|
33
|
-
|
|
34
|
-
bool evaluateSerializedScript(
|
|
35
|
-
const facebook::jsi::Buffer &scriptBuffer,
|
|
36
|
-
const facebook::jsi::Buffer &serializedScriptBuffer,
|
|
37
|
-
const std::string &sourceURL,
|
|
38
|
-
JsValueRef *result) override;
|
|
39
|
-
|
|
40
|
-
#pragma endregion
|
|
41
|
-
|
|
42
|
-
private:
|
|
43
|
-
JsErrorCode enableDebugging(
|
|
44
|
-
JsRuntimeHandle runtime,
|
|
45
|
-
std::string const &runtimeName,
|
|
46
|
-
bool breakOnNextLine,
|
|
47
|
-
uint16_t port,
|
|
48
|
-
std::unique_ptr<DebugProtocolHandler> &debugProtocolHandler,
|
|
49
|
-
std::unique_ptr<DebugService> &debugService);
|
|
50
|
-
|
|
51
|
-
void ProcessDebuggerCommandQueue();
|
|
52
|
-
|
|
53
|
-
static void CALLBACK ProcessDebuggerCommandQueueCallback(void *callbackState);
|
|
54
|
-
|
|
55
|
-
std::unique_ptr<DebugProtocolHandler> m_debugProtocolHandler;
|
|
56
|
-
std::unique_ptr<DebugService> m_debugService;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
} // namespace Microsoft::JSI
|