Closed Bug 412171 Opened 17 years ago Closed 16 years ago

In <browser.xml>, "Error: this.docShell is null", when the sidebar opens

Categories

(Toolkit :: UI Widgets, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9

People

(Reporter: sgautherie, Assigned: smaug)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: regression)

Attachments

(2 files)

(This is the error which bug 404236 was initially reported as.)


[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a5pre) Gecko/20070515
SeaMonkey/1.5a] (nightly) (W2Ksp4)

No bug.


[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9b3pre) Gecko/2008011303 SeaMonkey/2.0a1pre] (nightly) (W2Ksp4)

0. (In a browser window.)
1. Open the sidebar, (by pressing F9).
1r. Get 8 times the following error
[
Error: this.docShell is null
Source File: chrome://global/content/bindings/browser.xml
Line: 0
]


I guess these are all the |onget=""| property attributes in the file.

The common code/cause should be
<http://mxr.mozilla.org/seamonkey/source/toolkit/content/widgets/browser.xml>
[
 252       <field name="_docShell">null</field>
 253 
 254       <property name="docShell"
 255                 onget="return this._docShell || (this._docShell =
this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell);"
 256                 readonly="true"/>
]
The assignment code (on the right) is the one which used to be in /xpfe.


I thought this could be bug 406697, but it does not seem so:

*fix 1:
No effect,
as expected from initial report build date (which was before the fix for bug
385224).

*fix 2: 
(Not tested, as fix 1 has no effect on the current bug.)

*fix 3: 
No effect,
although |this._docShell| is not null when |this._docShell = null;| is
executed.
NB: What surprised me is that |onPageHide()| is executed [except the 1st time]
immediately before |onPageShow()| when the sidebar (panel) is being _shown_,
rather than when the sidebar (panel) is being _hidden_ !
I guess the sidebar itself is hidden, but its panel is still considered shown,
until "rebuilt" when the sidebar is shown again...
The errors show up (after |onPageHide()| and) _before_ |onPageShow()|.
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9b3pre) Gecko/2008011305 Minefield/3.0b3pre] (nightly) (W2Ksp4)

(only) 1 error when opening Sidebar, (either Ctrl+B or Ctrl+H), too.
But only the first time for each window. ("due" to bug 406697 ?)
Component: Sidebar → General
Product: Mozilla Application Suite → Core
QA Contact: sidebar → general
Target Milestone: seamonkey2.0alpha → mozilla1.9 M11
Could be related/duplicate of bug 313048 !?
(which I didn't find before because the error text had changed in the meantime :-/)
Blocks: 313048
Flags: blocking1.9?
Isn't this a duplicate of bug 410559?
(In reply to comment #3)
> Isn't this a duplicate of bug 410559?

No, the error here and the exception there are two different issues.
If you believe they have the same cause/fix, explain it further.
bug 410559 problems occur when trying to access properties of browser.webNavigation, which is defined by a getter:

<property name="webNavigation"
  onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"

so, "docShell" is being accessed in these cases too. If "docShell" is null, we'd expect the failures seen in bug 410559.
(In reply to comment #5)
> so, "docShell" is being accessed in these cases too. If "docShell" is null,
> we'd expect the failures seen in bug 410559.

"If" ? Did you checked whether or not |docShell| is actually null at that time ?
(Please, follow up this thread in that bug.)
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
(In reply to comment #7)
> *** This bug has been marked as a duplicate of bug 410559 ***

You are dup'ing the current bug to bug 410559, which you duped to bug 406697.
This seems to contradict my test(s) in comment 0.
Please, explain !
(In reply to comment #8)
> You are dup'ing the current bug to bug 410559, which you duped to bug 406697.

Silly mistake

> This seems to contradict my test(s) in comment 0.
> Please, explain !

Ok, I yield. Fix 1 from bug 406697 does not fix this bug (no matter how many ways I try it), so I am un-duping this bug.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Moving to blocking list to make sure something bad isn't going on here...
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
Target Milestone: mozilla1.9beta3 → ---
Status: REOPENED → NEW
Component: General → Embedding: Docshell
Flags: tracking1.9+ → blocking1.9+
QA Contact: general → docshell
I seriously doubt this is a docshell issue.  Most likely this is either an XBL issue or an issue in the binding itself.

That said, is there at least a regression range here?
(In reply to comment #11)
> That said, is there at least a regression range here?

Here is what I found:

The error appears with
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/2006092604 Minefield/3.0a1] (nightly) (W2Ksp4)
which gives
<http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=PhoenixTinderbox&branch=HEAD&branchtype=match&sortby=Date&hours=2&date=explicit&mindate=2006-09-25+04&maxdate=2006-09-26+05&cvsroot=%2Fcvsroot>
Likely the 3 checkins related to disabling Places:
[
2006-09-25 22:21	vladimir%pobox.com 	more turning-off-places bustage fixes
2006-09-25 20:52	vladimir%pobox.com 	b=353571, disable Places on trunk; r+sr=mconnor
2006-09-25 17:05	sspitzer%mozilla.org 	fix for bug #341654: search bookmarks broken (on trunk) if you build with --disable places
r=vlad
]

Before, from
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060215 Firefox/1.6a1] (nightly, 2006-02-15-14-trunk) (W2Ksp4)
{
benjamin%smedbergs.us	2006-02-15 10:46	 	Bug 327188 - enable places by default, r=bryner
}
to
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/2006092504 Minefield/3.0a1] (nightly) (W2Ksp4)
the feature is missing, because of the broken Places.
(a gap of 7+ months :-()

Immediately before, I tried
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060215 Firefox/1.6a1] (nightly, 2006-02-15-07-trunk) (W2Ksp4)
which outputs
{
Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsITypeAheadFind.setDocShell]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://global/content/bindings/browser.xml :: onPageHide :: line 455"  data: no]
Source File: chrome://global/content/bindings/browser.xml
Line: 455
}
when closing the sidebar;
but no error when opening it.

***

I guess SeaMonkey picked up this error when it switched to using Toolkit.
I'm going to stand by my diagnosis: this isn't a docshell bug.
Component: Embedding: Docshell → General
Flags: blocking1.9+
Product: Core → Firefox
QA Contact: docshell → general
re-setting blocking flag that got lost
Flags: blocking-firefox3+
Component: General → XUL Widgets
Flags: blocking-firefox3+
Product: Firefox → Toolkit
QA Contact: general → xul.widgets
Need blocking1.9+ again due to move. :(
Flags: blocking1.9?
Flags: blocking1.9? → blocking1.9+
Who owns this?
The error is different now that docshell is created already before showing the
sidebar. The problem is setting sessionhistory on non-top-level-chrome-type-docshell.
Is there any reason not to disable sessionhistory for sidebar?
Comment on attachment 311267 [details] [diff] [review]
disable sessionhistory
[Checkin: Comment 24]

>Index: browser/base/content/browser.xul

>-      <browser id="sidebar" flex="1" autoscroll="false"
>+      <browser id="sidebar" flex="1" autoscroll="false" disablehistory="true"

It seems to me that a XUL author shouldn't have to specify this attribute on threat of exception, especially given the lack of documentation on it (the XUL reference describes some different attribute in its place <http://developer.mozilla.org/en/docs/XUL:browser#a-disablehistory>).

Instead, if the attribute is absent, the browser widget should simply suppress the exception; it should only report it if the user explicitly specifies disablehistory="false" and the browser isn't the root tree item.

For that matter, it's unclear to me why its docshell isn't the root tree item in this case, which is why nsDocShell::SetSessionHistory fails in my debugging session <http://lxr.mozilla.org/mozilla/source/docshell/base/nsDocShell.cpp#3457>.

Nevertheless, this at least gets rid of the error, and it seems like a reasonable change, given that we don't need session history for the sidebar, and given how liberally the attribute is sprinkled throughout the code, f.e. on the tabbrowser just below this code <http://lxr.mozilla.org/mozilla/source/browser/base/content/browser.xul#511>, so r=myk.

But I'm not authorized to review this code; you'll need review from a browser owner or peer like Mike Connor.  Requesting review from him.
Attachment #311267 - Flags: review?(myk)
Attachment #311267 - Flags: review?(mconnor)
Attachment #311267 - Flags: review+
(In reply to comment #19)
> It seems to me that a XUL author shouldn't have to specify this attribute on
> threat of exception, especially given the lack of documentation on it (the XUL
> reference describes some different attribute in its place
> <http://developer.mozilla.org/en/docs/XUL:browser#a-disablehistory>).
> 
> Instead, if the attribute is absent, the browser widget should simply suppress
> the exception; it should only report it if the user explicitly specifies
> disablehistory="false" and the browser isn't the root tree item.

I thought the same thing when I encountered this exception some time ago and I filed bug 408668 about it.

Assignee: nobody → Olli.Pettay
(In reply to comment #17)
> The error is different now that docshell is created already before showing the
> sidebar.

Actually,
this error changed in FF: see bug 408668 comment 7;
but is still the same, as in comment 0, in SM.
Depends on: 408668
Hardware: PC → All
Comment on attachment 311267 [details] [diff] [review]
disable sessionhistory
[Checkin: Comment 24]

This is okay for now, I think that its probably right that the exception handling isn't quite right, but this works for now and we can rethink the widget behaviour for next platform cycle.
Attachment #311267 - Flags: review?(mconnor) → review+
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9pre) Gecko/2008033101 SeaMonkey/2.0a1pre] (nightly) (W2Ksp4)

Port from FF patch.

Each <browser> is responsible for 4 errors: 2 * 4 = 8.
Attachment #312823 - Flags: superreview?
Attachment #312823 - Flags: review?
Attachment #312823 - Flags: superreview?
Attachment #312823 - Flags: review?(mnyromyr)
Attachment #312823 - Flags: review?
Keywords: checkin-needed
Target Milestone: --- → mozilla1.9
Checked in the patch for FF. Since the original report was for SeaMonkey,
keeping this still open.
Attachment #311267 - Attachment description: disable sessionhistory → disable sessionhistory [Checkin: Comment 24]
Summary: In <browser.xml>, "Error: this.docShell is null", when the sidebar opens → [FIXED in FF] In <browser.xml>, "Error: this.docShell is null", when the sidebar opens
(In reply to comment #21)
> (In reply to comment #17)
> > The error is different now that docshell is created already before showing the
> > sidebar.
> 
> Actually,
> this error changed in FF: see bug 408668 comment 7;
> but is still the same, as in comment 0, in SM.

Would someone know which patch changed this ? ("security" bug, fixed by Boris !?)
As I would like to check if that was a FF only patch,
which SeaMonkey could want to get too ?
Thanks.
(In reply to comment #25)
> Would someone know which patch changed this ? ("security" bug, fixed by Boris
> !?)
IIRC, it was the architectural change by me. xul:browser starts loading when
attached to document, not when set visible. That is gecko-wide change, so
I'm not sure why SM behaves here differently than FF. Something different in chrome, probably.
Comment on attachment 312823 [details] [diff] [review]
(Bv1-SM) <sidebarOverlay.xul>
[Checkin: Comment 28]

Looks good enough for the hack it is. :-/
Attachment #312823 - Flags: review?(mnyromyr) → review+
Keywords: checkin-needed
Whiteboard: [c-n: Bv1-SM]
(landed the SM patch)
Keywords: checkin-needed
Attachment #312823 - Attachment description: (Bv1-SM) <sidebarOverlay.xul> → (Bv1-SM) <sidebarOverlay.xul> [Checkin: Comment 28]
See bug 408668 about fixing the root cause of this issue.
Status: NEW → RESOLVED
Closed: 17 years ago16 years ago
Resolution: --- → FIXED
Summary: [FIXED in FF] In <browser.xml>, "Error: this.docShell is null", when the sidebar opens → In <browser.xml>, "Error: this.docShell is null", when the sidebar opens
Whiteboard: [c-n: Bv1-SM]
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9pre) Gecko/2008040106 Minefield/3.0pre] (nightly) (W2Ksp4)
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9pre) Gecko/2008040616 SeaMonkey/2.0a1pre] (SEA-WIN32-TBOX-trunk) (W2Ksp4)

V.Fixed
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: