From 76f2007d4bd30314202820d96bba09f1e31dff33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BF=E3=81=91CAT?= Date: Tue, 26 Nov 2024 00:44:58 +0900 Subject: [PATCH 1/6] Fix TextUpdateEvent.selectionStart (#36966) --- files/en-us/web/api/textupdateevent/selectionstart/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/textupdateevent/selectionstart/index.md b/files/en-us/web/api/textupdateevent/selectionstart/index.md index fa5f431ce3c259d..1fc930f8291b2c7 100644 --- a/files/en-us/web/api/textupdateevent/selectionstart/index.md +++ b/files/en-us/web/api/textupdateevent/selectionstart/index.md @@ -10,7 +10,7 @@ browser-compat: api.TextUpdateEvent.selectionStart {{APIRef("EditContext API")}}{{SeeCompatTable}} -The **`TextUpdateEvent.selectionStart`** read-only property indicates the position of the end of the selection (or caret) within the text content of the editable region attached to the {{domxref("EditContext")}} object. +The **`TextUpdateEvent.selectionStart`** read-only property indicates the position of the start of the selection (or caret) within the text content of the editable region attached to the {{domxref("EditContext")}} object. ## Value From 8fdf1957f5b4848fd6d980805e81efd9bbfc037a Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 26 Nov 2024 03:55:29 +1100 Subject: [PATCH 2/6] FF134 Relnote: Intl.Duration supported (#36959) --- files/en-us/mozilla/firefox/releases/134/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/en-us/mozilla/firefox/releases/134/index.md b/files/en-us/mozilla/firefox/releases/134/index.md index a2e4c0cd5587669..9fc61836b5bdc74 100644 --- a/files/en-us/mozilla/firefox/releases/134/index.md +++ b/files/en-us/mozilla/firefox/releases/134/index.md @@ -22,6 +22,8 @@ This article provides information about the changes in Firefox 134 that affect d ### JavaScript +- {{jsxref("Intl.DurationFormat")}} is supported, enabling locale-sensitive formatting of durations. ([Firefox bug 1648139](https://bugzil.la/1648139)). + #### Removals ### SVG From d27842825162d0eb9d4a5ecfab86ed19cd28f048 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 26 Nov 2024 04:43:13 +1100 Subject: [PATCH 3/6] FF134 Promise.try() relnote/expr feature (#36958) * FF134 Promise.try() relnote/expr feature * Update files/en-us/mozilla/firefox/releases/134/index.md --------- Co-authored-by: Brian Smith --- .../firefox/experimental_features/index.md | 40 ------------------- .../mozilla/firefox/releases/134/index.md | 3 ++ 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/files/en-us/mozilla/firefox/experimental_features/index.md b/files/en-us/mozilla/firefox/experimental_features/index.md index f88b7a8b865ccb8..bafedc07c1cc3b1 100644 --- a/files/en-us/mozilla/firefox/experimental_features/index.md +++ b/files/en-us/mozilla/firefox/experimental_features/index.md @@ -1288,46 +1288,6 @@ This includes: `SVGPathSegList`, [SVGPathElement.getPathSegAtLength()](/en-US/do ## JavaScript -### Promise.try() - -{{jsxref("Promise.try()")}} is a convenience method that takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result in a {{jsxref("Promise")}} so that promise semantics (e.g. {{jsxref("Promise.then", ".then()")}}, {{jsxref("Promise.catch", ".catch()")}}) can be used to handle it ([Firefox bug 1905364](https://bugzil.la/1905364)). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Release channelVersion addedEnabled by default?
Nightly132No
Developer Edition--
Beta--
Release--
Preference namejavascript.options.experimental.promise_try
- ### JSON.parse with source The [`JSON.parse` source text access proposal](https://github.com/tc39/proposal-json-parse-with-source) extends [`JSON.parse`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) behavior to provide features to mitigate issues around loss of precision when converting values such as large floats and date values between JavaScript values and JSON text. ([Firefox bug 1913085](https://bugzil.la/1913085), [Firefox bug 1925334](https://bugzil.la/1925334)). diff --git a/files/en-us/mozilla/firefox/releases/134/index.md b/files/en-us/mozilla/firefox/releases/134/index.md index 9fc61836b5bdc74..2a985a556caac96 100644 --- a/files/en-us/mozilla/firefox/releases/134/index.md +++ b/files/en-us/mozilla/firefox/releases/134/index.md @@ -22,6 +22,9 @@ This article provides information about the changes in Firefox 134 that affect d ### JavaScript +- The {{jsxref("Promise.try()")}} convenience method is now supported. + The method takes a callback of any kind (a function that returns or throws, synchronously or asynchronously) and wraps its result in a {{jsxref("Promise")}}. + This allows you to use promise semantics ({{jsxref("Promise.then", ".then()")}}, {{jsxref("Promise.catch", ".catch()")}}) to handle the result from any kind of method. ([Firefox bug 1917879](https://bugzil.la/1917879) and [Firefox bug 1905364](https://bugzil.la/1905364)). - {{jsxref("Intl.DurationFormat")}} is supported, enabling locale-sensitive formatting of durations. ([Firefox bug 1648139](https://bugzil.la/1648139)). #### Removals From 7df171ff1d6da6a5e3911b7aedd56f6312bf0cca Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Mon, 25 Nov 2024 13:19:27 -0500 Subject: [PATCH 4/6] More explicitly differentiate between iterator helper methods/objects (#36711) * More explicitly differentiate between iterator helper methods/objects * Update files/en-us/web/javascript/reference/global_objects/iterator/index.md --- .../mozilla/firefox/releases/131/index.md | 2 +- .../global_objects/iterator/drop/index.md | 4 ++-- .../global_objects/iterator/filter/index.md | 4 ++-- .../global_objects/iterator/flatmap/index.md | 4 ++-- .../reference/global_objects/iterator/index.md | 18 +++++++++++------- .../global_objects/iterator/map/index.md | 4 ++-- .../global_objects/iterator/take/index.md | 4 ++-- .../reference/iteration_protocols/index.md | 4 ++-- 8 files changed, 24 insertions(+), 20 deletions(-) diff --git a/files/en-us/mozilla/firefox/releases/131/index.md b/files/en-us/mozilla/firefox/releases/131/index.md index 56c86d9cea02db6..71f2b82639df91e 100644 --- a/files/en-us/mozilla/firefox/releases/131/index.md +++ b/files/en-us/mozilla/firefox/releases/131/index.md @@ -16,7 +16,7 @@ This article provides information about the changes in Firefox 131 that affect d ### JavaScript -- Support for synchronous iterator helpers has been added, including: {{jsxref("Iterator.prototype.drop()")}}, {{jsxref("Iterator.prototype.every()")}}, {{jsxref("Iterator.prototype.filter()")}}, {{jsxref("Iterator.prototype.find()")}}, {{jsxref("Iterator.prototype.flatMap()")}}, {{jsxref("Iterator.prototype.forEach()")}}, {{jsxref("Iterator.prototype.map()")}}, {{jsxref("Iterator.prototype.reduce()")}}, {{jsxref("Iterator.prototype.some()")}}, and {{jsxref("Iterator.prototype.take()")}}. These helpers allow `Array`-like operations on iterators without having to create intermediate `Array` objects. They can also be used with very large data sets where creating an intermediate `Array` would not even be possible. For more information, see [Iterator helpers](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) in the `Iterator` interface. ([Firefox bug 1896390](https://bugzil.la/1896390)). +- Support for synchronous iterator helper methods has been added, including: {{jsxref("Iterator.prototype.drop()")}}, {{jsxref("Iterator.prototype.every()")}}, {{jsxref("Iterator.prototype.filter()")}}, {{jsxref("Iterator.prototype.find()")}}, {{jsxref("Iterator.prototype.flatMap()")}}, {{jsxref("Iterator.prototype.forEach()")}}, {{jsxref("Iterator.prototype.map()")}}, {{jsxref("Iterator.prototype.reduce()")}}, {{jsxref("Iterator.prototype.some()")}}, and {{jsxref("Iterator.prototype.take()")}}. These helpers allow `Array`-like operations on iterators without having to create intermediate `Array` objects. They can also be used with very large data sets where creating an intermediate `Array` would not even be possible. For more information, see [Iterator helper methods](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_methods) in the `Iterator` interface. ([Firefox bug 1896390](https://bugzil.la/1896390)). ### HTTP diff --git a/files/en-us/web/javascript/reference/global_objects/iterator/drop/index.md b/files/en-us/web/javascript/reference/global_objects/iterator/drop/index.md index 54057aa39c6ab74..d8f92058dc7b1a4 100644 --- a/files/en-us/web/javascript/reference/global_objects/iterator/drop/index.md +++ b/files/en-us/web/javascript/reference/global_objects/iterator/drop/index.md @@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Iterator.drop {{JSRef}} -The **`drop()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) that skips the given number of elements at the start of this iterator. +The **`drop()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects) that skips the given number of elements at the start of this iterator. ## Syntax @@ -22,7 +22,7 @@ drop(limit) ### Return value -A new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers). The first time the returned iterator helper's `next()` method is called, the current iterator is immediately advanced by `limit` elements, and then the next element (the `limit+1`-th element) is yielded. The iterator helper then yields the remaining elements one-by-one. If the current iterator has fewer than `limit` elements, the new iterator helper will be immediately completed the first time `next()` is called. +A new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects). The first time the returned iterator helper's `next()` method is called, the current iterator is immediately advanced by `limit` elements, and then the next element (the `limit+1`-th element) is yielded. The iterator helper then yields the remaining elements one-by-one. If the current iterator has fewer than `limit` elements, the new iterator helper will be immediately completed the first time `next()` is called. ### Exceptions diff --git a/files/en-us/web/javascript/reference/global_objects/iterator/filter/index.md b/files/en-us/web/javascript/reference/global_objects/iterator/filter/index.md index ddd0371fa703aa3..83bdc2d798eea8d 100644 --- a/files/en-us/web/javascript/reference/global_objects/iterator/filter/index.md +++ b/files/en-us/web/javascript/reference/global_objects/iterator/filter/index.md @@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Iterator.filter {{JSRef}} -The **`filter()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) that yields only those elements of the iterator for which the provided callback function returns `true`. +The **`filter()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects) that yields only those elements of the iterator for which the provided callback function returns `true`. ## Syntax @@ -26,7 +26,7 @@ filter(callbackFn) ### Return value -A new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers). Each time the iterator helper's `next()` method is called, it returns the next element in the iterator for which the callback function returns `true`. When the underlying iterator is completed, the iterator helper is also completed (the `next()` method produces `{ value: undefined, done: true }`). +A new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects). Each time the iterator helper's `next()` method is called, it returns the next element in the iterator for which the callback function returns `true`. When the underlying iterator is completed, the iterator helper object is also completed (the `next()` method produces `{ value: undefined, done: true }`). ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/iterator/flatmap/index.md b/files/en-us/web/javascript/reference/global_objects/iterator/flatmap/index.md index 8f758ff4ed9d5f4..953a367b25e84f4 100644 --- a/files/en-us/web/javascript/reference/global_objects/iterator/flatmap/index.md +++ b/files/en-us/web/javascript/reference/global_objects/iterator/flatmap/index.md @@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Iterator.flatMap {{JSRef}} -The **`flatMap()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) that takes each element in the original iterator, runs it through a mapping function, and yields elements returned by the mapping function (which are contained in another iterator or iterable). +The **`flatMap()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects) that takes each element in the original iterator, runs it through a mapping function, and yields elements returned by the mapping function (which are contained in another iterator or iterable). ## Syntax @@ -26,7 +26,7 @@ flatMap(callbackFn) ### Return value -A new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers). The first time the iterator helper's `next()` method is called, it calls `callbackFn` on the first element produced by the underlying iterator, and the return value, which should be an iterator or iterable, is yielded one-by-one by the iterator helper (like {{jsxref("Operators/yield*", "yield*")}}). The next element is fetched from the underlying iterator when the previous one returned by `callbackFn` is completed. When the underlying iterator is completed, the iterator helper is also completed (the `next()` method produces `{ value: undefined, done: true }`). +A new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects). The first time the iterator helper's `next()` method is called, it calls `callbackFn` on the first element produced by the underlying iterator, and the return value, which should be an iterator or iterable, is yielded one-by-one by the iterator helper (like {{jsxref("Operators/yield*", "yield*")}}). The next element is fetched from the underlying iterator when the previous one returned by `callbackFn` is completed. When the underlying iterator is completed, the iterator helper is also completed (the `next()` method produces `{ value: undefined, done: true }`). ### Exceptions diff --git a/files/en-us/web/javascript/reference/global_objects/iterator/index.md b/files/en-us/web/javascript/reference/global_objects/iterator/index.md index d3902493797c2bf..8540994b7deac9d 100644 --- a/files/en-us/web/javascript/reference/global_objects/iterator/index.md +++ b/files/en-us/web/javascript/reference/global_objects/iterator/index.md @@ -34,7 +34,7 @@ Each of these iterators have a distinct prototype object, which defines the `nex All of these prototype objects inherit from `Iterator.prototype`, which provides a [`[Symbol.iterator]()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator) method that returns the iterator object itself, making the iterator also [iterable](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol). -### Iterator helpers +### Iterator helper methods > [!NOTE] > These methods are _iterator_ helpers, not _iterable_ helpers, because the only requirement for an object to be iterable is just the presence of a `[Symbol.iterator]()` method. There is no shared prototype to install these methods on. @@ -90,7 +90,11 @@ You will find many iterator methods analogous to array methods, such as: {{jsxref("Iterator.prototype.drop()")}} and {{jsxref("Iterator.prototype.take()")}} combined are somewhat analogous to {{jsxref("Array.prototype.slice()")}}. -Among these methods, {{jsxref("Iterator/filter", "filter()")}}, {{jsxref("Iterator/flatMap", "flatMap()")}}, {{jsxref("Iterator/map", "map()")}}, {{jsxref("Iterator/drop", "drop()")}}, and {{jsxref("Iterator/take", "take()")}} return a new _Iterator Helper_ object. The iterator helper is also an `Iterator` instance, making the helper methods chainable. All iterator helper objects inherit from a common prototype object, which implements the iterator protocol: +### Iterator helper objects + +> **Note:** _Iterator helper objects_ and _iterator helper methods_ are two different concepts. An Iterator helper object is detectable at runtime, while "iterator helper method" is just a name for a set of methods for comprehension. _Iterator helper_ may refer to either the object or the method, depending on the context. + +Among the iterator helper methods, {{jsxref("Iterator/filter", "filter()")}}, {{jsxref("Iterator/flatMap", "flatMap()")}}, {{jsxref("Iterator/map", "map()")}}, {{jsxref("Iterator/drop", "drop()")}}, and {{jsxref("Iterator/take", "take()")}} return a new _Iterator Helper_ object. The iterator helper is also an `Iterator` instance, making these helper methods chainable. All iterator helper objects inherit from a common prototype object, which implements the iterator protocol: - `next()` - : Calls the `next()` method of the underlying iterator, applies the helper method to the result, and returns the result. @@ -151,25 +155,25 @@ These properties are defined on `Iterator.prototype` and shared by all `Iterator ## Instance methods - {{jsxref("Iterator.prototype.drop()")}} - - : Returns a new iterator helper that skips the given number of elements at the start of this iterator. + - : Returns a new iterator helper object that skips the given number of elements at the start of this iterator. - {{jsxref("Iterator.prototype.every()")}} - : Tests whether all elements produced by the iterator pass the test implemented by the provided function. - {{jsxref("Iterator.prototype.filter()")}} - - : Returns a new iterator helper that yields only those elements of the iterator for which the provided callback function returns `true`. + - : Returns a new iterator helper object that yields only those elements of the iterator for which the provided callback function returns `true`. - {{jsxref("Iterator.prototype.find()")}} - : Returns the first element produced by the iterator that satisfies the provided testing function. If no values satisfy the testing function, {{jsxref("undefined")}} is returned. - {{jsxref("Iterator.prototype.flatMap()")}} - - : Returns a new iterator helper that takes each element in the original iterator, runs it through a mapping function, and yields elements returned by the mapping function (which are contained in another iterator or iterable). + - : Returns a new iterator helper object that takes each element in the original iterator, runs it through a mapping function, and yields elements returned by the mapping function (which are contained in another iterator or iterable). - {{jsxref("Iterator.prototype.forEach()")}} - : Executes a provided function once for each element produced by the iterator. - {{jsxref("Iterator.prototype.map()")}} - - : Returns a new iterator helper that yields elements of the iterator, each transformed by a mapping function. + - : Returns a new iterator helper object that yields elements of the iterator, each transformed by a mapping function. - {{jsxref("Iterator.prototype.reduce()")}} - : Executes a user-supplied "reducer" callback function on each element produced by the iterator, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements is a single value. - {{jsxref("Iterator.prototype.some()")}} - : Tests whether at least one element in the iterator passes the test implemented by the provided function. It returns a boolean value. - {{jsxref("Iterator.prototype.take()")}} - - : Returns a new iterator helper that yields the given number of elements in this iterator and then terminates. + - : Returns a new iterator helper object that yields the given number of elements in this iterator and then terminates. - {{jsxref("Iterator.prototype.toArray()")}} - : Creates a new {{jsxref("Array")}} instance populated with the elements yielded from the iterator. - [`Iterator.prototype[Symbol.iterator]()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/Symbol.iterator) diff --git a/files/en-us/web/javascript/reference/global_objects/iterator/map/index.md b/files/en-us/web/javascript/reference/global_objects/iterator/map/index.md index 3b709aa514efda7..1ca53c32e30a600 100644 --- a/files/en-us/web/javascript/reference/global_objects/iterator/map/index.md +++ b/files/en-us/web/javascript/reference/global_objects/iterator/map/index.md @@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Iterator.map {{JSRef}} -The **`map()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) that yields elements of the iterator, each transformed by a mapping function. +The **`map()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects) that yields elements of the iterator, each transformed by a mapping function. ## Syntax @@ -26,7 +26,7 @@ map(callbackFn) ### Return value -A new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers). Each time the iterator helper's `next()` method is called, it gets the next element from the underlying iterator, applies `callbackFn`, and yields the return value. When the underlying iterator is completed, the iterator helper is also completed (the `next()` method produces `{ value: undefined, done: true }`). +A new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects). Each time the iterator helper's `next()` method is called, it gets the next element from the underlying iterator, applies `callbackFn`, and yields the return value. When the underlying iterator is completed, the iterator helper is also completed (the `next()` method produces `{ value: undefined, done: true }`). ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/iterator/take/index.md b/files/en-us/web/javascript/reference/global_objects/iterator/take/index.md index 35ef0a39218b5c2..8bd5ef7159f4e23 100644 --- a/files/en-us/web/javascript/reference/global_objects/iterator/take/index.md +++ b/files/en-us/web/javascript/reference/global_objects/iterator/take/index.md @@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Iterator.take {{JSRef}} -The **`take()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) that yields the given number of elements in this iterator and then terminates. +The **`take()`** method of {{jsxref("Iterator")}} instances returns a new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects) that yields the given number of elements in this iterator and then terminates. ## Syntax @@ -22,7 +22,7 @@ take(limit) ### Return value -A new [iterator helper](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers). The returned iterator helper yields the elements in the original iterator one-by-one, and then completes (the `next()` method produces `{ value: undefined, done: true }`) once `limit` elements have been yielded, or when the original iterator is exhausted, whichever comes first. +A new [iterator helper object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_objects). The returned iterator helper yields the elements in the original iterator one-by-one, and then completes (the `next()` method produces `{ value: undefined, done: true }`) once `limit` elements have been yielded, or when the original iterator is exhausted, whichever comes first. ### Exceptions diff --git a/files/en-us/web/javascript/reference/iteration_protocols/index.md b/files/en-us/web/javascript/reference/iteration_protocols/index.md index e689e441f98d10a..0eb9fb29805efc9 100644 --- a/files/en-us/web/javascript/reference/iteration_protocols/index.md +++ b/files/en-us/web/javascript/reference/iteration_protocols/index.md @@ -128,7 +128,7 @@ There is no object in the core JavaScript language that is async iterable. Some [Generator functions](/en-US/docs/Web/JavaScript/Reference/Statements/function*) return [generator objects](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator), which are iterable iterators. [Async generator functions](/en-US/docs/Web/JavaScript/Reference/Statements/async_function*) return [async generator objects](/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator), which are async iterable iterators. -The iterators returned from built-in iterables actually all inherit from a common class {{jsxref("Iterator")}}, which implements the aforementioned `[Symbol.iterator]() { return this; }` method, making them all iterable iterators. The `Iterator` class also provides additional [helper methods](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) in addition to the `next()` method required by the iterator protocol. You can inspect an iterator's prototype chain by logging it in a graphical console. +The iterators returned from built-in iterables actually all inherit from a common class {{jsxref("Iterator")}}, which implements the aforementioned `[Symbol.iterator]() { return this; }` method, making them all iterable iterators. The `Iterator` class also provides additional [helper methods](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_methods) in addition to the `next()` method required by the iterator protocol. You can inspect an iterator's prototype chain by logging it in a graphical console. ```plain console.log([][Symbol.iterator]()); @@ -303,7 +303,7 @@ The lack of `catch` here causes errors thrown by `doSomething()` or `doSomething ### Forwarding errors -Some built-in syntaxes wrap an iterator into another iterator. They include the iterator produced by {{jsxref("Iterator.from()")}}, [iterator helpers](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers) (`map()`, `filter()`, `take()`, `drop()`, and `flatMap()`), [`yield*`](/en-US/docs/Web/JavaScript/Reference/Operators/yield*), and a hidden wrapper when you use async iteration (`for await...of`, `Array.fromAsync`) on sync iterators. The wrapped iterator is then responsible for forwarding errors between the inner iterator and the caller. +Some built-in syntaxes wrap an iterator into another iterator. They include the iterator produced by {{jsxref("Iterator.from()")}}, [iterator helper methods](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_methods) (`map()`, `filter()`, `take()`, `drop()`, and `flatMap()`), [`yield*`](/en-US/docs/Web/JavaScript/Reference/Operators/yield*), and a hidden wrapper when you use async iteration (`for await...of`, `Array.fromAsync`) on sync iterators. The wrapped iterator is then responsible for forwarding errors between the inner iterator and the caller. - All wrapper iterators directly forward the `next()` method of the inner iterator, including its return value and thrown errors. - Wrapper iterators generally directly forward the `return()` method of the inner iterator. If the `return()` method doesn't exist on the inner iterator, it returns `{ done: true, value: undefined }` instead. In the case of iterator helpers: if the iterator helper's `next()` method has not been called, after trying to call `return()` on the inner iterator, the current iterator always returns `{ done: true, value: undefined }`. This is consistent with generator functions where execution hasn't entered the `yield*` expression yet. From 6989fc79df85a04a48f6359c6ca18dc09508d45a Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 26 Nov 2024 05:42:37 +1100 Subject: [PATCH 5/6] FF134: Relnote: RegExp.escape() supported (#36957) Co-authored-by: Brian Smith --- files/en-us/mozilla/firefox/releases/134/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/files/en-us/mozilla/firefox/releases/134/index.md b/files/en-us/mozilla/firefox/releases/134/index.md index 2a985a556caac96..524a27814d5a777 100644 --- a/files/en-us/mozilla/firefox/releases/134/index.md +++ b/files/en-us/mozilla/firefox/releases/134/index.md @@ -22,6 +22,7 @@ This article provides information about the changes in Firefox 134 that affect d ### JavaScript +- Support for the {{jsxref("RegExp.escape()")}} static method that can be used to escape any potential regex syntax characters in a string, returning a new string that can be safely used as a [literal](/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Literal_character) pattern for the {{jsxref("RegExp/RegExp", "RegExp()")}} constructor. ([Firefox bug 1918235](https://bugzil.la/1918235)). - The {{jsxref("Promise.try()")}} convenience method is now supported. The method takes a callback of any kind (a function that returns or throws, synchronously or asynchronously) and wraps its result in a {{jsxref("Promise")}}. This allows you to use promise semantics ({{jsxref("Promise.then", ".then()")}}, {{jsxref("Promise.catch", ".catch()")}}) to handle the result from any kind of method. ([Firefox bug 1917879](https://bugzil.la/1917879) and [Firefox bug 1905364](https://bugzil.la/1905364)). From d7524456e9dfd434953a02f7d74fcea67c99828c Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Mon, 25 Nov 2024 18:45:44 +0000 Subject: [PATCH 6/6] Add information on packed_4x8_integer_dot_product extension (#36898) * Add information on packed_4x8_integer_dot_product extension * fix linting error * Change table to dl * attempt to make text less confusing --- .../web/api/wgsllanguagefeatures/index.md | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/files/en-us/web/api/wgsllanguagefeatures/index.md b/files/en-us/web/api/wgsllanguagefeatures/index.md index 435a0b6f27bfb75..8575d33e2ac0047 100644 --- a/files/en-us/web/api/wgsllanguagefeatures/index.md +++ b/files/en-us/web/api/wgsllanguagefeatures/index.md @@ -22,10 +22,27 @@ The `WGSLLanguageFeatures` object is accessed via the {{domxref("GPU.wgslLanguag The following WGSL language extensions are defined at [WGSL language extensions](https://gpuweb.github.io/gpuweb/wgsl/#language-extension) in the WGSL specification. Bear in mind that the exact set of features available will vary across implementations and physical devices, and may change over time. -| Feature name | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `readonly_and_readwrite_storage_textures` | When available, allows the `"read-only"` and `"read-write"` [`storageTexture.access`](/en-US/docs/Web/API/GPUDevice/createBindGroupLayout#access) values to be set when specifying storage texture bind group entry types in a bind group layout. These enable WSGL code to read storage textures, and read/write storage textures, respectively. | -| `unrestricted_pointer_parameters` |

Loosens restrictions on pointers being passed to WGSL functions. When available, the following are allowed:

  • Parameter pointers to storage, uniform, and workgroup address spaces being passed to user-declared functions.
  • Pointers to structure members and array elements being passed to user-declared functions.

See [Pointers As Function Parameters](https://google.github.io/tour-of-wgsl/types/pointers/passing_pointers/) for more details.

| +- `packed_4x8_integer_dot_product` + + - : Allows **DP4a** (Dot Product of 4 Elements and Accumulate) GPU instructions to be used via your WGSL code. These efficiently perform 8-bit integer dot products to accelerate computation, saving memory and network bandwidth and improving performance compared with the equivalent `f32` versions. They are commonly used in machine learning models in inferencing, within AI frameworks. + + Specifically, when `packed_4x8_integer_dot_product` is available, WGSL code can use: + + - 32-bit integer scalars packing 4-component vectors of 8-bit integers to be used as inputs to dot product instructions (via the `dot4U8Packed()` and `dot4I8Packed()` built-in functions). + - Packing and unpacking instructions with packed 4-component vectors of 8-bit integers (via built-in functions such as `pack4xI8()` and `pack4xI8Clamp()`). + +- `readonly_and_readwrite_storage_textures` + + - : When available, allows the `"read-only"` and `"read-write"` [`storageTexture.access`](/en-US/docs/Web/API/GPUDevice/createBindGroupLayout#access) values to be set when specifying storage texture bind group entry types in a bind group layout. These enable WSGL code to read storage textures, and read/write storage textures, respectively. + +- `unrestricted_pointer_parameters` + + - : Loosens restrictions on pointers being passed to WGSL functions. When available, the following are allowed: + + - Parameter pointers to storage, uniform, and workgroup address spaces being passed to user-declared functions. + - Pointers to structure members and array elements being passed to user-declared functions. + + See [Pointers As Function Parameters](https://google.github.io/tour-of-wgsl/types/pointers/passing_pointers/) for more details. ## Instance properties