Open Bug 1251513 Opened 5 years ago Updated 2 years ago

window.parent() return the current window it self repeatedly


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

44 Branch
Windows 7
Not set





(Reporter: abu.saif01, Unassigned, NeedInfo)


(Whiteboard: btpp-followup-2016-03-11)


(4 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
Build ID: 20160210153822

Steps to reproduce:

Let's consider 3 static HTML page.

"main.html", "child1.html", "child2.html"

From main.html open a new window on any event using window name "myWin"

      function openWindow () {"child1.html","myWin");

From child1.html open another window on any event using the same nae "myWin"

	function openWindow () {"child2.html","myWin");

Now from child2.html try to get its parent. using `window.parent`.

Actual results:

`window.parent` return itself which is `child2.html`.

Repeated call repeatedly return itself.

window.parent.parent.parent.parent.parent return `child2.html`

Expected results:

`window.parent` should return ''child1.html"
`window.parent.parent` should return  `main.html`
`window.parent.parent.parent`  should retrun null/undefined
OS: Unspecified → Windows 7
Hardware: Unspecified → x86_64
Summary: window.parent() return it self repeatedly → window.parent() return the current window it self repeatedly
Component: Untriaged → DOM
Product: Firefox → Core
Attached file child2.html
Attached file child1.html
Attached file main.html
What makes you say so? parent only returns the parent browsing context, not the opener browsing context; i.e., with frames, not
See comment 4.
Flags: needinfo?(abu.saif01)
Whiteboard: btpp-followup-2016-03-04 
this say's `If a window does not have a parent, its parent property is a reference to itself.`
And I have seen different behavior on other browser.  

By the way i have tried below too::

window.opener.opener.opener.opener ..... on child2.html  and its also keep returning `child2.html` which is it self. (wrong in my point of view, and  window.opener.opener should return main.html & window.opener should return child1.html)

when 'window.opener' on child1.html return 'main.html' (correct)
Flags: needinfo?(abu.saif01)
Ms2ger, you seem to have knowledge here. Can you respond to comment 6?
Flags: needinfo?(Ms2ger)
Whiteboard: btpp-followup-2016-03-04 → btpp-followup-2016-03-11
Please attach test files that reproduce the problem.
Flags: needinfo?(Ms2ger) → needinfo?(abu.saif01)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.