react-native-windows 0.64.25 → 0.64.26
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 +13 -4
- 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/JSI/Desktop/JSI.Desktop.vcxproj +0 -3
- package/JSI/Desktop/JSI.Desktop.vcxproj.filters +0 -5
- package/JSI/Shared/ChakraApi.cpp +1 -37
- package/JSI/Shared/ChakraApi.h +0 -4
- package/JSI/Shared/ChakraJsiRuntime_edgemode.cpp +1 -5
- package/JSI/Shared/ChakraRuntime.cpp +0 -12
- package/JSI/Shared/ChakraRuntimeFactory.h +0 -2
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +0 -2
- package/PropertySheets/React.Cpp.props +2 -0
- package/Shared/OInstance.cpp +2 -15
- package/package.json +1 -1
- package/Chakra/ChakraCoreDebugger.h +0 -147
- package/JSI/Desktop/ChakraJsiRuntime_core.cpp +0 -322
- package/JSI/Shared/ChakraCoreRuntime.h +0 -59
- package/Scripts/Microsoft.ChakraCore.ARM64.nuspec +0 -50
- package/Scripts/Microsoft.ChakraCore.ARM64.targets +0 -15
|
@@ -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
|
|
@@ -123,8 +123,6 @@
|
|
|
123
123
|
REACTWINDOWS_BUILD - building with REACTWINDOWS_API as dll exports
|
|
124
124
|
OLD_CPPWINRT is a workaround to make target version to 19H1
|
|
125
125
|
-->
|
|
126
|
-
<PreprocessorDefinitions Condition="'$(CHAKRACOREUWP)'=='true'">CHAKRACORE;CHAKRACORE_UWP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
127
|
-
<PreprocessorDefinitions Condition="'$(CHAKRACOREUWP)'!='true'">USE_EDGEMODE_JSRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
128
126
|
<PreprocessorDefinitions>
|
|
129
127
|
REACTWINDOWS_BUILD;
|
|
130
128
|
RN_PLATFORM=windows;
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
BOOST_NO_TYPEID - Configure boost not to check typeid (not to use RTTI)
|
|
83
83
|
BOOST_SYSTEM_SOURCE - Build boost::system symbols from sources (drop dependency on boost_system.lib).
|
|
84
84
|
GTEST_HAS_RTTI - Let GTest know not to use RTTI
|
|
85
|
+
USE_EDGEMODE_JSRT When using Chakra, enforce System Chakra instead of JS9.
|
|
85
86
|
WIN32_LEAN_AND_MEAN - Reduce the Windows API included surface.
|
|
86
87
|
WINRT_LEAN_AND_MEAN - Disable rarely used cppwinrt templates that impact compile-time/PCH size.
|
|
87
88
|
-->
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
BOOST_NO_TYPEID;
|
|
94
95
|
BOOST_SYSTEM_SOURCE;
|
|
95
96
|
GTEST_HAS_RTTI=0;
|
|
97
|
+
USE_EDGEMODE_JSRT;
|
|
96
98
|
WIN32_LEAN_AND_MEAN;
|
|
97
99
|
%(PreprocessorDefinitions)
|
|
98
100
|
</PreprocessorDefinitions>
|
package/Shared/OInstance.cpp
CHANGED
|
@@ -388,12 +388,6 @@ InstanceImpl::InstanceImpl(
|
|
|
388
388
|
[[fallthrough]];
|
|
389
389
|
#endif
|
|
390
390
|
}
|
|
391
|
-
case JSIEngineOverride::Chakra:
|
|
392
|
-
// Applies only to ChakraCore-linked binaries.
|
|
393
|
-
Microsoft::React::SetRuntimeOptionBool("JSI.ForceSystemChakra", true);
|
|
394
|
-
m_devSettings->jsiRuntimeHolder =
|
|
395
|
-
std::make_shared<Microsoft::JSI::ChakraRuntimeHolder>(m_devSettings, m_jsThread, nullptr, nullptr);
|
|
396
|
-
break;
|
|
397
391
|
case JSIEngineOverride::V8NodeApi: {
|
|
398
392
|
#if defined(USE_V8)
|
|
399
393
|
std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore;
|
|
@@ -421,6 +415,7 @@ InstanceImpl::InstanceImpl(
|
|
|
421
415
|
[[fallthrough]];
|
|
422
416
|
#endif
|
|
423
417
|
}
|
|
418
|
+
case JSIEngineOverride::Chakra:
|
|
424
419
|
case JSIEngineOverride::ChakraCore:
|
|
425
420
|
default: // TODO: Add other engines once supported
|
|
426
421
|
m_devSettings->jsiRuntimeHolder =
|
|
@@ -564,11 +559,7 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
|
|
|
564
559
|
// Otherwise all bundles (User and Platform) are loaded through
|
|
565
560
|
// platformBundles.
|
|
566
561
|
if (PathFileExistsA(fullBundleFilePath.c_str())) {
|
|
567
|
-
#if defined(_CHAKRACORE_H_)
|
|
568
562
|
auto bundleString = FileMappingBigString::fromPath(fullBundleFilePath);
|
|
569
|
-
#else
|
|
570
|
-
auto bundleString = JSBigFileString::fromPath(fullBundleFilePath);
|
|
571
|
-
#endif
|
|
572
563
|
m_innerInstance->loadScriptFromString(std::move(bundleString), std::move(fullBundleFilePath), synchronously);
|
|
573
564
|
}
|
|
574
565
|
|
|
@@ -580,11 +571,7 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
|
|
|
580
571
|
m_innerInstance->loadScriptFromString(std::move(bundleString), jsBundleRelativePath, synchronously);
|
|
581
572
|
#endif
|
|
582
573
|
}
|
|
583
|
-
|
|
584
|
-
} catch (const facebook::react::ChakraJSException &e) {
|
|
585
|
-
m_devSettings->errorCallback(std::string{e.what()} + "\r\n" + e.getStack());
|
|
586
|
-
#endif
|
|
587
|
-
} catch (std::exception &e) {
|
|
574
|
+
} catch (const std::exception &e) {
|
|
588
575
|
m_devSettings->errorCallback(e.what());
|
|
589
576
|
}
|
|
590
577
|
}
|
package/package.json
CHANGED
|
@@ -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,322 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
#include "ChakraCoreRuntime.h"
|
|
5
|
-
#include "ChakraRuntimeFactory.h"
|
|
6
|
-
|
|
7
|
-
#include <cxxreact/MessageQueueThread.h>
|
|
8
|
-
#include "ByteArrayBuffer.h"
|
|
9
|
-
#include "Unicode.h"
|
|
10
|
-
|
|
11
|
-
// This file contains non-edge-mode (or win32) implementations.
|
|
12
|
-
#if !defined(USE_EDGEMODE_JSRT)
|
|
13
|
-
#include <ChakraCore.h>
|
|
14
|
-
#include "ChakraCoreDebugger.h"
|
|
15
|
-
|
|
16
|
-
namespace Microsoft::JSI {
|
|
17
|
-
|
|
18
|
-
namespace {
|
|
19
|
-
|
|
20
|
-
#if !defined(CHAKRACORE_UWP)
|
|
21
|
-
// This is very wierd. This should match with the definition of VS_VERSIONINFO
|
|
22
|
-
// as defined in
|
|
23
|
-
// https://docs.microsoft.com/en-us/windows/desktop/menurc/vs-versioninfo I
|
|
24
|
-
// can't find a way to include the actual definition of VS_VERSIONINFO
|
|
25
|
-
// TODO :: Re-evaluate this strategy.
|
|
26
|
-
struct FileVersionInfoResource {
|
|
27
|
-
uint16_t len;
|
|
28
|
-
uint16_t valLen;
|
|
29
|
-
uint16_t type;
|
|
30
|
-
wchar_t key[_countof(L"VS_VERSION_INFO")];
|
|
31
|
-
uint16_t padding1;
|
|
32
|
-
VS_FIXEDFILEINFO fixedFileInfo;
|
|
33
|
-
uint32_t padding2;
|
|
34
|
-
};
|
|
35
|
-
#endif
|
|
36
|
-
|
|
37
|
-
} // namespace
|
|
38
|
-
|
|
39
|
-
ChakraCoreRuntime::ChakraCoreRuntime(ChakraRuntimeArgs &&args) noexcept : ChakraRuntime(std::move(args)) {
|
|
40
|
-
this->Init();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
ChakraCoreRuntime::~ChakraCoreRuntime() noexcept {
|
|
44
|
-
stopDebuggingIfNeeded();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// TODO: We temporarily removed weak reference semantics from
|
|
48
|
-
// ChakraCore based jsi::Runtime.
|
|
49
|
-
|
|
50
|
-
void CALLBACK ChakraRuntime::PromiseRejectionTrackerCallback(
|
|
51
|
-
JsValueRef promise,
|
|
52
|
-
JsValueRef reason,
|
|
53
|
-
bool handled,
|
|
54
|
-
void *callbackState) {
|
|
55
|
-
ChakraRuntime *runtime = static_cast<ChakraRuntime *>(callbackState);
|
|
56
|
-
runtime->PromiseRejectionTracker(promise, reason, handled);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
void ChakraRuntime::PromiseRejectionTracker(JsValueRef /*promise*/, JsValueRef reason, bool handled) {
|
|
60
|
-
if (!handled) {
|
|
61
|
-
std::ostringstream errorStream;
|
|
62
|
-
errorStream << "ChakraCore uncaught promise rejection: ";
|
|
63
|
-
|
|
64
|
-
JsPropertyIdRef stackPropertyID;
|
|
65
|
-
JsErrorCode error = JsGetPropertyIdFromName(L"stack", &stackPropertyID);
|
|
66
|
-
if (error == JsNoError) {
|
|
67
|
-
JsValueRef stack;
|
|
68
|
-
error = JsGetProperty(reason, stackPropertyID, &stack);
|
|
69
|
-
if (error == JsNoError) {
|
|
70
|
-
JsValueRef stackStrValue;
|
|
71
|
-
error = JsConvertValueToString(stack, &stackStrValue);
|
|
72
|
-
if (error == JsNoError) {
|
|
73
|
-
errorStream << StringToStdString(stackStrValue);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (error != JsNoError) {
|
|
79
|
-
// weren't able to print stack, so just convert reason to a string
|
|
80
|
-
JsValueRef strValue;
|
|
81
|
-
error = JsConvertValueToString(reason, &strValue);
|
|
82
|
-
if (error == JsNoError) {
|
|
83
|
-
errorStream << StringToStdString(strValue);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
std::string errorString = errorStream.str();
|
|
88
|
-
throw facebook::jsi::JSError(*this, createStringFromAscii(errorString.c_str(), errorString.length()));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
void ChakraCoreRuntime::setupNativePromiseContinuation() noexcept {
|
|
93
|
-
if (runtimeArgs().enableNativePromiseSupport) {
|
|
94
|
-
JsSetPromiseContinuationCallback(PromiseContinuationCallback, this);
|
|
95
|
-
JsSetHostPromiseRejectionTracker(PromiseRejectionTrackerCallback, this);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
void ChakraCoreRuntime::startDebuggingIfNeeded() {
|
|
100
|
-
auto &args = runtimeArgs();
|
|
101
|
-
if (args.enableDebugging) {
|
|
102
|
-
auto port = args.debuggerPort == 0 ? DebuggerDefaultPort : args.debuggerPort;
|
|
103
|
-
auto runtimeName = args.debuggerRuntimeName.empty() ? DebuggerDefaultRuntimeName : args.debuggerRuntimeName;
|
|
104
|
-
|
|
105
|
-
JsErrorCode result = enableDebugging(
|
|
106
|
-
m_runtime,
|
|
107
|
-
runtimeName,
|
|
108
|
-
args.debuggerBreakOnNextLine,
|
|
109
|
-
static_cast<uint16_t>(port),
|
|
110
|
-
m_debugProtocolHandler,
|
|
111
|
-
m_debugService);
|
|
112
|
-
|
|
113
|
-
if (result == JsNoError) {
|
|
114
|
-
m_debugPort = port;
|
|
115
|
-
m_debugRuntimeName = runtimeName;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (args.debuggerBreakOnNextLine && m_debugProtocolHandler) {
|
|
120
|
-
if (args.loggingCallback)
|
|
121
|
-
args.loggingCallback("Waiting for debugger to connect...", LogLevel::Info);
|
|
122
|
-
|
|
123
|
-
m_debugProtocolHandler->WaitForDebugger();
|
|
124
|
-
|
|
125
|
-
if (args.loggingCallback)
|
|
126
|
-
args.loggingCallback("Debugger connected", LogLevel::Info);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
void ChakraCoreRuntime::stopDebuggingIfNeeded() {
|
|
131
|
-
if (m_debugService) {
|
|
132
|
-
JsErrorCode result = m_debugService->Close();
|
|
133
|
-
|
|
134
|
-
if (result == JsNoError) {
|
|
135
|
-
result = m_debugService->UnregisterHandler(m_debugRuntimeName);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
m_debugService = nullptr;
|
|
139
|
-
m_debugProtocolHandler = nullptr;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
JsErrorCode ChakraCoreRuntime::enableDebugging(
|
|
143
|
-
JsRuntimeHandle runtime,
|
|
144
|
-
std::string const &runtimeName,
|
|
145
|
-
bool breakOnNextLine,
|
|
146
|
-
uint16_t port,
|
|
147
|
-
std::unique_ptr<DebugProtocolHandler> &debugProtocolHandler,
|
|
148
|
-
std::unique_ptr<DebugService> &debugService) {
|
|
149
|
-
JsErrorCode result = JsNoError;
|
|
150
|
-
auto protocolHandler = std::make_unique<DebugProtocolHandler>(runtime);
|
|
151
|
-
auto service = std::make_unique<DebugService>(runtime);
|
|
152
|
-
|
|
153
|
-
result = service->RegisterHandler(runtimeName, *protocolHandler, breakOnNextLine);
|
|
154
|
-
|
|
155
|
-
if (result == JsNoError) {
|
|
156
|
-
if (protocolHandler) {
|
|
157
|
-
result = protocolHandler->SetCommandQueueCallback(ProcessDebuggerCommandQueueCallback, this);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (result == JsNoError) {
|
|
162
|
-
result = service->Listen(port);
|
|
163
|
-
|
|
164
|
-
if (runtimeArgs().loggingCallback)
|
|
165
|
-
runtimeArgs().loggingCallback(
|
|
166
|
-
(std::string("Listening on ws://127.0.0.1:") + std::to_string(port) + "/" + runtimeName).c_str(),
|
|
167
|
-
LogLevel::Info);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (result == JsNoError) {
|
|
171
|
-
debugProtocolHandler = std::move(protocolHandler);
|
|
172
|
-
debugService = std::move(service);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return result;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
void ChakraCoreRuntime::ProcessDebuggerCommandQueue() {
|
|
179
|
-
if (runtimeArgs().jsQueue) {
|
|
180
|
-
runtimeArgs().jsQueue->runOnQueue([this]() {
|
|
181
|
-
if (m_debugProtocolHandler) {
|
|
182
|
-
m_debugProtocolHandler->ProcessCommandQueue();
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/* static */ void ChakraCoreRuntime::ProcessDebuggerCommandQueueCallback(void *callbackState) {
|
|
189
|
-
ChakraCoreRuntime *runtime = reinterpret_cast<ChakraCoreRuntime *>(callbackState);
|
|
190
|
-
|
|
191
|
-
if (runtime) {
|
|
192
|
-
runtime->ProcessDebuggerCommandQueue();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// TODO :: This code is mostly copied from the old ChakraExecutor flow, and not
|
|
197
|
-
// verified for reliability yet.
|
|
198
|
-
// TODO :: Re-evaluate this strategy of finding the dll version for versioning
|
|
199
|
-
// the runtime.
|
|
200
|
-
/*static*/ void ChakraRuntime::initRuntimeVersion() noexcept {
|
|
201
|
-
// This code is win32 only at the moment. We will need to change this
|
|
202
|
-
// line if we want to support UWP.
|
|
203
|
-
#if !defined(CHAKRACORE_UWP)
|
|
204
|
-
constexpr wchar_t chakraDllName[] = L"ChakraCore.dll";
|
|
205
|
-
|
|
206
|
-
auto freeLibraryWrapper = [](void *p) { FreeLibrary((HMODULE)p); };
|
|
207
|
-
HMODULE moduleHandle;
|
|
208
|
-
if (!GetModuleHandleExW(0, chakraDllName, &moduleHandle))
|
|
209
|
-
return;
|
|
210
|
-
|
|
211
|
-
std::unique_ptr<void, decltype(freeLibraryWrapper)> moduleHandleWrapper{moduleHandle, std::move(freeLibraryWrapper)};
|
|
212
|
-
|
|
213
|
-
HRSRC versionResourceHandle = FindResourceW(moduleHandle, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
|
|
214
|
-
|
|
215
|
-
if (!versionResourceHandle ||
|
|
216
|
-
SizeofResource(static_cast<HMODULE>(moduleHandleWrapper.get()), versionResourceHandle) <
|
|
217
|
-
sizeof(FileVersionInfoResource))
|
|
218
|
-
return;
|
|
219
|
-
|
|
220
|
-
HGLOBAL versionResourcePtrHandle = LoadResource(moduleHandle, versionResourceHandle);
|
|
221
|
-
if (!versionResourcePtrHandle)
|
|
222
|
-
return;
|
|
223
|
-
|
|
224
|
-
FileVersionInfoResource *chakraVersionInfo =
|
|
225
|
-
static_cast<FileVersionInfoResource *>(LockResource(versionResourcePtrHandle));
|
|
226
|
-
if (!chakraVersionInfo)
|
|
227
|
-
return;
|
|
228
|
-
|
|
229
|
-
s_runtimeVersion = chakraVersionInfo->fixedFileInfo.dwFileVersionMS;
|
|
230
|
-
s_runtimeVersion <<= 32;
|
|
231
|
-
s_runtimeVersion |= chakraVersionInfo->fixedFileInfo.dwFileVersionLS;
|
|
232
|
-
#endif
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
std::unique_ptr<const facebook::jsi::Buffer> ChakraCoreRuntime::generatePreparedScript(
|
|
236
|
-
const std::string &sourceURL,
|
|
237
|
-
const facebook::jsi::Buffer &sourceBuffer) noexcept {
|
|
238
|
-
const std::wstring scriptUTF16 =
|
|
239
|
-
Microsoft::Common::Unicode::Utf8ToUtf16(reinterpret_cast<const char *>(sourceBuffer.data()), sourceBuffer.size());
|
|
240
|
-
|
|
241
|
-
unsigned int bytecodeSize = 0;
|
|
242
|
-
if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) == JsNoError) {
|
|
243
|
-
std::unique_ptr<ByteArrayBuffer> bytecodeBuffer(std::make_unique<ByteArrayBuffer>(bytecodeSize));
|
|
244
|
-
if (JsSerializeScript(scriptUTF16.c_str(), bytecodeBuffer->data(), &bytecodeSize) == JsNoError) {
|
|
245
|
-
return bytecodeBuffer;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return nullptr;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
facebook::jsi::Value ChakraCoreRuntime::evaluateJavaScriptSimple(
|
|
253
|
-
const facebook::jsi::Buffer &buffer,
|
|
254
|
-
const std::string &sourceURL) {
|
|
255
|
-
JsValueRef sourceRef;
|
|
256
|
-
JsCreateString(reinterpret_cast<const char *>(buffer.data()), buffer.size(), &sourceRef);
|
|
257
|
-
|
|
258
|
-
JsValueRef sourceURLRef = nullptr;
|
|
259
|
-
JsCreateString(reinterpret_cast<const char *>(sourceURL.c_str()), sourceURL.size(), &sourceURLRef);
|
|
260
|
-
|
|
261
|
-
JsValueRef result;
|
|
262
|
-
ChakraVerifyJsErrorElseThrow(
|
|
263
|
-
JsRun(sourceRef, 0, sourceURLRef, JsParseScriptAttributes::JsParseScriptAttributeNone, &result));
|
|
264
|
-
|
|
265
|
-
return ToJsiValue(result);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
bool ChakraCoreRuntime::evaluateSerializedScript(
|
|
269
|
-
const facebook::jsi::Buffer &scriptBuffer,
|
|
270
|
-
const facebook::jsi::Buffer &serializedScriptBuffer,
|
|
271
|
-
const std::string &sourceURL,
|
|
272
|
-
JsValueRef *result) {
|
|
273
|
-
JsValueRef bytecodeArrayBuffer = nullptr;
|
|
274
|
-
if (JsCreateExternalArrayBuffer(
|
|
275
|
-
const_cast<uint8_t *>(serializedScriptBuffer.data()),
|
|
276
|
-
static_cast<unsigned int>(serializedScriptBuffer.size()),
|
|
277
|
-
nullptr,
|
|
278
|
-
nullptr,
|
|
279
|
-
&bytecodeArrayBuffer) == JsNoError) {
|
|
280
|
-
JsValueRef sourceURLRef = nullptr;
|
|
281
|
-
if (!sourceURL.empty()) {
|
|
282
|
-
sourceURLRef = PointerToString(sourceURL);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
JsErrorCode errorCode = JsRunSerialized(
|
|
286
|
-
bytecodeArrayBuffer,
|
|
287
|
-
[](JsSourceContext sourceContext, JsValueRef *value, JsParseScriptAttributes *parseAttributes) {
|
|
288
|
-
const facebook::jsi::Buffer *scriptSource = reinterpret_cast<const facebook::jsi::Buffer *>(sourceContext);
|
|
289
|
-
if (JsCreateExternalArrayBuffer(
|
|
290
|
-
const_cast<uint8_t *>(scriptSource->data()),
|
|
291
|
-
static_cast<unsigned int>(scriptSource->size()),
|
|
292
|
-
nullptr,
|
|
293
|
-
nullptr,
|
|
294
|
-
value) != JsNoError)
|
|
295
|
-
std::terminate();
|
|
296
|
-
|
|
297
|
-
*parseAttributes = JsParseScriptAttributeNone;
|
|
298
|
-
return true;
|
|
299
|
-
},
|
|
300
|
-
reinterpret_cast<JsSourceContext>(m_pinnedScripts.back().get()),
|
|
301
|
-
sourceURLRef,
|
|
302
|
-
result);
|
|
303
|
-
|
|
304
|
-
if (errorCode == JsNoError) {
|
|
305
|
-
return true;
|
|
306
|
-
} else if (errorCode == JsErrorBadSerializedScript) {
|
|
307
|
-
return false;
|
|
308
|
-
} else {
|
|
309
|
-
ChakraVerifyJsErrorElseThrow(errorCode);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
std::unique_ptr<facebook::jsi::Runtime> MakeChakraCoreRuntime(ChakraRuntimeArgs &&args) noexcept {
|
|
317
|
-
return std::make_unique<ChakraCoreRuntime>(std::move(args));
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
} // namespace Microsoft::JSI
|
|
321
|
-
|
|
322
|
-
#endif
|
|
@@ -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
|
|
@@ -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>
|