Skip to content

Commit 32bf617

Browse files
authored
feat: update to gecko-dev 123.0.1 (#744)
1 parent 0664848 commit 32bf617

File tree

12 files changed

+37
-53
lines changed

12 files changed

+37
-53
lines changed

integration-tests/js-compute/fixtures/app/src/dynamic-backend.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,42 +1626,6 @@ function createValidHttpMeBackend() {
16261626
tlsMinVersion: 1.2,
16271627
tlsMaxVersion: 1.2,
16281628
certificateHostname: "http-me.glitch.me",
1629-
checkCertificate: true,
1630-
caCertificate: `-----BEGIN CERTIFICATE-----
1631-
MIIGFTCCBP2gAwIBAgIQBWn2NbRr0RaO2KoKZawI3DANBgkqhkiG9w0BAQsFADA8
1632-
MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRwwGgYDVQQDExNBbWF6b24g
1633-
UlNBIDIwNDggTTAxMB4XDTIzMDIyMjAwMDAwMFoXDTI0MDIwMTIzNTk1OVowFTET
1634-
MBEGA1UEAxMKZ2xpdGNoLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
1635-
ggEBAI9b/W4A/W6ayoqEgANycU0izvmZbTzcVzTA9+UsGKgsYRscIvc7hzx5LQ/v
1636-
odG3ZN1d+j1hmE5BJVIU9T32ROJgj/fSV5flvW66B9mNMKndjVElC/bV+Gdaro3B
1637-
QbwdgJnJhWZUQozCKuVB6bajIlbX7MM7zl8b1Iu0d+sXEBB/cYPfz97NM1HXDilg
1638-
EI2gJQ0TehggrmZiNStK5wEz1Lt41dBnt00tuYWdvNgMBSffxDKrrcZhA8BQZBls
1639-
1SH+GfyUJnfuleuC9m7xICsAQhXDQeuRGxR9TwDruIqAPfQkwsetAMH2L7nCdeFv
1640-
5Pc4ziFiOrB5zuMBxZBbqiO5nlcCAwEAAaOCAzgwggM0MB8GA1UdIwQYMBaAFIG4
1641-
DmOKiRIY5fo7O1CVn+blkBOFMB0GA1UdDgQWBBS5l/ww3EumPf1skwK6ksHL5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XK5YM6RTDPdTANBgkqhkiG9w0B
1658-
AQsFAAOCAQEAlaKQm/pbfZbmcECekZtLU9zQAmbcjKtfZ6IdbNx3+SV5u13/lUUO
1659-
o/yUuQ/BRoTYKLYnTY5ojY1/O4en4cLd9msSN+C5nuAEw//twiczBCwv9aAA+eQw
1660-
ssu1JNRB0qiV5wnpoyQ3/xF+TsOMT2heDOvpoG0WDLfrzuFJvWAfNwrRDjhORAQQ
1661-
7M740SMXdSv9aAZ8R1Aj/QyQqlwKOGPImqHvUDDmStEtjSrrMPM+BpuHrEdpQpbi
1662-
g6yC3gfHo2GQS2n3KDbk6JrqAk1ZIIhYrcU7TX9iuWj4MrEvse7mrL7GYF8ISrt8
1663-
j141R75hpv7ieDAtvoIL33FHE59ikJRwkg==
1664-
-----END CERTIFICATE-----`,
16651629
// Colon-delimited list of permitted SSL Ciphers
16661630
ciphers: "ECDHE-RSA-AES128-GCM-SHA256:!RC4",
16671631
sniHostname: "http-me.glitch.me",

runtime/js-compute-runtime/builtins/body.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ bool FastlyBody::read(JSContext *cx, unsigned argc, JS::Value *vp) {
6565
auto &chunk = result.unwrap();
6666
JS::UniqueChars buffer = std::move(chunk.ptr);
6767
JS::RootedObject array_buffer(cx);
68-
array_buffer.set(JS::NewArrayBufferWithContents(cx, chunk.len, buffer.get()));
68+
array_buffer.set(JS::NewArrayBufferWithContents(
69+
cx, chunk.len, buffer.get(), JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
6970
if (!array_buffer) {
7071
JS_ReportOutOfMemory(cx);
7172
return false;

runtime/js-compute-runtime/builtins/cache-core.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ bool CacheEntry::userMetadata(JSContext *cx, unsigned argc, JS::Value *vp) {
517517
}
518518
auto metadata = std::move(res.unwrap());
519519
JS::RootedObject array_buffer(cx);
520-
array_buffer.set(JS::NewArrayBufferWithContents(cx, metadata.len, metadata.ptr.get()));
520+
array_buffer.set(JS::NewArrayBufferWithContents(
521+
cx, metadata.len, metadata.ptr.get(), JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
521522
if (!array_buffer) {
522523
JS_ReportOutOfMemory(cx);
523524
return false;

runtime/js-compute-runtime/builtins/client-info.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ bool ClientInfo::tls_client_hello_get(JSContext *cx, unsigned argc, JS::Value *v
187187
}
188188

189189
auto hello = std::move(res.unwrap());
190-
buffer.set(JS::NewArrayBufferWithContents(cx, hello.len, hello.ptr.get()));
190+
buffer.set(JS::NewArrayBufferWithContents(cx, hello.len, hello.ptr.get(),
191+
JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
191192
if (!buffer) {
192193
// We can be here if the array buffer was too large -- if that was the case then a
193194
// JSMSG_BAD_ARRAY_LENGTH will have been created.
@@ -216,7 +217,8 @@ bool ClientInfo::tls_client_certificate_get(JSContext *cx, unsigned argc, JS::Va
216217
}
217218
auto cert = std::move(res.unwrap());
218219

219-
buffer.set(JS::NewArrayBufferWithContents(cx, cert.len, cert.ptr.get()));
220+
buffer.set(JS::NewArrayBufferWithContents(cx, cert.len, cert.ptr.get(),
221+
JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
220222
if (!buffer) {
221223
// We can be here if the array buffer was too large -- if that was the case then a
222224
// JSMSG_BAD_ARRAY_LENGTH will have been created.

runtime/js-compute-runtime/builtins/crypto-algorithm.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ JSObject *digest(JSContext *cx, std::span<uint8_t> data, const EVP_MD *algorithm
130130
}
131131
// 3. Return a new ArrayBuffer containing result.
132132
JS::RootedObject array_buffer(cx);
133-
array_buffer.set(JS::NewArrayBufferWithContents(cx, size, buf.get()));
133+
array_buffer.set(JS::NewArrayBufferWithContents(
134+
cx, size, buf.get(), JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
134135
if (!array_buffer) {
135136
JS_ReportOutOfMemory(cx);
136137
return nullptr;
@@ -781,7 +782,7 @@ JSObject *CryptoAlgorithmHMAC_Sign_Verify::sign(JSContext *cx, JS::HandleObject
781782

782783
// 2. Return a new ArrayBuffer object, associated with the relevant global object of this [HTML], and containing the bytes of mac.
783784
JS::RootedObject array_buffer(cx);
784-
array_buffer.set(JS::NewArrayBufferWithContents(cx, size, sig.get()));
785+
array_buffer.set(JS::NewArrayBufferWithContents(cx, size, sig.get(), JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
785786
if (!array_buffer) {
786787
JS_ReportOutOfMemory(cx);
787788
return nullptr;
@@ -900,7 +901,7 @@ JSObject *CryptoAlgorithmECDSA_Sign_Verify::sign(JSContext *cx, JS::HandleObject
900901
std::memcpy(result.get() + rBytesSize, sBytes, sBytesSize);
901902

902903
// 7. Return the result of creating an ArrayBuffer containing result.
903-
JS::RootedObject buffer(cx, JS::NewArrayBufferWithContents(cx, resultSize, result.get()));
904+
JS::RootedObject buffer(cx, JS::NewArrayBufferWithContents(cx, resultSize, result.get(), JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
904905
if (!buffer) {
905906
// We can be here is the array buffer was too large -- if that was the case then a
906907
// JSMSG_BAD_ARRAY_LENGTH will have been created. No other failure scenarios in this path will
@@ -1054,7 +1055,7 @@ JSObject *CryptoAlgorithmRSASSA_PKCS1_v1_5_Sign_Verify::sign(JSContext *cx, JS::
10541055

10551056
// 5. Return a new ArrayBuffer associated with the relevant global object of this [HTML], and
10561057
// containing the bytes of signature.
1057-
JS::RootedObject buffer(cx, JS::NewArrayBufferWithContents(cx, signature_length, signature.get()));
1058+
JS::RootedObject buffer(cx, JS::NewArrayBufferWithContents(cx, signature_length, signature.get(), JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
10581059
if (!buffer) {
10591060
// We can be here is the array buffer was too large -- if that was the case then a
10601061
// JSMSG_BAD_ARRAY_LENGTH will have been created. No other failure scenarios in this path will

runtime/js-compute-runtime/builtins/crypto-key.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,9 @@ JSObject *CryptoKey::createRSA(JSContext *cx, CryptoAlgorithmRSASSA_PKCS1_v1_5_I
657657
auto exp = keyData->exponent;
658658
std::copy(exp.begin(), exp.end(), p.get());
659659

660-
JS::RootedObject buffer(cx,
661-
JS::NewArrayBufferWithContents(cx, keyData->exponent.size(), p.get()));
660+
JS::RootedObject buffer(
661+
cx, JS::NewArrayBufferWithContents(cx, keyData->exponent.size(), p.get(),
662+
JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
662663
// `buffer` takes ownership of `p` if the call to NewArrayBufferWithContents was successful
663664
// if the call was not successful, we need to free `p` before exiting from the function.
664665
if (!buffer) {

runtime/js-compute-runtime/builtins/request-response.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ bool RequestOrResponse::parse_body(JSContext *cx, JS::HandleObject self, JS::Uni
388388
JS::RootedValue result(cx);
389389

390390
if constexpr (result_type == RequestOrResponse::BodyReadResult::ArrayBuffer) {
391-
JS::RootedObject array_buffer(cx, JS::NewArrayBufferWithContents(cx, len, buf.get()));
391+
JS::RootedObject array_buffer(
392+
cx, JS::NewArrayBufferWithContents(cx, len, buf.get(),
393+
JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
392394
if (!array_buffer) {
393395
return RejectPromiseWithPendingError(cx, result_promise);
394396
}

runtime/js-compute-runtime/builtins/shared/console.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <chrono>
44
#include <map>
55

6+
#include "mozilla/Try.h"
67
#include <js/Array.h>
78
#pragma clang diagnostic push
89
#pragma clang diagnostic ignored "-Winvalid-offsetof"
@@ -287,10 +288,16 @@ JS::Result<mozilla::Ok> ToSource(JSContext *cx, std::string &sourceOut, JS::Hand
287288
if (JS_ObjectIsFunction(obj)) {
288289
sourceOut += "[Function";
289290
std::string source;
290-
auto id = JS_GetFunctionId(JS_ValueToFunction(cx, val));
291-
if (id) {
291+
JS::Rooted<JSFunction *> fun(cx, JS_ValueToFunction(cx, val));
292+
if (fun) {
293+
JS::RootedString name(cx);
294+
if (!JS_GetFunctionId(cx, fun, &name)) {
295+
return JS::Result<mozilla::Ok>(JS::Error());
296+
}
297+
if (!name) {
298+
name = JS_AtomizeAndPinString(cx, "");
299+
}
292300
sourceOut += " ";
293-
JS::RootedString name(cx, id);
294301
auto msg = core::encode(cx, name);
295302
if (!msg) {
296303
return JS::Result<mozilla::Ok>(JS::Error());

runtime/js-compute-runtime/builtins/shared/text-encoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ bool TextEncoder::encode(JSContext *cx, unsigned argc, JS::Value *vp) {
2929
}
3030

3131
auto chars = core::encode(cx, args[0]);
32-
JS::RootedObject buffer(cx, JS::NewArrayBufferWithContents(cx, chars.len, chars.begin()));
32+
JS::RootedObject buffer(
33+
cx, JS::NewArrayBufferWithContents(cx, chars.len, chars.begin(),
34+
JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
3335
if (!buffer) {
3436
return false;
3537
}

runtime/js-compute-runtime/core/event_loop.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ bool process_body_read(JSContext *cx, JS::HandleObject streamSource, host_api::H
206206
// We don't release control of chunk's data until after we've checked that the array buffer
207207
// allocation has been successful, as that ensures that the return path frees chunk automatically
208208
// when necessary.
209-
JS::RootedObject buffer(cx, JS::NewArrayBufferWithContents(cx, chunk.len, chunk.ptr.get()));
209+
JS::RootedObject buffer(
210+
cx, JS::NewArrayBufferWithContents(cx, chunk.len, chunk.ptr.get(),
211+
JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory));
210212
if (!buffer) {
211213
return error_stream_controller_with_pending_exception(cx, controller);
212214
}

0 commit comments

Comments
 (0)