Bug 1085158 - FilePicker.js should use its parent window for the creation of File object, r=bz

This commit is contained in:
Andrea Marchesini 2014-10-21 14:50:21 +01:00
parent 507b8063c9
commit e977a9c3db

View File

@ -10,6 +10,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.importGlobalProperties(['File']);
function FilePicker() { function FilePicker() {
} }
@ -143,12 +145,22 @@ FilePicker.prototype = {
if (!f) { if (!f) {
return null; return null;
} }
return File(f);
if (this._domWin) {
return new this._domWin.File(f);
}
return new File(f);
}, },
get domfiles() { get domfiles() {
let win = this._domWin;
return this.getEnumerator([this.file], function(file) { return this.getEnumerator([this.file], function(file) {
return File(file); if (win) {
return new win.File(file);
}
return new File(file);
}); });
}, },