@@ -574,10 +574,10 @@ GetWindowProxyClass()
574
574
return &WindowProxyClass;
575
575
}
576
576
577
- JS::Value
578
- GetProxyReservedSlot (JSObject* obj, uint32_t slot)
577
+ void
578
+ GetProxyReservedSlot (JSObject* obj, uint32_t slot, JS::Value* dest )
579
579
{
580
- return js::GetProxyReservedSlot (obj, slot);
580
+ *dest = js::GetProxyReservedSlot (obj, slot);
581
581
}
582
582
583
583
void
@@ -952,4 +952,52 @@ WriteBytesToJSStructuredCloneData(const uint8_t* src, size_t len, JSStructuredCl
952
952
return dest->WriteBytes (reinterpret_cast <const char *>(src), len);
953
953
}
954
954
955
+ // MSVC uses a different calling conventions for functions
956
+ // that return non-POD values. Unfortunately, this includes anything
957
+ // with a constructor, such as JS::Value, so we can't call these
958
+ // from Rust. These wrapper functions are only here to
959
+ // ensure the calling convention is right.
960
+ // https://docs.microsoft.com/en-us/cpp/build/return-values-cpp
961
+ // https://mozilla.logbot.info/jsapi/20180622#c14918658
962
+
963
+ void
964
+ JS_ComputeThis (JSContext* cx, JS::Value* vp, JS::Value* dest) {
965
+ *dest = JS::detail::ComputeThis (cx, vp);
966
+ }
967
+
968
+ void
969
+ JS_GetModuleHostDefinedField (JSObject* module, JS::Value* dest) {
970
+ *dest = JS::GetModuleHostDefinedField (module);
971
+ }
972
+
973
+ void
974
+ JS_GetPromiseResult (JS::HandleObject promise, JS::Value* dest) {
975
+ *dest = JS::GetPromiseResult (promise);
976
+ }
977
+
978
+ void
979
+ JS_THIS (JSContext* cx, JS::Value* vp, JS::Value* dest) {
980
+ *dest = JS_THIS (cx, vp);
981
+ }
982
+
983
+ void
984
+ JS_GetNaNValue (JSContext* cx, JS::Value* dest) {
985
+ *dest = JS_GetNaNValue (cx);
986
+ }
987
+
988
+ void
989
+ JS_GetPositiveInfinityValue (JSContext* cx, JS::Value* dest) {
990
+ *dest = JS_GetPositiveInfinityValue (cx);
991
+ }
992
+
993
+ void
994
+ JS_GetEmptyStringValue (JSContext* cx, JS::Value* dest) {
995
+ *dest = JS_GetEmptyStringValue (cx);
996
+ }
997
+
998
+ void
999
+ JS_GetReservedSlot (JSObject* obj, uint32_t index, JS::Value* dest) {
1000
+ *dest = JS_GetReservedSlot (obj, index );
1001
+ }
1002
+
955
1003
} // extern "C"
0 commit comments