|
10 | 10 | #include <cxxreact/ErrorUtils.h> |
11 | 11 | #include <cxxreact/JSBigString.h> |
12 | 12 | #include <cxxreact/JSExecutor.h> |
| 13 | +#include <cxxreact/ReactMarker.h> |
13 | 14 | #include <cxxreact/SystraceSection.h> |
14 | 15 | #include <glog/logging.h> |
15 | 16 | #include <jsi/JSIDynamic.h> |
16 | 17 | #include <jsi/instrumentation.h> |
17 | 18 | #include <jsireact/JSIExecutor.h> |
18 | 19 | #include <react/featureflags/ReactNativeFeatureFlags.h> |
19 | 20 | #include <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h> |
20 | | - |
21 | | -#include <cxxreact/ReactMarker.h> |
| 21 | +#include <react/utils/jsi.h> |
22 | 22 | #include <iostream> |
23 | 23 | #include <tuple> |
24 | 24 | #include <utility> |
@@ -140,43 +140,6 @@ ReactInstance::getRuntimeScheduler() noexcept { |
140 | 140 | return runtimeScheduler_; |
141 | 141 | } |
142 | 142 |
|
143 | | -/** |
144 | | - * Defines a property on the global object that is neither enumerable, nor |
145 | | - * configurable, nor writable. This ensures that the private globals exposed by |
146 | | - * ReactInstance cannot overwritten by third-party JavaScript code. It also |
147 | | - * ensures that third-party JavaScript code unaware of these globals isn't able |
148 | | - * to accidentally access them. In JavaScript, equivalent to: |
149 | | - * |
150 | | - * Object.defineProperty(global, propName, { |
151 | | - * value: value |
152 | | - * }) |
153 | | - */ |
154 | | -static void defineReadOnlyGlobal( |
155 | | - jsi::Runtime& runtime, |
156 | | - std::string propName, |
157 | | - jsi::Value&& value) { |
158 | | - if (runtime.global().hasProperty(runtime, propName.c_str())) { |
159 | | - throw jsi::JSError( |
160 | | - runtime, |
161 | | - "Tried to redefine read-only global \"" + propName + |
162 | | - "\", but read-only globals can only be defined once."); |
163 | | - } |
164 | | - jsi::Object jsObject = |
165 | | - runtime.global().getProperty(runtime, "Object").asObject(runtime); |
166 | | - jsi::Function defineProperty = jsObject.getProperty(runtime, "defineProperty") |
167 | | - .asObject(runtime) |
168 | | - .asFunction(runtime); |
169 | | - |
170 | | - jsi::Object descriptor = jsi::Object(runtime); |
171 | | - descriptor.setProperty(runtime, "value", std::move(value)); |
172 | | - defineProperty.callWithThis( |
173 | | - runtime, |
174 | | - jsObject, |
175 | | - runtime.global(), |
176 | | - jsi::String::createFromUtf8(runtime, propName), |
177 | | - descriptor); |
178 | | -} |
179 | | - |
180 | 143 | namespace { |
181 | 144 |
|
182 | 145 | // Copied from JSIExecutor.cpp |
|
0 commit comments