mozilla / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
176 stars 278 forks source link

404 error on setting image tag src #262

Closed JordanTheriault closed 9 years ago

JordanTheriault commented 9 years ago

Whenever a string of any value is added to src of the img tag within the editor, a 404 error occurs. The 404 error occurs on every stroke after src is specified.

This error does not take place in the CSS url() case.

This happens despite a blob url being generated in the case of the selfie extension. Further, the image rendering in the preview works.

This leads to a large number of requests being made to the server and has a high cost.

example

JordanTheriault commented 9 years ago

Image will display is the string to a valid file is removed and re-added, so it is likely not an issue with nohost.

This seems to only occur when a diff check takes place.

sedge commented 9 years ago

This appears to happen on any change to the editor after the src attribute of an <img> tag has been populated.

humphd commented 9 years ago

This turns out to be caused by https://github.com/KeniMorri/HTMLHinter, which is where we use SlowParse. @Pomax, any ideas what would cause SlowParse to actually try and load an img's src URL?

Let's disable HTMLHinter on Bramble until we fix this.

humphd commented 9 years ago

@gideonthomas confirms this is being caused by slowparse.

Pomax commented 9 years ago

Slowparse builds an active DOM, so the quickest path to success here will be to write a dropin for the document API we're using in https://github.com/mozilla/slowparse/blob/gh-pages/src/DOMBuilder.js, with minimal Node (the data structure, not Node.js) implementations for appending children and setting attributes.

To create an inventory of all calls relevant to shimming, a "search all" on this.dombuilder in https://github.com/mozilla/slowparse/blob/gh-pages/src/HTMLParser.js should work quite well.

humphd commented 9 years ago

This is being fixed in https://github.com/mozilla/slowparse/pull/79

gideonthomas commented 9 years ago

will be fixed with https://github.com/humphd/brackets/issues/263

Pomax commented 9 years ago

Slowparse has been patched and updated.

gideonthomas commented 9 years ago

Fixed in 40bd5f4040034628cc75b7b10577ce9016d5cc39