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

Don't warn about dynamically injected script tags if the library is already loaded #22712

Closed
jakemac53 opened this issue Mar 6, 2015 · 7 comments
Closed

Comments

@jakemac53
Copy link
Contributor

@jakemac53 jakemac53 commented Mar 6, 2015

When injecting an html import which contains a dartium script into the dom at runtime, dartium currently throws a warning since that script will not be loaded. If the library pointed to by that script is already loaded though, then it should not throw this warning.

This is going to be a relatively common case in newer polymer apps, and without it we are forced to either ignore the warning or do an annoying dance that requires adding an extra html import for every element (one that contains the dart file, and one that does not).

@jakemac53
Copy link
Contributor Author

@jakemac53 jakemac53 commented Mar 6, 2015

Here is a really basic example situation https://gist.github.com/jakemac53/a5d272982ae3232d4dff

@jakemac53
Copy link
Contributor Author

@jakemac53 jakemac53 commented Mar 6, 2015

Dartium actually has some code that is intended to do this, but it looks like its really just a url canonicalization issue. From index.dart the url looks like 'package:foo/foo.dart' but from the html import it looks like 'http://my_site.com/packages/foo/foo.dart'.

One idea is if the existing original check fails, then check if the url contains a prefix matching the existing package root ('http://my_site.com/packages' in this case). If it does replace that with 'package:' and check if that matches a currently loaded library. This is a bit hacky but its just to suppress an error so its probably perfectly fine.

@kasperl
Copy link
Contributor

@kasperl kasperl commented Mar 7, 2015

Added Triaged label.

@jakemac53
Copy link
Contributor Author

@jakemac53 jakemac53 commented Mar 30, 2015

Any updates on this? This is forcing a pretty ugly workaround at the moment for anybody using polymer 0.16.0 (it now takes 3 files to create an element instead of 2 if you don't want dartium warnings).


cc @vsmenon.

@vsmenon
Copy link
Member

@vsmenon vsmenon commented Apr 9, 2015

jake: I think this is obsolete now. The call in Dartium that generated (validateUrlLoaded) this warning was removed in one of jacobr's recent changes:

http://src.chromium.org/viewvc/blink/branches/dart/dartium/Source/bindings/core/dart/DartController.cpp?r1=190940&r2=191142


cc @jacob314.
Added AssumedStale label.

@jakemac53
Copy link
Contributor Author

@jakemac53 jakemac53 commented Apr 10, 2015

Looks like I am seeing a different error now, Inline Darts scripts not supported after main script is invoked.


Added Triaged label.

@tmst
Copy link

@tmst tmst commented Feb 4, 2016

Moving the following script tag from the index.html <head> into the <body> element stopped these errors from appearing in my Dartium console:
<script type="application/dart" src="index.dart"></script>

Don't ask me how I found out (hint: T&E). That's all I know. :-(

@kevmoo kevmoo added P2 type-bug and removed triaged labels Mar 1, 2016
@matanlurey matanlurey closed this Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.