calendar-occurrence-prompt is not initialized correctly [Error: 'ReferenceError: cal is not defined' in calUtils.js]



4 years ago
4 years ago


(Reporter: Taraman, Assigned: Taraman)


(Blocks: 1 bug, {regression})

Lightning 2.6
Dependency tree / graph



(2 attachments, 1 obsolete attachment)



4 years ago
User Agent 	Mozilla/5.0 (X11; Linux i686; rv:26.0) Gecko/20100101 Thunderbird/26.0a1
Lightning	2.8a1

when doubleclicking an occurrence of a recurring item, the dialog opens, but it seems, the onload function is not called.

Title and properties are not set and thus the dialog is unusable.

Comment 1

4 years ago
This is caused by rev b532ed24389a
Don't know why yet.


Comment 2

4 years ago
Confirmed on 2.7. Bug 788004 was fixed for 2.6 therefore this might be broken on comm-beta too.

Error: ReferenceError: cal is not defined
Source file: chrome://calendar/content/calUtils.js
Line: 459
Blocks: 788004
Version: Trunk → Lightning 2.6


4 years ago
Summary: calendar-occurrence-prompt is not initialized correctly → calendar-occurrence-prompt is not initialized correctly [Error: 'ReferenceError: cal is not defined' in calUtils.js]

Comment 3

4 years ago
Created attachment 788009 [details] [diff] [review]
Patch V1

Thanks Stefan, that was a goog clue - I didn't get this error message for some reason.

Now cal is defined in calUtils.js
Assignee: nobody → Mozilla
Attachment #788009 - Flags: review?(philipp)
Comment on attachment 788009 [details] [diff] [review]
Patch V1

This might not be the best idea: calUtils.jsm loads the calUtils.js functions, and now you are kind of creating a circular dependency. It will probably work since the file is only loaded once, but I'm not sure its best.

I see two other options solving this:

1) Rewrite the code in calendar-occurrence-prompt.xul to use calUtils.jsm, which means it will be loaded, then calUtils.js will have it available

2) Remove the cal namespace from functions in calUtils.js if it references a function in calUtils.js itself, or move the function to the jsm if it references a function in the jsm file.

Option 1 is really a band-aid, since it will likely fail for the next dialog that doesn't load calUtils.jsm. Option 2 is probably good preparation for actually moving to calUtils.jsm.
Attachment #788009 - Flags: review?(philipp) → review-
Just a note for option 1, these commands will help you find all functions from calUtils.js

# Generate the patterns:
grep -o '^function [^(]\+(' ~/mozilla/comm-central/calendar/base/src/calUtils.js | sed -e 's/^function /[^\\.]/' > cufunc

# Use the pattern file to search files for unprefixed functions:
grep -nf cufunc path/to/file.js
Created attachment 788097 [details] [diff] [review]
Band-aid patch v1

Just for reference, here is the (untested) band-aid patch I had in my queue. Still not the best option though.

Comment 7

4 years ago
Isn't it so that we need both steps anyway?

If we switch to the .jsm, the rest of the code will have to switch some time anyway.
Else we will have both versions in the repo forever.

Or do I miss something?
Comment on attachment 788009 [details] [diff] [review]
Patch V1

I spoke with Markus and we've come to the conclusion that this band-aid might not be the best solution (dialog loads js, js loads jsm, jsm loads js, js tries to load jsm but stops because its already loaded), but its the safest band-aid for Lightning 2.6.

Markus agreed to look into converting a few of the jsm functions, we've set this aside for 2.7 or later though.

I'm going to push this now so we can build the beta.
Attachment #788009 - Flags: review-
Attachment #788009 - Flags: review+
Attachment #788009 - Flags: approval-calendar-beta+
Attachment #788009 - Flags: approval-calendar-aurora+
Comment on attachment 788009 [details] [diff] [review]
Patch V1
Attachment #788009 - Flags: checkin+
Hardware: x86 → All
Target Milestone: --- → 2.6


4 years ago
Blocks: 905097

Comment 10

4 years ago
Created attachment 791736 [details] [diff] [review]
Bandaid Patch V1.1

I tested this patch and it fixes the dialog.

I also checked that the other dialogs using calUtils.js are working and not throwing any exceptions.

So this should enable us to remove the hack introduced to fix beta.

The next steps as laid out in comment 4 will be dealt with in bug 906107 and bug 905097
Attachment #788097 - Attachment is obsolete: true
Attachment #791736 - Flags: review?(philipp)


4 years ago
Keywords: regression


4 years ago
Blocks: 922777
Comment on attachment 791736 [details] [diff] [review]
Bandaid Patch V1.1

r=philipp, sorry for the delay.
Attachment #791736 - Flags: review?(philipp) → review+

Comment 12

4 years ago
Pushed to comm-central <>

Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: 2.6 → 2.9

Comment 13

4 years ago
Nit: This was checked-in after the merge, i.e. for 3.0 and not 2.9. We should update this once the new target milestone is available.
Target Milestone: 2.9 → 3.0


4 years ago
No longer blocks: 922777
I have no chlue whether this is the correct bug, but upgrading from icedove 17 to 24 just broke my Calendar:

I have multiple Errors like this:

Timestamp: 22/03/14 23:29:15
Error: TypeError: Components.classes[cid] is undefined
Source File: resource://calendar/modules/calUtils.jsm -> file:///home/USERNAME/.icedove/masso6vj.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calUtils.js
Line: 22

whick refers to this lines of Code:

/* HACK: Loading calUtils.jsm here is a hack and should be fixed asap. If you
 * see this here after Lightning 2.6, please drop everything and make it go
 * away. See bug 902916 for details.

function _calIcalCreator(cid, iid) {
    return function(icalString) {
        let thing = Components.classes[cid].createInstance(iid);
        if (icalString) {
            thing.icalString = icalString;
        return thing;

So how do I make it go away?
You need to log in before you can comment on or make changes to this bug.