mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 785744 - Async file picker cleanup. r=neil
This commit is contained in:
parent
e2dc01a32c
commit
e5dea77d70
@ -137,19 +137,18 @@ MockFilePickerInstance.prototype = {
|
||||
},
|
||||
open: function(aFilePickerShownCallback) {
|
||||
MockFilePicker.showing = true;
|
||||
var self = this;
|
||||
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
||||
.getService(Components.interfaces.nsIThreadManager);
|
||||
tm.mainThread.dispatch({
|
||||
run: function() {
|
||||
try {
|
||||
let result = self.show();
|
||||
aFilePickerShownCallback.done(result);
|
||||
} catch(ex) {
|
||||
aFilePickerShownCallback.done(self.returnCancel);
|
||||
}
|
||||
tm.mainThread.dispatch(function() {
|
||||
let result = Components.interfaces.nsIFilePicker.returnCancel;
|
||||
try {
|
||||
result = this.show();
|
||||
} catch(ex) {
|
||||
}
|
||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
||||
if (aFilePickerShownCallback) {
|
||||
aFilePickerShownCallback.done(result);
|
||||
}
|
||||
}.bind(this), Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -187,11 +187,13 @@ nsFilePicker.prototype = {
|
||||
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
||||
.getService(Components.interfaces.nsIThreadManager);
|
||||
tm.mainThread.dispatch(function() {
|
||||
let result = Components.interfaces.nsIFilePicker.returnCancel;
|
||||
try {
|
||||
let result = this.show();
|
||||
aFilePickerShownCallback.done(result);
|
||||
result = this.show();
|
||||
} catch(ex) {
|
||||
aFilePickerShownCallback.done(this.returnCancel);
|
||||
}
|
||||
if (aFilePickerShownCallback) {
|
||||
aFilePickerShownCallback.done(result);
|
||||
}
|
||||
}.bind(this), Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
||||
},
|
||||
|
@ -51,15 +51,16 @@ public:
|
||||
// It's possible that some widget implementations require GUI operations
|
||||
// to be on the main thread, so that's why we're not dispatching to another
|
||||
// thread and calling back to the main after it's done.
|
||||
int16_t result;
|
||||
int16_t result = nsIFilePicker::returnCancel;
|
||||
nsresult rv = mFilePicker->Show(&result);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("FilePicker's Show() implementation failed!");
|
||||
mCallback->Done(nsIFilePicker::returnCancel);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return mCallback->Done(result);
|
||||
if (mCallback) {
|
||||
mCallback->Done(result);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user