[Addon] Fix showMessageBox function 97/230797/2
authorws29.jung <ws29.jung@samsung.com>
Tue, 14 Apr 2020 07:39:33 +0000 (16:39 +0900)
committerws29.jung <ws29.jung@samsung.com>
Tue, 14 Apr 2020 08:36:57 +0000 (17:36 +0900)
Old version of Electron only had 'showMessageBox' function,
and it handled sync and async mode under binded C++ function.
Now new Electron export 'showMessageBoxSync' function separatly
and it works as sync mode of old 'showMessageBox'.
To handle both functions with one source code, this patch makes
addonapi method to use logical function fallback.

Change-Id: I97c06ebff302c7e3770166fe162c53ea251f05b0
Signed-off-by: ws29.jung <ws29.jung@samsung.com>
wrt_app/addon/browser/modules/window.js

index c7a92f2..44e779d 100644 (file)
@@ -10,11 +10,12 @@ module.exports = {
 
   showMessageBox: function (winId, options) {
     let window = TopLevelWindow.fromId(winId);
-    dialog.showMessageBox(window, options, null);
+    let showMessageBox = (dialog.showMessageBoxSync || dialog.showMessageBox);
+    showMessageBox(window, options);
   },
 
   show: function (winId) {
     let window = TopLevelWindow.fromId(winId);
     window.show();
   }
-}
\ No newline at end of file
+}