| 871 | } |
| 872 | |
| 873 | Ref<RefCountable> V8JavaScriptContext::valueToWrappedObject(const JSValue& value, |
| 874 | JSExceptionTracker& exceptionTracker) { |
| 875 | v8::HandleScope handleScope(_isolate); |
| 876 | auto indirect = fromValdiJSValueToIndirect(value); |
| 877 | auto objectInfo = indirect.getWithWrapperID(_isolate); |
| 878 | auto val = v8::Local<v8::Object>::Cast(objectInfo.first); |
| 879 | |
| 880 | if (indirect.isEmpty()) { |
| 881 | exceptionTracker.onError("Provided js value is already been cleared"); |
| 882 | return Ref<RefCountable>(); |
| 883 | } else if (!val->IsObject()) { |
| 884 | exceptionTracker.onError("Provided js value is not object"); |
| 885 | return Ref<RefCountable>(); |
| 886 | } else if (objectInfo.second != kWrappedObjectID) { |
| 887 | exceptionTracker.onError("Provided js value is not a wrapped object"); |
| 888 | return Ref<RefCountable>(); |
| 889 | } |
| 890 | |
| 891 | SC_ASSERT(val->InternalFieldCount() == static_cast<int>(InternalFieldSlot::Count)); |
| 892 | auto external = v8::Local<v8::External>::Cast(val->GetInternalField(static_cast<int>(InternalFieldSlot::DataSlot))); |
| 893 | if (!external->IsExternal()) { |
| 894 | exceptionTracker.onError("Internal field value is not of type external"); |
| 895 | } |
| 896 | |
| 897 | return unsafeBridge<RefCountable>(external->Value()); |
| 898 | } |
| 899 | |
| 900 | JSTypedArray V8JavaScriptContext::valueToTypedArray(const JSValue& value, JSExceptionTracker& exceptionTracker) { |
| 901 | v8::HandleScope handleScope(_isolate); |
no test coverage detected