You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the spec, register(name, operationCtor) constructs an instance eagerly in order to get the run function. On the other hand, the Chromium implementation retrieves this function from the prototype without constructing it.
In the spec, no this value is supplied to the run callback invocation (which would almost certainly confusing to authors). In the Chromium implementation, an instance is constructed lazily the first time run is to be invoked, and that instance is used.
Basically, what needs to be decided is:
When should instances of the class be constructed?
Eagerly, inside register
Lazily, the first time one is needed by run or selectURL
Lazily, each time one is needed by run or selectURL
Never (this would then point at the global)
How should the registered operation's run property be accessed?
On an instance, each time the operation is invoked. (This probably implies choosing (ii) or (iii) above, and is similar to how JavaScript code normally invokes functions on objects.)
On an instance, during register. (This probably implies choosing (i) above, and is similar to storing bound functions.)
On the prototype, during register. (This probably implies not choosing (i) above, and is similar to how custom elements stores callbacks.)
Whatever the choices are, the spec and Chromium implementations should be updated to match, and the "callback this value" passed to invoke should be set accordingly (this may involve additional plumbing to get the object instance to the place where "invoke a callback function" is used).
The text was updated successfully, but these errors were encountered:
In the spec,
register(name, operationCtor)
constructs an instance eagerly in order to get therun
function. On the other hand, the Chromium implementation retrieves this function from the prototype without constructing it.In the spec, no
this
value is supplied to therun
callback invocation (which would almost certainly confusing to authors). In the Chromium implementation, an instance is constructed lazily the first timerun
is to be invoked, and that instance is used.Basically, what needs to be decided is:
register
run
orselectURL
run
orselectURL
this
would then point at the global)run
property be accessed?register
. (This probably implies choosing (i) above, and is similar to storing bound functions.)register
. (This probably implies not choosing (i) above, and is similar to how custom elements stores callbacks.)Whatever the choices are, the spec and Chromium implementations should be updated to match, and the "callback this value" passed to invoke should be set accordingly (this may involve additional plumbing to get the object instance to the place where "invoke a callback function" is used).
The text was updated successfully, but these errors were encountered: