Closed Bug 435174 Opened 16 years ago Closed 16 years ago

Today Pane not displayed after startup when using Spamato extension [Error: LOG is not a function]

Categories

(Calendar :: Lightning Only, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ssitter, Assigned: ssitter)

Details

(Keywords: regression)

Attachments

(1 file)

From <http://forums.mozillazine.org/viewtopic.php?t=657592>

When Lightning 0.9pre and Spamato 0.99.9 <http://sourceforge.net/projects/spamato/> <http://downloads.sourceforge.net/spamato/spamato4thunderbird-0.99.9.xpi> are installed the Today Pane is no longer displayed after startup.

Regression range: Works in Lightning 0.9pre (20080505) + Spamato 0.99.9
                  Fails in Lightning 0.9pre (20080506) + Spamato 0.99.9

Error Console shows:

  Error: LOG is not a function
  Source File: chrome://calendar/content/calendar-views.js
  Line: 429

The LOG() calls were added by Bug 401693. 
Unfortunately Spamato already declares a global variable named LOG: <http://spamato.cvs.sourceforge.net/spamato/spamato4thunderbird/addon/spamato/chrome/content/spamato/communication.js?view=markup#l_43>

Removing the LOG() calls seems to fix the issue at the moment. A proper fix might be to move the global methods to calendar namespace e.g. by renaming it to calLOG().
Similar problems made us use Component.classes instead of Cc. I guess we could rename our functions every time some other extension uses the same name, but I'd prefer namespace support for js, which I believe only exists in the future, in js2.

I kind of liked the fact that LOG() was so short and prominent. Maybe we could rather persuade Spamato to use a different variable?
Honestly, if I would be a Spamato developer I'd just say: "Why should we change? Our latest release works with Lightning 0.7 and 0.8. Now Lightning does a change and breaks." Nevertheless it might be worth to ask them.

For the moment I'd suggest to replace the LOG() calls with plain dump() calls or to remove them. Thoughts?
We use LOG() for a reason (i.e show the message in the error console instead of only the system console).

I wonder why it worked before? Did we not have LOG() calls in chrome script?
IMO the only feasible opportunity is really to prefix all (shared) UI code stuff (or alternatively scope all that stuff in a top-level object, e.g. named "cal"). While namespace support would be favourable (however that looks like), we even then need to adopt the UI code to define lookup preference.
Should we fix this for better compatibility with other extensions?
Flags: blocking-calendar0.9?
I agree. we should go with namespace support or scope code into a global "cal" object. However, I don't think this should block 0.9, but patches (at least partial ones for e.g. calendar-views.js) are welcome.
Flags: blocking-calendar0.9? → blocking-calendar0.9-
I've heard we can fake namespace support using something like

var extensions = extensions || {};
var extensions.calendar = extensions.calendar || {};

with (extensions.calendar) {
    // Old code goes here
}

This change will ruin cvsblame, since we'll need to indent everything.
Or just replace the LOG() calls with simple dump() calls in the UI code.
Flags: wanted-calendar0.9+
This patch works around the issue by removing the LOG() calls in scheduleMidnightUpdate(). This way it's possible to work with Lightning. Timezone service, alarm service, itip email service work and successfully use LOG() to log to the Error Console.

The only component that fails seems to be the migration code. If the Spamato extension is installed and Lightning is installed for the very first time the migration wizard is not shown but Lightning starts correctly.
Attachment #332941 - Flags: review?(daniel.boelzle)
Comment on attachment 332941 [details] [diff] [review]
[checked in] remove the LOG() calls

r=dbo and checked in on HEAD and MOZILLA_1_8_BRANCH.
Attachment #332941 - Attachment description: remove the LOG() calls → [checked in] remove the LOG() calls
Attachment #332941 - Flags: review?(daniel.boelzle) → review+
OS: Windows XP → All
Hardware: PC → All
Just found this thread by accident.

The next release of Spamato doesn't have any 'global' variables outside the "SPAMATO."-namespace. We had several difficulties also with other extensions and decided to use our own namespace to circumvent this and future problems.

It would anyway be a good idea to prefix your own code I suppose :-).
Resolving as FIXED. Current Lightning 0.9pre nightly builds should work now if the Spamato extension is installed. And according to comment #11 Lightning 0.8 should work again after the Spamato extension is updated.

Daniel, Philipp please file a follow-up bug if there should be more work done to avoid similar issues, e.g. by renaming or using namespace.
Assignee: nobody → ssitter
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → 0.9
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: