зеркало из https://github.com/mozilla/gecko-dev.git
Fix component registration order issues
This commit is contained in:
Родитель
b689decba7
Коммит
ee34f18b88
|
@ -41,7 +41,7 @@ const kStorageServiceIID = Components.interfaces.mozIStorageService;
|
|||
|
||||
const kMozStorageStatementWrapperContractID = "@mozilla.org/storage/statement-wrapper;1";
|
||||
const kMozStorageStatementWrapperIID = Components.interfaces.mozIStorageStatementWrapper;
|
||||
const MozStorageStatementWrapper = new Components.Constructor(kMozStorageStatementWrapperContractID, kMozStorageStatementWrapperIID);
|
||||
var MozStorageStatementWrapper = null;
|
||||
|
||||
function createStatement (dbconn, sql) {
|
||||
var stmt = dbconn.createStatement(sql);
|
||||
|
@ -50,6 +50,10 @@ function createStatement (dbconn, sql) {
|
|||
return wrapper;
|
||||
}
|
||||
|
||||
function onCalCalendarManagerLoad() {
|
||||
MozStorageStatementWrapper = new Components.Constructor(kMozStorageStatementWrapperContractID, kMozStorageStatementWrapperIID);
|
||||
}
|
||||
|
||||
function calCalendarManager() {
|
||||
this.wrappedJSObject = this;
|
||||
this.initDB();
|
||||
|
|
|
@ -43,22 +43,37 @@
|
|||
|
||||
const kCalRecurrenceInfoContractID = "@mozilla.org/calendar/recurrence-info;1";
|
||||
const kCalIRecurrenceInfo = Components.interfaces.calIRecurrenceInfo;
|
||||
const CalRecurrenceInfo = new Components.Constructor(kCalRecurrenceInfoContractID, kCalIRecurrenceInfo);
|
||||
var CalRecurrenceInfo = null;
|
||||
|
||||
const kCalRecurrenceRuleContractID = "@mozilla.org/calendar/recurrence-rule;1";
|
||||
const kCalIRecurrenceRule = Components.interfaces.calIRecurrenceRule;
|
||||
const CalRecurrenceRule = new Components.Constructor(kCalRecurrenceRuleContractID, kCalIRecurrenceRule);
|
||||
var CalRecurrenceRule = null;
|
||||
|
||||
const kCalRecurrenceDateSetContractID = "@mozilla.org/calendar/recurrence-date-set;1";
|
||||
const kCalIRecurrenceDateSet = Components.interfaces.calIRecurrenceDateSet;
|
||||
const CalRecurrenceDateSet = new Components.Constructor(kCalRecurrenceDateSetContractID, kCalIRecurrenceDateSet);
|
||||
var CalRecurrenceDateSet = null;
|
||||
|
||||
const kCalRecurrenceDateContractID = "@mozilla.org/calendar/recurrence-date;1";
|
||||
const kCalIRecurrenceDate = Components.interfaces.calIRecurrenceDate;
|
||||
const CalRecurrenceDate = new Components.Constructor(kCalRecurrenceDateContractID, kCalIRecurrenceDate);
|
||||
var CalRecurrenceDate = null;
|
||||
|
||||
var CalDateTime = null;
|
||||
var CalAttendee = null;
|
||||
|
||||
const ICAL = Components.interfaces.calIIcalComponent;
|
||||
|
||||
function onCalItemBaseLoad() {
|
||||
CalRecurrenceInfo = new Components.Constructor(kCalRecurrenceInfoContractID, kCalIRecurrenceInfo);
|
||||
CalRecurrenceRule = new Components.Constructor(kCalRecurrenceRuleContractID, kCalIRecurrenceRule);
|
||||
CalRecurrenceDateSet = new Components.Constructor(kCalRecurrenceDateSetContractID, kCalIRecurrenceDateSet);
|
||||
CalRecurrenceDate = new Components.Constructor(kCalRecurrenceDateContractID, kCalIRecurrenceDate);
|
||||
|
||||
CalDateTime = new Components.Constructor("@mozilla.org/calendar/datetime;1",
|
||||
Components.interfaces.calIDateTime);
|
||||
CalAttendee = new Components.Constructor("@mozilla.org/calendar/attendee;1",
|
||||
Components.interfaces.calIAttendee);
|
||||
}
|
||||
|
||||
function calItemBase() { }
|
||||
|
||||
calItemBase.prototype = {
|
||||
|
@ -482,14 +497,6 @@ function makeMemberAttr(ctor, varname, dflt, attr)
|
|||
// helper functions
|
||||
//
|
||||
|
||||
const CalDateTime =
|
||||
new Components.Constructor("@mozilla.org/calendar/datetime;1",
|
||||
Components.interfaces.calIDateTime);
|
||||
|
||||
const CalAttendee =
|
||||
new Components.Constructor("@mozilla.org/calendar/attendee;1",
|
||||
Components.interfaces.calIAttendee);
|
||||
|
||||
function icalFromString(str)
|
||||
{
|
||||
const icssvc = Components.classes["@mozilla.org/calendar/ics-service;1"].
|
||||
|
|
|
@ -44,12 +44,14 @@ const componentData =
|
|||
{cid: null,
|
||||
contractid: null,
|
||||
script: "calItemBase.js",
|
||||
constructor: null},
|
||||
constructor: null,
|
||||
onComponentLoad: "onCalItemBaseLoad()"},
|
||||
|
||||
{cid: Components.ID("{f42585e7-e736-4600-985d-9624c1c51992}"),
|
||||
contractid: "@mozilla.org/calendar/manager;1",
|
||||
script: "calCalendarManager.js",
|
||||
constructor: "calCalendarManager"},
|
||||
constructor: "calCalendarManager",
|
||||
onComponentLoad: "onCalCalendarManagerLoad()"},
|
||||
|
||||
{cid: Components.ID("{974339d5-ab86-4491-aaaf-2b2ca177c12b}"),
|
||||
contractid: "@mozilla.org/calendar/event;1",
|
||||
|
@ -165,9 +167,13 @@ var calItemModule = {
|
|||
this.loadScripts();
|
||||
|
||||
for (var i = 0; i < componentData.length; i++) {
|
||||
if (cid.equals(componentData[i].cid))
|
||||
if (cid.equals(componentData[i].cid)) {
|
||||
if (componentData[i].onComponentLoad) {
|
||||
eval(componentData[i].onComponentLoad);
|
||||
}
|
||||
// eval to get usual scope-walking
|
||||
return this.makeFactoryFor(eval(componentData[i].constructor));
|
||||
}
|
||||
}
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче