Add Link Preload as an off-by-default experimental feature menu item.
authoryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Jan 2017 22:53:54 +0000 (22:53 +0000)
committeryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Jan 2017 22:53:54 +0000 (22:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167201

Reviewed by Ryosuke Niwa.

Source/WebCore:

Removed the explicit setting of the Link Preload experimental feature,
as it is now on by default for testing.

No new tests as this just removes methods from settings.

* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences linkPreloadEnabled]):
(-[WebPreferences setLinkPreloadEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit/win:

* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::valueForKey):
(WebPreferences::setLinkPreloadEnabled):
(WebPreferences::linkPreloadEnabled):
* WebPreferences.h:
* Interfaces/IWebPreferencesPrivate.idl:

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetLinkPreloadEnabled):
(WKPreferencesGetLinkPreloadEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebPreferencesToConsistentValues):

Websites/webkit.org:

* experimental-features.html: Added Link Preload.

LayoutTests:

Removed code explicitly enabling Link preload from the tests, as it is now
turned on by default for testing. Corrected expectation files accordingly.

* http/tests/fetch/redirectmode-and-preload.html:
* http/tests/preload/delaying_onload_link_preload_after_discovery.html:
* http/tests/preload/delaying_onload_link_preload_after_discovery_image.html:
* http/tests/preload/download_resources-expected.txt:
* http/tests/preload/download_resources.html:
* http/tests/preload/download_resources_from_header_iframe.html:
* http/tests/preload/download_resources_from_invalid_headers.html:
* http/tests/preload/dynamic_adding_preload.html:
* http/tests/preload/dynamic_remove_preload_href-expected.txt:
* http/tests/preload/dynamic_remove_preload_href.html:
* http/tests/preload/not_delaying_window_onload_before_discovery.html:
* http/tests/preload/onerror_event-expected.txt:
* http/tests/preload/onerror_event.html:
* http/tests/preload/onload_event-expected.txt:
* http/tests/preload/onload_event.html:
* http/tests/preload/resources/download_resources_from_header.php:
* http/tests/preload/resources/invalid_resources_from_header.php:
* http/tests/preload/single_download_preload-expected.txt:
* http/tests/preload/single_download_preload.html:
* http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html:
* http/tests/security/cached-cross-origin-preloading-css-stylesheet.html:

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

46 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/fetch/redirectmode-and-preload.html
LayoutTests/http/tests/preload/delaying_onload_link_preload_after_discovery.html
LayoutTests/http/tests/preload/delaying_onload_link_preload_after_discovery_image.html
LayoutTests/http/tests/preload/download_resources-expected.txt
LayoutTests/http/tests/preload/download_resources.html
LayoutTests/http/tests/preload/download_resources_from_header_iframe.html
LayoutTests/http/tests/preload/download_resources_from_invalid_headers.html
LayoutTests/http/tests/preload/dynamic_adding_preload.html
LayoutTests/http/tests/preload/dynamic_remove_preload_href-expected.txt
LayoutTests/http/tests/preload/dynamic_remove_preload_href.html
LayoutTests/http/tests/preload/not_delaying_window_onload_before_discovery.html
LayoutTests/http/tests/preload/onerror_event-expected.txt
LayoutTests/http/tests/preload/onerror_event.html
LayoutTests/http/tests/preload/onload_event-expected.txt
LayoutTests/http/tests/preload/onload_event.html
LayoutTests/http/tests/preload/resources/download_resources_from_header.php
LayoutTests/http/tests/preload/resources/invalid_resources_from_header.php
LayoutTests/http/tests/preload/single_download_preload-expected.txt
LayoutTests/http/tests/preload/single_download_preload.html
LayoutTests/http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html
LayoutTests/http/tests/security/cached-cross-origin-preloading-css-stylesheet.html
Source/WebCore/ChangeLog
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKit/win/WebPreferenceKeysPrivate.h
Source/WebKit/win/WebPreferences.cpp
Source/WebKit/win/WebPreferences.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Websites/webkit.org/ChangeLog
Websites/webkit.org/experimental-features.html

index a0a70f4..d4fcfdd 100644 (file)
@@ -1,3 +1,35 @@
+2017-01-28  Yoav Weiss  <yoav@yoav.ws>
+
+        Add Link Preload as an off-by-default experimental feature menu item.
+        https://bugs.webkit.org/show_bug.cgi?id=167201
+
+        Reviewed by Ryosuke Niwa.
+
+        Removed code explicitly enabling Link preload from the tests, as it is now
+        turned on by default for testing. Corrected expectation files accordingly.
+
+        * http/tests/fetch/redirectmode-and-preload.html:
+        * http/tests/preload/delaying_onload_link_preload_after_discovery.html:
+        * http/tests/preload/delaying_onload_link_preload_after_discovery_image.html:
+        * http/tests/preload/download_resources-expected.txt:
+        * http/tests/preload/download_resources.html:
+        * http/tests/preload/download_resources_from_header_iframe.html:
+        * http/tests/preload/download_resources_from_invalid_headers.html:
+        * http/tests/preload/dynamic_adding_preload.html:
+        * http/tests/preload/dynamic_remove_preload_href-expected.txt:
+        * http/tests/preload/dynamic_remove_preload_href.html:
+        * http/tests/preload/not_delaying_window_onload_before_discovery.html:
+        * http/tests/preload/onerror_event-expected.txt:
+        * http/tests/preload/onerror_event.html:
+        * http/tests/preload/onload_event-expected.txt:
+        * http/tests/preload/onload_event.html:
+        * http/tests/preload/resources/download_resources_from_header.php:
+        * http/tests/preload/resources/invalid_resources_from_header.php:
+        * http/tests/preload/single_download_preload-expected.txt:
+        * http/tests/preload/single_download_preload.html:
+        * http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html:
+        * http/tests/security/cached-cross-origin-preloading-css-stylesheet.html:
+
 2017-01-28  Antoine Quint  <graouts@apple.com>
 
         [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
index d5212c5..3c1520e 100644 (file)
@@ -8,10 +8,6 @@
     <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
     <script src="/js-test-resources/testharness.js"></script>
     <script src="/js-test-resources/testharnessreport.js"></script>
-    <script>
-if (window.internals)
-    internals.settings.setLinkPreloadEnabled(true);
-    </script>
     <link rel=preload onload="startTests()" href="./resources/redirect-with-cache.php?enableCaching&url=http://localhost:8000/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2F127.0.0.1%3A8000&name=alert-fail.js&contentType=text/ascii">
   </head>
   <body>
index 1fe5590..0094e99 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
     if (window.testRunner) {
         testRunner.dumpAsText()
         testRunner.waitUntilDone();
@@ -14,8 +12,6 @@
 <script>
     window.addEventListener("load", function() {
         shouldBeTrue("finishedScript");
-        if (window.internals)
-            window.internals.settings.setLinkPreloadEnabled(false);
         setTimeout(function() { testRunner.notifyDone(); }, 0);
     });
     var scr = document.createElement("script");
index 84735ee..aeb1b4c 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
     if (window.testRunner) {
         testRunner.dumpAsText()
         testRunner.waitUntilDone();
@@ -14,8 +12,6 @@
 <script>
     window.addEventListener("load", function() {
         shouldBeTrue("finishedImage");
-        if (window.internals)
-            window.internals.settings.setLinkPreloadEnabled(false);
         testRunner.notifyDone();
     });
     var img = new Image();
index af135a4..e488a73 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 15: <link rel=preload> must have a valid `as` value
+CONSOLE MESSAGE: line 11: <link rel=preload> must have a valid `as` value
 PASS internals.isPreloaded('../resources/dummy.js'); is true
 PASS internals.isPreloaded('../resources/dummy.css'); is true
 PASS internals.isPreloaded('../resources/square.png'); is true
index 6d5c504..3e6ea1b 100644 (file)
@@ -1,10 +1,6 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
-</script>
 <script src="/js-test-resources/js-test.js"></script>
 <link rel=preload href="../resources/dummy.js" as=script>
 <link rel=preload href="../resources/dummy.css" as=style>
@@ -29,7 +25,3 @@
     shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?badvalue');");
     shouldBeTrue("internals.isPreloaded('../resources/dummy.xml');");
 </script>
-<script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(false);
-</script>
index 0d5cc21..9191469 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
     if (window.testRunner) {
         testRunner.dumpAsText();
         testRunner.dumpChildFramesAsText();
index d7f746a..6343c51 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
     if (window.testRunner) {
         testRunner.dumpAsText();
         testRunner.dumpChildFramesAsText();
index cea8fe0..afdcf9d 100644 (file)
@@ -1,10 +1,6 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
-</script>
 <script src="/js-test-resources/js-test.js"></script>
 <body>
 <script>
@@ -17,8 +13,5 @@
 <script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
 <script>
     shouldBeTrue("internals.isPreloaded('../resources/dummy.js');");
-
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(false);
 </script>
 </body>
index 6ec1848..3b48d10 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 19: <link rel=preload> has an invalid `href` value
+CONSOLE MESSAGE: line 17: <link rel=preload> has an invalid `href` value
 PASS downloadedImage is false
 PASS successfullyParsed is true
 
index 310def2..12fdb14 100644 (file)
@@ -2,10 +2,8 @@
 <html>
 <head>
 <script>
-    if (window.internals) {
-        window.internals.settings.setLinkPreloadEnabled(true);
+    if (window.internals)
         window.internals.settings.setResourceTimingEnabled(true);
-    }
 </script>
 <script src="/js-test-resources/js-test.js"></script>
 <body>
                 downloadedImage = true;
         }
         shouldBeFalse("downloadedImage");
-        if (window.internals) {
-            window.internals.settings.setLinkPreloadEnabled(false);
+        if (window.internals)
             window.internals.settings.setResourceTimingEnabled(false);
-        }
     });
 </script>
 </body>
index 5b75960..7f422a6 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
     if (window.testRunner) {
         testRunner.dumpAsText()
         testRunner.waitUntilDone();
@@ -15,8 +13,6 @@
     function test() {
         shouldBeTrue("windowOnLoad");
         if (finishedImage && finishedScript) {
-            if (window.internals)
-                window.internals.settings.setLinkPreloadEnabled(false);
             if (window.testRunner)
                 testRunner.notifyDone();
         }
index 5bcd26e..2916af2 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 29: <link rel=preload> must have a valid `as` value
+CONSOLE MESSAGE: line 27: <link rel=preload> must have a valid `as` value
 PASS successfullyParsed is true
 
 TEST COMPLETE
index ac0cc94..d1ad228 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
     if (window.testRunner) {
         testRunner.dumpAsText()
         testRunner.waitUntilDone();
@@ -37,8 +35,6 @@
         shouldBeTrue("trackFailed");
         shouldBeTrue("gibrishFailed");
         shouldBeTrue("noTypeFailed");
-        if (window.internals)
-            window.internals.settings.setLinkPreloadEnabled(false);
         if (window.testRunner)
             testRunner.notifyDone();
     };
index 7b232ce..1f19053 100644 (file)
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: line 35: <link rel=preload> must have a valid `as` value
-CONSOLE MESSAGE: line 36: <link rel=preload> must have a valid `as` value
+CONSOLE MESSAGE: line 33: <link rel=preload> must have a valid `as` value
+CONSOLE MESSAGE: line 34: <link rel=preload> must have a valid `as` value
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 8b11bf8..a6cba66 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(true);
     if (window.testRunner) {
         testRunner.dumpAsText()
         testRunner.waitUntilDone();
@@ -50,8 +48,6 @@
         shouldBeTrue("xsltErrored");
         shouldBeTrue("noTypeLoaded");
         shouldBeTrue("emptyTypeLoaded");
-        if (window.internals)
-            window.internals.settings.setLinkPreloadEnabled(false);
         if (window.testRunner)
             testRunner.notifyDone();
     }
index 1918b85..996c954 100644 (file)
@@ -20,7 +20,3 @@ header("Link: <../resources/dummy.xml>; rel=preload", false);
     shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?badvalue');");
     shouldBeTrue("internals.isPreloaded('../resources/dummy.xml');");
 </script>
-<script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(false);
-</script>
index 0fdc7f7..bdf344b 100644 (file)
@@ -40,7 +40,3 @@ header("Link: <   ../resources/dummy.js?foobar >; rel=preload; as='", false);
     shouldBeFalse("internals.isPreloaded('#foobar');");
     shouldBeFalse("internals.isPreloaded('../resources/Ahem.ttf');");
 </script>
-<script>
-    if (window.internals)
-        window.internals.settings.setLinkPreloadEnabled(false);
-</script>
index 07b58d8..de01342 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 21: <link rel=preload> must have a valid `as` value
+CONSOLE MESSAGE: line 19: <link rel=preload> must have a valid `as` value
  
 
 PASS Makes sure that preloaded resources are not downloaded again when used 
index 15e04fa..8683e8f 100644 (file)
@@ -1,9 +1,7 @@
 <!DOCTYPE html>
 <script>
-    if (window.internals) {
-        internals.settings.setLinkPreloadEnabled(true);
+    if (window.internals)
         internals.settings.setResourceTimingEnabled(true);
-    }
 </script>
 <script src="/js-test-resources/testharness.js"></script>
 <script src="/js-test-resources/testharnessreport.js"></script>
             // FIXME: XHR should trigger a single download, but it downloads 2 resources instead.
             verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml", 2);
             // FIXME: We should verify for video and audio as well, but they seem to (flakily?) trigger multiple partial requests.
-            if (window.internals) {
-                internals.settings.setLinkPreloadEnabled(false);
+            if (window.internals)
                 internals.settings.setResourceTimingEnabled(false);
-            }
             t.done();
             }), 100);
     }));
