Mantis

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021297GameMaker Runner[All Projects] HTML5Public2016-04-26 16:032016-06-02 11:43
ReporterPiotr Gnys 
Assigned ToFritz 
PriorityLowSeverityC - GeneralReproducibility100%
StatusClosedResolutionFixed 
PlatformHTML5OS OS Version
Summary0021297: HTML5: sprite_add() does not support cross origin
Descriptionif the user attempts to add a sprite from a url using sprite_add they will receive the error:
Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at

This issue can be fixed by opening the HTML5 output file, and making a REGEXP replace on:
var ([a-zA-Z_0-9]+)=new Image\(\);
to:
var $1=new Image\(\);$1.crossOrigin='';

This is however not ideal as it requires the user to alter files outside of GameMaker: Studio in order to add functionality.
Steps To ReproduceWrite code to load http://www.gravatar.com/avatar/8455938a1db5c475a87d76edacb6284e [^] with sprite_add
Run the project
Notice that you receive the error Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at
Open the HTML5 output file, and making a REGEXP replace on:
var ([a-zA-Z_0-9]+)=new Image\(\);
to:
var $1=new Image\(\);$1.crossOrigin='';
Run the project again
Notice it now functions without error
Additional InformationOriginal helpdesk ticket: http://help.yoyogames.com/tickets/104219 [^]
GM Version
Attached Files? file icon crossOrigin-sprite_add.gmz [^] (222,158 bytes) 2016-06-02 11:42

- Relationships

-  Notes
(0043088)
rcusumano (Updater)
2016-04-26 16:19

Huh, neat. I thought this was unsolvable after reading some webgl security blogs.
(0043089)
Piotr Gnys (Updater)
2016-04-26 16:25
edited on: 2016-04-26 16:26

https://dl.dropboxusercontent.com/u/33525625/gmsmarketplace/GravatarDemo/index.html [^] - here is working example AFTER changes are made (var x = new Image(); x.crossOrigin = '';). To enter "@" sign you may need to press "Shift+`" on keyboard (` is left to 1). You need to have gravatar account.

(0043673)
Daniel Cleaton (Administrator)
2016-06-02 11:43

Added a sample.

Verifying in EA478. Closing. Fix will be in next EA/Beta releases.


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker