summaryrefslogtreecommitdiff
path: root/gui.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-09-18 15:34:59 +0200
committerjmoenig <jens@moenig.org>2013-09-18 15:34:59 +0200
commite9afcc9ec3e990eb1ebc79790fcf5048372858c1 (patch)
treed1dbf920aa3b93174adb70e9d57cf60d9c01ad98 /gui.js
parentc0a0c1f4a7a9f3cfd055288817530cf7c46bb26d (diff)
downloadsnap-e9afcc9ec3e990eb1ebc79790fcf5048372858c1.tar.gz
snap-e9afcc9ec3e990eb1ebc79790fcf5048372858c1.zip
prevent costumes with imported CORS-tainted canvases
expected to fix #155, #154, #151, #148, #147, #127 for future projects
Diffstat (limited to 'gui.js')
-rw-r--r--gui.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/gui.js b/gui.js
index c11793e..e68d62c 100644
--- a/gui.js
+++ b/gui.js
@@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.gui = '2013-September-17';
+modules.gui = '2013-September-18';
// Declarations
@@ -1488,6 +1488,19 @@ IDE_Morph.prototype.droppedImage = function (aCanvas, name) {
aCanvas,
name ? name.split('.')[0] : '' // up to period
);
+
+ if (costume.isTainted()) {
+ this.inform(
+ 'Unable to import this image',
+ 'The picture you wish to import has been\n' +
+ 'tainted by a restrictive cross-origin policy\n' +
+ 'making it unusable for costumes in Snap!. \n\n' +
+ 'Try downloading this picture first to your\n' +
+ 'computer, and import it from there.'
+ );
+ return;
+ }
+
this.currentSprite.addCostume(costume);
this.currentSprite.wearCostume(costume);
this.spriteBar.tabBar.tabTo('costumes');