summaryrefslogtreecommitdiff
path: root/src/3rdparty/webkit/WebCore/page
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@nokia.com>2009-09-29 12:36:30 +0200
committerJocelyn Turcotte <jocelyn.turcotte@nokia.com>2009-09-29 12:41:41 +0200
commitbb917438a942da68e065a4810b29697a1340cdd6 (patch)
tree84f2f55fda1d2895bc2d0f10529fcdbbef76adef /src/3rdparty/webkit/WebCore/page
parentf234e50f3d29c4a7dfefd89d537787b1fc327eb2 (diff)
downloadqt4-tools-bb917438a942da68e065a4810b29697a1340cdd6.tar.gz
Updated WebKit from /home/joce/dev/qtwebkit/ to qtwebkit-4.6-snapshot-29092009-2 ( 999c28aa9f6ad9e0d6a26a794220e1cb45408a97 )
Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-09-28 HJK Reviewed by Simon Hausmann. Compile fix with namespaced Qt. * Api/qwebinspector_p.h: 2009-09-27 Joe Ligman <joseph.ligman@mindspring.com> Reviewed by Simon Hausmann. [Qt] Adding API setFocus and hasFocus to QWebElement. This API is needed for clients that want to check/set the focus node of the document. https://bugs.webkit.org/show_bug.cgi?id=29682 * Api/qwebelement.cpp: (QWebElement::hasFocus): (QWebElement::setFocus): * Api/qwebelement.h: * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::hasSetFocus): 2009-09-25 Csaba Osztrogonac <oszi@inf.u-szeged.hu> Reviewed by Simon Hausmann. [Qt] Make tst_qwebframe work if Qt built without SSL support https://bugs.webkit.org/show_bug.cgi?id=29735 * tests/qwebframe/tst_qwebframe.cpp: Missing #ifndef blocks added. 2009-09-24 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by Simon Hausmann. [Qt] Update QWebElement API to remove script related methods. QWebElement::evaluateScript is the only one kept, these are removed to postpone most of the QtWebKit<->JavaScript API design after 4.6. https://bugs.webkit.org/show_bug.cgi?id=29708 * Api/qwebelement.cpp: * Api/qwebelement.h: Methods removed: - QWebElement::callFunction - QWebElement::functions - QWebElement::scriptableProperty - QWebElement::setScriptableProperty - QWebElement::scriptableProperties * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::evaluateScript): 2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by Simon Hausmann. [Qt] Rename QWebElement::evaluateScript to QWebElement::evaluateJavaScript. https://bugs.webkit.org/show_bug.cgi?id=29709 * Api/qwebelement.cpp: (QWebElement::evaluateJavaScript): * Api/qwebelement.h: * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::evaluateJavaScript): 2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by Simon Hausmann. [Qt] Update the stypeProperty API of QWebElement. https://bugs.webkit.org/show_bug.cgi?id=29711 * Api/qwebelement.cpp: (QWebElement::styleProperty): - Merge the stypeProperty and the computedStyleProperty methods - Remove the default value for the style resolving enum - Rename ResolveRule to StyleResolveStrategy (QWebElement::setStyleProperty): - Remove the priority argument since it is possible to control the behaviour by adding !important or removing in the value. * Api/qwebelement.h: * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::style): (tst_QWebElement::computedStyle): * tests/qwebframe/tst_qwebframe.cpp: 2009-09-24 Jon Honeycutt <jhoneycutt@apple.com> Reviewed by Alice Liu. * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): Pass 0 for new Page constructor argument.
Diffstat (limited to 'src/3rdparty/webkit/WebCore/page')
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.cpp114
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.cpp20
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.h2
-rw-r--r--src/3rdparty/webkit/WebCore/page/HaltablePlugin.h44
-rw-r--r--src/3rdparty/webkit/WebCore/page/Page.cpp34
-rw-r--r--src/3rdparty/webkit/WebCore/page/Page.h13
-rw-r--r--src/3rdparty/webkit/WebCore/page/PluginHalter.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/page/PluginHalter.h59
-rw-r--r--src/3rdparty/webkit/WebCore/page/PluginHalterClient.h42
-rw-r--r--src/3rdparty/webkit/WebCore/page/Settings.cpp24
-rw-r--r--src/3rdparty/webkit/WebCore/page/Settings.h12
-rw-r--r--src/3rdparty/webkit/WebCore/page/android/InspectorControllerAndroid.cpp1
12 files changed, 436 insertions, 41 deletions
diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
index 809d541de6..5ac4049881 100644
--- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
+++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
@@ -34,6 +34,8 @@
#include "CString.h"
#include "Chrome.h"
#include "Console.h"
+#include "Database.h"
+#include "DOMApplicationCache.h"
#include "DOMSelection.h"
#include "DOMTimer.h"
#include "PageTransitionEvent.h"
@@ -55,6 +57,7 @@
#include "Media.h"
#include "MessageEvent.h"
#include "Navigator.h"
+#include "NotificationCenter.h"
#include "Page.h"
#include "PageGroup.h"
#include "PlatformScreen.h"
@@ -62,29 +65,14 @@
#include "Screen.h"
#include "SecurityOrigin.h"
#include "Settings.h"
+#include "Storage.h"
+#include "StorageArea.h"
+#include "StorageNamespace.h"
#include "SuddenTermination.h"
#include "WebKitPoint.h"
#include <algorithm>
#include <wtf/MathExtras.h>
-#if ENABLE(DATABASE)
-#include "Database.h"
-#endif
-
-#if ENABLE(DOM_STORAGE)
-#include "Storage.h"
-#include "StorageArea.h"
-#include "StorageNamespace.h"
-#endif
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-#include "DOMApplicationCache.h"
-#endif
-
-#if ENABLE(NOTIFICATIONS)
-#include "NotificationCenter.h"
-#endif
-
using std::min;
using std::max;
@@ -137,6 +125,66 @@ static DOMWindowSet& windowsWithBeforeUnloadEventListeners()
return windowsWithBeforeUnloadEventListeners;
}
+static void addUnloadEventListener(DOMWindow* domWindow)
+{
+ DOMWindowSet& set = windowsWithUnloadEventListeners();
+ if (set.isEmpty())
+ disableSuddenTermination();
+ set.add(domWindow);
+}
+
+static void removeUnloadEventListener(DOMWindow* domWindow)
+{
+ DOMWindowSet& set = windowsWithUnloadEventListeners();
+ DOMWindowSet::iterator it = set.find(domWindow);
+ if (it == set.end())
+ return;
+ set.remove(it);
+ if (set.isEmpty())
+ enableSuddenTermination();
+}
+
+static void removeAllUnloadEventListeners(DOMWindow* domWindow)
+{
+ DOMWindowSet& set = windowsWithUnloadEventListeners();
+ DOMWindowSet::iterator it = set.find(domWindow);
+ if (it == set.end())
+ return;
+ set.removeAll(it);
+ if (set.isEmpty())
+ enableSuddenTermination();
+}
+
+static void addBeforeUnloadEventListener(DOMWindow* domWindow)
+{
+ DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
+ if (set.isEmpty())
+ disableSuddenTermination();
+ set.add(domWindow);
+}
+
+static void removeBeforeUnloadEventListener(DOMWindow* domWindow)
+{
+ DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
+ DOMWindowSet::iterator it = set.find(domWindow);
+ if (it == set.end())
+ return;
+ set.remove(it);
+ if (set.isEmpty())
+ enableSuddenTermination();
+}
+
+static void removeAllBeforeUnloadEventListeners(DOMWindow* domWindow)
+{
+ DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
+ DOMWindowSet::iterator it = set.find(domWindow);
+ if (it == set.end())
+ return;
+ set.removeAll(it);
+ if (set.isEmpty())
+ enableSuddenTermination();
+}
+
static bool allowsBeforeUnloadListeners(DOMWindow* window)
{
ASSERT_ARG(window, window);
@@ -193,7 +241,7 @@ unsigned DOMWindow::pendingUnloadEventListeners() const
void DOMWindow::dispatchAllPendingUnloadEvents()
{
- DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
+ DOMWindowSet& set = windowsWithUnloadEventListeners();
if (set.isEmpty())
return;
@@ -328,8 +376,8 @@ DOMWindow::~DOMWindow()
if (m_frame)
m_frame->clearFormerDOMWindow(this);
- windowsWithUnloadEventListeners().clear(this);
- windowsWithBeforeUnloadEventListeners().clear(this);
+ removeAllUnloadEventListeners(this);
+ removeAllBeforeUnloadEventListeners(this);
}
ScriptExecutionContext* DOMWindow::scriptExecutionContext() const
@@ -552,15 +600,12 @@ Storage* DOMWindow::localStorage() const
if (!page->settings()->localStorageEnabled())
return 0;
- StorageNamespace* localStorage = page->group().localStorage();
- RefPtr<StorageArea> storageArea = localStorage ? localStorage->storageArea(document->securityOrigin()) : 0;
- if (storageArea) {
+ RefPtr<StorageArea> storageArea = page->group().localStorage()->storageArea(document->securityOrigin());
#if ENABLE(INSPECTOR)
- page->inspectorController()->didUseDOMStorage(storageArea.get(), true, m_frame);
+ page->inspectorController()->didUseDOMStorage(storageArea.get(), true, m_frame);
#endif
- m_localStorage = Storage::create(m_frame, storageArea.release());
- }
+ m_localStorage = Storage::create(m_frame, storageArea.release());
return m_localStorage.get();
}
#endif
@@ -579,6 +624,9 @@ NotificationCenter* DOMWindow::webkitNotifications() const
if (!page)
return 0;
+ if (!page->settings()->experimentalNotificationsEnabled())
+ return 0;
+
NotificationPresenter* provider = page->chrome()->notificationPresenter();
if (provider)
m_notifications = NotificationCenter::create(document, provider);
@@ -1215,9 +1263,9 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event
document->addListenerTypeIfNeeded(eventType);
if (eventType == eventNames().unloadEvent)
- windowsWithUnloadEventListeners().add(this);
+ addUnloadEventListener(this);
else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this))
- windowsWithBeforeUnloadEventListeners().add(this);
+ addBeforeUnloadEventListener(this);
return true;
}
@@ -1228,9 +1276,9 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
return false;
if (eventType == eventNames().unloadEvent)
- windowsWithUnloadEventListeners().remove(this);
+ removeUnloadEventListener(this);
else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this))
- windowsWithBeforeUnloadEventListeners().remove(this);
+ removeBeforeUnloadEventListener(this);
return true;
}
@@ -1266,8 +1314,8 @@ void DOMWindow::removeAllEventListeners()
{
EventTarget::removeAllEventListeners();
- windowsWithUnloadEventListeners().clear(this);
- windowsWithBeforeUnloadEventListeners().clear(this);
+ removeAllUnloadEventListeners(this);
+ removeAllBeforeUnloadEventListeners(this);
}
void DOMWindow::captureEvents()
diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
index 8d519efb8f..3772d6555d 100644
--- a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
@@ -1758,6 +1758,13 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
return swallowEvent;
}
+#if !PLATFORM(GTK)
+bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const
+{
+ return false;
+}
+#endif
+
bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
{
Document* doc = m_frame->document();
@@ -1777,11 +1784,12 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
bool isOverWidget;
bool didSetLatchedNode = false;
+ HitTestRequest request(HitTestRequest::ReadOnly);
+ HitTestResult result(vPoint);
+ doc->renderView()->layer()->hitTest(request, result);
+
if (m_useLatchedWheelEventNode) {
if (!m_latchedWheelEventNode) {
- HitTestRequest request(HitTestRequest::ReadOnly);
- HitTestResult result(vPoint);
- doc->renderView()->layer()->hitTest(request, result);
m_latchedWheelEventNode = result.innerNode();
m_widgetIsLatched = result.isOverWidget();
didSetLatchedNode = true;
@@ -1795,13 +1803,13 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
if (m_previousWheelScrolledNode)
m_previousWheelScrolledNode = 0;
- HitTestRequest request(HitTestRequest::ReadOnly);
- HitTestResult result(vPoint);
- doc->renderView()->layer()->hitTest(request, result);
node = result.innerNode();
isOverWidget = result.isOverWidget();
}
+ if (shouldTurnVerticalTicksIntoHorizontal(result))
+ e.turnVerticalTicksIntoHorizontal();
+
if (node) {
// Figure out which view to send the event to.
RenderObject* target = node->renderer();
diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.h b/src/3rdparty/webkit/WebCore/page/EventHandler.h
index 706625289d..e1a02dbec4 100644
--- a/src/3rdparty/webkit/WebCore/page/EventHandler.h
+++ b/src/3rdparty/webkit/WebCore/page/EventHandler.h
@@ -125,6 +125,8 @@ public:
bool shouldDragAutoNode(Node*, const IntPoint&) const; // -webkit-user-drag == auto
#endif
+ bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const;
+
bool tabsToLinks(KeyboardEvent*) const;
bool tabsToAllControls(KeyboardEvent*) const;
diff --git a/src/3rdparty/webkit/WebCore/page/HaltablePlugin.h b/src/3rdparty/webkit/WebCore/page/HaltablePlugin.h
new file mode 100644
index 0000000000..a5fe0f430e
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/page/HaltablePlugin.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HaltablePlugin_h
+#define HaltablePlugin_h
+
+namespace WebCore {
+
+class Node;
+
+class HaltablePlugin {
+public:
+ virtual ~HaltablePlugin() { }
+
+ virtual void halt() = 0;
+ virtual void restart() = 0;
+ virtual Node* node() const = 0;
+};
+
+} // namespace WebCore
+
+#endif // HaltablePlugin_h
diff --git a/src/3rdparty/webkit/WebCore/page/Page.cpp b/src/3rdparty/webkit/WebCore/page/Page.cpp
index 182d22c133..2d0c91c3ff 100644
--- a/src/3rdparty/webkit/WebCore/page/Page.cpp
+++ b/src/3rdparty/webkit/WebCore/page/Page.cpp
@@ -49,6 +49,7 @@
#include "NetworkStateNotifier.h"
#include "PageGroup.h"
#include "PluginData.h"
+#include "PluginHalter.h"
#include "ProgressTracker.h"
#include "RenderWidget.h"
#include "RenderTheme.h"
@@ -99,7 +100,7 @@ static void networkStateChanged()
frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false));
}
-Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient)
+Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient, PluginHalterClient* pluginHalterClient)
: m_chrome(new Chrome(this, chromeClient))
, m_dragCaretController(new SelectionController(0, true))
#if ENABLE(DRAG_SUPPORT)
@@ -135,6 +136,7 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
, m_customHTMLTokenizerTimeDelay(-1)
, m_customHTMLTokenizerChunkSize(-1)
, m_canStartPlugins(true)
+ , m_pluginHalterClient(pluginHalterClient)
{
#if !ENABLE(CONTEXT_MENUS)
UNUSED_PARAM(contextMenuClient);
@@ -154,6 +156,8 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
ASSERT(!allPages->contains(this));
allPages->add(this);
+ pluginHalterEnabledStateChanged();
+
#if ENABLE(JAVASCRIPT_DEBUGGER)
JavaScriptDebugServer::shared().pageCreated(this);
#endif
@@ -679,4 +683,32 @@ InspectorTimelineAgent* Page::inspectorTimelineAgent() const
}
#endif
+void Page::pluginHalterEnabledStateChanged()
+{
+ if (m_settings->pluginHalterEnabled()) {
+ ASSERT(!m_pluginHalter);
+ m_pluginHalter.set(new PluginHalter(m_pluginHalterClient));
+ m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
+ } else
+ m_pluginHalter = 0;
+}
+
+void Page::pluginAllowedRunTimeChanged()
+{
+ if (m_pluginHalter)
+ m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
+}
+
+void Page::didStartPlugin(HaltablePlugin* obj)
+{
+ if (m_pluginHalter)
+ m_pluginHalter->didStartPlugin(obj);
+}
+
+void Page::didStopPlugin(HaltablePlugin* obj)
+{
+ if (m_pluginHalter)
+ m_pluginHalter->didStopPlugin(obj);
+}
+
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/page/Page.h b/src/3rdparty/webkit/WebCore/page/Page.h
index d3f7ddb0dc..602d99b8b8 100644
--- a/src/3rdparty/webkit/WebCore/page/Page.h
+++ b/src/3rdparty/webkit/WebCore/page/Page.h
@@ -54,12 +54,15 @@ namespace WebCore {
class EditorClient;
class FocusController;
class Frame;
+ class HaltablePlugin;
class InspectorClient;
class InspectorController;
class InspectorTimelineAgent;
class Node;
class PageGroup;
class PluginData;
+ class PluginHalter;
+ class PluginHalterClient;
class PluginView;
class ProgressTracker;
class RenderTheme;
@@ -82,7 +85,7 @@ namespace WebCore {
public:
static void setNeedsReapplyStyles();
- Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*);
+ Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*, PluginHalterClient*);
~Page();
RenderTheme* theme() const { return m_theme.get(); };
@@ -181,6 +184,11 @@ namespace WebCore {
void userStyleSheetLocationChanged();
const String& userStyleSheet() const;
+ void didStartPlugin(HaltablePlugin*);
+ void didStopPlugin(HaltablePlugin*);
+ void pluginAllowedRunTimeChanged();
+ void pluginHalterEnabledStateChanged();
+
static void setDebuggerForAllPages(JSC::Debugger*);
void setDebugger(JSC::Debugger*);
JSC::Debugger* debugger() const { return m_debugger; }
@@ -284,6 +292,9 @@ namespace WebCore {
bool m_canStartPlugins;
HashSet<PluginView*> m_unstartedPlugins;
+ OwnPtr<PluginHalter> m_pluginHalter;
+ PluginHalterClient* m_pluginHalterClient;
+
#if ENABLE(DOM_STORAGE)
RefPtr<StorageNamespace> m_sessionStorage;
#endif
diff --git a/src/3rdparty/webkit/WebCore/page/PluginHalter.cpp b/src/3rdparty/webkit/WebCore/page/PluginHalter.cpp
new file mode 100644
index 0000000000..8025337c8d
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/page/PluginHalter.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "PluginHalter.h"
+
+#include "HaltablePlugin.h"
+#include "PluginHalterClient.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/Vector.h>
+
+using namespace std;
+
+namespace WebCore {
+
+PluginHalter::PluginHalter(PluginHalterClient* client)
+ : m_client(client)
+ , m_timer(this, &PluginHalter::timerFired)
+ , m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
+{
+ ASSERT_ARG(client, client);
+}
+
+void PluginHalter::didStartPlugin(HaltablePlugin* obj)
+{
+ ASSERT_ARG(obj, obj);
+ ASSERT_ARG(obj, !m_plugins.contains(obj));
+
+ double currentTime = WTF::currentTime();
+
+ m_plugins.add(obj, currentTime);
+
+ if (m_plugins.size() == 1)
+ m_oldestStartTime = currentTime;
+
+ startTimerIfNecessary();
+}
+
+void PluginHalter::didStopPlugin(HaltablePlugin* obj)
+{
+ m_plugins.remove(obj);
+}
+
+void PluginHalter::timerFired(Timer<PluginHalter>*)
+{
+ if (m_plugins.isEmpty())
+ return;
+
+ Vector<HaltablePlugin*> plugins;
+ copyKeysToVector(m_plugins, plugins);
+
+ // Plug-ins older than this are candidates to be halted.
+ double pluginCutOffTime = WTF::currentTime() - m_pluginAllowedRunTime;
+
+ m_oldestStartTime = numeric_limits<double>::max();
+
+ for (size_t i = 0; i < plugins.size(); ++i) {
+ double thisStartTime = m_plugins.get(plugins[i]);
+ if (thisStartTime > pluginCutOffTime) {
+ // This plug-in is too young to be halted. We find the oldest
+ // plug-in that is not old enough to be halted and use it to set
+ // the timer's next fire time.
+ if (thisStartTime < m_oldestStartTime)
+ m_oldestStartTime = thisStartTime;
+ continue;
+ }
+
+ if (m_client->shouldHaltPlugin(plugins[i]->node()))
+ plugins[i]->halt();
+
+ m_plugins.remove(plugins[i]);
+ }
+
+ startTimerIfNecessary();
+}
+
+void PluginHalter::startTimerIfNecessary()
+{
+ if (m_timer.isActive())
+ return;
+
+ if (m_plugins.isEmpty())
+ return;
+
+ double nextFireInterval = static_cast<double>(m_pluginAllowedRunTime) - (currentTime() - m_oldestStartTime);
+ m_timer.startOneShot(nextFireInterval < 0 ? 0 : nextFireInterval);
+}
+
+} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/page/PluginHalter.h b/src/3rdparty/webkit/WebCore/page/PluginHalter.h
new file mode 100644
index 0000000000..26f51013ab
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/page/PluginHalter.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PluginHalter_h
+#define PluginHalter_h
+
+#include "Timer.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+class HaltablePlugin;
+class PluginHalterClient;
+
+class PluginHalter {
+public:
+ PluginHalter(PluginHalterClient*);
+
+ void didStartPlugin(HaltablePlugin*);
+ void didStopPlugin(HaltablePlugin*);
+
+ void setPluginAllowedRunTime(unsigned runTime) { m_pluginAllowedRunTime = runTime; }
+
+private:
+ void timerFired(Timer<PluginHalter>*);
+ void startTimerIfNecessary();
+
+ PluginHalterClient* m_client;
+ Timer<PluginHalter> m_timer;
+ unsigned m_pluginAllowedRunTime;
+ double m_oldestStartTime;
+ HashMap<HaltablePlugin*, double> m_plugins;
+};
+
+} // namespace WebCore
+
+#endif // PluginHalter_h
diff --git a/src/3rdparty/webkit/WebCore/page/PluginHalterClient.h b/src/3rdparty/webkit/WebCore/page/PluginHalterClient.h
new file mode 100644
index 0000000000..7ea460ac06
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/page/PluginHalterClient.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PluginHalterClient_h
+#define PluginHalterClient_h
+
+namespace WebCore {
+
+class Node;
+
+class PluginHalterClient {
+public:
+ virtual ~PluginHalterClient() { }
+
+ virtual bool shouldHaltPlugin(Node*) const = 0;
+};
+
+} // namespace WebCore
+
+#endif // PluginHalterClient_h
diff --git a/src/3rdparty/webkit/WebCore/page/Settings.cpp b/src/3rdparty/webkit/WebCore/page/Settings.cpp
index da36feed74..708d595a58 100644
--- a/src/3rdparty/webkit/WebCore/page/Settings.cpp
+++ b/src/3rdparty/webkit/WebCore/page/Settings.cpp
@@ -61,6 +61,7 @@ Settings::Settings(Page* page)
, m_defaultFontSize(0)
, m_defaultFixedFontSize(0)
, m_maximumDecodedImageSize(numeric_limits<size_t>::max())
+ , m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
, m_isJavaEnabled(false)
, m_loadsImagesAutomatically(false)
, m_privateBrowsingEnabled(false)
@@ -114,6 +115,8 @@ Settings::Settings(Page* page)
, m_downloadableBinaryFontsEnabled(true)
, m_xssAuditorEnabled(false)
, m_acceleratedCompositingEnabled(true)
+ , m_experimentalNotificationsEnabled(false)
+ , m_pluginHalterEnabled(false)
{
// A Frame may not have been created yet, so we initialize the AtomicString
// hash before trying to use it.
@@ -497,6 +500,27 @@ void Settings::setAcceleratedCompositingEnabled(bool enabled)
setNeedsReapplyStylesInAllFrames(m_page);
}
+void Settings::setExperimentalNotificationsEnabled(bool enabled)
+{
+ m_experimentalNotificationsEnabled = enabled;
+}
+
+void Settings::setPluginHalterEnabled(bool enabled)
+{
+ if (m_pluginHalterEnabled == enabled)
+ return;
+
+ m_pluginHalterEnabled = enabled;
+
+ m_page->pluginHalterEnabledStateChanged();
+}
+
+void Settings::setPluginAllowedRunTime(unsigned runTime)
+{
+ m_pluginAllowedRunTime = runTime;
+ m_page->pluginAllowedRunTimeChanged();
+}
+
#if PLATFORM(WIN) || (PLATFORM(WIN_OS) && PLATFORM(WX))
void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
{
diff --git a/src/3rdparty/webkit/WebCore/page/Settings.h b/src/3rdparty/webkit/WebCore/page/Settings.h
index 7900c91632..b3daf19c43 100644
--- a/src/3rdparty/webkit/WebCore/page/Settings.h
+++ b/src/3rdparty/webkit/WebCore/page/Settings.h
@@ -253,11 +253,20 @@ namespace WebCore {
void setAcceleratedCompositingEnabled(bool);
bool acceleratedCompositingEnabled() const { return m_acceleratedCompositingEnabled; }
+ void setExperimentalNotificationsEnabled(bool);
+ bool experimentalNotificationsEnabled() const { return m_experimentalNotificationsEnabled; }
+
#if PLATFORM(WIN) || (PLATFORM(WIN_OS) && PLATFORM(WX))
static void setShouldUseHighResolutionTimers(bool);
static bool shouldUseHighResolutionTimers() { return gShouldUseHighResolutionTimers; }
#endif
+ void setPluginHalterEnabled(bool);
+ bool pluginHalterEnabled() const { return m_pluginHalterEnabled; }
+
+ void setPluginAllowedRunTime(unsigned);
+ unsigned pluginAllowedRunTime() const { return m_pluginAllowedRunTime; }
+
private:
Page* m_page;
@@ -278,6 +287,7 @@ namespace WebCore {
int m_defaultFontSize;
int m_defaultFixedFontSize;
size_t m_maximumDecodedImageSize;
+ unsigned m_pluginAllowedRunTime;
bool m_isJavaEnabled : 1;
bool m_loadsImagesAutomatically : 1;
bool m_privateBrowsingEnabled : 1;
@@ -322,6 +332,8 @@ namespace WebCore {
bool m_downloadableBinaryFontsEnabled : 1;
bool m_xssAuditorEnabled : 1;
bool m_acceleratedCompositingEnabled : 1;
+ bool m_experimentalNotificationsEnabled : 1;
+ bool m_pluginHalterEnabled : 1;
#if USE(SAFARI_THEME)
static bool gShouldPaintNativeControls;
diff --git a/src/3rdparty/webkit/WebCore/page/android/InspectorControllerAndroid.cpp b/src/3rdparty/webkit/WebCore/page/android/InspectorControllerAndroid.cpp
index 3ba64e93ee..978bc253bd 100644
--- a/src/3rdparty/webkit/WebCore/page/android/InspectorControllerAndroid.cpp
+++ b/src/3rdparty/webkit/WebCore/page/android/InspectorControllerAndroid.cpp
@@ -90,6 +90,7 @@ void InspectorController::addProfile(PassRefPtr<JSC::Profile>, unsigned int, con
void InspectorController::inspectedPageDestroyed() {}
void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, JSC::UString& sourceString) {}
+void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame) {}
void InspectorController::startGroup(MessageSource source, JSC::ExecState* exec, const JSC::ArgList& arguments, unsigned lineNumber, const String& sourceURL) {}
void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL) {}
void InspectorController::startTiming(const JSC::UString& title) {}