fixed old Chrome bug handling for svg saving

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2413 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Bruno Heridet
2013-02-16 15:36:19 +00:00
parent 525e869e7f
commit b599a2a54b

View File

@@ -627,15 +627,14 @@
// can just provide their own custom save handler and might not want the XML prolog // can just provide their own custom save handler and might not want the XML prolog
svg = '<?xml version="1.0"?>\n' + svg; svg = '<?xml version="1.0"?>\n' + svg;
// Opens the SVG in new window, with warning about Mozilla bug #308590 when applicable // IE9 doesn't allow standalone Data URLs
var ua = navigator.userAgent; // https://connect.microsoft.com/IE/feedback/details/542600/data-uri-images-fail-when-loaded-by-themselves
if (svgedit.browser.isIE()) {
// Chrome 5 (and 6?) don't allow saving, show source instead ( http://code.google.com/p/chromium/issues/detail?id=46735 )
// IE9 doesn't allow standalone Data URLs ( https://connect.microsoft.com/IE/feedback/details/542600/data-uri-images-fail-when-loaded-by-themselves )
if ((~ua.indexOf('Chrome') && $.browser.version >= 533) || ~ua.indexOf('MSIE')) {
showSourceEditor(0, true); showSourceEditor(0, true);
return; return;
} }
// Opens the SVG in new window
var win = window.open('data:image/svg+xml;base64,' + Utils.encode64(svg)); var win = window.open('data:image/svg+xml;base64,' + Utils.encode64(svg));
// Alert will only appear the first time saved OR the first time the bug is encountered // Alert will only appear the first time saved OR the first time the bug is encountered
@@ -644,8 +643,9 @@
var note = uiStrings.notification.saveFromBrowser.replace('%s', 'SVG'); var note = uiStrings.notification.saveFromBrowser.replace('%s', 'SVG');
// Check if FF and has <defs/> // Check if FF and has <defs/>
if (ua.indexOf('Gecko/') !== -1) { if (svgedit.browser.isGecko()) {
if (svg.indexOf('<defs') !== -1) { if (svg.indexOf('<defs') !== -1) {
// warning about Mozilla bug #308590 when applicable (seems to be fixed now in Feb 2013)
note += '\n\n' + uiStrings.notification.defsFailOnSave; note += '\n\n' + uiStrings.notification.defsFailOnSave;
$.pref('save_notice_done', 'all'); $.pref('save_notice_done', 'all');
done = 'all'; done = 'all';
@@ -655,7 +655,6 @@
} else { } else {
$.pref('save_notice_done', 'all'); $.pref('save_notice_done', 'all');
} }
if (done !== 'part') { if (done !== 'part') {
win.alert(note); win.alert(note);
} }