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

Detect and ban code that triggers compiler bug from PR #3087 #3088

Open
joeyparrish opened this issue Jan 11, 2021 · 0 comments
Open

Detect and ban code that triggers compiler bug from PR #3087 #3088

joeyparrish opened this issue Jan 11, 2021 · 0 comments
Labels
priority: P4 Nice to have / wishful thinking type: bug Something isn't working correctly
Milestone

Comments

@joeyparrish
Copy link
Member

In #3087 (comment), I detailed what seems to be a compiler bug. This code in lib/dash/dash_parser.js triggers the bug:

    // Attach trick mode tracks to normal tracks.
    for (const trickModeSet of trickModeAdaptationSets) {
      const targetIds = trickModeSet.trickModeFor.split(' ');
      for (const normalSet of normalAdaptationSets) {
        if (targetIds.includes(normalSet.id)) {
          for (const stream of normalSet.streams) {
            const MimeUtils = shaka.util.MimeUtils;
            // There may be multiple trick mode streams, but we do not
            // currently support that.  Just choose one.
            // TODO: https://github.com/google/shaka-player/issues/1528
            stream.trickModeVideo = trickModeSet.streams.find((trickStream) =>
              MimeUtils.getCodecBase(stream.codecs) ==
              MimeUtils.getCodecBase(trickStream.codecs));
          }
        }
      }
    }

The compiler's iterator polyfill is in play here, as well as an alias which is not directly referenced in scope, but only in a synchronous callback.

Since we can't fix the compiler, and we can't audit the whole codebase for this sort of thing by hand, we need to try to write either an eslint rule or a Closure compiler conformance rule to detect and ban this pattern.

@joeyparrish joeyparrish added the type: bug Something isn't working correctly label Jan 11, 2021
@shaka-bot shaka-bot added this to the v3.1 milestone Jan 11, 2021
@joeyparrish joeyparrish modified the milestones: v3.1, Backlog Feb 12, 2021
@joeyparrish joeyparrish added the priority: P4 Nice to have / wishful thinking label May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: P4 Nice to have / wishful thinking type: bug Something isn't working correctly
2 participants