Closed
Bug 38625
Opened 25 years ago
Closed 25 years ago
nsIDOMWindow->GetParent returns self
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
VERIFIED
INVALID
People
(Reporter: dougt, Assigned: jst)
Details
(Whiteboard: [nsbeta2+])
PRBool IsChildOfDomWindow(nsIDOMWindow *parent, nsIDOMWindow *child)
{
if (parent == child)
return PR_TRUE;
nsCOMPtr<nsIDOMWindow> childsParent;
child->GetParent(getter_AddRefs(childsParent));
if (!childsParent) // <--------- (A)
return PR_FALSE;
return IsChildOfDomWindow(parent, childsParent);
}
if I do not check to see if the childsParent == parent at (A), I crash on some
pages.
To reproduce this:
1. Goto http://www.mozilla.org/
2. Click on Report A Bug on the left side of the document. This will you to
http://www.mozilla.org/quality/help/bug-form.html.
3. Right click on the link that says "Create a Bugzilla Account".
4. Select "Open Link in new window".
5. In this new window, type in a bug number at the bottom of the screen and
click "Find".
Crash occurs.
PR_AtomicIncrement(int * 0x038ecb00) line 285 + 4 bytes
nsDocShell::AddRef(nsDocShell * const 0x038ecad0) line 122 + 52 bytes
nsWebShell::AddRef(nsWebShell * const 0x038ecad0) line 488 + 12 bytes
nsDocShell::QueryInterface(nsDocShell * const 0x038ecad0, const nsID & {...},
void * * 0x00033090) line 138 + 57 bytes
nsWebShell::QueryInterface(nsWebShell * const 0x038ecad0, const nsID & {...},
void * * 0x000330c4) line 513 + 30 bytes
nsQueryInterface::operator()(const nsID & {...}, void * * 0x000330c4) line 32 +
25 bytes
nsCOMPtr<nsIDocShellTreeItem>::assign_from_helper(const nsCOMPtr_helper & {...},
const nsID & {...}) line 825 + 18 bytes
nsCOMPtr<nsIDocShellTreeItem>::nsCOMPtr<nsIDocShellTreeItem>(const
nsQueryInterface & {...}) line 538
GlobalWindowImpl::GetParent(GlobalWindowImpl * const 0x038e57b4, nsIDOMWindow *
* 0x0003314c) line 516
IsChildOfDomWindow(nsIDOMWindow * 0x0307fb04, nsIDOMWindow * 0x038e57b4) line
226 + 36 bytes
IsChildOfDomWindow(nsIDOMWindow * 0x0307fb04, nsIDOMWindow * 0x038e57b4) line
230 + 18 bytes
... (recursive call leads to stack overflow)
Reporter | ||
Updated•25 years ago
|
This is needed for beta2, given the crash; giving PDT approval.
Whiteboard: [nsbeta2+]
Assignee | ||
Comment 2•25 years ago
|
||
I had a look at this today and it turns out that this is is an invalid bug, even
if I was sure this was a bug. So the deal is that if a window doesn't have a
parent, it returns itself, the reason for this is probably backwards
compatibility since 4.x does the same thing.
The reason for this bug IIRC is that I told dougt to file it since I thought
that GetParent() would return null if there's no parent, but that's not the
case, I don't knoe exacly why?
I checked the code and it does the proper checking for this, ie there is no
crash due to this at the moment.
I'm marking this bug INVALID, but it's my bad that it got filed in the first
place.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•