index 4af1540..a2bdc9d 100644 (file)
@@ -1,7 +1,5 @@
 <!DOCTYPE html>
 <script>
-if (window.internals)
-    internals.settings.setLinkPreloadEnabled(true);
 if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
index c9e7407..c95a9e5 100644 (file)
@@ -2,8 +2,6 @@
 <html>
 <body>
 <script>
-if (window.internals)
-    internals.settings.setLinkPreloadEnabled(true);
 if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
index fcc72af..c3046a1 100644 (file)
@@ -1,3 +1,21 @@
+2017-01-28  Yoav Weiss  <yoav@yoav.ws>
+
+        Add Link Preload as an off-by-default experimental feature menu item.
+        https://bugs.webkit.org/show_bug.cgi?id=167201
+
+        Reviewed by Ryosuke Niwa.
+
+        Removed the explicit setting of the Link Preload experimental feature,
+        as it is now on by default for testing.
+
+        No new tests as this just removes methods from settings.
+
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::Backup::Backup):
+        (WebCore::InternalSettings::Backup::restoreTo):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
 
         Fix typo in error message
index 42d043b..28d0b2b 100644 (file)
@@ -95,7 +95,6 @@ InternalSettings::Backup::Backup(Settings& settings)
     , m_forcedDisplayIsMonochromeAccessibilityValue(settings.forcedDisplayIsMonochromeAccessibilityValue())
     , m_forcedPrefersReducedMotionAccessibilityValue(settings.forcedPrefersReducedMotionAccessibilityValue())
     , m_resourceTimingEnabled(RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
-    , m_linkPreloadEnabled(RuntimeEnabledFeatures::sharedFeatures().linkPreloadEnabled())
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     , m_indexedDBWorkersEnabled(RuntimeEnabledFeatures::sharedFeatures().indexedDBWorkersEnabled())
 #endif
@@ -184,7 +183,6 @@ void InternalSettings::Backup::restoreTo(Settings& settings)
     Settings::setAllowsAnySSLCertificate(false);
 
     RuntimeEnabledFeatures::sharedFeatures().setResourceTimingEnabled(m_resourceTimingEnabled);
-    RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(m_linkPreloadEnabled);
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     RuntimeEnabledFeatures::sharedFeatures().setIndexedDBWorkersEnabled(m_indexedDBWorkersEnabled);
 #endif
@@ -671,11 +669,6 @@ void InternalSettings::setResourceTimingEnabled(bool enabled)
     RuntimeEnabledFeatures::sharedFeatures().setResourceTimingEnabled(enabled);
 }
 
-void InternalSettings::setLinkPreloadEnabled(bool enabled)
-{
-    RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(enabled);
-}
-
 void InternalSettings::setIndexedDBWorkersEnabled(bool enabled)
 {
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
index 0477004..5c9e936 100644 (file)
@@ -110,7 +110,6 @@ public:
 
     // RuntimeEnabledFeatures.
     static void setResourceTimingEnabled(bool);
-    static void setLinkPreloadEnabled(bool);
     static void setIndexedDBWorkersEnabled(bool);
     static void setCSSGridLayoutEnabled(bool);
     static void setWebGL2Enabled(bool);
@@ -188,7 +187,6 @@ private:
 
         // Runtime enabled settings.
         bool m_resourceTimingEnabled;
-        bool m_linkPreloadEnabled;
         bool m_indexedDBWorkersEnabled;
         bool m_cssGridLayoutEnabled;
         bool m_webGL2Enabled;
index 1df0d3b..5f4bdec 100644 (file)
@@ -83,7 +83,6 @@ enum ForcedAccessibilityValue { "system", "on", "off" };
 
     // RuntimeEnabledFeatures.
     void setResourceTimingEnabled(boolean enabled);
-    void setLinkPreloadEnabled(boolean enabled);
     void setIndexedDBWorkersEnabled(boolean enabled);
     void setCSSGridLayoutEnabled(boolean enabled);
     void setWebGL2Enabled(boolean enabled);
index 403644e..659b9bb 100644 (file)
@@ -1,3 +1,18 @@
+2017-01-28  Yoav Weiss  <yoav@yoav.ws>
+
+        Add Link Preload as an off-by-default experimental feature menu item.
+        https://bugs.webkit.org/show_bug.cgi?id=167201
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences linkPreloadEnabled]):
+        (-[WebPreferences setLinkPreloadEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
 
         Add User Timing Experimental Feature
index 6e5135d..64b6339 100644 (file)
 #define WebKitSubtleCryptoEnabledPreferenceKey @"WebKitSubtleCryptoEnabled"
 #define WebKitMediaStreamEnabledPreferenceKey @"WebKitMediaStreamEnabled"
 #define WebKitPeerConnectionEnabledPreferenceKey @"WebKitPeerConnectionEnabled"
+#define WebKitLinkPreloadEnabledPreferenceKey @"WebKitLinkPreloadEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the
index 916d791..2da9cd4 100644 (file)
@@ -2755,6 +2755,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitPeerConnectionEnabledPreferenceKey];
 }
 
