1

My Polymer.dart web app, that works fine in Dartium, is giving the following error (it repeats seven times) when compiled with dart2js using pub build --mode=debug and loaded in Chrome.

Resource interpreted as Script but transferred with MIME type text/plain: "http://confab.dev/index.html_bootstrap.dart". confab.dev/:10
warning: file:///home/dan/projects/confabulous/webatara/web/index.html.0.dart library not found index.html_bootstrap.dart.js:17188
Uncaught Error: NoSuchMethodError: Cannot call "get$functions" on "#<JsLibraryMirror>" (Object #<JsLibraryMirror> has no method 'get$functions') index.html_bootstrap.dart.js:17188
Stack Trace: 
TypeError: Object #<JsLibraryMirror> has no method 'get$functions'
    at dart._loadLibrary (http://confab.dev/index.html_bootstrap.dart.js:20000:19)
    at dart._loadLibraries (http://confab.dev/index.html_bootstrap.dart.js:19917:11)
    at dart._initPolymerOptimized (http://confab.dev/index.html_bootstrap.dart.js:19908:7)
    at dart.initPolymer (http://confab.dev/index.html_bootstrap.dart.js:19902:7)
    at main (http://confab.dev/index.html_bootstrap.dart.js:4112:7)
    at _IsolateContext.eval$1 (http://confab.dev/index.html_bootstrap.dart.js:1369:23)
    at dart.startRootIsolate (http://confab.dev/index.html_bootstrap.dart.js:1145:21)
    at http://confab.dev/index.html_bootstrap.dart.js:26514:7
    at init.currentScript (http://confab.dev/index.html_bootstrap.dart.js:26494:5)
    at http://confab.dev/index.html_bootstrap.dart.js:26508:3
 index.html_bootstrap.dart.js:17188
Uncaught NoSuchMethodError: Cannot call "get$functions" on "#<JsLibraryMirror>" (Object #<JsLibraryMirror> has no method 'get$functions') index.html_bootstrap.dart.js:2369

Because source maps don't appear to work (they're turned on in Chrome, and I have .map files), I don't even know which part of my code is causing this.

I've tried with interop.js included both before dart.js, as the docs say, and after, as this issue says.

Community
  • 1
  • 1
Isvara
  • 3,403
  • 1
  • 28
  • 42
  • Are you using mirrors? What version of Dart/Polymer are you using? Sourcemaps have some problems https://code.google.com/p/dart/issues/detail?id=17544 and you manually need to add `//# sourceMappingURL=/path/to/file.js.map` (see http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/) – Günter Zöchbauer Mar 20 '14 at 05:14
  • I am using mirrors, but it has been working since I started using them. Dart 1.2.0 and Polymer 0.9.5. – Isvara Mar 20 '14 at 05:22
  • Do you use some special functionality like deferred library loading? – Günter Zöchbauer Mar 20 '14 at 05:27
  • No, the only two 'special' things I use are reflection and JS interop. Weirdly, though, I just rolled back my repo to before I used either of those, and I still get the same errors -- errors that I didn't get at the time. – Isvara Mar 20 '14 at 05:40
  • I have never seen such an error and Goole didn't bring useful results. I guess you have tried `pub upgrade`? I think you should file a bug. – Günter Zöchbauer Mar 20 '14 at 06:07
  • `pub upgrade` fixed it. It turns out that something had replaced the polymer 0.9.5 that I'd been using with 0.8.10+4. Quite odd. – Isvara Mar 21 '14 at 02:47

2 Answers2

0

Looks like a bug in dart2js. Please file an issue, ideally with a reproducible test-case.

Florian Loitsch
  • 7,698
  • 25
  • 30
0

pub upgrade fixed it. It turns out that something had replaced the polymer 0.9.5 that I'd been using with 0.8.10+4. Quite odd. The solution to this is to set the polymer version as '>= 0.9.5' instead of 'any', which I will do eventually, but for now I'm interested to see if it happens again.

Isvara
  • 3,403
  • 1
  • 28
  • 42