зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1193526 - Handle image.src being invalid. r=jgilbert
MozReview-Commit-ID: IhTC5kkiBu5
This commit is contained in:
Родитель
53a7c08931
Коммит
455022580c
|
@ -48,7 +48,15 @@ function generateTest(pixelFormat, pixelType, pathToTestRoot, prologue) {
|
||||||
|
|
||||||
textureLoc = gl.getUniformLocation(program, "tex");
|
textureLoc = gl.getUniformLocation(program, "tex");
|
||||||
|
|
||||||
wtu.loadTexture(gl, pathToTestRoot + "/resources/red-green.png", runTest);
|
var image = new Image();
|
||||||
|
image.onload = function() {
|
||||||
|
runTest(image);
|
||||||
|
};
|
||||||
|
image.onerror = function() {
|
||||||
|
testFailed("Creating image from canvas failed. Image src: " + this.src);
|
||||||
|
finishTest();
|
||||||
|
};
|
||||||
|
image.src = pathToTestRoot + "/resources/red-green.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
function runOneIteration(image, useTexSubImage2D, flipY, topColor, bottomColor)
|
function runOneIteration(image, useTexSubImage2D, flipY, topColor, bottomColor)
|
||||||
|
|
|
@ -48,7 +48,15 @@ function generateTest(pixelFormat, pixelType, pathToTestRoot, prologue) {
|
||||||
|
|
||||||
textureLoc = gl.getUniformLocation(program, "tex");
|
textureLoc = gl.getUniformLocation(program, "tex");
|
||||||
|
|
||||||
wtu.loadTexture(gl, pathToTestRoot + "/resources/red-green.svg", runTest);
|
var image = new Image();
|
||||||
|
image.onload = function() {
|
||||||
|
runTest(image);
|
||||||
|
};
|
||||||
|
image.onerror = function() {
|
||||||
|
testFailed("Creating image from canvas failed. Image src: " + this.src);
|
||||||
|
finishTest();
|
||||||
|
};
|
||||||
|
image.src = pathToTestRoot + "/resources/red-green.svg";
|
||||||
}
|
}
|
||||||
|
|
||||||
function runOneIteration(image, useTexSubImage2D, flipY, topColor, bottomColor)
|
function runOneIteration(image, useTexSubImage2D, flipY, topColor, bottomColor)
|
||||||
|
|
|
@ -1147,6 +1147,9 @@ var loadTexture = function(gl, url, callback) {
|
||||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
||||||
callback(image);
|
callback(image);
|
||||||
};
|
};
|
||||||
|
image.onerror = function() {
|
||||||
|
throw new Error('Failed to load image at: ' + image.src);
|
||||||
|
};
|
||||||
image.src = url;
|
image.src = url;
|
||||||
return texture;
|
return texture;
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче