Fix returning the chosen option for synchronous dialogs.
This commit is contained in:
parent
a0a5b20ef1
commit
02d14ed23b
1 changed files with 6 additions and 6 deletions
|
@ -59,9 +59,8 @@ v8::Handle<v8::Value> ShowMessageBox(const v8::Arguments &args) {
|
||||||
return node::ThrowTypeError("Bad argument");
|
return node::ThrowTypeError("Bad argument");
|
||||||
|
|
||||||
NativeWindow* native_window = FromV8Value(args[5]);
|
NativeWindow* native_window = FromV8Value(args[5]);
|
||||||
v8::Persistent<v8::Function> callback = FromV8Value(args[6]);
|
|
||||||
|
|
||||||
if (callback.IsEmpty()) {
|
if (!args[6]->IsFunction()) {
|
||||||
int chosen = atom::ShowMessageBox(
|
int chosen = atom::ShowMessageBox(
|
||||||
native_window,
|
native_window,
|
||||||
(MessageBoxType)type,
|
(MessageBoxType)type,
|
||||||
|
@ -71,6 +70,7 @@ v8::Handle<v8::Value> ShowMessageBox(const v8::Arguments &args) {
|
||||||
detail);
|
detail);
|
||||||
return scope.Close(v8::Integer::New(chosen));
|
return scope.Close(v8::Integer::New(chosen));
|
||||||
} else {
|
} else {
|
||||||
|
v8::Persistent<v8::Function> callback = FromV8Value(args[6]);
|
||||||
atom::ShowMessageBox(
|
atom::ShowMessageBox(
|
||||||
native_window,
|
native_window,
|
||||||
(MessageBoxType)type,
|
(MessageBoxType)type,
|
||||||
|
@ -93,9 +93,8 @@ v8::Handle<v8::Value> ShowOpenDialog(const v8::Arguments &args) {
|
||||||
return node::ThrowTypeError("Bad argument");
|
return node::ThrowTypeError("Bad argument");
|
||||||
|
|
||||||
NativeWindow* native_window = FromV8Value(args[3]);
|
NativeWindow* native_window = FromV8Value(args[3]);
|
||||||
v8::Persistent<v8::Function> callback = FromV8Value(args[4]);
|
|
||||||
|
|
||||||
if (callback.IsEmpty()) {
|
if (!args[4]->IsFunction()) {
|
||||||
std::vector<base::FilePath> paths;
|
std::vector<base::FilePath> paths;
|
||||||
if (!file_dialog::ShowOpenDialog(native_window,
|
if (!file_dialog::ShowOpenDialog(native_window,
|
||||||
title,
|
title,
|
||||||
|
@ -110,6 +109,7 @@ v8::Handle<v8::Value> ShowOpenDialog(const v8::Arguments &args) {
|
||||||
|
|
||||||
return scope.Close(result);
|
return scope.Close(result);
|
||||||
} else {
|
} else {
|
||||||
|
v8::Persistent<v8::Function> callback = FromV8Value(args[4]);
|
||||||
file_dialog::ShowOpenDialog(
|
file_dialog::ShowOpenDialog(
|
||||||
native_window,
|
native_window,
|
||||||
title,
|
title,
|
||||||
|
@ -130,9 +130,8 @@ v8::Handle<v8::Value> ShowSaveDialog(const v8::Arguments &args) {
|
||||||
return node::ThrowTypeError("Bad argument");
|
return node::ThrowTypeError("Bad argument");
|
||||||
|
|
||||||
NativeWindow* native_window = FromV8Value(args[2]);
|
NativeWindow* native_window = FromV8Value(args[2]);
|
||||||
v8::Persistent<v8::Function> callback = FromV8Value(args[3]);
|
|
||||||
|
|
||||||
if (callback.IsEmpty()) {
|
if (!args[3]->IsFunction()) {
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
if (!file_dialog::ShowSaveDialog(native_window,
|
if (!file_dialog::ShowSaveDialog(native_window,
|
||||||
title,
|
title,
|
||||||
|
@ -142,6 +141,7 @@ v8::Handle<v8::Value> ShowSaveDialog(const v8::Arguments &args) {
|
||||||
|
|
||||||
return scope.Close(ToV8Value(path));
|
return scope.Close(ToV8Value(path));
|
||||||
} else {
|
} else {
|
||||||
|
v8::Persistent<v8::Function> callback = FromV8Value(args[3]);
|
||||||
file_dialog::ShowSaveDialog(
|
file_dialog::ShowSaveDialog(
|
||||||
native_window,
|
native_window,
|
||||||
title,
|
title,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue