From dc870c0d41e1163e6ac7645429287580b7599290 Mon Sep 17 00:00:00 2001 From: Khushil Mistry Date: Thu, 14 Nov 2019 08:59:00 +0100 Subject: [PATCH] Bug 1557504 - remove [array] use in xpidl from calICalendarSearchProvider.idl and calICalendarViewController.idl. r=pmorris --- calendar/base/content/agenda-listbox-utils.js | 7 +------ calendar/base/content/calendar-clipboard.js | 2 +- calendar/base/content/calendar-management.js | 2 +- .../base/content/calendar-task-tree-utils.js | 2 +- calendar/base/content/calendar-views-utils.js | 10 ++-------- .../base/public/calICalendarSearchProvider.idl | 3 +-- .../base/public/calICalendarViewController.idl | 3 +-- calendar/base/src/calCalendarSearchService.js | 3 +-- calendar/test/unit/test_search_service.js | 16 ++++++++-------- 9 files changed, 17 insertions(+), 31 deletions(-) diff --git a/calendar/base/content/agenda-listbox-utils.js b/calendar/base/content/agenda-listbox-utils.js index a250c1c831..079e01f930 100644 --- a/calendar/base/content/agenda-listbox-utils.js +++ b/calendar/base/content/agenda-listbox-utils.js @@ -558,12 +558,7 @@ agendaListbox.deleteSelectedItem = function(aDoNotConfirm) { let listItem = this.agendaListboxControl.selectedItem; if (this.isEventListItem(listItem)) { let selectedItems = [listItem.occurrence]; - calendarViewController.deleteOccurrences( - selectedItems.length, - selectedItems, - false, - aDoNotConfirm - ); + calendarViewController.deleteOccurrences(selectedItems, false, aDoNotConfirm); } }; diff --git a/calendar/base/content/calendar-clipboard.js b/calendar/base/content/calendar-clipboard.js index 3591bee2c8..882f356994 100644 --- a/calendar/base/content/calendar-clipboard.js +++ b/calendar/base/content/calendar-clipboard.js @@ -122,7 +122,7 @@ function copyToClipboard(aCalendarItemArray = null, aCutMode = false) { if (aCutMode) { // check for MODIFICATION_PARENT let useParent = response == 3; - calendarViewController.deleteOccurrences(targetItems.length, targetItems, useParent, true); + calendarViewController.deleteOccurrences(targetItems, useParent, true); } } } diff --git a/calendar/base/content/calendar-management.js b/calendar/base/content/calendar-management.js index dc454c0f33..03e5ca9727 100644 --- a/calendar/base/content/calendar-management.js +++ b/calendar/base/content/calendar-management.js @@ -514,7 +514,7 @@ function calendarListSetupContextMenu(event) { } // Only enable calendar search if there's actually the chance of finding something: - let hasProviders = cal.getCalendarSearchService().getProviders({}).length < 1 && "true"; + let hasProviders = cal.getCalendarSearchService().getProviders().length < 1 && "true"; setElementValue("list-calendars-context-find", hasProviders, "collapsed"); } diff --git a/calendar/base/content/calendar-task-tree-utils.js b/calendar/base/content/calendar-task-tree-utils.js index 415a8a5348..de5a359b65 100644 --- a/calendar/base/content/calendar-task-tree-utils.js +++ b/calendar/base/content/calendar-task-tree-utils.js @@ -287,7 +287,7 @@ function modifyTaskFromContext(aEvent, initialDate) { */ function deleteToDoCommand(aEvent, aDoNotConfirm) { let tasks = getSelectedTasks(aEvent); - calendarViewController.deleteOccurrences(tasks.length, tasks, false, aDoNotConfirm); + calendarViewController.deleteOccurrences(tasks, false, aDoNotConfirm); } /** diff --git a/calendar/base/content/calendar-views-utils.js b/calendar/base/content/calendar-views-utils.js index abcbf6604b..39a80a44bf 100644 --- a/calendar/base/content/calendar-views-utils.js +++ b/calendar/base/content/calendar-views-utils.js @@ -89,13 +89,7 @@ var calendarViewController = { * Deletes the given occurrences * @see calICalendarViewController */ - deleteOccurrences: function( - count, - occurrencesArg, - useParentItems, - doNotConfirm, - extResponseArg = null - ) { + deleteOccurrences: function(occurrencesArg, useParentItems, doNotConfirm, extResponseArg = null) { startBatchTransaction(); let recurringItems = {}; let extResponse = extResponseArg || { responseMode: Ci.calIItipItem.USER }; @@ -544,7 +538,7 @@ function getLastCalendarView() { */ function deleteSelectedEvents() { let selectedItems = currentView().getSelectedItems({}); - calendarViewController.deleteOccurrences(selectedItems.length, selectedItems, false, false); + calendarViewController.deleteOccurrences(selectedItems, false, false); // clear selection currentView().setSelectedItems(0, [], true); } diff --git a/calendar/base/public/calICalendarSearchProvider.idl b/calendar/base/public/calICalendarSearchProvider.idl index 96dc36810c..41718398df 100644 --- a/calendar/base/public/calICalendarSearchProvider.idl +++ b/calendar/base/public/calICalendarSearchProvider.idl @@ -50,8 +50,7 @@ interface calICalendarSearchService : calICalendarSearchProvider /** * Gets the currently registered set of search providers. */ - void getProviders(out uint32_t aCount, - [array, size_is(aCount), retval] out calICalendarSearchProvider aProviders); + Array getProviders(); /** * Adds a new search provider. diff --git a/calendar/base/public/calICalendarViewController.idl b/calendar/base/public/calICalendarViewController.idl index caadb8569f..dff5820434 100644 --- a/calendar/base/public/calICalendarViewController.idl +++ b/calendar/base/public/calICalendarViewController.idl @@ -63,8 +63,7 @@ interface calICalendarViewController : nsISupports * @param aDoNotConfirm If set, the events will be deleted without * confirmation. */ - void deleteOccurrences (in uint32_t aCount, - [array, size_is(aCount)] in calIItemBase aOccurrences, + void deleteOccurrences (in Array aOccurrences, in boolean aUseParentItems, in boolean aDoNotConfirm); }; diff --git a/calendar/base/src/calCalendarSearchService.js b/calendar/base/src/calCalendarSearchService.js index 5672b26eec..057b3a72d6 100644 --- a/calendar/base/src/calCalendarSearchService.js +++ b/calendar/base/src/calCalendarSearchService.js @@ -83,8 +83,7 @@ calCalendarSearchService.prototype = { }, // calICalendarSearchService: - getProviders: function(out_aCount) { - out_aCount.value = this.mProviders.size; + getProviders: function() { return [...this.mProviders]; }, addProvider: function(aProvider) { diff --git a/calendar/test/unit/test_search_service.js b/calendar/test/unit/test_search_service.js index d14136e379..81fab725ca 100644 --- a/calendar/test/unit/test_search_service.js +++ b/calendar/test/unit/test_search_service.js @@ -14,9 +14,9 @@ function run_test() { } function test_found() { - search.getProviders({}).forEach(search.removeProvider, search); + search.getProviders().forEach(search.removeProvider, search); - equal(search.getProviders({}).length, 0); + equal(search.getProviders().length, 0); let provider1 = { id: 1, @@ -42,12 +42,12 @@ function test_found() { provider2.wrappedJSObject = provider2; search.addProvider(provider1); - equal(search.getProviders({}).length, 1); + equal(search.getProviders().length, 1); search.addProvider(provider2); - equal(search.getProviders({}).length, 2); + equal(search.getProviders().length, 2); search.removeProvider(provider1); - equal(search.getProviders({}).length, 1); - equal(search.getProviders({})[0].wrappedJSObject.id, 2); + equal(search.getProviders().length, 1); + equal(search.getProviders()[0].wrappedJSObject.id, 2); let listener = { called: false, @@ -66,7 +66,7 @@ function test_found() { } function test_failure() { - search.getProviders({}).forEach(search.removeProvider, search); + search.getProviders().forEach(search.removeProvider, search); let provider = { searchForCalendars: function(aStr, aHint, aMax, aListener) { @@ -90,7 +90,7 @@ function test_failure() { } function test_cancel() { - search.getProviders({}).forEach(search.removeProvider, search); + search.getProviders().forEach(search.removeProvider, search); let provider = { QueryInterface: cal.generateQI([Ci.calICalendarSearchProvider, Ci.calIOperation]),