New issue
Advanced search Search tips

Issue 658095 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 468240
issue 658086



Sign in to add a comment

Using callbacks and observers in the bindings is confusing (and sometimes broken)

Project Member Reported by esprehn@chromium.org, Oct 21 2016

Issue description

It seems doing:

callback interface X {
  handleEvent(...);
}

[Custom]
callback interface X {
  handleEvent(...);
}

callback interface X {
  [Custom] handleEvent(...);
}

callback Foo = void ();

[Custom] callback Foo = void ();

All generate subtlety different code, and almost all users are actually creating custom bindings of them. The non custom version of callbacks appears to actually be broken (See  issue 658086 ).

There's a bunch of callbacks now, and also observer interfaces

IntersectionObserver => [Custom] callback, CustomConstructor on observer.
ResizeObserver => regular callback interface with [Custom] void handleEvent, no custom observer.
PerformanceObserver => nothing custom (this is broken today).
MutationObserver => CustomConstructor(MutationCallback), confusingly MutationCallback is not defined in idl at all, and is totally in C++ as custom code. It seems the idl compiler didn't type check the inputs, it probably should and yell when you pass something that's undefined.
IDBObserver => callback, CustomConstructor (this is broken today).

 
Summary: Using callbacks and observers in the bindings is confusing (and sometimes broken) (was: Using callbacks and observers in the bindings is confusing)
Blockedon: 658086
Owner: bashi@chromium.org
lkawai@ (an intern) already implemented callback functions in the IDL compiler. All the weird custom bindings are going to be replaced with the generated callback functions.


Comment 4 by foolip@chromium.org, Oct 21 2016

 Issue 569301  is supposed to fix callback functions. Last I checked, all callback interfaces except EventListener should actually be callback functions. (NodeFilter should also be a callback interface, but is currently weird.)

Comment 5 by bashi@chromium.org, Oct 25 2016

Blockedon: 468240
IIUC callback function support is almost done except for lifetime handing. Those callback interfaces should be replaced with callback functions, but I think it's better to do that after  issue 468240  is resolved. Without wrapper-tracing, we have to write custom bindings anyway.

Comment 6 by peria@chromium.org, Nov 1 2016

Status: Assigned (was: Untriaged)

Sign in to add a comment