Closed Bug 289272 Opened 19 years ago Closed 19 years ago

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

Categories

(Calendar :: Internal Components, defect)

x86
Linux
defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stelian, Assigned: shaver)

Details

(Keywords: regression)

Attachments

(1 file)

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.
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
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
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: