Commit c8db9b11 authored by weinig's avatar weinig

Reviewed by Adam Roben.

        Move self, opener, parent, top, window, and frames from kjs_window
        to DOMWindow and auto-generate the bindings for them.

        * bindings/js/kjs_window.cpp:
        (KJS::Window::getValueProperty):
        * bindings/js/kjs_window.h:
        (KJS::Window::):
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::self):
        (WebCore::DOMWindow::opener):
        (WebCore::DOMWindow::parent):
        (WebCore::DOMWindow::top):
        * page/DOMWindow.h:
        (WebCore::DOMWindow::window):
        (WebCore::DOMWindow::frames):
        * page/DOMWindow.idl:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bcd93e64
2007-07-16 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
Move self, opener, parent, top, window, and frames from kjs_window
to DOMWindow and auto-generate the bindings for them.
* bindings/js/kjs_window.cpp:
(KJS::Window::getValueProperty):
* bindings/js/kjs_window.h:
(KJS::Window::):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::self):
(WebCore::DOMWindow::opener):
(WebCore::DOMWindow::parent):
(WebCore::DOMWindow::top):
* page/DOMWindow.h:
(WebCore::DOMWindow::window):
(WebCore::DOMWindow::frames):
* page/DOMWindow.idl:
2007-07-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
......@@ -169,16 +169,10 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
showModalDialog Window::ShowModalDialog DontDelete|Function 1
# -- Attributes --
crypto Window::Crypto DontDelete|ReadOnly
frames Window::Frames DontDelete|ReadOnly
event Window::Event_ DontDelete
location Window::Location_ DontDelete
navigator Window::Navigator_ DontDelete|ReadOnly
clientInformation Window::ClientInformation DontDelete|ReadOnly
opener Window::Opener DontDelete|ReadOnly
parent Window::Parent DontDelete|ReadOnly
self Window::Self DontDelete|ReadOnly
window Window::Window_ DontDelete|ReadOnly
top Window::Top DontDelete|ReadOnly
# -- Event Listeners --
onabort Window::Onabort DontDelete
onblur Window::Onblur DontDelete
......@@ -521,8 +515,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
if (!isSafeScript(exec))
return jsUndefined();
return getDOMExceptionConstructor(exec);
case Frames:
return retrieve(impl()->frame());
case Event_:
if (!isSafeScript(exec))
return jsUndefined();
......@@ -543,17 +535,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
const_cast<Window *>(this)->putDirect("clientInformation", n, DontDelete|ReadOnly);
return n;
}
case Opener:
if (impl()->frame()->loader()->opener())
return retrieve(impl()->frame()->loader()->opener());
return jsNull();
case Parent:
return retrieve(impl()->frame()->tree()->parent() ? impl()->frame()->tree()->parent() : impl()->frame());
case Self:
case Window_:
return retrieve(impl()->frame());
case Top:
return retrieve(impl()->frame()->page()->mainFrame());
case Image:
if (!isSafeScript(exec))
return jsUndefined();
......
......@@ -150,9 +150,8 @@ namespace KJS {
ResizeBy, ResizeTo, ShowModalDialog,
// Attributes
Crypto, Frames, Event_, Location_,
Navigator_, ClientInformation, Opener,
Parent, Self, Window_, Top,
Crypto, Event_, Location_, Navigator_,
ClientInformation,
// Event Listeners
Onabort, Onblur, Onchange, Onclick,
......
......@@ -441,6 +441,50 @@ void DOMWindow::setDefaultStatus(const String& string)
m_frame->setJSDefaultStatusBarText(string);
}
DOMWindow* DOMWindow::self() const
{
if (!m_frame)
return 0;
return m_frame->domWindow();
}
DOMWindow* DOMWindow::opener() const
{
if (!m_frame)
return 0;
Frame* opener = m_frame->loader()->opener();
if (!opener)
return 0;
return opener->domWindow();
}
DOMWindow* DOMWindow::parent() const
{
if (!m_frame)
return 0;
Frame* parent = m_frame->tree()->parent();
if (parent)
return parent->domWindow();
return m_frame->domWindow();
}
DOMWindow* DOMWindow::top() const
{
if (!m_frame)
return 0;
Page* page = m_frame->page();
if (!page)
return 0;
return page->mainFrame()->domWindow();
}
Document* DOMWindow::document() const
{
if (!m_frame)
......
......@@ -107,6 +107,15 @@ namespace WebCore {
String defaultstatus() const { return defaultStatus(); }
void setDefaultstatus(const String& string) { setDefaultStatus(string); }
// Self referential attributes
DOMWindow* self() const;
DOMWindow* window() const { return self(); }
DOMWindow* frames() const { return self(); }
DOMWindow* opener() const;
DOMWindow* parent() const;
DOMWindow* top() const;
// DOM Level 2 AbstractView Interface
Document* document() const;
......
......@@ -88,6 +88,15 @@ module window {
attribute DOMString defaultstatus;
#endif
// Self referential attributes
readonly attribute [DoNotCheckDomainSecurity] DOMWindow self;
readonly attribute [DoNotCheckDomainSecurity] DOMWindow window;
readonly attribute [DoNotCheckDomainSecurity] DOMWindow frames;
readonly attribute [DoNotCheckDomainSecurity] DOMWindow opener;
readonly attribute [DoNotCheckDomainSecurity] DOMWindow parent;
readonly attribute [DoNotCheckDomainSecurity] DOMWindow top;
// DOM Level 2 AbstractView Interface
readonly attribute Document document;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment