Closed Bug 227263 Opened 21 years ago Closed 21 years ago

trying to get domain from document when URL is about:blank produces "uncaught exception"

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bugzilla, Assigned: jst)

References

Details

Attachments

(1 file)

My right click extension checks the domain of the current window. but if the
user right clicks on a about:blank page I get the following exception:

Error: uncaught exception: [Exception... "Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.domain]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
chrome://tdccms/content/context.js :: anonymous :: line 60"  data: no]

the line is:
if ("domain" in document.commandDispatcher.focusedWindow.document &&
document.commandDispatcher.focusedWindow.document.domain)

is it correct to do an exception?
Attached patch Fix.Splinter Review
This makes document.domain null for documents that don't come from a domain.
Assignee: general → jst
Status: NEW → ASSIGNED
Attachment #140104 - Flags: superreview?(peterv)
Attachment #140104 - Flags: review?(peterv)
Attachment #140104 - Flags: superreview?(peterv)
Attachment #140104 - Flags: superreview+
Attachment #140104 - Flags: review?(peterv)
Attachment #140104 - Flags: review+
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Checked in a test for this, called test_bug196523.html
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: