Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
fire error event on xhr error.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Aug 5, 2014
1 parent ad5cfb2 commit fa005c1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/HTMLImports.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ if (!useNative) {
return doc === mainDoc ? this.documentPreloadSelectors :
this.importsPreloadSelectors;
},
loaded: function(url, elt, resource) {
loaded: function(url, elt, resource, err) {
flags.load && console.log('loaded', url, elt);
// store generic resource
// TODO(sorvell): fails for nodes inside <template>.content
// see https://code.google.com/p/chromium/issues/detail?id=249381.
elt.__resource = resource;
elt.__error = err;
if (isDocumentLink(elt)) {
var doc = this.documents[url];
// if we've never seen a document at this url
Expand Down
2 changes: 1 addition & 1 deletion src/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
//if (!err) {
// If url was redirected, use the redirected location so paths are
// calculated relative to that.
this.onload(redirectedUrl || url, p, resource);
this.onload(redirectedUrl || url, p, resource, err);
//}
this.tail();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var importParser = {
elt.import.__importParsed = true;
this.markParsingComplete(elt);
// fire load event
if (elt.__resource) {
if (elt.__resource && !elt.__error) {
elt.dispatchEvent(new CustomEvent('load', {bubbles: false}));
} else {
elt.dispatchEvent(new CustomEvent('error', {bubbles: false}));
Expand Down

0 comments on commit fa005c1

Please sign in to comment.