summaryrefslogtreecommitdiffstats
path: root/WebCore/page/DOMWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/DOMWindow.cpp')
-rw-r--r--WebCore/page/DOMWindow.cpp74
1 files changed, 48 insertions, 26 deletions
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index 413dba1..40b7494 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "DOMWindow.h"
+#include "AbstractDatabase.h"
#include "Base64.h"
#include "BarInfo.h"
#include "BeforeUnloadEvent.h"
@@ -229,7 +230,7 @@ bool DOMWindow::dispatchAllPendingBeforeUnloadEvents()
if (!frame)
continue;
- if (!frame->shouldClose())
+ if (!frame->loader()->shouldClose())
return false;
}
@@ -756,7 +757,18 @@ void DOMWindow::focus()
if (!m_frame)
return;
- m_frame->focusWindow();
+ Page* page = m_frame->page();
+ if (!page)
+ return;
+
+ // If we're a top level window, bring the window to the front.
+ if (m_frame == page->mainFrame())
+ page->chrome()->focus();
+
+ if (!m_frame)
+ return;
+
+ m_frame->eventHandler()->focusDocumentView();
}
void DOMWindow::blur()
@@ -764,7 +776,14 @@ void DOMWindow::blur()
if (!m_frame)
return;
- m_frame->unfocusWindow();
+ Page* page = m_frame->page();
+ if (!page)
+ return;
+
+ if (m_frame != page->mainFrame())
+ return;
+
+ page->chrome()->unfocus();
}
void DOMWindow::close()
@@ -782,8 +801,13 @@ void DOMWindow::close()
Settings* settings = m_frame->settings();
bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseWindows();
- if (page->openedByDOM() || page->getHistoryLength() <= 1 || allowScriptsToCloseWindows)
- m_frame->scheduleClose();
+ if (!(page->openedByDOM() || page->getHistoryLength() <= 1 || allowScriptsToCloseWindows))
+ return;
+
+ if (!m_frame->loader()->shouldClose())
+ return;
+
+ page->chrome()->closeWindowSoon();
}
void DOMWindow::print()
@@ -1064,36 +1088,34 @@ void DOMWindow::setName(const String& string)
m_frame->tree()->setName(string);
}
-String DOMWindow::status() const
+void DOMWindow::setStatus(const String& string)
{
- if (!m_frame)
- return String();
+ m_status = string;
- return m_frame->jsStatusBarText();
-}
+ if (!m_frame)
+ return;
-void DOMWindow::setStatus(const String& string)
-{
- if (!m_frame)
- return;
+ Page* page = m_frame->page();
+ if (!page)
+ return;
- m_frame->setJSStatusBarText(string);
+ ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
+ page->chrome()->setStatusbarText(m_frame, m_status);
}
-String DOMWindow::defaultStatus() const
+void DOMWindow::setDefaultStatus(const String& string)
{
- if (!m_frame)
- return String();
+ m_defaultStatus = string;
- return m_frame->jsDefaultStatusBarText();
-}
+ if (!m_frame)
+ return;
-void DOMWindow::setDefaultStatus(const String& string)
-{
- if (!m_frame)
- return;
+ Page* page = m_frame->page();
+ if (!page)
+ return;
- m_frame->setJSDefaultStatusBarText(string);
+ ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
+ page->chrome()->setStatusbarText(m_frame, m_defaultStatus);
}
DOMWindow* DOMWindow::self() const
@@ -1219,7 +1241,7 @@ double DOMWindow::devicePixelRatio() const
PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec)
{
RefPtr<Database> database = 0;
- if (m_frame && Database::isAvailable() && m_frame->document()->securityOrigin()->canAccessDatabase())
+ if (m_frame && AbstractDatabase::isAvailable() && m_frame->document()->securityOrigin()->canAccessDatabase())
database = Database::openDatabase(m_frame->document(), name, version, displayName, estimatedSize, creationCallback, ec);
if (!database && !ec)