Skip to content

Embedded delegates are no longer linked with the Function prototype. #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tomasdeml opened this issue Feb 12, 2019 · 3 comments
Closed

Comments

@tomasdeml
Copy link

tomasdeml commented Feb 12, 2019

See failing test for ChakraCore in #67. The test was passing in v3.0.1 but now fails (v3.0.5).

@Taritsyn
Copy link
Owner

Taritsyn commented Feb 12, 2019

Hello, Tomáš!

This error also occurs in the MSIE, V8 and Vroom modules. In ChakraCore and MSIE modules, it is caused by the implementation of garbage collection mechanism for embedded objects (see the source code).

In general, an embedded delegate does not have to be a function, it just has to work as a function. I will certainly see what can be done, but I will not change the existing garbage collection mechanism. In any case, this unit test will not pass in the V8 and Vroom modules.

@Taritsyn
Copy link
Owner

If you just use this expression to check whether an embedded object is a function:

Object.getPrototypeOf(embeddedFunc) === Function.prototype

It is better to use the following code (does not work only in the MSIE module):

typeof embeddedFunc === 'function'

If you pass an embedded delegate to some library, where this check is performed, you can simply wrap the delegate to function:

function wrappedFunc() {
    return embeddedFunc();
}

Taritsyn added a commit that referenced this issue Mar 4, 2019
…legates are no longer linked with the `Function` prototype”
@Taritsyn
Copy link
Owner

Hello, Tomáš!

This error is fixed in version 3.0.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants