angulardart/angular

DDC-built app not working in Chrome Canary

missvalentinep opened this issue · 1 comments

Problem

When opening in Chrome Canary my Angular app built with DDC I get this error and nothing works.

dart_sdk.js:99588 EXCEPTION: NoSuchMethodError: 'currentIndex'
method not found
Receiver: Instance of 'CollectionChangeRecord'

Full stack trace is available here.

No error is present when opening the same app in ordinary Chrome. Also, opening the app compiled with dart2js in Canary works, too.

I wasn't sure who is responsible for this error - AngularDart, DarkSDK or Chrome Canary, but since the error occurred in object created in Angular, I'm opening an issue in this repo.

Narrowing down the problem:

angular/src/core/change_detection/differs/default_iterable_differ.dart:110

 int currentIndex = unsafeCast(record.currentIndex);

build_web_compilers/src/dev_compiler/dart_sdk.js:3927

dart.dload = function dload(obj, field, mirrors) {
    if (typeof obj == "function" && field == "call") {
      return obj;
    }
    let f = dart._canonicalMember(obj, field);                                            // (*)
    _debugger.trackCall(obj);
    if (f != null) {
      let type = dart.getType(obj);
      if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
      if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, null);
      if (!mirrors && dart.test(dart.isJsInterop(obj))) {
        return obj[f];
      }
    }
    return dart.noSuchMethod(obj, new dart.InvocationImpl.new(field, [], {isGetter: true}));
  };

build_web_compilers/src/dev_compiler/dart_sdk.js:4300

dart._canonicalMember = function _canonicalMember(obj, name) {
    if (typeof name === "symbol") return name;
    if (obj != null && obj[dart._extensionType] != null) {                          // (*)
      return dartx[name];
    }
    if (name == "constructor" || name == "prototype") {
      name = "+" + name;
    }
    return name;
  };

obj[dart._extensionType] exists and has MemoryInfo class (only in Chrome Canary, in ordinary Chrome this field doesn't exist).
Therefore, _canonicalMember returns undefined and dart.dload returns dart.noSuchMethod, which causes the Error: NoSuchMethodError: 'currentIndex' method not found error, despite the fact that the field exists.

Just in case, the property path is obj.__proto__.__proto__.__proto__["Symbol(extensionType)"];
image

Additional info

  • Dart SDK Version (dart --version)
    2.7.2, but also reproducible on 2.8.1, 2.9.1
  • AngularDart Version (i.e. 4.0.0, 5.0.0-alpha+5, MASTER)
    5.3.1
  • Whether you are using Windows, macOS, or Linux (if applicable)
    macOS
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable)
    Chrome Canary (Version 87.0.4243.0 (Official Build) canary (x86_64))
  • Any other packages or constraints we should know about
    Running webdev serve with --no-injected-client, because without adding this flag I get an error (also only in Canary)
Unhandled error detected in the injected client.js script.

You can disable this script in webdev by passing --no-injected-client if it
is preventing your app from loading, but note that this will also prevent
all debugging and hot reload/restart functionality from working.

The original error is below, please file an issue at
https://github.com/dart-lang/webdev/issues/new and attach this output:

NoSuchMethodError: method not found: 'get$digestsPath' (J.getInterceptor$x(...).get$digestsPath is not a function)
TypeError: J.getInterceptor$x(...).get$digestsPath is not a function
    at Object.get$digestsPath$x (http://127.0.0.1:8080/dwds/src/injected/client.js:3536:43)
    at http://127.0.0.1:8080/dwds/src/injected/client.js:22757:60
    at _wrapJsFunctionForAsync_closure.$protected (http://127.0.0.1:8080/dwds/src/injected/client.js:3834:15)

Thanks for reporting! This has been fixed in DDC + DartJS.

Also see the following for any longer term discussion: dart-lang/sdk#43284