Opera 12 still does not support window.URL.revokeObjectURL.

This commit is contained in:
Nicolas Stepien 2012-06-14 13:29:27 +02:00
parent a3e352acb2
commit 88a282d73b
2 changed files with 15 additions and 9 deletions

View File

@ -1691,7 +1691,9 @@
return; return;
} }
url = window.URL || window.webkitURL; url = window.URL || window.webkitURL;
url.revokeObjectURL(this.url); if (typeof url.revokeObjectURL === "function") {
url.revokeObjectURL(this.url);
}
fileUrl = url.createObjectURL(file); fileUrl = url.createObjectURL(file);
img = $.el('img'); img = $.el('img');
$.on(img, 'load', function() { $.on(img, 'load', function() {
@ -1723,12 +1725,13 @@
bb.append(ui8a.buffer); bb.append(ui8a.buffer);
_this.url = url.createObjectURL(bb.getBlob('image/png')); _this.url = url.createObjectURL(bb.getBlob('image/png'));
_this.el.style.backgroundImage = "url(" + _this.url + ")"; _this.el.style.backgroundImage = "url(" + _this.url + ")";
return url.revokeObjectURL(fileUrl); return typeof url.revokeObjectURL === "function" ? url.revokeObjectURL(fileUrl) : void 0;
}); });
return img.src = fileUrl; return img.src = fileUrl;
}; };
_Class.prototype.rmFile = function() { _Class.prototype.rmFile = function() {
var _base1;
QR.resetFileInput(); QR.resetFileInput();
delete this.file; delete this.file;
this.el.title = null; this.el.title = null;
@ -1736,7 +1739,7 @@
if (QR.spoiler) { if (QR.spoiler) {
$('label', this.el).hidden = true; $('label', this.el).hidden = true;
} }
return (window.URL || window.webkitURL).revokeObjectURL(this.url); return typeof (_base1 = window.URL || window.webkitURL).revokeObjectURL === "function" ? _base1.revokeObjectURL(this.url) : void 0;
}; };
_Class.prototype.select = function() { _Class.prototype.select = function() {
@ -1800,7 +1803,7 @@
}; };
_Class.prototype.rm = function() { _Class.prototype.rm = function() {
var index; var index, _base1;
QR.resetFileInput(); QR.resetFileInput();
$.rm(this.el); $.rm(this.el);
index = QR.replies.indexOf(this); index = QR.replies.indexOf(this);
@ -1810,7 +1813,9 @@
(QR.replies[index - 1] || QR.replies[index + 1]).select(); (QR.replies[index - 1] || QR.replies[index + 1]).select();
} }
QR.replies.splice(index, 1); QR.replies.splice(index, 1);
(window.URL || window.webkitURL).revokeObjectURL(this.url); if (typeof (_base1 = window.URL || window.webkitURL).revokeObjectURL === "function") {
_base1.revokeObjectURL(this.url);
}
return delete this; return delete this;
}; };

View File

@ -1252,7 +1252,8 @@ QR =
@el.style.backgroundImage = null @el.style.backgroundImage = null
return return
url = window.URL or window.webkitURL url = window.URL or window.webkitURL
url.revokeObjectURL @url # XXX Opera does not support window.URL.revokeObjectURL
url.revokeObjectURL? @url
# Create a redimensioned thumbnail. # Create a redimensioned thumbnail.
fileUrl = url.createObjectURL file fileUrl = url.createObjectURL file
@ -1291,7 +1292,7 @@ QR =
@url = url.createObjectURL bb.getBlob 'image/png' @url = url.createObjectURL bb.getBlob 'image/png'
@el.style.backgroundImage = "url(#{@url})" @el.style.backgroundImage = "url(#{@url})"
url.revokeObjectURL fileUrl url.revokeObjectURL? fileUrl
img.src = fileUrl img.src = fileUrl
rmFile: -> rmFile: ->
@ -1300,7 +1301,7 @@ QR =
@el.title = null @el.title = null
@el.style.backgroundImage = null @el.style.backgroundImage = null
$('label', @el).hidden = true if QR.spoiler $('label', @el).hidden = true if QR.spoiler
(window.URL or window.webkitURL).revokeObjectURL @url (window.URL or window.webkitURL).revokeObjectURL? @url
select: -> select: ->
QR.selected?.el.id = null QR.selected?.el.id = null
QR.selected = @ QR.selected = @
@ -1346,7 +1347,7 @@ QR =
else if @el.id is 'selected' else if @el.id is 'selected'
(QR.replies[index-1] or QR.replies[index+1]).select() (QR.replies[index-1] or QR.replies[index+1]).select()
QR.replies.splice index, 1 QR.replies.splice index, 1
(window.URL or window.webkitURL).revokeObjectURL @url (window.URL or window.webkitURL).revokeObjectURL? @url
delete @ delete @
captcha: captcha: