react-native-windows 0.80.1 → 0.80.5
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/Directory.Build.props +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.cpp +169 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.h +42 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +60 -33
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +68 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +6 -1
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +14 -1
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +75 -24
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +4 -25
- package/Microsoft.ReactNative/JsiApi.cpp +1 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +3 -0
- package/Microsoft.ReactNative/ReactHost/DebuggerNotifications.h +54 -0
- package/Microsoft.ReactNative/ReactHost/React.h +11 -4
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +195 -29
- package/Microsoft.ReactNative/ReactHost/ReactHost.h +22 -4
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +24 -5
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/ReactRootView.cpp +108 -0
- package/Microsoft.ReactNative/ReactRootView.h +6 -0
- package/Microsoft.ReactNative/Views/DevMenu.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/React.Cpp.props +2 -2
- package/ReactCommon/ReactCommon.vcxproj +18 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +4 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +23 -9
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +16 -0
- package/ReactCommon/cgmanifest.json +1 -1
- package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +2 -0
- package/Shared/DevServerHelper.h +13 -3
- package/Shared/DevSettings.h +7 -0
- package/Shared/DevSupportManager.cpp +79 -20
- package/Shared/DevSupportManager.h +7 -19
- package/Shared/Hermes/HermesRuntimeAgentDelegate.cpp +99 -0
- package/Shared/Hermes/HermesRuntimeAgentDelegate.h +81 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +263 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.h +77 -0
- package/Shared/HermesRuntimeHolder.cpp +29 -111
- package/Shared/HermesRuntimeHolder.h +214 -32
- package/Shared/IDevSupportManager.h +5 -2
- package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.cpp +108 -0
- package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.h +19 -0
- package/Shared/Inspector/ReactInspectorThread.h +18 -0
- package/Shared/JSI/RuntimeHolder.h +5 -2
- package/Shared/OInstance.cpp +44 -27
- package/Shared/Shared.vcxitems +27 -17
- package/Shared/Shared.vcxitems.filters +33 -15
- package/package.json +4 -4
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +0 -79
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.h +0 -51
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +0 -50
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.cpp +0 -41
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.h +0 -127
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.inc +0 -125
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +0 -16
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_win.cpp +0 -23
- package/Microsoft.ReactNative.Cxx/JSI/decorator.h +0 -1054
- package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +0 -145
- package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +0 -372
- package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +0 -797
- package/Microsoft.ReactNative.Cxx/JSI/jsi.h +0 -1799
- package/Microsoft.ReactNative.Cxx/JSI/threadsafe.h +0 -79
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +0 -3531
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +0 -38
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +0 -614
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +0 -212
- package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +0 -199
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +0 -78
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +0 -196
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +0 -429
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.cpp +0 -45
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.h +0 -91
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +0 -670
- package/Shared/InspectorPackagerConnection.cpp +0 -232
- package/Shared/InspectorPackagerConnection.h +0 -61
- /package/Shared/{HermesSamplingProfiler.cpp → Hermes/HermesSamplingProfiler.cpp} +0 -0
- /package/Shared/{HermesSamplingProfiler.h → Hermes/HermesSamplingProfiler.h} +0 -0
|
@@ -1,797 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#include <cassert>
|
|
9
|
-
#include <cmath>
|
|
10
|
-
#include <cstdlib>
|
|
11
|
-
#include <stdexcept>
|
|
12
|
-
|
|
13
|
-
#include <jsi/instrumentation.h>
|
|
14
|
-
#include <jsi/jsi.h>
|
|
15
|
-
|
|
16
|
-
namespace facebook {
|
|
17
|
-
namespace jsi {
|
|
18
|
-
|
|
19
|
-
namespace {
|
|
20
|
-
|
|
21
|
-
// This is used for generating short exception strings.
|
|
22
|
-
std::string kindToString(const Value& v, Runtime* rt = nullptr) {
|
|
23
|
-
if (v.isUndefined()) {
|
|
24
|
-
return "undefined";
|
|
25
|
-
} else if (v.isNull()) {
|
|
26
|
-
return "null";
|
|
27
|
-
} else if (v.isBool()) {
|
|
28
|
-
return v.getBool() ? "true" : "false";
|
|
29
|
-
} else if (v.isNumber()) {
|
|
30
|
-
return "a number";
|
|
31
|
-
} else if (v.isString()) {
|
|
32
|
-
return "a string";
|
|
33
|
-
} else if (v.isSymbol()) {
|
|
34
|
-
return "a symbol";
|
|
35
|
-
#if JSI_VERSION >= 6
|
|
36
|
-
} else if (v.isBigInt()) {
|
|
37
|
-
return "a bigint";
|
|
38
|
-
#endif
|
|
39
|
-
} else {
|
|
40
|
-
assert(v.isObject() && "Expecting object.");
|
|
41
|
-
return rt != nullptr && v.getObject(*rt).isFunction(*rt) ? "a function"
|
|
42
|
-
: "an object";
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// getPropertyAsFunction() will try to create a JSError. If the
|
|
47
|
-
// failure is in building a JSError, this will lead to infinite
|
|
48
|
-
// recursion. This function is used in place of getPropertyAsFunction
|
|
49
|
-
// when building JSError, to avoid that infinite recursion.
|
|
50
|
-
Value callGlobalFunction(Runtime& runtime, const char* name, const Value& arg) {
|
|
51
|
-
Value v = runtime.global().getProperty(runtime, name);
|
|
52
|
-
if (!v.isObject()) {
|
|
53
|
-
throw JSINativeException(
|
|
54
|
-
std::string("callGlobalFunction: JS global property '") + name +
|
|
55
|
-
"' is " + kindToString(v, &runtime) + ", expected a Function");
|
|
56
|
-
}
|
|
57
|
-
Object o = v.getObject(runtime);
|
|
58
|
-
if (!o.isFunction(runtime)) {
|
|
59
|
-
throw JSINativeException(
|
|
60
|
-
std::string("callGlobalFunction: JS global property '") + name +
|
|
61
|
-
"' is a non-callable Object, expected a Function");
|
|
62
|
-
}
|
|
63
|
-
Function f = std::move(o).getFunction(runtime);
|
|
64
|
-
return f.call(runtime, arg);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
#if JSI_VERSION >= 14
|
|
68
|
-
// Given a sequence of UTF8 encoded bytes, advance the input to past where a
|
|
69
|
-
// 32-bit unicode codepoint as been decoded and return the codepoint. If the
|
|
70
|
-
// UTF8 encoding is invalid, then return the value with the unicode replacement
|
|
71
|
-
// character (U+FFFD). This decoder also relies on zero termination at end of
|
|
72
|
-
// the input for bound checks.
|
|
73
|
-
// \param input char pointer pointing to the current character
|
|
74
|
-
// \return Unicode codepoint
|
|
75
|
-
uint32_t decodeUTF8(const char*& input) {
|
|
76
|
-
uint32_t ch = (unsigned char)input[0];
|
|
77
|
-
if (ch <= 0x7f) {
|
|
78
|
-
input += 1;
|
|
79
|
-
return ch;
|
|
80
|
-
}
|
|
81
|
-
uint32_t ret;
|
|
82
|
-
constexpr uint32_t replacementCharacter = 0xFFFD;
|
|
83
|
-
if ((ch & 0xE0) == 0xC0) {
|
|
84
|
-
uint32_t ch1 = (unsigned char)input[1];
|
|
85
|
-
if ((ch1 & 0xC0) != 0x80) {
|
|
86
|
-
input += 1;
|
|
87
|
-
return replacementCharacter;
|
|
88
|
-
}
|
|
89
|
-
ret = ((ch & 0x1F) << 6) | (ch1 & 0x3F);
|
|
90
|
-
input += 2;
|
|
91
|
-
if (ret <= 0x7F) {
|
|
92
|
-
return replacementCharacter;
|
|
93
|
-
}
|
|
94
|
-
} else if ((ch & 0xF0) == 0xE0) {
|
|
95
|
-
uint32_t ch1 = (unsigned char)input[1];
|
|
96
|
-
if ((ch1 & 0x40) != 0 || (ch1 & 0x80) == 0) {
|
|
97
|
-
input += 1;
|
|
98
|
-
return replacementCharacter;
|
|
99
|
-
}
|
|
100
|
-
uint32_t ch2 = (unsigned char)input[2];
|
|
101
|
-
if ((ch2 & 0x40) != 0 || (ch2 & 0x80) == 0) {
|
|
102
|
-
input += 2;
|
|
103
|
-
return replacementCharacter;
|
|
104
|
-
}
|
|
105
|
-
ret = ((ch & 0x0F) << 12) | ((ch1 & 0x3F) << 6) | (ch2 & 0x3F);
|
|
106
|
-
input += 3;
|
|
107
|
-
if (ret <= 0x7FF) {
|
|
108
|
-
return replacementCharacter;
|
|
109
|
-
}
|
|
110
|
-
} else if ((ch & 0xF8) == 0xF0) {
|
|
111
|
-
uint32_t ch1 = (unsigned char)input[1];
|
|
112
|
-
if ((ch1 & 0x40) != 0 || (ch1 & 0x80) == 0) {
|
|
113
|
-
input += 1;
|
|
114
|
-
return replacementCharacter;
|
|
115
|
-
}
|
|
116
|
-
uint32_t ch2 = (unsigned char)input[2];
|
|
117
|
-
if ((ch2 & 0x40) != 0 || (ch2 & 0x80) == 0) {
|
|
118
|
-
input += 2;
|
|
119
|
-
return replacementCharacter;
|
|
120
|
-
}
|
|
121
|
-
uint32_t ch3 = (unsigned char)input[3];
|
|
122
|
-
if ((ch3 & 0x40) != 0 || (ch3 & 0x80) == 0) {
|
|
123
|
-
input += 3;
|
|
124
|
-
return replacementCharacter;
|
|
125
|
-
}
|
|
126
|
-
ret = ((ch & 0x07) << 18) | ((ch1 & 0x3F) << 12) | ((ch2 & 0x3F) << 6) |
|
|
127
|
-
(ch3 & 0x3F);
|
|
128
|
-
input += 4;
|
|
129
|
-
if (ret <= 0xFFFF) {
|
|
130
|
-
return replacementCharacter;
|
|
131
|
-
}
|
|
132
|
-
if (ret > 0x10FFFF) {
|
|
133
|
-
return replacementCharacter;
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
input += 1;
|
|
137
|
-
return replacementCharacter;
|
|
138
|
-
}
|
|
139
|
-
return ret;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Given a valid 32-bit unicode codepoint, encode it as UTF-16 into the output.
|
|
143
|
-
void encodeUTF16(std::u16string& out, uint32_t cp) {
|
|
144
|
-
if (cp < 0x10000) {
|
|
145
|
-
out.push_back((uint16_t)cp);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
cp -= 0x10000;
|
|
149
|
-
uint16_t highSurrogate = 0xD800 + ((cp >> 10) & 0x3FF);
|
|
150
|
-
out.push_back(highSurrogate);
|
|
151
|
-
uint16_t lowSurrogate = 0xDC00 + (cp & 0x3FF);
|
|
152
|
-
out.push_back(lowSurrogate);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Convert the UTF8 encoded string into a UTF16 encoded string. If the
|
|
156
|
-
// input is not valid UTF8, the replacement character (U+FFFD) is used to
|
|
157
|
-
// represent the invalid sequence.
|
|
158
|
-
std::u16string convertUTF8ToUTF16(const std::string& utf8) {
|
|
159
|
-
std::u16string ret;
|
|
160
|
-
const char* curr = utf8.data();
|
|
161
|
-
const char* end = curr + utf8.length();
|
|
162
|
-
while (curr < end) {
|
|
163
|
-
auto cp = decodeUTF8(curr);
|
|
164
|
-
encodeUTF16(ret, cp);
|
|
165
|
-
}
|
|
166
|
-
return ret;
|
|
167
|
-
}
|
|
168
|
-
#endif
|
|
169
|
-
|
|
170
|
-
#if JSI_VERSION >= 19
|
|
171
|
-
// Given a unsigned number, which is less than 16, return the hex character.
|
|
172
|
-
inline char hexDigit(unsigned x) {
|
|
173
|
-
return static_cast<char>(x < 10 ? '0' + x : 'A' + (x - 10));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Given a sequence of UTF 16 code units, return true if all code units are
|
|
177
|
-
// ASCII characters
|
|
178
|
-
bool isAllASCII(const char16_t* utf16, size_t length) {
|
|
179
|
-
for (const char16_t* e = utf16 + length; utf16 != e; ++utf16) {
|
|
180
|
-
if (*utf16 > 0x7F)
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Given a sequences of UTF 16 code units, return a string that explicitly
|
|
187
|
-
// expresses the code units
|
|
188
|
-
std::string getUtf16CodeUnitString(const char16_t* utf16, size_t length) {
|
|
189
|
-
// Every character will need 4 hex digits + the character escape "\u".
|
|
190
|
-
// Plus 2 character for the opening and closing single quote.
|
|
191
|
-
std::string s = std::string(6 * length + 2, 0);
|
|
192
|
-
s.front() = '\'';
|
|
193
|
-
|
|
194
|
-
for (size_t i = 0; i != length; ++i) {
|
|
195
|
-
char16_t ch = utf16[i];
|
|
196
|
-
size_t start = (6 * i) + 1;
|
|
197
|
-
|
|
198
|
-
s[start] = '\\';
|
|
199
|
-
s[start + 1] = 'u';
|
|
200
|
-
|
|
201
|
-
s[start + 2] = hexDigit((ch >> 12) & 0x000f);
|
|
202
|
-
s[start + 3] = hexDigit((ch >> 8) & 0x000f);
|
|
203
|
-
s[start + 4] = hexDigit((ch >> 4) & 0x000f);
|
|
204
|
-
s[start + 5] = hexDigit(ch & 0x000f);
|
|
205
|
-
}
|
|
206
|
-
s.back() = '\'';
|
|
207
|
-
return s;
|
|
208
|
-
}
|
|
209
|
-
#endif
|
|
210
|
-
|
|
211
|
-
} // namespace
|
|
212
|
-
|
|
213
|
-
Buffer::~Buffer() = default;
|
|
214
|
-
|
|
215
|
-
#if JSI_VERSION >= 9
|
|
216
|
-
MutableBuffer::~MutableBuffer() = default;
|
|
217
|
-
#endif
|
|
218
|
-
|
|
219
|
-
PreparedJavaScript::~PreparedJavaScript() = default;
|
|
220
|
-
|
|
221
|
-
Value HostObject::get(Runtime&, const PropNameID&) {
|
|
222
|
-
return Value();
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
void HostObject::set(Runtime& rt, const PropNameID& name, const Value&) {
|
|
226
|
-
std::string msg("TypeError: Cannot assign to property '");
|
|
227
|
-
msg += name.utf8(rt);
|
|
228
|
-
msg += "' on HostObject with default setter";
|
|
229
|
-
throw JSError(rt, msg);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
HostObject::~HostObject() {}
|
|
233
|
-
|
|
234
|
-
#if JSI_VERSION >= 7
|
|
235
|
-
NativeState::~NativeState() {}
|
|
236
|
-
#endif
|
|
237
|
-
|
|
238
|
-
Runtime::~Runtime() {}
|
|
239
|
-
|
|
240
|
-
Instrumentation& Runtime::instrumentation() {
|
|
241
|
-
class NoInstrumentation : public Instrumentation {
|
|
242
|
-
std::string getRecordedGCStats() override {
|
|
243
|
-
return "";
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
std::unordered_map<std::string, int64_t> getHeapInfo(bool) override {
|
|
247
|
-
return std::unordered_map<std::string, int64_t>{};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
void collectGarbage(std::string) override {}
|
|
251
|
-
|
|
252
|
-
void startTrackingHeapObjectStackTraces(
|
|
253
|
-
std::function<void(
|
|
254
|
-
uint64_t,
|
|
255
|
-
std::chrono::microseconds,
|
|
256
|
-
std::vector<HeapStatsUpdate>)>) override {}
|
|
257
|
-
void stopTrackingHeapObjectStackTraces() override {}
|
|
258
|
-
|
|
259
|
-
void startHeapSampling(size_t) override {}
|
|
260
|
-
void stopHeapSampling(std::ostream&) override {}
|
|
261
|
-
|
|
262
|
-
#if JSI_VERSION >= 13
|
|
263
|
-
void createSnapshotToFile(
|
|
264
|
-
const std::string& /*path*/,
|
|
265
|
-
const HeapSnapshotOptions& /*options*/) override
|
|
266
|
-
#else
|
|
267
|
-
void createSnapshotToFile(const std::string&) override
|
|
268
|
-
#endif
|
|
269
|
-
{
|
|
270
|
-
throw JSINativeException(
|
|
271
|
-
"Default instrumentation cannot create a heap snapshot");
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
#if JSI_VERSION >= 13
|
|
275
|
-
void createSnapshotToStream(
|
|
276
|
-
std::ostream& /*os*/,
|
|
277
|
-
const HeapSnapshotOptions& /*options*/) override
|
|
278
|
-
#else
|
|
279
|
-
void createSnapshotToStream(std::ostream&) override
|
|
280
|
-
#endif
|
|
281
|
-
{
|
|
282
|
-
throw JSINativeException(
|
|
283
|
-
"Default instrumentation cannot create a heap snapshot");
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
std::string flushAndDisableBridgeTrafficTrace() override {
|
|
287
|
-
std::abort();
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
void writeBasicBlockProfileTraceToFile(const std::string&) const override {
|
|
291
|
-
std::abort();
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
void dumpProfilerSymbolsToFile(const std::string&) const override {
|
|
295
|
-
std::abort();
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
static NoInstrumentation sharedInstance;
|
|
300
|
-
return sharedInstance;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
#if JSI_VERSION >= 2
|
|
304
|
-
Value Runtime::createValueFromJsonUtf8(const uint8_t* json, size_t length) {
|
|
305
|
-
Function parseJson = global()
|
|
306
|
-
.getPropertyAsObject(*this, "JSON")
|
|
307
|
-
.getPropertyAsFunction(*this, "parse");
|
|
308
|
-
return parseJson.call(*this, String::createFromUtf8(*this, json, length));
|
|
309
|
-
}
|
|
310
|
-
#else
|
|
311
|
-
Value Value::createFromJsonUtf8(
|
|
312
|
-
Runtime& runtime,
|
|
313
|
-
const uint8_t* json,
|
|
314
|
-
size_t length) {
|
|
315
|
-
Function parseJson = runtime.global()
|
|
316
|
-
.getPropertyAsObject(runtime, "JSON")
|
|
317
|
-
.getPropertyAsFunction(runtime, "parse");
|
|
318
|
-
return parseJson.call(runtime, String::createFromUtf8(runtime, json, length));
|
|
319
|
-
}
|
|
320
|
-
#endif
|
|
321
|
-
|
|
322
|
-
#if JSI_VERSION >= 19
|
|
323
|
-
String Runtime::createStringFromUtf16(const char16_t* utf16, size_t length) {
|
|
324
|
-
if (isAllASCII(utf16, length)) {
|
|
325
|
-
std::string buffer(length, '\0');
|
|
326
|
-
for (size_t i = 0; i < length; ++i) {
|
|
327
|
-
buffer[i] = static_cast<char>(utf16[i]);
|
|
328
|
-
}
|
|
329
|
-
return createStringFromAscii(buffer.data(), length);
|
|
330
|
-
}
|
|
331
|
-
auto s = getUtf16CodeUnitString(utf16, length);
|
|
332
|
-
return global()
|
|
333
|
-
.getPropertyAsFunction(*this, "eval")
|
|
334
|
-
.call(*this, s)
|
|
335
|
-
.getString(*this);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
PropNameID Runtime::createPropNameIDFromUtf16(
|
|
339
|
-
const char16_t* utf16,
|
|
340
|
-
size_t length) {
|
|
341
|
-
auto jsString = createStringFromUtf16(utf16, length);
|
|
342
|
-
return createPropNameIDFromString(jsString);
|
|
343
|
-
}
|
|
344
|
-
#endif
|
|
345
|
-
|
|
346
|
-
#if JSI_VERSION >= 14
|
|
347
|
-
std::u16string Runtime::utf16(const PropNameID& sym) {
|
|
348
|
-
auto utf8Str = utf8(sym);
|
|
349
|
-
return convertUTF8ToUTF16(utf8Str);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
std::u16string Runtime::utf16(const String& str) {
|
|
353
|
-
auto utf8Str = utf8(str);
|
|
354
|
-
return convertUTF8ToUTF16(utf8Str);
|
|
355
|
-
}
|
|
356
|
-
#endif
|
|
357
|
-
|
|
358
|
-
#if JSI_VERSION >= 16
|
|
359
|
-
void Runtime::getStringData(
|
|
360
|
-
const jsi::String& str,
|
|
361
|
-
void* ctx,
|
|
362
|
-
void (*cb)(void* ctx, bool ascii, const void* data, size_t num)) {
|
|
363
|
-
auto utf16Str = utf16(str);
|
|
364
|
-
cb(ctx, false, utf16Str.data(), utf16Str.size());
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
void Runtime::getPropNameIdData(
|
|
368
|
-
const jsi::PropNameID& sym,
|
|
369
|
-
void* ctx,
|
|
370
|
-
void (*cb)(void* ctx, bool ascii, const void* data, size_t num)) {
|
|
371
|
-
auto utf16Str = utf16(sym);
|
|
372
|
-
cb(ctx, false, utf16Str.data(), utf16Str.size());
|
|
373
|
-
}
|
|
374
|
-
#endif
|
|
375
|
-
|
|
376
|
-
#if JSI_VERSION >= 17
|
|
377
|
-
void Runtime::setPrototypeOf(const Object& object, const Value& prototype) {
|
|
378
|
-
auto setPrototypeOfFn = global()
|
|
379
|
-
.getPropertyAsObject(*this, "Object")
|
|
380
|
-
.getPropertyAsFunction(*this, "setPrototypeOf");
|
|
381
|
-
setPrototypeOfFn.call(*this, object, prototype).asObject(*this);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
Value Runtime::getPrototypeOf(const Object& object) {
|
|
385
|
-
auto setPrototypeOfFn = global()
|
|
386
|
-
.getPropertyAsObject(*this, "Object")
|
|
387
|
-
.getPropertyAsFunction(*this, "getPrototypeOf");
|
|
388
|
-
return setPrototypeOfFn.call(*this, object);
|
|
389
|
-
}
|
|
390
|
-
#endif
|
|
391
|
-
|
|
392
|
-
#if JSI_VERSION >= 18
|
|
393
|
-
Object Runtime::createObjectWithPrototype(const Value& prototype) {
|
|
394
|
-
auto createFn = global()
|
|
395
|
-
.getPropertyAsObject(*this, "Object")
|
|
396
|
-
.getPropertyAsFunction(*this, "create");
|
|
397
|
-
return createFn.call(*this, prototype).asObject(*this);
|
|
398
|
-
}
|
|
399
|
-
#endif
|
|
400
|
-
|
|
401
|
-
Pointer& Pointer::operator=(Pointer&& other) JSI_NOEXCEPT_15 {
|
|
402
|
-
if (ptr_) {
|
|
403
|
-
ptr_->invalidate();
|
|
404
|
-
}
|
|
405
|
-
ptr_ = other.ptr_;
|
|
406
|
-
other.ptr_ = nullptr;
|
|
407
|
-
return *this;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
Object Object::getPropertyAsObject(Runtime& runtime, const char* name) const {
|
|
411
|
-
Value v = getProperty(runtime, name);
|
|
412
|
-
|
|
413
|
-
if (!v.isObject()) {
|
|
414
|
-
throw JSError(
|
|
415
|
-
runtime,
|
|
416
|
-
std::string("getPropertyAsObject: property '") + name + "' is " +
|
|
417
|
-
kindToString(v, &runtime) + ", expected an Object");
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return v.getObject(runtime);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
Function Object::getPropertyAsFunction(Runtime& runtime, const char* name)
|
|
424
|
-
const {
|
|
425
|
-
Object obj = getPropertyAsObject(runtime, name);
|
|
426
|
-
if (!obj.isFunction(runtime)) {
|
|
427
|
-
throw JSError(
|
|
428
|
-
runtime,
|
|
429
|
-
std::string("getPropertyAsFunction: property '") + name + "' is " +
|
|
430
|
-
kindToString(std::move(obj), &runtime) + ", expected a Function");
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
return std::move(obj).getFunction(runtime);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
Array Object::asArray(Runtime& runtime) const& {
|
|
437
|
-
if (!isArray(runtime)) {
|
|
438
|
-
throw JSError(
|
|
439
|
-
runtime,
|
|
440
|
-
"Object is " + kindToString(Value(runtime, *this), &runtime) +
|
|
441
|
-
", expected an array");
|
|
442
|
-
}
|
|
443
|
-
return getArray(runtime);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
Array Object::asArray(Runtime& runtime) && {
|
|
447
|
-
if (!isArray(runtime)) {
|
|
448
|
-
throw JSError(
|
|
449
|
-
runtime,
|
|
450
|
-
"Object is " + kindToString(Value(runtime, *this), &runtime) +
|
|
451
|
-
", expected an array");
|
|
452
|
-
}
|
|
453
|
-
return std::move(*this).getArray(runtime);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
Function Object::asFunction(Runtime& runtime) const& {
|
|
457
|
-
if (!isFunction(runtime)) {
|
|
458
|
-
throw JSError(
|
|
459
|
-
runtime,
|
|
460
|
-
"Object is " + kindToString(Value(runtime, *this), &runtime) +
|
|
461
|
-
", expected a function");
|
|
462
|
-
}
|
|
463
|
-
return getFunction(runtime);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
Function Object::asFunction(Runtime& runtime) && {
|
|
467
|
-
if (!isFunction(runtime)) {
|
|
468
|
-
throw JSError(
|
|
469
|
-
runtime,
|
|
470
|
-
"Object is " + kindToString(Value(runtime, *this), &runtime) +
|
|
471
|
-
", expected a function");
|
|
472
|
-
}
|
|
473
|
-
return std::move(*this).getFunction(runtime);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
Value::Value(Value&& other) JSI_NOEXCEPT_15 : Value(other.kind_) {
|
|
477
|
-
if (kind_ == BooleanKind) {
|
|
478
|
-
data_.boolean = other.data_.boolean;
|
|
479
|
-
} else if (kind_ == NumberKind) {
|
|
480
|
-
data_.number = other.data_.number;
|
|
481
|
-
} else if (kind_ >= PointerKind) {
|
|
482
|
-
new (&data_.pointer) Pointer(std::move(other.data_.pointer));
|
|
483
|
-
}
|
|
484
|
-
// when the other's dtor runs, nothing will happen.
|
|
485
|
-
other.kind_ = UndefinedKind;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
Value::Value(Runtime& runtime, const Value& other) : Value(other.kind_) {
|
|
489
|
-
// data_ is uninitialized, so use placement new to create non-POD
|
|
490
|
-
// types in it. Any other kind of initialization will call a dtor
|
|
491
|
-
// first, which is incorrect.
|
|
492
|
-
if (kind_ == BooleanKind) {
|
|
493
|
-
data_.boolean = other.data_.boolean;
|
|
494
|
-
} else if (kind_ == NumberKind) {
|
|
495
|
-
data_.number = other.data_.number;
|
|
496
|
-
} else if (kind_ == SymbolKind) {
|
|
497
|
-
new (&data_.pointer) Pointer(runtime.cloneSymbol(other.data_.pointer.ptr_));
|
|
498
|
-
#if JSI_VERSION >= 6
|
|
499
|
-
} else if (kind_ == BigIntKind) {
|
|
500
|
-
new (&data_.pointer) Pointer(runtime.cloneBigInt(other.data_.pointer.ptr_));
|
|
501
|
-
#endif
|
|
502
|
-
} else if (kind_ == StringKind) {
|
|
503
|
-
new (&data_.pointer) Pointer(runtime.cloneString(other.data_.pointer.ptr_));
|
|
504
|
-
} else if (kind_ >= ObjectKind) {
|
|
505
|
-
new (&data_.pointer) Pointer(runtime.cloneObject(other.data_.pointer.ptr_));
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
Value::~Value() {
|
|
510
|
-
if (kind_ >= PointerKind) {
|
|
511
|
-
data_.pointer.~Pointer();
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
bool Value::strictEquals(Runtime& runtime, const Value& a, const Value& b) {
|
|
516
|
-
if (a.kind_ != b.kind_) {
|
|
517
|
-
return false;
|
|
518
|
-
}
|
|
519
|
-
switch (a.kind_) {
|
|
520
|
-
case UndefinedKind:
|
|
521
|
-
case NullKind:
|
|
522
|
-
return true;
|
|
523
|
-
case BooleanKind:
|
|
524
|
-
return a.data_.boolean == b.data_.boolean;
|
|
525
|
-
case NumberKind:
|
|
526
|
-
return a.data_.number == b.data_.number;
|
|
527
|
-
case SymbolKind:
|
|
528
|
-
return runtime.strictEquals(
|
|
529
|
-
static_cast<const Symbol&>(a.data_.pointer),
|
|
530
|
-
static_cast<const Symbol&>(b.data_.pointer));
|
|
531
|
-
#if JSI_VERSION >= 6
|
|
532
|
-
case BigIntKind:
|
|
533
|
-
return runtime.strictEquals(
|
|
534
|
-
static_cast<const BigInt&>(a.data_.pointer),
|
|
535
|
-
static_cast<const BigInt&>(b.data_.pointer));
|
|
536
|
-
#endif
|
|
537
|
-
case StringKind:
|
|
538
|
-
return runtime.strictEquals(
|
|
539
|
-
static_cast<const String&>(a.data_.pointer),
|
|
540
|
-
static_cast<const String&>(b.data_.pointer));
|
|
541
|
-
case ObjectKind:
|
|
542
|
-
return runtime.strictEquals(
|
|
543
|
-
static_cast<const Object&>(a.data_.pointer),
|
|
544
|
-
static_cast<const Object&>(b.data_.pointer));
|
|
545
|
-
}
|
|
546
|
-
return false;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
bool Value::asBool() const {
|
|
550
|
-
if (!isBool()) {
|
|
551
|
-
throw JSINativeException(
|
|
552
|
-
"Value is " + kindToString(*this) + ", expected a boolean");
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
return getBool();
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
double Value::asNumber() const {
|
|
559
|
-
if (!isNumber()) {
|
|
560
|
-
throw JSINativeException(
|
|
561
|
-
"Value is " + kindToString(*this) + ", expected a number");
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
return getNumber();
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
Object Value::asObject(Runtime& rt) const& {
|
|
568
|
-
if (!isObject()) {
|
|
569
|
-
throw JSError(
|
|
570
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected an Object");
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
return getObject(rt);
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
Object Value::asObject(Runtime& rt) && {
|
|
577
|
-
if (!isObject()) {
|
|
578
|
-
throw JSError(
|
|
579
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected an Object");
|
|
580
|
-
}
|
|
581
|
-
auto ptr = data_.pointer.ptr_;
|
|
582
|
-
data_.pointer.ptr_ = nullptr;
|
|
583
|
-
return static_cast<Object>(ptr);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
Symbol Value::asSymbol(Runtime& rt) const& {
|
|
587
|
-
if (!isSymbol()) {
|
|
588
|
-
throw JSError(
|
|
589
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected a Symbol");
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
return getSymbol(rt);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
Symbol Value::asSymbol(Runtime& rt) && {
|
|
596
|
-
if (!isSymbol()) {
|
|
597
|
-
throw JSError(
|
|
598
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected a Symbol");
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
return std::move(*this).getSymbol(rt);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
#if JSI_VERSION >= 6
|
|
605
|
-
BigInt Value::asBigInt(Runtime& rt) const& {
|
|
606
|
-
if (!isBigInt()) {
|
|
607
|
-
throw JSError(
|
|
608
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected a BigInt");
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
return getBigInt(rt);
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
BigInt Value::asBigInt(Runtime& rt) && {
|
|
615
|
-
if (!isBigInt()) {
|
|
616
|
-
throw JSError(
|
|
617
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected a BigInt");
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
return std::move(*this).getBigInt(rt);
|
|
621
|
-
}
|
|
622
|
-
#endif
|
|
623
|
-
|
|
624
|
-
String Value::asString(Runtime& rt) const& {
|
|
625
|
-
if (!isString()) {
|
|
626
|
-
throw JSError(
|
|
627
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected a String");
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
return getString(rt);
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
String Value::asString(Runtime& rt) && {
|
|
634
|
-
if (!isString()) {
|
|
635
|
-
throw JSError(
|
|
636
|
-
rt, "Value is " + kindToString(*this, &rt) + ", expected a String");
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
return std::move(*this).getString(rt);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
String Value::toString(Runtime& runtime) const {
|
|
643
|
-
Function toString = runtime.global().getPropertyAsFunction(runtime, "String");
|
|
644
|
-
return toString.call(runtime, *this).getString(runtime);
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
#if JSI_VERSION >= 8
|
|
648
|
-
uint64_t BigInt::asUint64(Runtime& runtime) const {
|
|
649
|
-
if (!isUint64(runtime)) {
|
|
650
|
-
throw JSError(runtime, "Lossy truncation in BigInt64::asUint64");
|
|
651
|
-
}
|
|
652
|
-
return getUint64(runtime);
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
int64_t BigInt::asInt64(Runtime& runtime) const {
|
|
656
|
-
if (!isInt64(runtime)) {
|
|
657
|
-
throw JSError(runtime, "Lossy truncation in BigInt64::asInt64");
|
|
658
|
-
}
|
|
659
|
-
return getInt64(runtime);
|
|
660
|
-
}
|
|
661
|
-
#endif
|
|
662
|
-
|
|
663
|
-
Array Array::createWithElements(
|
|
664
|
-
Runtime& rt,
|
|
665
|
-
std::initializer_list<Value> elements) {
|
|
666
|
-
Array result(rt, elements.size());
|
|
667
|
-
size_t index = 0;
|
|
668
|
-
for (const auto& element : elements) {
|
|
669
|
-
result.setValueAtIndex(rt, index++, element);
|
|
670
|
-
}
|
|
671
|
-
return result;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
std::vector<PropNameID> HostObject::getPropertyNames(Runtime&) {
|
|
675
|
-
return {};
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
Runtime::ScopeState* Runtime::pushScope() {
|
|
679
|
-
return nullptr;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
void Runtime::popScope(ScopeState*) {}
|
|
683
|
-
|
|
684
|
-
JSError::JSError(Runtime& rt, Value&& value) {
|
|
685
|
-
setValue(rt, std::move(value));
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
JSError::JSError(Runtime& rt, std::string msg) : message_(std::move(msg)) {
|
|
689
|
-
try {
|
|
690
|
-
setValue(
|
|
691
|
-
rt,
|
|
692
|
-
callGlobalFunction(rt, "Error", String::createFromUtf8(rt, message_)));
|
|
693
|
-
} catch (const JSIException& ex) {
|
|
694
|
-
message_ = std::string(ex.what()) + " (while raising " + message_ + ")";
|
|
695
|
-
setValue(rt, String::createFromUtf8(rt, message_));
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
JSError::JSError(Runtime& rt, std::string msg, std::string stack)
|
|
700
|
-
: message_(std::move(msg)), stack_(std::move(stack)) {
|
|
701
|
-
try {
|
|
702
|
-
Object e(rt);
|
|
703
|
-
e.setProperty(rt, "message", String::createFromUtf8(rt, message_));
|
|
704
|
-
e.setProperty(rt, "stack", String::createFromUtf8(rt, stack_));
|
|
705
|
-
setValue(rt, std::move(e));
|
|
706
|
-
} catch (const JSIException& ex) {
|
|
707
|
-
setValue(rt, String::createFromUtf8(rt, ex.what()));
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
JSError::JSError(std::string what, Runtime& rt, Value&& value)
|
|
712
|
-
: JSIException(std::move(what)) {
|
|
713
|
-
setValue(rt, std::move(value));
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
JSError::JSError(Value&& value, std::string message, std::string stack)
|
|
717
|
-
: JSIException(message + "\n\n" + stack),
|
|
718
|
-
value_(std::make_shared<Value>(std::move(value))),
|
|
719
|
-
message_(std::move(message)),
|
|
720
|
-
stack_(std::move(stack)) {}
|
|
721
|
-
|
|
722
|
-
void JSError::setValue(Runtime& rt, Value&& value) {
|
|
723
|
-
value_ = std::make_shared<Value>(std::move(value));
|
|
724
|
-
|
|
725
|
-
if ((message_.empty() || stack_.empty()) && value_->isObject()) {
|
|
726
|
-
auto obj = value_->getObject(rt);
|
|
727
|
-
|
|
728
|
-
if (message_.empty()) {
|
|
729
|
-
try {
|
|
730
|
-
Value message = obj.getProperty(rt, "message");
|
|
731
|
-
if (!message.isUndefined() && !message.isString()) {
|
|
732
|
-
message = callGlobalFunction(rt, "String", message);
|
|
733
|
-
}
|
|
734
|
-
if (message.isString()) {
|
|
735
|
-
message_ = message.getString(rt).utf8(rt);
|
|
736
|
-
} else if (!message.isUndefined()) {
|
|
737
|
-
message_ = "String(e.message) is a " + kindToString(message, &rt);
|
|
738
|
-
}
|
|
739
|
-
} catch (const JSIException& ex) {
|
|
740
|
-
message_ = std::string("[Exception while creating message string: ") +
|
|
741
|
-
ex.what() + "]";
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
if (stack_.empty()) {
|
|
746
|
-
try {
|
|
747
|
-
Value stack = obj.getProperty(rt, "stack");
|
|
748
|
-
if (!stack.isUndefined() && !stack.isString()) {
|
|
749
|
-
stack = callGlobalFunction(rt, "String", stack);
|
|
750
|
-
}
|
|
751
|
-
if (stack.isString()) {
|
|
752
|
-
stack_ = stack.getString(rt).utf8(rt);
|
|
753
|
-
} else if (!stack.isUndefined()) {
|
|
754
|
-
stack_ = "String(e.stack) is a " + kindToString(stack, &rt);
|
|
755
|
-
}
|
|
756
|
-
} catch (const JSIException& ex) {
|
|
757
|
-
message_ = std::string("[Exception while creating stack string: ") +
|
|
758
|
-
ex.what() + "]";
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
if (message_.empty()) {
|
|
764
|
-
try {
|
|
765
|
-
if (value_->isString()) {
|
|
766
|
-
message_ = value_->getString(rt).utf8(rt);
|
|
767
|
-
} else {
|
|
768
|
-
Value message = callGlobalFunction(rt, "String", *value_);
|
|
769
|
-
if (message.isString()) {
|
|
770
|
-
message_ = message.getString(rt).utf8(rt);
|
|
771
|
-
} else {
|
|
772
|
-
message_ = "String(e) is a " + kindToString(message, &rt);
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
} catch (const JSIException& ex) {
|
|
776
|
-
message_ = std::string("[Exception while creating message string: ") +
|
|
777
|
-
ex.what() + "]";
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
if (stack_.empty()) {
|
|
782
|
-
stack_ = "no stack";
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
if (what_.empty()) {
|
|
786
|
-
what_ = message_ + "\n\n" + stack_;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
JSIException::~JSIException() {}
|
|
791
|
-
|
|
792
|
-
JSINativeException::~JSINativeException() {}
|
|
793
|
-
|
|
794
|
-
JSError::~JSError() {}
|
|
795
|
-
|
|
796
|
-
} // namespace jsi
|
|
797
|
-
} // namespace facebook
|