Skip to content
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

Missing static native methods from dart:html #36205

Closed
nshahan opened this Issue Mar 13, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@nshahan
Copy link
Contributor

nshahan commented Mar 13, 2019

Some (maybe all) static native methods in dart:html are not available when you build with DDC but they are when you build with dart2js.

Examples:

Calling Css.supports(...) generates a runtime error:

NoSuchMethodError: tried to call a non-function, such as null: 'html.Css.supports'

Or calling MediaRecorder.isTypeSupported(...)

NoSuchMethodError: tried to call a non-function, such as null: 'html.MediaRecorder.isTypeSupported'
@jmesserly

This comment has been minimized.

Copy link
Member

jmesserly commented Mar 18, 2019

From the error message, the compiler appears to be generating a call to html.Css.supports rather than directly to the DOM's CSS.supports. Should be an easy fix.

@jmesserly

This comment has been minimized.

Copy link
Member

jmesserly commented Mar 18, 2019

It looks like I spotted this bug (I wasn't the original code author) from reading it and left a helpful TODO:

    // A static native element should just forward directly to the
    // JS type's member.
    //
    // TODO(jmesserly): this code path seems broken. It doesn't exist
    // elsewhere, such as [_emitAccess], so it will only take affect for
    // unqualified static access inside of the the same class.
    //
    // If we want this feature to work, we'll need to implement it in the
    // standard [_emitStaticClassName] code path, which will need to know the
    // member we're calling so it can determine whether to use the Dart class
    // name or the native JS class name.

It looks like I fixed it in the DDC+Kernel backend, so it only affects DDC+Analyzer.

@jmesserly

This comment has been minimized.

@dart-bot dart-bot closed this in cb4b615 Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.