Javascript errors related to calItemBase makes Sunbird event creation/display/etc impossible

RESOLVED FIXED

Status

Calendar
Internal Components
--
blocker
RESOLVED FIXED
13 years ago
13 years ago

People

(Reporter: Stelian Pop, Assigned: shaver)

Tracking

({regression})

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1

Launching sunbird gives a lot of:

* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "'[JavaScript Error: "CalDateTime is not a constructor" {file:
"file:///home/admin/mozilla-head/mozilla/dist/bin/components/calItemBase.js"
line: 118}]' when calling method: [nsIFactory::createInstance]"  nsresult:
"0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame
::
file:///home/admin/mozilla-head/mozilla/dist/bin/components/calStorageCalendar.js
:: anonymous :: line 747"  data: yes]

This is caused by the recent changes (rev 1.9 of calItemModule.js). In this
revision, calItemBase.onComponentLoad is never called because calItemBase's cid
is null causing it to never be registered in registerSelf().

A workaround could be to move the onComponentLoad: "onCalItemBaseLoad()" line
into the calEvent declaration instead of calItemBase. But a better solution
could exist...

Reproducible: Always

Steps to Reproduce:
1. Launch sunbird 
2. Look at all the errors in the console
3. Try (without luck) to see events, create some etc.
Keywords: regression
vlad, looks like you caused this.
confirming, for what it is worth.
Status: UNCONFIRMED → NEW
Ever confirmed: true
It doesn't matter that it's not registerSelf()ed, because the onComponentLoad
code is (correctly) not run at registerSelf time.  The problem is that calEvent
depends on the CalDateTime constructor definition, which is never run: we never
try to get a class object for the CID-less "item base" code, of course, and
calEvent doesn't indicate that it needs such a function run.

Patch (tested, even!) coming up.
Status: NEW → ASSIGNED
Created attachment 179859 [details] [diff] [review]
Perform base initialization the first time we create a class object.

I thought about chaining through different dependencies in the componentData,
tracking initialization state, etc., but then I decided I'd rather do real
work.  So I moved the parts that are module-shared but not really part of the
ItemBase delegation-target object into calItemModule.js for a one-time init. 
Works for me in xpcshell, and I was getting the error before.

Testing: still tasty.
Attachment #179859 - Flags: first-review?(mvl)
Attachment #179859 - Flags: first-review?(mvl) → first-review+
Fixed, thanks.
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.