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

Dartium and "build.dart" differ in behavior for paths in img tag #15013

Closed
sethladd opened this issue Nov 11, 2013 · 19 comments
Closed

Dartium and "build.dart" differ in behavior for paths in img tag #15013

sethladd opened this issue Nov 11, 2013 · 19 comments
Labels
status-blocked Blocked from making progress by another (referenced) issue type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@sethladd
Copy link
Contributor

Accessing app from example.com/index.html

I have this:

web/elements/foo.html:

    <p>
      <img src="imgs/WordHerderOnHorse.png" width="150">
    </p>

The image lives in:

web/imgs/WordHerderOnHorse.png

In Dartium, this works, because Dartium is treating imgs/WordHerderOnHorse.png as example.com/imgs/WordHerderOnHorse.png

However, when I run it through build.dart --deploy, it's rewriting that link to elements/imgs/... which does not exist.

So, who's right?

@sethladd
Copy link
Contributor Author

Changed the title to: "Dartium and "build.dart" differ in behavior for paths in img tag".

@jmesserly
Copy link

--deploy is doing the rightish thing. Native HTML Imports aren't behaving correctly with URL resolution. I think Polymer is always using polyfills at the moment. I had to workaround this when porting the new TodoMVC from Polymer (https://codereview.chromium.org/60353013/).

Here's the Blink bug for this feature: https://code.google.com/p/chromium/issues/detail?id=240592

I don't think we can workaround this in HTML Imports Polyfill anymore (now that webkitStartDart is gone), so I think we just have to wait for a fix on the C++ side.

I did workaround it in my app so feel free to use that (somewhat ugly) technique.


Removed Area-Polymer, Library-PolymerBuild labels.
Added Area-Dartium label.

@sethladd
Copy link
Contributor Author

I'm surprised that there is any URL rewriting. Why is the URL rewritten? That is, why is the --deploy "smarter" here?

@jmesserly
Copy link

I'm surprised that there is any URL rewriting. Why is the URL rewritten? That is, why is the --deploy "smarter" here?

  1. HTML Imports loads things from URLs relative to the imported document's URL. (At least, that is how the polyfill works, so presumably that is/was matching spec'd behavior.)
  2. polymer.dart deploy tool, like Polymer's own Vulcanizer, inlines HTML documents for deployment.
  3. Inlining moves things from one URL to another, therefore we/they must fix URLs (see https://github.com/Polymer/vulcanize/blob/37826f88bf7f1672eed21465a0ef25276c24027c/lib/vulcan.js#L36)

@jmesserly
Copy link

aha, I think I know why you're surprised. This used to work, because Dartium and Polymer.js both used HTML Imports Polyfill for development, and build.dart/Vulcanizer for deployment.

But we changed to native HTML Imports recently. Polymer-js is not using it yet. That's why we hit bugs like https://code.google.com/p/dart/issues/detail?id=12434#c21, but they haven't hit them yet.

Was it premature to switch to native? Perhaps. I certainly didn't expect so many issues :|.

We could go back to adding this to your HTML page:

    <script src="packages/html_imports/html_imports.js">

... but we'd need to flip the experimental flag for HTML Imports back to OFF. Because if native is turned on, it will finish before the Polyfill has a chance.

Anyway I'd suggest some people (perhaps sigmund@ vsm@) follow up with morrita@ and figure out what is best for Dartium given the Blink implementation timeline.


cc @sigmundch.
cc @vsmenon.

@sigmundch
Copy link
Member

I'm afraid that switching back might not be that easy. Part of the problem here is how we load and bootstrap the code in Dartium. Without native support, we would have to require that our users write extra import statements, or go back to do something like we did with 'boot.js'. The latter is especially hard now that webkitStartDart is gone.

Another alternative would be to keep using the native implementation, but do some url-fixes in our loader code to compensate for that bug in blink.

@sethladd
Copy link
Contributor Author

Thanks, I didn't realize that pub build inlines. If so, makes sense it's changing paths.

@sethladd
Copy link
Contributor Author

Thank you for following up! The difference in behavior is certainly confusing.

And yes, I used to have to do this:

a href="../#foo"

But now I have to do this:

a href="#foo"

So something certainly changed.

I have no problem including any number of extra files to get consistent behavior. I assume a building script will take care of concatenating/minifying/etc

Thanks guys!

And for the record, if we know of the blink bug we can drop a link there.

@vsmenon
Copy link
Member

vsmenon commented Nov 14, 2013

Siggi: is there something we need to do here in Dartium?


Set owner to @sigmundch.
Added this to the M9 milestone.
Added NeedsInfo label.

@vsmenon
Copy link
Member

vsmenon commented Nov 14, 2013

Removed this from the M9 milestone.
Added this to the 1.1 milestone.

@sigmundch
Copy link
Member

No that I know of. This seems like a blink bug, but I haven't found a bug item for them that I can link here, so we might have to file one for them.

@sigmundch
Copy link
Member

I filed a bug for blink here with a small repro example:

https://code.google.com/p/chromium/issues/detail?id=319598

@sethladd
Copy link
Contributor Author

Thanks! Starred.

@DartBot
Copy link

DartBot commented Jan 25, 2014

This comment was originally written by fayb...@gmail.com


This could be a temp solution, as long as when you run in production your image is in the folder img in the root directory.


Attachment:
common-element.dart (809 Bytes)

@sigmundch
Copy link
Member

Removed the owner.
Added Waiting label.

@vsmenon
Copy link
Member

vsmenon commented Feb 27, 2014

Removed this from the 1.1 milestone.
Added this to the 1.3 milestone.

@vsmenon
Copy link
Member

vsmenon commented Jun 4, 2014

Removed this from the 1.3 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@kevmoo kevmoo added status-blocked Blocked from making progress by another (referenced) issue and removed waiting labels Feb 8, 2016
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status-blocked Blocked from making progress by another (referenced) issue type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

8 participants