michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function getExampleDotComURL(conformanceDirRelativePath) { michael@0: var prefix = 'http://example.com/tests/content/canvas/test/webgl-conformance/'; michael@0: return prefix + conformanceDirRelativePath; michael@0: } michael@0: michael@0: function setExampleDotComImage(imageElemID, imagePath, relPathToBase, onLoadCallback) { michael@0: var img = document.getElementById(imageElemID); michael@0: if (!img) michael@0: throw 'Bad `imageElemID`: ' + imageElemID; michael@0: michael@0: if (onLoadCallback) michael@0: img.onload = onLoadCallback; michael@0: michael@0: img.onerror = function() { michael@0: console.log('Failed to load image from: ' + img.src); michael@0: console.log('Loading same-domain backup image.'); michael@0: michael@0: img.onerror = function() { michael@0: console.log('Failed to load backup image from: ' + img.src); michael@0: return; michael@0: }; michael@0: michael@0: img.src = relPathToBase + imagePath; michael@0: }; michael@0: michael@0: img.src = getExampleDotComURL(imagePath); michael@0: }