Fixing bug 101492. Making self.close() do nothing when called from within a frame in a frameset (or from an iframe) for backwards compatibility. r=peterv@netscape.com, sr=brendan@mozilla.org

This commit is contained in:
jst%netscape.com 2001-10-16 21:19:05 +00:00
parent 26446d9b36
commit 7e92fb61be

View File

@ -2416,6 +2416,16 @@ GlobalWindowImpl::GetFrames(nsIDOMWindow** aFrames)
NS_IMETHODIMP
GlobalWindowImpl::Close()
{
nsCOMPtr<nsIDOMWindow> parent;
GetParent(getter_AddRefs(parent));
if (parent != NS_STATIC_CAST(nsIDOMWindow *, this)) {
// window.close() is called on a frame in a frameset, such calls
// are ignored.
return NS_OK;
}
// Note: the basic security check, rejecting windows not opened through JS,
// has been removed. This was approved long ago by ...you're going to call me
// on this, aren't you... well it was. And anyway, a better means is coming.