Open Bug 408668 Opened 18 years ago Updated 4 years ago

Browser should check if it is in the root docshell before wiring up session history

Categories

(Toolkit :: UI Widgets, defect)

defect

Tracking

()

REOPENED

People

(Reporter: ancestor.ak, Unassigned)

References

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Attached file testcase (requires chrome privileges) (obsolete) —
Browser's constructor generates the following exception: Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebNavigation.sessionHistory]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/browser.xml :: :: line 582" data: no] Source File: chrome://global/content/bindings/browser.xml Line: 588 Doesn't happen with Firefox 2.
It turns out that you can only wire up session history in the root docshell and you should use "disablehistory" attribute with browsers in other docshells. This bug was exposed by bug 353403 - previously we used to swallow the exception. Nickolay, I just wanted to confirm that the above reasoning correct, so I can document it on MDC.
Status: NEW → RESOLVED
Closed: 18 years ago
OS: Windows XP → All
Hardware: PC → All
Resolution: --- → INVALID
Come to think of it, if we know that session history can *never* be set up in non-top windows, wouldn't it make sense to check this automatically instead of forcing consumers to set disablehistory?
(In reply to comment #1) > It turns out that you can only wire up session history in the root docshell and > you should use "disablehistory" attribute with browsers in other docshells. I don't remember much about this, but I think session history is available for <browser type="content"> and the like. Neil should know more.
(In reply to comment #2) >Come to think of it, if we know that session history can *never* be set up in >non-top windows, wouldn't it make sense to check this automatically instead of >forcing consumers to set disablehistory? Shouldn't they be using iframes instead? (In reply to comment #3) >(In reply to comment #1) >>It turns out that you can only wire up session history in the root docshell and >>you should use "disablehistory" attribute with browsers in other docshells. >I don't remember much about this, but I think session history is available for ><browser type="content"> and the like. Neil should know more. Yes, you can only use history on content browser types.
(In reply to comment #3) > I don't remember much about this, but I think session history is available for > <browser type="content"> and the like. Neil should know more. It's limited to root docshell, too: http://mxr.mozilla.org/seamonkey/source/docshell/base/nsDocShell.cpp#3407 (In reply to comment #4) > Shouldn't they be using iframes instead? In case of my extension I am loading an untrusted page, so I definitely need a browser, is that right? Also, browser has plenty of additional properties and methods that a consumer might need. iframe doesn't always cut it. I am reopening and morphing the bug.
Status: RESOLVED → REOPENED
Keywords: regression, testcase
Resolution: INVALID → ---
Summary: Exception when loading a window containing a <browser/> → Browser should check if it is in the root docshell before wiring up session history
Attachment #293502 - Attachment is obsolete: true
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9b5pre) Gecko/2008032106 Minefield/3.0b5pre] (nightly) (W2Ksp4) [Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9b5pre) Gecko/2008032605 Minefield/3.0b5pre] (nightly) (W2Ksp4) Now that bug 406697 (exceptions) is fixed, I get one of this on the first opening of the sidebar (after each application start): {{ Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebNavigation.sessionHistory]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/browser.xml :: :: line 644" data: no] Source File: chrome://global/content/bindings/browser.xml Line: 650 }}
Flags: blocking1.9?
Keywords: regression
(In reply to comment #7) > Now that bug 406697 (exceptions) is fixed, More like s/exceptions/strict warning/ actually.
(In reply to comment #5) > In case of my extension I am loading an untrusted page, so I definitely need a > browser, is that right? The XPCNativeWrapper documentation implies that that XUL iframes with type="content" are also untrusted <http://developer.mozilla.org/en/docs/XPCNativeWrapper#What_is_a_trusted_window.3F>.
(In reply to comment #9) > (In reply to comment #5) > > In case of my extension I am loading an untrusted page, so I definitely need a > > browser, is that right? > > The XPCNativeWrapper documentation implies that that XUL iframes with > type="content" are also untrusted > <http://developer.mozilla.org/en/docs/XPCNativeWrapper#What_is_a_trusted_window.3F>. ... which is confirmed by this testcase when loaded as chrome (when loaded as content it behaves differently, not sure if that's a bug or not).
Thanks for clarifying. Are you therefore suggesting that we shouldn't make this change (i.e. make it easier to use browsers in non-root documents)?
(In reply to comment #11) > Thanks for clarifying. Are you therefore suggesting that we shouldn't make this > change (i.e. make it easier to use browsers in non-root documents)? I think we definitely should make this change, since the current behavior is nonsensical. I was just pointing out that it is possible to use an iframe to load untrusted content (and wanting to verify it for myself as well, since I do it). Of course, if you need the other machinery browser widgets provide, then it still makes sense to use them, and in any case they shouldn't require you to specify attributes on threat of exception.
> (when loaded as content it behaves differently, not sure if that's a bug or > not). According to dveditz, this is expected behavior, since the remote XUL file is content, and data: URLs loaded by content are considered to come from the same security context.
(In reply to comment #10) >when loaded as content it behaves differently, not sure if that's a bug or not type= is ignored for content frames; there's no "onion" effect here.
Not blocking on this based on Comment #13.
Flags: blocking1.9? → blocking1.9-
(In reply to comment #7) > I get one of this on the first opening of the sidebar (after each application > start): That was bug 412171. ***** Bug 412171 comment 22: {{ Mike Connor 2008-03-31 13:44:15 PDT [...] 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. }}
Flags: wanted1.9.0.x?
Not wanted, also based on comment 13.
Flags: wanted1.9.0.x? → wanted1.9.0.x-
Blocks: 366509
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: