Bug 1355151 - limit opening of an event window to a single instance again. r=decathlon a=philipp DONTBUILD
authormakemyday@gmx-topmail.de
Sun, 16 Apr 2017 14:47:53 +0200
changeset 27824 aea8a32b9e42342d2bcf7d08071c68a0215913ef
parent 27823 567c3434053e258ca976b3362a5d2c40a2b0f8b2
child 27825 ca7ac05524f880eaf685cb74b026f3426b8bbf79
child 27827 cba05355d5896eb2cf89b4879086b04752261fbd
push id1930
push usermozilla@jorgk.com
push dateFri, 28 Apr 2017 15:31:08 +0000
treeherdercomm-beta@aea8a32b9e42 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdecathlon, philipp
bugs1355151
Bug 1355151 - limit opening of an event window to a single instance again. r=decathlon a=philipp DONTBUILD
calendar/base/src/calUtils.js
--- a/calendar/base/src/calUtils.js
+++ b/calendar/base/src/calUtils.js
@@ -1880,24 +1880,35 @@ function getCompositeCalendar() {
             }
         } catch (exc) { // catch errors in case we run in contexts without status feedback
         }
     }
     return getCompositeCalendar.mObject;
 }
 
 /**
- * Search for already open item dialog.
+ * Search for already open item dialog or tab.
  *
- * @param aItem     The item of the dialog to search for.
+ * @param aItem     The item of the dialog or tab to search for.
  */
 function findItemWindow(aItem) {
+    // check for existing dialog windows
     let list = Services.wm.getEnumerator("Calendar:EventDialog");
     while (list.hasMoreElements()) {
         let dlg = list.getNext();
+        if (dlg.arguments[0] &&
+            dlg.arguments[0].mode == "modify" &&
+            dlg.arguments[0].calendarEvent &&
+            dlg.arguments[0].calendarEvent.hashId == aItem.hashId) {
+            return dlg;
+        }
+    }
+    // check for existing summary windows
+    list = Services.wm.getEnumerator("Calendar:EventSummaryDialog");
+    while (list.hasMoreElements()) {
+        let dlg = list.getNext();
         if (dlg.calendarItem &&
-            dlg.mode == "modify" &&
             dlg.calendarItem.hashId == aItem.hashId) {
             return dlg;
         }
     }
     return null;
 }