Closed Bug 348479 Opened 18 years ago Closed 17 years ago

"this.bgbox has no properties" error when switching "Workweek days only"

Categories

(Calendar :: Calendar Frontend, defect)

x86
Windows XP
defect
Not set
trivial

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: damian.publicemail, Unassigned)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060812 Calendar/0.3a2+

When you switch on/off Workweek days only from menu view error appears in console

Reproducible: Always

Steps to Reproduce:
1. click "Workweek days only" and check out error console
Actual Results:  
error console:

Error: this.bgbox has no properties
Source File: chrome://calendar/content/calendar-multiday-view.xml
Line: 622

Expected Results:  
see effects - view mode has changed, so command works
Version: unspecified → Trunk
qawanted for a fast confirmation here.  Likely blocks 0.3.
Keywords: qawanted
WFM with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060812 Calendar/0.3a2+
WFM with both 

- Mozilla/5.0 (Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060812 Calendar/0.3a2+ and - Mozilla/5.0 (Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060811 Calendar/0.3a2+

I tested the week/multiweek/month view with a used and fresh profile and could not reproduce the error.
Attached image missing file —
(In reply to comment #3)
> I tested the week/multiweek/month view with a used and fresh profile and could
> not reproduce the error.

I tested also with working and clean profile, however scenario is so simply that I do not think I can give you more details...

maybe number of line which I pasted will be helpful? I tried to open link with error I got information that file cannot be found. Do you have this file?
Can't reproduce.

(In reply to comment #0)
> When you switch on/off Workweek days only from menu view
> error appears in console
What are your workweek days settings? What days are on/off? 
What is first day of week?
Also ensure that you unpacked/installed Sunbird in a clean folder.
Heh, I am not able to reproduce with clean profile, however when I set in option: monday as first day of week, showing three weeks with one previous I got this error (for the same scenario)

Error: aDate has no properties
Source File: chrome://calendar/content/calendar-decorated-multiweek-view.xml
Line: 175

day view mode with latest build sunbird-0.3a2+.en-US.win32.zip
The error from Comment #6 should be fixed by Bug 350094.
I'm still not able to reproduce the problem.
1. create new profile
2. Tools -> Options -> Views: monday is first day of week, sunday and saturday are not workweek (so like by default)
3. create event with repeating forever
4. switch to week view
5. switch on worksweek days only in menu view
6. in minimonth press saturday, friday and sunday (of current week) untill you see this error, when you switch from one day to another error occurs

Error: this.bgbox has no properties
Source File: chrome://calendar/content/calendar-multiday-view.xml
Line: 582

I might have selected saturday and that's why scenario was so simply
-retested with yesterday build, plese confirm
I can reproduce using the steps described in comment 8.

However, there is less needed to get this error message:

1. in clean profile, go to week view
2. create event on saturday
3. select Workdays only (View|...)

Result: Error: this.bgbox has no properties
Source File: chrome://calendar/content/calendar-multiday-view.xml
Line: 595

In case it matters: tested on Saturday using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060909 Calendar/0.3a2+
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: qawanted
Summary: error when switching "Workweek days only" → "this.bgbox has no properties" error when switching "Workweek days only"
(patch -l -p 2 -i file.patch)

Convert bgbox (and topbox) from readonly property to readonly field, 
so that it doesn't depend on document when called from setTimeout thread.

Tested on sunbird 0.4a1 20061104.

(Note: occurs more often for events on last visible day of the workweek when showing workweek days only.  Since timeout is involved, may depend on the speed of your processor.)

[Diagnosis method:
"this.bgbox has no properties" error on line 595: calendar-event-column method relayout() calling this.bgbox.setAttribute

How is this.bgbox defined...  Looking at source it is defined as a property, whose getter does document.getAnonymousElementByAttribute(..."bgbox").  So maybe document is different than expected.  Where is this called...

  installed venkman (javascript debugger) extension into sunbird
  tools > javascript debugger
  venkman: Debug > Error Trigger > Stop for Errors
  venkman: Exclude Browser files (chrome) -- toggled OFF
  sunbird: redisplayed week that causes error message
  venkman stopped on error, bgbox has no properties.
  Click "call Stack" tab.
  Look at call stack to see from where it is called.
  Called from line 555, which is in "addEvent", called by an anonymous function via setTimeout.
  Guessing that the setTimeout thread doesn't provide the same context so document is different.  
  bgbox doesn't change, so there is no reason for the property to ask the document to search for the element each time --- try using a readonly field instead, defined at construction.
  Seems to work (no more error message, events appear ok when week redisplayed), confirming diagnosis.
]
Attachment #245391 - Flags: first-review?(ssitter)
Comment on attachment 245391 [details] [diff] [review]
patch multiday-view to avoid lookup bgbox on every access

I'm sorry for the long delay. This bug somehow fall off my todo list.

>--- mozilla/calendar/base/content/calendar-multiday-view.xml
>+      <field name="topbox" readonly="true">
>+        document.getAnonymousElementByAttribute(this, "anonid", "topbox")
>+      </field>
>+
>+      <field name="bgbox" readonly="true">
>+        document.getAnonymousElementByAttribute(this, "anonid", "bgbox")
>+      </field>

According to http://developer.mozilla.org/en/docs/XBL:XBL_1.0_Reference:Elements#field there is no readonly attribute on the xbl field. I also think that the content of the field must live inside a CDATA section.

I had trouble to reproduce the "this.bgbox has no properties" error using Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.3pre) Gecko/20070313 Calendar/0.5pre. I only observed the error as reported in Bug 366299.

Than I was able to reproduce the error but only during restart of Sunbird:

Error: this.bgbox has no properties
Source File: chrome://calendar/content/calendar-multiday-view.xml
Line: 607

With that patch applied Sunbird failed in a different location:

Error: document.getAnonymousElementByAttribute(this, "anonid", "fgdragspacer") has no properties
Source File: chrome://calendar/content/calendar-multiday-view.xml
Line: 630

r- based on this.
Attachment #245391 - Flags: first-review?(ssitter) → first-review-
Attached patch rev0 - check for this.bgbox — — Splinter Review
This additional check for this.bgbox removes the error after switching to "Workweek days only".
Attachment #259090 - Flags: first-review?(michael.buettner)
Comment on attachment 259090 [details] [diff] [review]
rev0 - check for this.bgbox

I tried to figure out why exactly the bug actually happens. As it turns out it is quite a bit involved ;-) toggleWorkdaysOnly() indirectly calls setDateRange() which in turn calls relayout(). This basically removes the (no longer necessary) calendar-event-columns in order to reflect the newly selected days. But because currentView().goToDay(currentView().selectedDay) still holds a reference to the column that is about to be destroyed, it is still alive (at least for the duration of this function call). But it is no longer available in the DOM tree, thus getAnonymousElementByAttribute() fails and returns NULL. this happens just because the calendar-event-column is longer part of the DOM tree. as this is perfectly valid in this scenario and we happen to find that this code is executed just because we want to tell this column that it is no longer selected, this patch is what solves the problem in an elegant way.
Attachment #259090 - Flags: first-review?(michael.buettner) → first-review+
Whiteboard: [needs checkin]
Checked in on trunk and MOZILLA_1_8_BRANCH

-> FIXED
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: [needs checkin]
verified with
Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.4pre) Gecko/20070614 Sunbird/0.5
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: