From 13bbc900487ee8d41851c10529ab441360db942f Mon Sep 17 00:00:00 2001 From: maplemiao Date: Fri, 30 Mar 2018 16:37:18 +0800 Subject: [PATCH] support blob image resources in non-foreignObjectRendering mode --- src/ResourceLoader.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ResourceLoader.js b/src/ResourceLoader.js index b946d5b..23f6191 100644 --- a/src/ResourceLoader.js +++ b/src/ResourceLoader.js @@ -33,6 +33,10 @@ export default class ResourceLoader { if (this.hasResourceInCache(src)) { return src; } + if (isBlobImage(src)) { + this.cache[src] = loadImage(src, this.options.imageTimeout || 0); + return src; + } if (!isSVG(src) || FEATURES.SUPPORT_SVG_DRAWING) { if (this.options.allowTaint === true || isInlineImage(src) || this.isSameOrigin(src)) { @@ -215,6 +219,7 @@ const INLINE_IMG = /^data:image\/.*/i; const isInlineImage = (src: string): boolean => INLINE_IMG.test(src); const isInlineBase64Image = (src: string): boolean => INLINE_BASE64.test(src); +const isBlobImage = (src: string): boolean => src.substr(0, 4) === 'blob'; const isSVG = (src: string): boolean => src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);