Closed Bug 792266 Opened 12 years ago Closed 12 years ago

Use Services.jsm where possible

Categories

(Calendar :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aryx, Assigned: aryx)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch use Services.jsm where possible, patch, v1 (obsolete) (deleted) β€” β€” Splinter Review
Calendar should use JavaScript modules where possible because these get cached. https://developer.mozilla.org/en-US/docs/JavaScript_code_modules/Services.jsm This patch switches to Services.jsm where possible. Please excuse that I haven't tested it, https://wiki.mozilla.org/ReleaseEngineering/ThunderbirdTryServer says building things different from Thunderbird dependents on luck. /calendar/base/src/calUtils.cpp and /calendar/base/src/calUtils.h also have getConsoleService, do these files also have to be changed? In calUtils.jsm, there is: getIOService: generateServiceAccessor("@mozilla.org/network/io-service;1", Components.interfaces.nsIIOService2), Should /calendar/ be rewritten to use Services.io.*? Else the interface exists twice.
Attachment #662340 - Flags: review?(philipp)
Comment on attachment 662340 [details] [diff] [review] use Services.jsm where possible, patch, v1 What about Services.io, i.e replacing all use of cal.getIOService() with Services.io ? Also, I think you can replace all calls to calGetStringBundle() directly with Service.strings.createBundle() Very big thank you on this, r=philipp even without the mentioned changes, but of course I'd appreciate if you could take care.
Attachment #662340 - Flags: review?(philipp) → review+
This patch: 1) replaces all use of cal.getIOService() with Services.io, 2) replaces all calls to calGetStringBundle() directly with Service.strings.createBundle(), 3) and replaces all remaining uses of Components.utils.import("resource:///modules/Services.jsm") with Components.utils.import("resource://gre/modules/Services.jsm"); (5 times and the ones from the patch's version 1). I have no checkin rights and think it's the best if you do it because you are the owner, so I don't set checkin-needed into the whiteboard.
Assignee: nobody → archaeopteryx
Attachment #662340 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0
There was a typo in the patch, its Services.scriptloader and not Services.scriptLoader. Push from comment 4 fixes that
I'm getting lots of errors. While creating services from category 'profile-after-change', could not create service for entry 'deleted-items-manager', contract ID '@mozilla.org/calendar/deleted-items-manager;1' ---------- Tue Sep 25 2012 18:51:40 Error: calAlarm is not defined Source file: file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calItemModule.js Line: 47 ---------- While creating services from category 'profile-after-change', could not create service for entry 'calendar-startup-service', contract ID '@mozilla.org/calendar/startup-service;1' ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calWeekInfoService.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calTodo.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calTransactionManager.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calStartupService.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calRelation.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calRecurrenceInfo.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calProtocolHandler.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calItipItem.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calIcsSerializer.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calIcsParser.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calFreeBusyService.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calEvent.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calDeletedItems.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calDateTimeFormatter.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calCalendarSearchService.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calCalendarManager.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calAttachment.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calAttendee.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calAlarmMonitor.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calAlarmService.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calAlarm.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calCachedCalendar.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calUtils.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49 ---------- Tue Sep 25 2012 18:51:40 Error: TypeError: Services.scriptLoader is undefined (file:///C:/T1/hg/objdir-sm/mozilla/dist/seamonkey/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calItemBase.js) Source file: resource://calendar/modules/calUtils.jsm Line: 49
This should all be fixed by the extra push in comment 4. Is this already the nightly, or your own build?
https://hg.mozilla.org/comm-central/rev/0c2f3651b710 Bustage fix for: > Error: ReferenceError: Service is not defined > Source File: chrome://calendar/content/calendar-migration-dialog.js Line: 156
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: