Bug 773988 - Allow saving a snapshot from a media stream without a known filename, r=dolske.

This commit is contained in:
Florian Quèze 2013-11-07 14:01:55 +01:00
parent c531180a28
commit 06154893be

View File

@ -986,16 +986,15 @@ nsContextMenu.prototype = {
},
saveVideoFrameAsImage: function () {
urlSecurityCheck(this.mediaURL,
this._unremotePrincipal(this.browser.contentPrincipal),
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
let name = "";
try {
let uri = makeURI(this.mediaURL);
let url = uri.QueryInterface(Ci.nsIURL);
if (url.fileBaseName)
name = decodeURI(url.fileBaseName) + ".jpg";
} catch (e) { }
if (this.mediaURL) {
try {
let uri = makeURI(this.mediaURL);
let url = uri.QueryInterface(Ci.nsIURL);
if (url.fileBaseName)
name = decodeURI(url.fileBaseName) + ".jpg";
} catch (e) { }
}
if (!name)
name = "snapshot.jpg";
var video = this.target;