+- (BOOL)linkPreloadEnabled
+{
+    return [self _boolValueForKey:WebKitLinkPreloadEnabledPreferenceKey];
+}
+
+- (void)setLinkPreloadEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitLinkPreloadEnabledPreferenceKey];
+}
+
 - (void)setMetaRefreshEnabled:(BOOL)enabled
 {
     [self setHTTPEquivEnabled:enabled];
index 752748c..44a3af6 100644 (file)
@@ -529,5 +529,6 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 @property (nonatomic) BOOL allowsInlineMediaPlaybackAfterFullscreen;
 @property (nonatomic) BOOL intersectionObserverEnabled;
 @property (nonatomic) BOOL userTimingEnabled;
+@property (nonatomic) BOOL linkPreloadEnabled;
 
 @end
index 073fc18..07d1d7c 100644 (file)
@@ -2912,6 +2912,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
     RuntimeEnabledFeatures::sharedFeatures().setUserTimingEnabled(preferences.userTimingEnabled);
 
+    RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(preferences.linkPreloadEnabled);
+
     NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
     if (timeout > 0)
         settings.setIncrementalRenderingSuppressionTimeoutInSeconds(timeout);
index 64d6084..8e8a65e 100644 (file)
@@ -1,3 +1,19 @@
+2017-01-28  Yoav Weiss  <yoav@yoav.ws>
+
+        Add Link Preload as an off-by-default experimental feature menu item.
+        https://bugs.webkit.org/show_bug.cgi?id=167201
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::valueForKey):
+        (WebPreferences::setLinkPreloadEnabled):
+        (WebPreferences::linkPreloadEnabled):
+        * WebPreferences.h:
+        * Interfaces/IWebPreferencesPrivate.idl:
+
 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
 
         Add User Timing Experimental Feature
index 4fc459e..3f5a955 100644 (file)
@@ -196,4 +196,6 @@ interface IWebPreferencesPrivate4 : IWebPreferencesPrivate3
     HRESULT setWebAnimationsEnabled([in] BOOL enabled);
     HRESULT userTimingEnabled([out, retval] BOOL*);
     HRESULT setUserTimingEnabled([in] BOOL enabled);
+    HRESULT linkPreloadEnabled([out, retval] BOOL*);
+    HRESULT setLinkPreloadEnabled([in] BOOL enabled);
 }
index 9bac32c..f7493a5 100644 (file)
 #define WebKitWebAnimationsEnabledPreferenceKey "WebKitWebAnimationsEnabled"
 
 #define WebKitUserTimingEnabledPreferenceKey "WebKitUserTimingEnabled"
+
+#define WebKitLinkPreloadEnabledPreferenceKey "WebKitLinkPreloadEnabled"
index 236fa91..6f49e80 100644 (file)
@@ -309,6 +309,8 @@ void WebPreferences::initializeDefaultSettings()
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitUserTimingEnabledPreferenceKey), kCFBooleanFalse);
 
+    CFDictionaryAddValue(defaults, CFSTR(WebKitLinkPreloadEnabledPreferenceKey), kCFBooleanFalse);
+
     defaultSettings = defaults;
 }
 
@@ -2008,6 +2010,20 @@ HRESULT WebPreferences::modernMediaControlsEnabled(_Out_ BOOL* enabled)
     return S_OK;
 }
 
+HRESULT WebPreferences::setLinkPreloadEnabled(BOOL enabled)
+{
+    setBoolValue(WebKitLinkPreloadEnabledPreferenceKey, enabled);
+    return S_OK;
+}
+
+HRESULT WebPreferences::linkPreloadEnabled(_Out_ BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = boolValueForKey(WebKitLinkPreloadEnabledPreferenceKey);
+    return S_OK;
+}
+
 HRESULT WebPreferences::setApplicationId(BSTR applicationId)
 {
     m_applicationId = String(applicationId).createCFString();
index 7983c10..08041bd 100644 (file)
@@ -249,6 +249,8 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setWebAnimationsEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE userTimingEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setUserTimingEnabled(BOOL);
+    virtual HRESULT STDMETHODCALLTYPE linkPreloadEnabled(_Out_ BOOL*);
+    virtual HRESULT STDMETHODCALLTYPE setLinkPreloadEnabled(BOOL);
 
     // WebPreferences
 
index 0832d5b..34ddbc9 100644 (file)
@@ -1,3 +1,18 @@
+2017-01-28  Yoav Weiss  <yoav@yoav.ws>
+
+        Add Link Preload as an off-by-default experimental feature menu item.
+        https://bugs.webkit.org/show_bug.cgi?id=167201
+
+        Reviewed by Ryosuke Niwa.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetLinkPreloadEnabled):
+        (WKPreferencesGetLinkPreloadEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
 
         Add User Timing Experimental Feature
index 81202aa..580771d 100644 (file)
     macro(CSSGridLayoutEnabled, cssGridLayoutEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "CSS Grid", "CSS Grid Layout Module support") \
     macro(SpringTimingFunctionEnabled, springTimingFunctionEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "CSS Spring Animations", "CSS Spring Animation prototype") \
     macro(GamepadsEnabled, gamepadsEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Gamepads", "Web Gamepad API support") \
+    macro(LinkPreloadEnabled, linkPreloadEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Link Preload", "Link preload support") \
     macro(ModernMediaControlsEnabled, modernMediaControlsEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Modern Media Controls", "Use modern media controls look") \
     macro(InputEventsEnabled, inputEventsEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Input Events", "Enable InputEvents support") \
     macro(SubtleCryptoEnabled, subtleCryptoEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "SubtleCrypto", "Enable SubtleCrypto support") \
index d3d5a2d..be01061 100644 (file)
@@ -1641,6 +1641,16 @@ bool WKPreferencesGetSubtleCryptoEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->subtleCryptoEnabled();
 }
 
+void WKPreferencesSetLinkPreloadEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setLinkPreloadEnabled(flag);
+}
+
+bool WKPreferencesGetLinkPreloadEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->linkPreloadEnabled();
+}
+
 void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setShouldSuppressKeyboardInputDuringProvisionalNavigation(flag);
index d11e0f6..025f146 100644 (file)
@@ -461,6 +461,10 @@ WK_EXPORT bool WKPreferencesGetSubtleCryptoEnabled(WKPreferencesRef);
 WK_EXPORT void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef);
 
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetLinkPreloadEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetLinkPreloadEnabled(WKPreferencesRef);
+
 #ifdef __cplusplus
 }
 #endif
index 8d6f980..92af536 100644 (file)
@@ -3240,6 +3240,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 
     // Experimental Features.
 
+    RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(store.getBoolValueForKey(WebPreferencesKey::linkPreloadEnabledKey()));
+
 #if ENABLE(CSS_GRID_LAYOUT)
     RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::cssGridLayoutEnabledKey()));
 #endif
index 663657e..ccc5b57 100644 (file)
@@ -1,3 +1,15 @@
+2017-01-28  Yoav Weiss  <yoav@yoav.ws>
+
+        Add Link Preload as an off-by-default experimental feature menu item.
+        https://bugs.webkit.org/show_bug.cgi?id=167201
+
+        Reviewed by Ryosuke Niwa.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (resetWebPreferencesToConsistentValues):
+
 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
 
         Add User Timing Experimental Feature
index 68ff473..3b8f2cb 100644 (file)
@@ -900,6 +900,7 @@ static void enableExperimentalFeatures(WebPreferences* preferences)
     [preferences setCSSGridLayoutEnabled:YES];
     // FIXME: SpringTimingFunction
     [preferences setGamepadsEnabled:YES];
+    [preferences setLinkPreloadEnabled:YES];
     [preferences setModernMediaControlsEnabled:YES];
     // FIXME: InputEvents
     [preferences setSubtleCryptoEnabled:YES];
index cf4aba3..98de156 100644 (file)
@@ -879,6 +879,7 @@ static void resetWebPreferencesToConsistentValues(IWebPreferences* preferences)
     prefsPrivate4->setShadowDOMEnabled(TRUE);
     prefsPrivate4->setCustomElementsEnabled(TRUE);
     prefsPrivate4->setModernMediaControlsEnabled(FALSE);
+    prefsPrivate4->setLinkPreloadEnabled(TRUE);
 
     setAlwaysAcceptCookies(false);
 }
index 72eb351..0aadd05 100644 (file)
@@ -1,3 +1,12 @@
+2017-01-28  Yoav Weiss  <yoav@yoav.ws>
+
+        Add Link Preload as an off-by-default experimental feature menu item.
+        https://bugs.webkit.org/show_bug.cgi?id=167201
+
+        Reviewed by Ryosuke Niwa.
+
+        * experimental-features.html: Added Link Preload.
+
 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
 
         Add User Timing Experimental Feature
index ff5e1ba..1aa8263 100644 (file)
@@ -78,6 +78,11 @@ function testWebGL2() {
     return canvas.getContext("webgl2");
 }
 
+function testLinkPreload() {
+    var link = document.createElement("link");
+    return link.relList.supports("preload");
+}
+
 function testGamepad() {
     return navigator.getGamepads;
 }
@@ -140,6 +145,7 @@ window.addEventListener("load", function () {
         <div class="test" id="Gamepad"><p>Gamepad API</p></div>
         <div class="test" id="FormValidation"><p>HTML Form Validation</p></div>
         <div class="test" id="InputEvents"><p>HTML Input Events</p></div>
+        <div class="test" id="LinkPreload"><p>Link Preload</p></div>
         <div class="test" id="SubtleCrypto"><p>SubtleCrypto</p></div>
         <div class="test" id="VariationFonts"><p>Variation Fonts</p></div>
         <div class="test" id="UserTiming"><p>User Timing</p></div>