Skip to content

Commit 9e44160

Browse files
committed
Merge branch 'main' into feat/temporal-instant-tolocalestring
2 parents fb2d992 + f5e88de commit 9e44160

8 files changed

Lines changed: 95 additions & 56 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
persist-credentials: false
3131

3232
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
33+
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
3434
with:
3535
languages: ${{ matrix.language }}
3636
build-mode: none
3737

3838
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
39+
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
4040
with:
4141
category: "/language:${{matrix.language}}"

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ jobs:
192192
run: cargo tarpaulin --workspace --features annex-b,intl_bundled,experimental --ignore-tests --engine llvm --out xml
193193

194194
- name: Upload to codecov.io
195-
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
195+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v5
196196

197197
tests:
198198
name: Test

Cargo.lock

Lines changed: 42 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ simple_logger = "5.1.0"
9595
cargo_metadata = "0.23.1"
9696
trybuild = "1.0.116"
9797
rayon = "1.10.0"
98-
toml = "1.0.7"
98+
toml = "1.1.0"
9999
color-eyre = "0.6.3"
100100
comfy-table = "7.2.2"
101101
serde_repr = "0.1.20"
102102
bus = "2.4.1"
103103
wasm-bindgen = { version = "0.2.97", default-features = false }
104104
getrandom = { version = "0.4.2", default-features = false }
105105
console_error_panic_hook = "0.1.7"
106-
wasm-bindgen-test = "0.3.64"
106+
wasm-bindgen-test = "0.3.65"
107107
smol = "2.0.2"
108108
rustyline = { version = "17.0.2", default-features = false }
109109
dhat = "0.3.3"

core/engine/src/builtins/temporal/instant/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,14 +693,14 @@ impl Instant {
693693
// Converting epoch milliseconds
694694
let epoch_ms = instant.inner.epoch_milliseconds() as f64;
695695

696-
return format_date_time_locale(
696+
format_date_time_locale(
697697
locales,
698698
options,
699699
FormatType::Any,
700700
FormatDefaults::All,
701701
epoch_ms,
702702
context,
703-
);
703+
)
704704
}
705705

706706
#[cfg(not(feature = "intl"))]

core/engine/src/builtins/typed_array/object.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::sync::atomic::Ordering;
44

55
use crate::{
66
Context, JsExpect, JsNativeError, JsResult, JsString, JsValue,
7-
builtins::array_buffer::BufferObject,
7+
builtins::array_buffer::{BufferObject, BufferRef},
88
object::{
99
JsData, JsObject,
1010
internal_methods::{
@@ -279,6 +279,26 @@ impl TypedArray {
279279
// 4. Return true.
280280
Some(index)
281281
}
282+
283+
/// Abstract operation `IsTypedArrayFixedLength ( O )`.
284+
///
285+
/// More information:
286+
/// - [ECMAScript reference][spec]
287+
///
288+
/// [spec]: https://tc39.es/ecma262/#sec-istypedarrayfixedlength
289+
fn is_fixed_length(&self) -> bool {
290+
// 1. If O.[[ArrayLength]] is auto, return false.
291+
if self.is_auto_length() {
292+
return false;
293+
}
294+
295+
// 2. Let buffer be O.[[ViewedArrayBuffer]].
296+
match self.viewed_array_buffer().as_buffer() {
297+
// 3. If IsFixedLengthArrayBuffer(buffer) is false and IsSharedArrayBuffer(buffer) is false, return false.
298+
BufferRef::Buffer(buf) => buf.is_fixed_len(),
299+
BufferRef::SharedBuffer(_) => true,
300+
}
301+
}
282302
}
283303

284304
// Integer-Indexed Exotic Objects [[PreventExtensions]] ( O )
@@ -295,8 +315,9 @@ pub(crate) fn typed_array_exotic_prevent_extensions(
295315
.downcast_ref::<TypedArray>()
296316
.js_expect("must be a TypedArray")?;
297317

298-
ta.viewed_array_buffer().as_buffer().is_fixed_len()
299-
};
318+
ta.is_fixed_length()
319+
}; // Note: this block ensures that the borrow of obj is dropped
320+
// so it may be re-borrowed in step 3
300321

301322
// 1. If IsTypedArrayFixedLength(O) is false, return false.
302323
if !is_fixed_length {

core/engine/src/builtins/typed_array/tests.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,24 @@ fn typedarray_conversion_mismatch_throws() {
161161
),
162162
]);
163163
}
164+
165+
#[test]
166+
fn typedarray_exotic_prevent_extensions() {
167+
// ref: https://github.com/tc39/test262/blob/main/test/staging/built-ins/Object/preventExtensions/preventExtensions-variable-length-typed-arrays.js
168+
run_test_actions([
169+
TestAction::run("const gsab = new SharedArrayBuffer(4, { maxByteLength: 8 });"),
170+
TestAction::run("const fixedLength = new Uint8Array(gsab, 0, 4);"),
171+
TestAction::run("const fixedLengthWithOffset = new Uint8Array(gsab, 2, 2);"),
172+
TestAction::run("Object.preventExtensions(fixedLength);"),
173+
TestAction::run("Object.preventExtensions(fixedLengthWithOffset);"),
174+
TestAction::assert("!Object.isExtensible(fixedLength)"),
175+
TestAction::assert("!Object.isExtensible(fixedLengthWithOffset)"),
176+
TestAction::run("const rab = new ArrayBuffer(4);"),
177+
TestAction::run("const fixedLength1 = new Uint8Array(rab, 0, 4);"),
178+
TestAction::run("const fixedLengthWithOffset1 = new Uint8Array(rab, 2, 2);"),
179+
TestAction::run("Object.preventExtensions(fixedLength1);"),
180+
TestAction::run("Object.preventExtensions(fixedLengthWithOffset1);"),
181+
TestAction::assert("!Object.isExtensible(fixedLength1)"),
182+
TestAction::assert("!Object.isExtensible(fixedLengthWithOffset1)"),
183+
]);
184+
}

tests/insta-bytecode/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ edition.workspace = true
88
boa_engine = { workspace = true }
99

1010
[dev-dependencies]
11-
insta = { version = "1.46.3", features = ["filters", "glob"] }
11+
insta = { version = "1.47.0", features = ["filters", "glob"] }

0 commit comments

Comments
 (0)