|
15 | 15 | #endif |
16 | 16 |
|
17 | 17 | #include "assert.h" |
| 18 | +#include "js/BigInt.h" // JS::StringToBigInt |
18 | 19 | #include "js/BuildId.h" |
19 | 20 | #include "js/Class.h" |
20 | 21 | #include "js/Id.h" |
21 | 22 | #include "js/MemoryMetrics.h" |
22 | | -#include "js/Modules.h" // include for JS::GetModulePrivate |
| 23 | +#include "js/Modules.h" // JS::GetModulePrivate |
23 | 24 | #include "js/Principals.h" |
24 | 25 | #include "js/Promise.h" |
25 | 26 | #include "js/Proxy.h" |
@@ -555,6 +556,12 @@ bool ShouldMeasureObject(JSObject* obj, nsISupports** iface) { |
555 | 556 | return false; |
556 | 557 | } |
557 | 558 |
|
| 559 | +typedef mozilla::Range<const JS::Latin1Char> RangeLatin1; |
| 560 | + |
| 561 | +typedef mozilla::Range<const char16_t> RangeConstUtf16; |
| 562 | + |
| 563 | +typedef mozilla::Range<char16_t> RangeUtf16; |
| 564 | + |
558 | 565 | extern "C" { |
559 | 566 |
|
560 | 567 | JSPrincipals* CreateRustJSPrincipals(const JSPrincipalsCallbacks& callbacks, |
@@ -1121,4 +1128,22 @@ void FinishOffThreadStencil( |
1121 | 1128 | *stencil = std::move(retval); |
1122 | 1129 | } |
1123 | 1130 |
|
| 1131 | +JS::BigInt* JS_StringToBigInt(JSContext* cx, mozilla::Range<const JS::Latin1Char> chars) { |
| 1132 | + return JS::StringToBigInt(cx, chars); |
| 1133 | +} |
| 1134 | + |
| 1135 | +JS::BigInt* JS_StringToBigInt1(JSContext* cx, mozilla::Range<const char16_t> chars) { |
| 1136 | + return JS::StringToBigInt(cx, chars); |
| 1137 | +} |
| 1138 | + |
| 1139 | +bool CopyStringChars(JSContext* cx, mozilla::Range<char16_t> dest, |
| 1140 | + JSString* str) { |
| 1141 | + return JS_CopyStringChars(cx, dest, str); |
| 1142 | +} |
| 1143 | + |
| 1144 | +JS::Latin1CharsZ LossyTwoByteCharsToNewLatin1CharsZ( |
| 1145 | + JSContext* cx, const mozilla::Range<const char16_t> tbchars) { |
| 1146 | + return JS::LossyTwoByteCharsToNewLatin1CharsZ(cx, tbchars); |
| 1147 | +} |
| 1148 | + |
1124 | 1149 | } // extern "C" |
0 commit comments