Index: ui/file_manager/gallery/js/background.js |
diff --git a/ui/file_manager/gallery/js/background.js b/ui/file_manager/gallery/js/background.js |
index 61ea019d2f1723588bc96580eeea76886ec7484a..a3798821dbe5a49b155f6a9de6c93af2fc938e08 100644 |
--- a/ui/file_manager/gallery/js/background.js |
+++ b/ui/file_manager/gallery/js/background.js |
@@ -142,7 +142,12 @@ chrome.app.runtime.onLaunched.addListener(function(launchData) { |
closePromise = appWindowPromise.then(function(appWindow) { |
return new Promise(function(fulfill) { |
appWindow.close(); |
- appWindow.onClosed.addListener(fulfill); |
+ try { |
+ appWindow.onClosed.addListener(fulfill); |
+ } catch (error) { |
+ // Sometimes it failes to addListener. |
yoshiki
2014/05/23 06:16:13
The handler should be registered before closing it
hirono
2014/05/26 02:21:48
Done.
|
+ fulfill(); |
+ } |
}); |
}); |
} else { |