From bce22389bbd4595fe0d5ab7f4373f8e6a5350bc3 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Fri, 10 Mar 2017 19:41:47 -0500 Subject: [PATCH] Clean up Blob resources. --- examples/js/loaders/GLTF2Loader.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/js/loaders/GLTF2Loader.js b/examples/js/loaders/GLTF2Loader.js index 00632f8857..49adbb522e 100644 --- a/examples/js/loaders/GLTF2Loader.js +++ b/examples/js/loaders/GLTF2Loader.js @@ -1074,11 +1074,13 @@ THREE.GLTF2Loader = ( function () { var source = json.images[ texture.source ]; var sourceUri = source.uri; + var urlCreator; + if ( source.bufferView !== undefined ) { var bufferView = dependencies.bufferViews[ source.bufferView ]; var blob = new Blob( [ bufferView ], { type: source.mimeType } ); - var urlCreator = window.URL || window.webkitURL; + urlCreator = window.URL || window.webkitURL; sourceUri = urlCreator.createObjectURL( blob ); } @@ -1095,6 +1097,12 @@ THREE.GLTF2Loader = ( function () { textureLoader.load( resolveURL( sourceUri, options.path ), function ( _texture ) { + if ( urlCreator !== undefined ) { + + urlCreator.revokeObjectURL( sourceUri ); + + } + _texture.flipY = false; if ( texture.name !== undefined ) _texture.name = texture.name; -- GitLab