From 3f861af42d0347e07efc27841945702a65038ccb Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sun, 25 Nov 2018 22:15:07 +0800 Subject: [PATCH] - Update: Bump StackBlur version --- dist/canvg.js | 20 ++++++++++++++++--- dist/extensions/ext-server_moinsave.js | 20 ++++++++++++++++--- dist/extensions/ext-server_opensave.js | 20 ++++++++++++++++--- .../stackblur-canvas/dist/stackblur-es.js | 6 +++--- package-lock.json | 6 +++--- package.json | 2 +- 6 files changed, 58 insertions(+), 16 deletions(-) diff --git a/dist/canvg.js b/dist/canvg.js index abc3d803..7592f945 100644 --- a/dist/canvg.js +++ b/dist/canvg.js @@ -1,6 +1,20 @@ var canvg = (function (exports) { 'use strict'; + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); @@ -584,7 +598,7 @@ var canvg = (function (exports) { * @param {Integer} topY * @param {Integer} width * @param {Integer} height - * @throws {Error} + * @throws {Error|TypeError} * @returns {ImageData} See {@link https://html.spec.whatwg.org/multipage/canvas.html#imagedata} */ @@ -594,8 +608,8 @@ var canvg = (function (exports) { canvas = document.getElementById(canvas); } - if (!canvas || !('getContext' in canvas)) { - return; + if (!canvas || _typeof(canvas) !== 'object' || !('getContext' in canvas)) { + throw new TypeError('Expecting canvas with `getContext` method in processCanvasRGB(A) calls!'); } var context = canvas.getContext('2d'); diff --git a/dist/extensions/ext-server_moinsave.js b/dist/extensions/ext-server_moinsave.js index c6108f0c..7622b7ca 100644 --- a/dist/extensions/ext-server_moinsave.js +++ b/dist/extensions/ext-server_moinsave.js @@ -1,6 +1,20 @@ var svgEditorExtension_server_moinsave = (function () { 'use strict'; + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); @@ -584,7 +598,7 @@ var svgEditorExtension_server_moinsave = (function () { * @param {Integer} topY * @param {Integer} width * @param {Integer} height - * @throws {Error} + * @throws {Error|TypeError} * @returns {ImageData} See {@link https://html.spec.whatwg.org/multipage/canvas.html#imagedata} */ @@ -594,8 +608,8 @@ var svgEditorExtension_server_moinsave = (function () { canvas = document.getElementById(canvas); } - if (!canvas || !('getContext' in canvas)) { - return; + if (!canvas || _typeof(canvas) !== 'object' || !('getContext' in canvas)) { + throw new TypeError('Expecting canvas with `getContext` method in processCanvasRGB(A) calls!'); } var context = canvas.getContext('2d'); diff --git a/dist/extensions/ext-server_opensave.js b/dist/extensions/ext-server_opensave.js index 56c561c7..89587c18 100644 --- a/dist/extensions/ext-server_opensave.js +++ b/dist/extensions/ext-server_opensave.js @@ -1,6 +1,20 @@ var svgEditorExtension_server_opensave = (function () { 'use strict'; + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); @@ -584,7 +598,7 @@ var svgEditorExtension_server_opensave = (function () { * @param {Integer} topY * @param {Integer} width * @param {Integer} height - * @throws {Error} + * @throws {Error|TypeError} * @returns {ImageData} See {@link https://html.spec.whatwg.org/multipage/canvas.html#imagedata} */ @@ -594,8 +608,8 @@ var svgEditorExtension_server_opensave = (function () { canvas = document.getElementById(canvas); } - if (!canvas || !('getContext' in canvas)) { - return; + if (!canvas || _typeof(canvas) !== 'object' || !('getContext' in canvas)) { + throw new TypeError('Expecting canvas with `getContext` method in processCanvasRGB(A) calls!'); } var context = canvas.getContext('2d'); diff --git a/editor/external/stackblur-canvas/dist/stackblur-es.js b/editor/external/stackblur-canvas/dist/stackblur-es.js index f7b00402..b38752bc 100644 --- a/editor/external/stackblur-canvas/dist/stackblur-es.js +++ b/editor/external/stackblur-canvas/dist/stackblur-es.js @@ -91,7 +91,7 @@ function processImage(img, canvas, radius, blurAlphaChannel) { * @param {Integer} topY * @param {Integer} width * @param {Integer} height - * @throws {Error} + * @throws {Error|TypeError} * @returns {ImageData} See {@link https://html.spec.whatwg.org/multipage/canvas.html#imagedata} */ @@ -101,8 +101,8 @@ function getImageDataFromCanvas(canvas, topX, topY, width, height) { canvas = document.getElementById(canvas); } - if (!canvas || !('getContext' in canvas)) { - return; + if (!canvas || typeof canvas !== 'object' || !('getContext' in canvas)) { + throw new TypeError('Expecting canvas with `getContext` method in processCanvasRGB(A) calls!'); } const context = canvas.getContext('2d'); diff --git a/package-lock.json b/package-lock.json index 7250f212..21341d86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9400,9 +9400,9 @@ } }, "stackblur-canvas": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.0.0.tgz", - "integrity": "sha512-660gH1SpjeKyfUYnne9nuIya7CDGds6NdIrxzOToSgaSlOqbh7UYGP9VlxlQ8IX7af/nPuAHLkN03l84OesX7Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.1.0.tgz", + "integrity": "sha512-RwIUB2RMahW1gf0n98b/CpMnGtzepwD5Nn1RRXdg51FU5Sp5VWAbUEsGPQx7qbw7Ljkwwtzci/APw6G+y10k1w==", "dev": true }, "stackframe": { diff --git a/package.json b/package.json index 00b7a9a6..86f8b85c 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "rollup-plugin-terser": "^3.0.0", "sinon": "^7.1.1", "sinon-test": "^2.4.0", - "stackblur-canvas": "^2.0.0", + "stackblur-canvas": "^2.1.0", "testcafe": "^0.23.2" } }