| 1301 | return callContext.getContext().newUndefined(); |
| 1302 | } |
| 1303 | |
| 1304 | JSValueRef JavaScriptRuntime::runtimeProtectNativeRefs(JSFunctionNativeCallContext& callContext) { |
| 1305 | auto contextId = getParameterAsContextId(callContext, 0); |
| 1306 | CHECK_CALL_CONTEXT(callContext); |
| 1307 | |
| 1308 | Ref<Context> context; |
| 1309 | if (contextId == ContextIdNull) { |
| 1310 | context = Context::currentRoot(); |
| 1311 | } else { |
| 1312 | auto result = getContextForId(contextId); |
| 1313 | if (!result) { |
| 1314 | return callContext.throwError(result.moveError()); |
| 1315 | } |
| 1316 | context = result.moveValue(); |
| 1317 | } |
| 1318 | |
| 1319 | context->retainDisposables(); |
| 1320 | |
| 1321 | auto releaseLambda = |
| 1322 | makeShared<JSFunctionWithCallable>(ReferenceInfoBuilder(callContext.getReferenceInfo()).withReturnValue(), |
| 1323 | [context](JSFunctionNativeCallContext& callContext) -> JSValueRef { |
| 1324 | context->releaseDisposables(); |
| 1325 | return callContext.getContext().newUndefined(); |
| 1326 | }); |
| 1327 | |
| 1328 | return callContext.getContext().newFunction(releaseLambda, callContext.getExceptionTracker()); |
| 1329 | } |
| 1330 | |
| 1331 | JSValueRef JavaScriptRuntime::runtimeGetFrameForViewId(JSFunctionNativeCallContext& callContext) { |
| 1332 | return handleViewNodeSpecificActionSync( |
| 1333 | callContext, [](ViewNode& viewNode) { return Valdi::Value(viewNode.getDirectionAgnosticFrame().toMap()); }); |
| 1334 | } |
| 1335 | |
| 1336 | JSValueRef JavaScriptRuntime::runtimeGetNativeViewForViewId(JSFunctionNativeCallContext& callContext) { |
| 1337 | return handleViewNodeSpecificActionSync(callContext, |
| 1338 | [](ViewNode& viewNode) { return viewNode.toPlaformRepresentation(true); }); |
| 1339 | } |
| 1340 | |
| 1341 | JSValueRef JavaScriptRuntime::runtimeGetLayoutDebugInfo(JSFunctionNativeCallContext& callContext) { |
| 1342 | return handleViewNodeSpecificActionSync( |
| 1343 | callContext, [](ViewNode& viewNode) { return Value(viewNode.getLayoutDebugDescription()); }); |
| 1344 | } |
| 1345 | |
| 1346 | JSValueRef JavaScriptRuntime::runtimeGetNativeNodeForElementId(JSFunctionNativeCallContext& callContext) { |
| 1347 | auto contextId = getParameterAsContextId(callContext, 0); |
| 1348 | CHECK_CALL_CONTEXT(callContext); |
| 1349 | |
| 1350 | auto nodeId = static_cast<RawViewNodeId>(callContext.getParameterAsInt(1)); |
| 1351 | CHECK_CALL_CONTEXT(callContext); |
| 1352 | |
| 1353 | auto context = _contextManager->getContext(contextId); |
| 1354 | if (context == nullptr) { |
nothing calls this directly
no test coverage detected