LayoutTests/inspector frequently run slow and timeout when run in WebKit2 but not...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Jul 2015 00:17:28 +0000 (00:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Jul 2015 00:17:28 +0000 (00:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147456

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-07-30
Reviewed by Timothy Hatcher.

By default, WebKit2 WebPage's on PLATFORM(COCOA) enabling DOM Timer
throttling. Under testing, this ends up impacting Web Inspector
tests that create their own WKWebView which never gets displayed
and so gets throttled. Disable throttling on the Inspector's view
during testing.

* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _hiddenPageDOMTimerThrottlingEnabled]):
(-[WKPreferences _setHiddenPageDOMTimerThrottlingEnabled:]):
SPI to toggle DOM timer throttling.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::createInspectorPage):
* UIProcess/WebInspectorProxy.h:
(WebKit::WebInspectorProxy::isUnderTest):
Provide a way to get if we are under test, and set it before
calling into the platform method.

* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
When testing, disable timer throttling.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187627 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit2/UIProcess/WebInspectorProxy.cpp
Source/WebKit2/UIProcess/WebInspectorProxy.h
Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

index 37e3b09..3fefac3 100644 (file)
@@ -1,3 +1,33 @@
+2015-07-30  Joseph Pecoraro  <pecoraro@apple.com>
+
+        LayoutTests/inspector frequently run slow and timeout when run in WebKit2 but not WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=147456
+
+        Reviewed by Timothy Hatcher.
+
+        By default, WebKit2 WebPage's on PLATFORM(COCOA) enabling DOM Timer
+        throttling. Under testing, this ends up impacting Web Inspector
+        tests that create their own WKWebView which never gets displayed
+        and so gets throttled. Disable throttling on the Inspector's view
+        during testing.
+
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _hiddenPageDOMTimerThrottlingEnabled]):
+        (-[WKPreferences _setHiddenPageDOMTimerThrottlingEnabled:]):
+        SPI to toggle DOM timer throttling.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::createInspectorPage):
+        * UIProcess/WebInspectorProxy.h:
+        (WebKit::WebInspectorProxy::isUnderTest):
+        Provide a way to get if we are under test, and set it before
+        calling into the platform method.
+
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        When testing, disable timer throttling.
+
 2015-07-30  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] Set AirPlay discovery mode to disabled when page is hidden
index cf3f1d6..28bcbca 100644 (file)
@@ -257,6 +257,16 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setLogsPageMessagesToSystemConsoleEnabled(logsPageMessagesToSystemConsoleEnabled);
 }
 
+- (BOOL)_hiddenPageDOMTimerThrottlingEnabled
+{
+    return _preferences->hiddenPageDOMTimerThrottlingEnabled();
+}
+
+- (void)_setHiddenPageDOMTimerThrottlingEnabled:(BOOL)hiddenPageDOMTimerRhrottlingEnabled
+{
+    _preferences->setHiddenPageDOMTimerThrottlingEnabled(hiddenPageDOMTimerRhrottlingEnabled);
+}
+
 - (BOOL)_allowFileAccessFromFileURLs
 {
     return _preferences->allowFileAccessFromFileURLs();
index a1f3c22..fca3c1c 100644 (file)
@@ -62,6 +62,8 @@ typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
 
 @property (nonatomic, setter=_setLogsPageMessagesToSystemConsoleEnabled:) BOOL _logsPageMessagesToSystemConsoleEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
+@property (nonatomic, setter=_setHiddenPageDOMTimerThrottlingEnabled:) BOOL _hiddenPageDOMTimerThrottlingEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
 @property (nonatomic, setter=_setAllowFileAccessFromFileURLs:) BOOL _allowFileAccessFromFileURLs WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 @property (nonatomic, setter=_setJavaScriptRuntimeFlags:) _WKJavaScriptRuntimeFlags _javaScriptRuntimeFlags WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
index 3f4e7f8..9db6ccb 100644 (file)
@@ -484,13 +484,13 @@ void WebInspectorProxy::createInspectorPage(IPC::Attachment connectionIdentifier
     if (!m_inspectedPage)
         return;
 
+    m_underTest = underTest;
     eagerlyCreateInspectorPage();
 
     ASSERT(m_inspectorPage);
     if (!m_inspectorPage)
         return;
 
-    m_underTest = underTest;
     m_connectionIdentifier = WTF::move(connectionIdentifier);
 
     m_inspectorPage->process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_inspectedPage->pageID(), m_underTest), m_inspectorPage->pageID());
index 78d40ab..b2d3dfa 100644 (file)
@@ -206,6 +206,8 @@ private:
     bool canAttach() const { return m_canAttach; }
     bool shouldOpenAttached();
 
+    bool isUnderTest() const { return m_underTest; }
+
     void open();
 
     // The inspector level is used to give different preferences to each inspector
index 45d895e..806f49c 100644 (file)
@@ -420,6 +420,9 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
 #endif
     preferences._allowFileAccessFromFileURLs = YES;
     preferences._javaScriptRuntimeFlags = 0;
+    if (isUnderTest())
+        preferences._hiddenPageDOMTimerThrottlingEnabled = NO;
+
     [configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool())];
     [configuration _setGroupIdentifier:inspectorPageGroupIdentifier()];