From ac1fcff807a6ee0984fc40622c2a95336211b43a Mon Sep 17 00:00:00 2001 From: Jeremy Roman Date: Fri, 2 Aug 2024 13:46:11 -0400 Subject: [PATCH 1/3] Editorial: Update uses of WebIDL "invoke a callback function" It's now required for non-promise-returning uses to specify how exceptions are handled. Specifying the argument list is also made more consistent, using the shorthand syntax for lists where appropriate. Part of whatwg/webidl#1425. --- source | 64 +++++++++++++++++++++------------------------------------- 1 file changed, 23 insertions(+), 41 deletions(-) diff --git a/source b/source index 74985cd2fb5..0900333c0c5 100644 --- a/source +++ b/source @@ -64478,7 +64478,7 @@ callback BlobCallback = undefined (Blob? blob); FILEAPI

  • Invoke callback with - « result ».

  • + « result » and "report".

    @@ -111511,15 +111511,13 @@ import "https://example.com/foo/../module2.mjs";
    If special error event handling is true
    -

    Invoke callback with five - arguments, the first one having the value of event's message attribute, the second having the value of - event's filename attribute, the third - having the value of event's lineno - attribute, the fourth having the value of event's colno attribute, the fifth having the value of - event's error attribute, and with the callback this value set to event's Invoke callback with « + event's message, event's + filename, event's lineno, event's colno, event's error », "rethrow", and with the + callback this value set to event's currentTarget. Let return value be the callback's return value. WEBIDL

    @@ -111527,11 +111525,11 @@ import "https://example.com/foo/../module2.mjs";
    Otherwise
    -

    Invoke callback - with one argument, the value of which is the Event object event, - with the callback this value set to event's - currentTarget. Let return value be - the callback's return value. WEBIDL

    +

    Invoke callback with « + event », "rethrow", and with the callback this value set to event's currentTarget. Let return value be the + callback's return value. WEBIDL

    @@ -113702,17 +113700,10 @@ enum DOMParserSupportedType {
  • Record timing info for timer handler given handler, global's relevant settings object, and repeat.

  • -
  • -

    If handler is a Function, then invoke handler given - arguments with the callback this - value set to thisArg. If this throws an exception, catch it, and report it for handler's corresponding - JavaScript object's associated realm's global object.

    - -

    This global object not necessarily the same as global, if - handler comes from another realm.

    +
  • If handler is a Function, then invoke handler given + arguments and "report", and with the callback this value set to thisArg.

  • @@ -113958,12 +113949,7 @@ scheduleWork(); // queues a task to do lots of work

    The queueMicrotask(callback) method must queue a microtask to invoke - callback, and if callback throws an exception, report it for callback's corresponding JavaScript object's - associated realm's global object.

    - -

    This global object not necessarily the same as this, if - callback comes from another realm.

    + callback with « » and "report.

    The queueMicrotask() method allows authors to schedule a callback on the microtask queue. This allows their code to run once the @@ -116100,13 +116086,8 @@ interface mixin AnimationFrameProvider {

  • Remove callbacks[handle].

  • -
  • Invoke callback, passing - now as the only argument, and if an exception is thrown, - report it for callback's - corresponding JavaScript object's associated realm's - global object.

    -

    This global object not necessarily the same as this, if - callback comes from another realm.

  • +
  • Invoke callback with « + now » and "report".

  • @@ -120403,8 +120384,9 @@ window.fakeWorklet1.addModule("script.mjs"); data-x="idl-Function">Function instance.

  • Return the result of invoking - callback with the arguments « true » and with classInstance as the callback this value.

  • + callback with the arguments « true » and "rethrow, and with + classInstance as the callback this + value.

    Another, perhaps better, specification architecture would be to extract the " Date: Mon, 5 Aug 2024 14:58:29 +0900 Subject: [PATCH 2/3] Tweaks and a missed case --- source | 49 +++++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/source b/source index 0900333c0c5..4df03916677 100644 --- a/source +++ b/source @@ -72939,13 +72939,9 @@ customElements.define("x-foo", class extends HTMLElement {

    callback reaction

    Invoke reaction's - callback function with reaction's arguments, and with element as - the callback this value.

    - -

    If this throws an exception, catch it, and report it for reaction's callback function's corresponding - JavaScript object's associated realm's global object.

    + callback function with reaction's arguments and "report", and callback this value + set to element.

    @@ -111507,35 +111503,32 @@ import "https://example.com/foo/../module2.mjs";

    Process the Event object event as follows:

    -
    If special error event handling is true
    -
    -

    Invoke callback with « +

    Let return value be the result of invoking callback with « event's message, event's filename, event's lineno, event's colno, event's error », "rethrow", and with the - callback this value set to event's currentTarget. Let return value be the - callback's return value. WEBIDL

    + data-x="dom-ErrorEvent-error">error », "rethrow", and with callback this value set to event's currentTarget.

    Otherwise
    -
    -

    Invoke callback with « - event », "rethrow", and with the Let return value be the result of invoking callback with « + event », "rethrow", and with callback this value set to event's currentTarget. Let return value be the - callback's return value. WEBIDL

    + data-x="dom-Event-currentTarget">currentTarget.

    -

    If an exception gets thrown by the callback, end these steps and allow the exception to - propagate. (It will propagate to the DOM event dispatch - logic, which will then report it.)

    +

    If an exception gets thrown by the callback, it will be rethrown, ending these + steps and propagating to the DOM event dispatch + logic, which will then report it.

  • @@ -113702,8 +113695,8 @@ enum DOMParserSupportedType {
  • If handler is a Function, then invoke handler given - arguments and "report", and with the callback this value set to thisArg.

    + arguments and "report", and with callback this value set to thisArg.

  • @@ -113949,7 +113942,7 @@ scheduleWork(); // queues a task to do lots of work

    The queueMicrotask(callback) method must queue a microtask to invoke - callback with « » and "report.

    + callback with « » and "report".

    The queueMicrotask() method allows authors to schedule a callback on the microtask queue. This allows their code to run once the @@ -120384,9 +120377,9 @@ window.fakeWorklet1.addModule("script.mjs"); data-x="idl-Function">Function instance.

  • Return the result of invoking - callback with the arguments « true » and "rethrow, and with - classInstance as the callback this - value.

  • + callback with « true » and "rethrow", and with callback this value set to + classInstance.

    Another, perhaps better, specification architecture would be to extract the " Date: Tue, 6 Aug 2024 17:34:18 -0400 Subject: [PATCH 3/3] split run-on sentence --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 4df03916677..5ee944135de 100644 --- a/source +++ b/source @@ -111527,8 +111527,8 @@ import "https://example.com/foo/../module2.mjs";

    If an exception gets thrown by the callback, it will be rethrown, ending these - steps and propagating to the DOM event dispatch - logic, which will then report it.

    + steps. The exception will propagate to the DOM event + dispatch logic, which will then report it.