Diff
Modified: trunk/Source/WebCore/ChangeLog (176296 => 176297)
--- trunk/Source/WebCore/ChangeLog 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebCore/ChangeLog 2014-11-19 00:56:33 UTC (rev 176297)
@@ -1,3 +1,23 @@
+2014-11-18 Chris Dumez <[email protected]>
+
+ Add a setting to toggle DOMTimer throttling support
+ https://bugs.webkit.org/show_bug.cgi?id=138844
+ <rdar://problem/19020874>
+
+ Reviewed by Andreas Kling.
+
+ Add a setting to disable DOM timers throttling, in order to help
+ developers determine if a specific issue is caused by timer
+ throttling.
+
+ * page/DOMTimer.cpp:
+ (WebCore::DOMTimerFireState::contextDocument):
+ (WebCore::DOMTimerFireState::scriptMadeUserObservableChanges):
+ (WebCore::DOMTimer::isDOMTimersThrottlingEnabled):
+ (WebCore::DOMTimer::updateThrottlingStateIfNecessary):
+ * page/DOMTimer.h:
+ * page/Settings.in:
+
2014-11-18 Beth Dakin <[email protected]>
REGRESSION: Invoking dictionary lookup on text in some search fields searches for
Modified: trunk/Source/WebCore/page/DOMTimer.cpp (176296 => 176297)
--- trunk/Source/WebCore/page/DOMTimer.cpp 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebCore/page/DOMTimer.cpp 2014-11-19 00:56:33 UTC (rev 176297)
@@ -31,9 +31,11 @@
#include "HTMLPlugInElement.h"
#include "InspectorInstrumentation.h"
#include "Logging.h"
+#include "Page.h"
#include "PluginViewBase.h"
#include "ScheduledAction.h"
#include "ScriptExecutionContext.h"
+#include "Settings.h"
#include "UserGestureIndicator.h"
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
@@ -45,7 +47,6 @@
#include "Chrome.h"
#include "ChromeClient.h"
#include "Frame.h"
-#include "Page.h"
#include "WKContentObservation.h"
#endif
@@ -77,6 +78,8 @@
current = m_previous;
}
+ Document* contextDocument() const { return m_contextIsDocument ? &downcast<Document>(m_context) : nullptr; }
+
void setScriptMadeUserObservableChanges() { m_scriptMadeUserObservableChanges = true; }
void setScriptMadeNonUserObservableChanges() { m_scriptMadeNonUserObservableChanges = true; }
void setScriptMadeNonUserObservableChangesToElementStyle(StyledElement& element)
@@ -91,8 +94,9 @@
if (m_scriptMadeUserObservableChanges)
return true;
+ Document* document = contextDocument();
// To be conservative, we also consider any DOM Tree change to be user observable.
- return m_contextIsDocument && downcast<Document>(m_context).domTreeVersion() != m_initialDOMTreeVersion;
+ return document && document->domTreeVersion() != m_initialDOMTreeVersion;
}
void setChangedStyleOfElementOutsideViewport(StyledElement& element)
@@ -251,8 +255,31 @@
context.removeTimeout(timeoutId);
}
+inline bool DOMTimer::isDOMTimersThrottlingEnabled(Document& document) const
+{
+ auto* page = document.page();
+ if (!page)
+ return true;
+ return page->settings().domTimersThrottlingEnabled();
+}
+
void DOMTimer::updateThrottlingStateIfNecessary(const DOMTimerFireState& fireState)
{
+ Document* contextDocument = fireState.contextDocument();
+ // We don't throttle timers in worker threads.
+ if (!contextDocument)
+ return;
+
+ if (UNLIKELY(!isDOMTimersThrottlingEnabled(*contextDocument))) {
+ if (m_throttleState == ShouldThrottle) {
+ // Unthrottle the timer in case it was throttled before the setting was updated.
+ LOG(DOMTimers, "%p - Unthrottling DOM timer because throttling was disabled via settings.", this);
+ m_throttleState = ShouldNotThrottle;
+ updateTimerIntervalIfNecessary();
+ }
+ return;
+ }
+
if (fireState.scriptMadeUserObservableChanges()) {
ASSERT(m_elementsCausingThrottling.isEmpty());
if (m_throttleState != ShouldNotThrottle) {
Modified: trunk/Source/WebCore/page/DOMTimer.h (176296 => 176297)
--- trunk/Source/WebCore/page/DOMTimer.h 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebCore/page/DOMTimer.h 2014-11-19 00:56:33 UTC (rev 176297)
@@ -35,6 +35,7 @@
namespace WebCore {
class DOMTimerFireState;
+ class Document;
class HTMLPlugInElement;
class IntRect;
class ScheduledAction;
@@ -65,6 +66,7 @@
double intervalClampedToMinimum() const;
+ bool isDOMTimersThrottlingEnabled(Document&) const;
bool isIntervalDependentOnViewport() const { return m_throttleState == ShouldThrottle && !m_elementsCausingThrottling.isEmpty(); }
void registerForViewportChanges();
void unregisterForViewportChanges();
Modified: trunk/Source/WebCore/page/Settings.in (176296 => 176297)
--- trunk/Source/WebCore/page/Settings.in 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebCore/page/Settings.in 2014-11-19 00:56:33 UTC (rev 176297)
@@ -76,6 +76,7 @@
_javascript_ExperimentsEnabled initial=false
scriptMarkupEnabled initial=true
needsSiteSpecificQuirks initial=false
+domTimersThrottlingEnabled initial=true
webArchiveDebugModeEnabled initial=false, conditional=WEB_ARCHIVE
localFileContentSniffingEnabled initial=false
offlineWebApplicationCacheEnabled initial=false
Modified: trunk/Source/WebKit/mac/ChangeLog (176296 => 176297)
--- trunk/Source/WebKit/mac/ChangeLog 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-11-19 00:56:33 UTC (rev 176297)
@@ -1,3 +1,24 @@
+2014-11-18 Chris Dumez <[email protected]>
+
+ Add a setting to toggle DOMTimer throttling support
+ https://bugs.webkit.org/show_bug.cgi?id=138844
+ <rdar://problem/19020874>
+
+ Reviewed by Andreas Kling.
+
+ Add a setting to disable DOM timers throttling, in order to help
+ developers determine if a specific issue is caused by timer
+ throttling.
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences domTimersThrottlingEnabled]):
+ (-[WebPreferences setDOMTimersThrottlingEnabled:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChanged:]):
+
2014-11-18 Tim Horton <[email protected]>
Avoid re-encoding action menu image data
Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (176296 => 176297)
--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2014-11-19 00:56:33 UTC (rev 176297)
@@ -87,6 +87,7 @@
#define WebKitJavaScriptExperimentsEnabledPreferenceKey @"WebKitJavaScriptExperimentsEnabledPreferenceKey"
#define WebKitAuthorAndUserStylesEnabledPreferenceKey @"WebKitAuthorAndUserStylesEnabledPreferenceKey"
#define WebKitApplicationChromeModeEnabledPreferenceKey @"WebKitApplicationChromeModeEnabledPreferenceKey"
+#define WebKitDOMTimersThrottlingEnabledPreferenceKey @"WebKitDOMTimersThrottlingEnabledPreferenceKey"
#define WebKitWebArchiveDebugModeEnabledPreferenceKey @"WebKitWebArchiveDebugModeEnabledPreferenceKey"
#define WebKitLocalFileContentSniffingEnabledPreferenceKey @"WebKitLocalFileContentSniffingEnabledPreferenceKey"
#define WebKitLocalStorageDatabasePathPreferenceKey @"WebKitLocalStorageDatabasePathPreferenceKey"
Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (176296 => 176297)
--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2014-11-19 00:56:33 UTC (rev 176297)
@@ -476,6 +476,7 @@
[NSNumber numberWithBool:NO], WebKitJavaScriptExperimentsEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAuthorAndUserStylesEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitApplicationChromeModeEnabledPreferenceKey,
+ [NSNumber numberWithBool:YES], WebKitDOMTimersThrottlingEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitWebArchiveDebugModeEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitLocalFileContentSniffingEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitOfflineWebApplicationCacheEnabledPreferenceKey,
@@ -1224,6 +1225,16 @@
[self _setBoolValue:flag forKey:WebKitApplicationChromeModeEnabledPreferenceKey];
}
+- (BOOL)domTimersThrottlingEnabled
+{
+ return [self _boolValueForKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
+}
+
+- (void)setDOMTimersThrottlingEnabled:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
+}
+
- (BOOL)webArchiveDebugModeEnabled
{
return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (176296 => 176297)
--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2014-11-19 00:56:33 UTC (rev 176297)
@@ -102,6 +102,9 @@
- (BOOL)automaticallyDetectsCacheModel;
- (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel;
+- (BOOL)domTimersThrottlingEnabled;
+- (void)setDOMTimersThrottlingEnabled:(BOOL)domTimersThrottlingEnabled;
+
- (BOOL)webArchiveDebugModeEnabled;
- (void)setWebArchiveDebugModeEnabled:(BOOL)webArchiveDebugModeEnabled;
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (176296 => 176297)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2014-11-19 00:56:33 UTC (rev 176297)
@@ -2222,6 +2222,7 @@
settings.setApplicationChromeMode([preferences applicationChromeModeEnabled]);
settings.setNeedsSiteSpecificQuirks(_private->useSiteSpecificSpoofing);
+ settings.setDOMTimersThrottlingEnabled([preferences domTimersThrottlingEnabled]);
settings.setWebArchiveDebugModeEnabled([preferences webArchiveDebugModeEnabled]);
settings.setLocalFileContentSniffingEnabled([preferences localFileContentSniffingEnabled]);
settings.setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]);
Modified: trunk/Source/WebKit2/ChangeLog (176296 => 176297)
--- trunk/Source/WebKit2/ChangeLog 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-19 00:56:33 UTC (rev 176297)
@@ -1,3 +1,23 @@
+2014-11-18 Chris Dumez <[email protected]>
+
+ Add a setting to toggle DOMTimer throttling support
+ https://bugs.webkit.org/show_bug.cgi?id=138844
+ <rdar://problem/19020874>
+
+ Reviewed by Andreas Kling.
+
+ Add a setting to disable DOM timers throttling, in order to help
+ developers determine if a specific issue is caused by timer
+ throttling.
+
+ * Shared/WebPreferencesDefinitions.h:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetDOMTimersThrottlingEnabled):
+ (WKPreferencesGetDOMTimersThrottlingEnabled):
+ * UIProcess/API/C/WKPreferencesRefPrivate.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
2014-11-18 Geoffrey Garen <[email protected]>
Removed the custom allocator for ListHashSet nodes
Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (176296 => 176297)
--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h 2014-11-19 00:56:33 UTC (rev 176297)
@@ -120,6 +120,7 @@
macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \
macro(TabsToLinks, tabsToLinks, Bool, bool, DEFAULT_WEBKIT_TABSTOLINKS_ENABLED) \
macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \
+ macro(DOMTimersThrottlingEnabled, domTimersThrottlingEnabled, Bool, bool, true) \
macro(WebArchiveDebugModeEnabled, webArchiveDebugModeEnabled, Bool, bool, false) \
macro(LocalFileContentSniffingEnabled, localFileContentSniffingEnabled, Bool, bool, false) \
macro(UsesPageCache, usesPageCache, Bool, bool, true) \
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (176296 => 176297)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2014-11-19 00:56:33 UTC (rev 176297)
@@ -579,6 +579,16 @@
return toImpl(preferencesRef)->shouldPrintBackgrounds();
}
+void WKPreferencesSetDOMTimersThrottlingEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+ toImpl(preferencesRef)->setDOMTimersThrottlingEnabled(enabled);
+}
+
+bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->domTimersThrottlingEnabled();
+}
+
void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled)
{
toImpl(preferencesRef)->setWebArchiveDebugModeEnabled(enabled);
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h (176296 => 176297)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h 2014-11-19 00:56:33 UTC (rev 176297)
@@ -116,6 +116,10 @@
WK_EXPORT void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferences, WKStringRef path);
WK_EXPORT WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferences);
+// Defaults to true.
+WK_EXPORT void WKPreferencesSetDOMTimersThrottlingEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferences);
+
// Defaults to false.
WK_EXPORT void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferences, bool enabled);
WK_EXPORT bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferences);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (176296 => 176297)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-11-19 00:49:33 UTC (rev 176296)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-11-19 00:56:33 UTC (rev 176297)
@@ -2660,6 +2660,7 @@
settings.setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::_javascript_CanOpenWindowsAutomaticallyKey()));
settings.setForceFTPDirectoryListings(store.getBoolValueForKey(WebPreferencesKey::forceFTPDirectoryListingsKey()));
settings.setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey()));
+ settings.setDOMTimersThrottlingEnabled(store.getBoolValueForKey(WebPreferencesKey::domTimersThrottlingEnabledKey()));
#if ENABLE(WEB_ARCHIVE)
settings.setWebArchiveDebugModeEnabled(store.getBoolValueForKey(WebPreferencesKey::webArchiveDebugModeEnabledKey()));
#endif