From 5639faf0697a8a55464eb6cbfcc6d605c09f01a2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 17 Nov 2016 12:13:07 +0900 Subject: [PATCH] Also fix the Windows and Linux side of async openExternal --- atom/common/platform_util_linux.cc | 9 +-------- atom/common/platform_util_win.cc | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/atom/common/platform_util_linux.cc b/atom/common/platform_util_linux.cc index 63488fe7df03..923adbd882be 100644 --- a/atom/common/platform_util_linux.cc +++ b/atom/common/platform_util_linux.cc @@ -92,14 +92,7 @@ bool OpenExternal(const GURL& url, bool activate) { void OpenExternal(const GURL& url, bool activate, const OpenExternalCallback& callback) { // TODO(gabriel): Implement async open if callback is specified - bool opened = OpenExternal(url, activate); - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - if (!opened) { - callback.Run(v8::Exception::Error( - v8::String::NewFromUtf8(isolate, "Failed to open"))); - } else { - callback.Run(v8::Null(isolate)); - } + callback.Run(OpenExternal(url, activate) ? "" : "Failed to open"); } bool MoveItemToTrash(const base::FilePath& full_path) { diff --git a/atom/common/platform_util_win.cc b/atom/common/platform_util_win.cc index 6c59699a8344..348868dc5865 100644 --- a/atom/common/platform_util_win.cc +++ b/atom/common/platform_util_win.cc @@ -319,14 +319,7 @@ bool OpenExternal(const base::string16& url, bool activate) { void OpenExternal(const base::string16& url, bool activate, const OpenExternalCallback& callback) { // TODO(gabriel): Implement async open if callback is specified - bool opened = OpenExternal(url, activate); - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - if (!opened) { - callback.Run(v8::Exception::Error( - v8::String::NewFromUtf8(isolate, "Failed to open"))); - } else { - callback.Run(v8::Null(isolate)); - } + callback.Run(OpenExternal(url, activate) ? "" : "Failed to open"); } bool MoveItemToTrash(const base::FilePath& path) {