Browse Source

Merge branch 'andrewcarreiro-errorCatch'

pull/55/head
james.cryer 9 years ago
parent
commit
5f9af34aee
  1. 13
      resemble.js
  2. 6019
      tests/chai-3.4.2.js
  3. 70
      tests/main_spec.js
  4. 12
      tests/test.html

13
resemble.js

@ -148,7 +148,14 @@ URL: https://github.com/Huddle/Resemble.js
hiddenImage.setAttribute('crossorigin', 'anonymous'); hiddenImage.setAttribute('crossorigin', 'anonymous');
} }
hiddenImage.onerror = function () {
hiddenImage.onerror = null; //fixes pollution between calls
images.push({ error : "Image load error."});
callback();
};
hiddenImage.onload = function() { hiddenImage.onload = function() {
hiddenImage.onload = null; //fixes pollution between calls
var hiddenCanvas = document.createElement('canvas'); var hiddenCanvas = document.createElement('canvas');
var imageData; var imageData;
@ -532,6 +539,12 @@ URL: https://github.com/Huddle/Resemble.js
var width; var width;
var height; var height;
if(images.length === 2){ if(images.length === 2){
if( images[0].error || images[1].error ){
data = {};
data.error = images[0].error ? images[0].error : images[1].error;
triggerDataUpdate();
return;
}
width = images[0].width > images[1].width ? images[0].width : images[1].width; width = images[0].width > images[1].width ? images[0].width : images[1].width;
height = images[0].height > images[1].height ? images[0].height : images[1].height; height = images[0].height > images[1].height ? images[0].height : images[1].height;

6019
tests/chai-3.4.2.js

File diff suppressed because it is too large Load Diff

70
tests/main_spec.js

File diff suppressed because one or more lines are too long

12
tests/test.html

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p>Check the console for test results</p>
<script src="../resemble.js"></script>
<script src="chai-3.4.2.js"></script>
<script src="main_spec.js"></script>
</body>
</html>
Loading…
Cancel
Save