Closed Bug 1762592 Opened 2 years ago Closed 2 years ago

Consider supporting mapping to AsyncAmbiguous through GenerateWebIDLBindings.py config file

Categories

(WebExtensions :: General, task, P3)

task
Points:
2

Tracking

(firefox104 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: rpl, Assigned: rpl)

References

(Blocks 1 open bug)

Details

(Whiteboard: [addons-jira])

Attachments

(1 file, 1 obsolete file)

While working on the WebIDL bindings for the scripting WebExtensions API (Bug 1748315) we noticed that the type signatures currently being generated by the GenerateWebIDLBindings.py script based on the scripting API JSONSchema definitions for the methods getRegisteredContentScripts and unregisterContentScripts are not all distinguishable from a WebIDL perspective.

As an example for the getRegisteredContentScript we would be generating 2 methods with the following parameters:

   [Throws, WebExtensionStub="Async"]
   any getRegisteredContentScripts(any filter, optional Function callback);
   [Throws, WebExtensionStub="Async"]
   any getRegisteredContentScripts(optional Function callback);

which are not distinguishable when getRegisteredContentScript is called with a single parameter (e.g. with only one undefined value passed as call parameters, both the type signatures would match).

As a short term solution, we are considering to use a single method with the "AsyncAmbiguous" WebExtensionStub (which we already support and currently use for browser.runtime.sendMessage):

   [Throws, WebExtensionStub="AsyncAmbiguous"]
   any getRegisteredContentScripts(any... args);

The CallWebExtMethodAsyncAmbiguous stub does take care internally of removing the optional chrome-compatible callback parameter before serializing and forwarding the rest of the parameters to the ExtensionAPIRequestHandler defined on the main thread, and so it would technically be the same as if a webidl method defined as any getRegisteredContentScripts(any filter, optional Function callback).

Points: --- → 2
Blocks: 1779561

Comment on attachment 9270421 [details]
Bug 1762592 - Remove unnecessary trailing whitespace from extension API generated webidl filed.

Revision D142683 was moved to bug 1779561. Setting attachment 9270421 [details] to obsolete.

Attachment #9270421 - Attachment is obsolete: true
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/cf8d44dbecdc
Support mapping to AsyncAmbiguous through GenerateWebIDLBindings.py config file. r=willdurand
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: