Gisellameloni / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

IE 11.0.18 Crashes freaquently #1275

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Draw something on editor.
2. Click on Export from SVG-Edit menu (Top left corner)
3. Click ok from the popup to export. This process will crash the browser.

As per our code review, this is happening due to getSvgString() function from 
svgCanvas.js

In what browser did you experience this problem? This issue is specifically 
happen in IE 11 version(11.0.18).

In what version of SVG-edit does the problem occur? (Latest trunk, 2.7.1,
etc)

Thanks for your help in advance.

Original issue reported on code.google.com by sukhadia...@gmail.com on 18 Apr 2015 at 11:06

GoogleCodeExporter commented 9 years ago
I have the same issue for version 2.6.  This crash happens in this.svgToString 
function when javascript tries to get values namespaceURI and nodeValue from 
the svg attributes of the DOM model. 

To reproduce:
1. add any text object to canvas
2. press 'U' or 'Svg' button at top left corner
3. modfy text in svg text editor and press 'Ok' button. 
4. repeat step 2. Browser crashed

The reason is recent Microsoft update Microsoft Security Bulletin MS15-032 
(3038314)
Its affects also IE 10.

You can uninstall this update and this will the issue but it's not a solution 
for all clients.
This is critical for us and we need to fix it ASAP. Any help would be highly 
appreciated.

Original comment by sergey.y...@gmail.com on 24 Apr 2015 at 10:55

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Update:

I found issue in svgcanvas.js when you load svg in some places function  
prepareSVG sanitized DOM of loaded svg. And this is a reason of IE crash.

The simplest way is disable sanitize for IE
change this 
this.prepareSvg(newDoc);
to this
if (!svgedit.browser.isIE)
this.prepareSvg(newDoc);

if you still need this feature for IE you are welcome to dig deeper.

Original comment by sergey.y...@gmail.com on 30 Apr 2015 at 2:10

GoogleCodeExporter commented 9 years ago
Hello sergey,

Thanks a lot for you timely help.
you saved my life.

Regards,
Kunjesh

Original comment by sukhadia...@gmail.com on 6 May 2015 at 1:07

GoogleCodeExporter commented 9 years ago
Sergey - Is there any solution if you NEED to use the prepareSvg function in IE?

Original comment by ramseyc...@att.net on 14 May 2015 at 5:24

GoogleCodeExporter commented 9 years ago
Any plans on fixing the issue ? We have an svg heavy application and the entire 
application crashes.
Would appreciate if any one can throw more light on this issue. Skipping 
prepareSvg would not work for us.

Original comment by ranjith....@gmail.com on 14 May 2015 at 7:42

GoogleCodeExporter commented 9 years ago
Update 2:

Skipping prepareSvg leads to issue with pathes. 
preparesvg sanitize dom model which cause IE crash and convert pathes to 
absolute commands. The last one should be kept. This impacts to proper define 
bbox for path svg elements.

So I enable preparesvg function call and now this function looks:
    this.prepareSvg = function(newDoc) {

        if (!svgedit.browser.isIE)
            this.sanitizeSvg(newDoc.documentElement);

        // convert paths into absolute commands
        var paths = newDoc.getElementsByTagNameNS(svgns, "path");
        for (var i = 0, len = paths.length; i < len; ++i) {
            var path = paths[i];
            path.setAttribute('d', pathActions.convertPath(path));
            pathActions.fixEnd(path);
        }
    };

I don't understand why sanitize applied at DOM elements. SVG is xml and 
sanitize should be applied to xml before convert it to DOM. 

To avoid IE crash I disabled sanitize for IE and in our solution user not 
permitted unmanaged modification  of svg  and we in control of svg quality, so 
we are good with current fix.

But I suggest to optimize sanitize functionality and apply it to svg rather 
then dom elements.

Original comment by sergey.y...@gmail.com on 15 May 2015 at 8:42

GoogleCodeExporter commented 9 years ago
Sergey - Thanks for the quick reply.  We have implemented this solution and it 
seems to have fixed our problems. 

Thanks again!

Original comment by ramseyc...@att.net on 17 May 2015 at 1:09

GoogleCodeExporter commented 9 years ago
thanks its also work for me in IE 11

Original comment by deepak.k...@gmail.com on 4 Jun 2015 at 6:05

GoogleCodeExporter commented 9 years ago
thanks, in iE11 the workaround worked.
But unfortunately it seems o break our application in IE10 in some cases
Are there any news about that issue?

Original comment by hueb...@ironshark.de on 26 Jun 2015 at 3:17

GoogleCodeExporter commented 9 years ago
We also have the same issue in IE10. Did you find a solution to solve it in 
IE10?

Original comment by christ...@woetzer.de on 13 Jul 2015 at 1:40

GoogleCodeExporter commented 9 years ago
Issue is beacuse of this code in sanitizeSvg function in svgedit.compiled.js 
file:

for(q=i.attributes.length;q--;){

var D=i.attributes.item(q),u=D.nodeName,A=D.localName,p=D.namespaceURI;

if(!(g.hasOwnProperty(A)&&p==g[A]&&p!=a.XMLNS)&&!(p==a.XMLNS&&I[D.nodeValue])){u
.indexOf("se:")===0&&w.push([u,D.nodeValue]);i.removeAttributeNS(p,A)}

if(svgedit.browser.isGecko())switch(u){case "transform":case 
"gradientTransform":case "patternTransform":A=D.nodeValue.replace(/(\d)-/g,"$1 
-");
i.setAttribute(u,A)}

if(u=="style"){D=D.nodeValue.split(";");for(u=D.length;u--;){p=D[u].split(":");A
=$.trim(p[0]);p=$.trim(p[1]);e.indexOf(A)>=0&&i.setAttribute(A,p)}i.removeAttrib
ute("style")}

}

Original comment by rake...@b2btechnosolutions.com on 13 Jul 2015 at 1:44

GoogleCodeExporter commented 9 years ago
To be more precise because of this code : var D=i.attributes.item(q)

Original comment by rake...@b2btechnosolutions.com on 13 Jul 2015 at 1:45

GoogleCodeExporter commented 9 years ago
Thanks for the helpful pinpointing, rakesht. I don't really have time/energy to 
help with this, but just wanted to say you might try replacing the line with:

var D=i.attributes[q];

...and see if that makes any difference.

You could also use `console.log(q)` before that line to find out which numbered 
attribute gives the problem.

I'd also strongly recommend testing against the version currently on Github to 
test against the latest code.

It would also be helpful to do `console.log(i.outerHTML);` right before the 
error to see the specific element it is choking on, and then if you know the 
attribute count, you can confirm which particular attribute gives the problem 
(or if it is all attributes).

Original comment by bret...@gmail.com on 13 Jul 2015 at 5:35

GoogleCodeExporter commented 9 years ago
Is there any way to without using KB3038314 update for IE-10 load svg-edit 
sketch tool?

Original comment by dharmesh...@gmail.com on 14 Jul 2015 at 5:12