Closed Bug 425318 Opened 12 years ago Closed 12 years ago
JS Error when opening a new tab (only affects debug builds)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5pre) Gecko/2008032700 Minefield/3.0pre ID:2008032700 Steps to reproduce: -> Open a new Tab -> Check the Error Console Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.host]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://browser/content/browser.js :: browser_onSecChange :: line 3819" data: no] Source File: chrome://browser/content/tabbrowser.xml Line: 484 Reproduced on a Mac and Windows Debug Build
This is DEBUG only, right? I think I've had a patch for this in my tree for a while...
nsLocation::GetHost can throw for nsSimpleURIs like about:blank...
Assignee: nobody → gavin.sharp
Status: NEW → ASSIGNED
Attachment #311966 - Flags: review?(mano)
Priority: -- → P2
Hardware: PC → All
Summary: JS Error when i open a new Tab → JS Error when opening a new tab (only affects debug builds)
Target Milestone: --- → Firefox 3
Attachment #311966 - Flags: review?(mano) → review+
Comment on attachment 311966 [details] [diff] [review] patch Simple debug-only fix to avoid unneeded Error Console noise.
Attachment #311966 - Flags: approval1.9?
Comment on attachment 311966 [details] [diff] [review] patch a=beltzner
Attachment #311966 - Flags: approval1.9? → approval1.9+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
That's expected behavior, since about: URIs are nsSimpleURIs rather than nsStandardURLs. What would the hostname of an about: URI be, anyways?
The API in question isn't a pure JS API, it's an XPCOM getter. That means it can be used by C++, which somewhat restricts it's behavior - it must follow XPCOM conventions. Even if we were to make the architectural changes required to change this behavior, and were willing to swallow the compatibility hit that implies, in most cases it wouldn't really help - the difference between checking for undefined and using try/catch isn't significant. Callers need to deal either way.
You need to log in before you can comment on or make changes to this bug.