Add preference to disable all http-equiv.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jul 2015 20:19:36 +0000 (20:19 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jul 2015 20:19:36 +0000 (20:19 +0000)
<rdar://problem/9091261> and https://bugs.webkit.org/show_bug.cgi?id=146553

Reviewed by Sam Weinig.
Source/WebCore:

No new tests (Covered by existing test)

* dom/Document.cpp:
(WebCore::Document::processHttpEquiv):
* page/Settings.in:

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences setMetaRefreshEnabled:]): Still expose this SPI, but have it affect
  the "httpEquivEnabled" setting.
(-[WebPreferences metaRefreshEnabled]): Ditto.
(-[WebPreferences setHTTPEquivEnabled:]):
(-[WebPreferences httpEquivEnabled]):
* WebView/WebPreferencesPrivate.h:

* WebView/WebView.mm:
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
(-[WebView _preferencesChanged:]):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetMetaRefreshEnabled): Still expose this SPI, but have it affect
  the "httpEquivEnabled" setting.
(WKPreferencesGetMetaRefreshEnabled): Ditto
(WKPreferencesSetHTTPEquivEnabled):
(WKPreferencesGetHTTPEquivEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests:

* loader/meta-refresh-disabled.html:

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

17 files changed:
LayoutTests/ChangeLog
LayoutTests/loader/meta-refresh-disabled.html
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/page/Settings.in
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/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index fea5780..f524572 100644 (file)
@@ -1,5 +1,14 @@
 2015-07-02  Brady Eidson  <beidson@apple.com>
 
+        Add preference to disable all http-equiv.
+        <rdar://problem/9091261> and https://bugs.webkit.org/show_bug.cgi?id=146553
+
+        Reviewed by Sam Weinig.
+
+        * loader/meta-refresh-disabled.html:
+
+2015-07-02  Brady Eidson  <beidson@apple.com>
+
         [Content Extensions] Block synchronous XMLHTTPRequest.
         <rdar://problem/21573006> and https://bugs.webkit.org/show_bug.cgi?id=146271
 
index 273e389..f41fb8b 100644 (file)
@@ -1,7 +1,7 @@
 <head>
 <script>
 if (window.testRunner) {
-    testRunner.overridePreference("WebKitMetaRefreshEnabled", "0");
+    testRunner.overridePreference("WebKitHTTPEquivEnabled", "0");
     testRunner.dumpAsText();
     testRunner.waitUntilDone();
 }
index 99ac1cd..a9f4e32 100644 (file)
@@ -1,3 +1,16 @@
+2015-07-02  Brady Eidson  <beidson@apple.com>
+
+        Add preference to disable all http-equiv.
+        <rdar://problem/9091261> and https://bugs.webkit.org/show_bug.cgi?id=146553
+
+        Reviewed by Sam Weinig.
+
+        No new tests (Covered by existing test)
+
+        * dom/Document.cpp:
+        (WebCore::Document::processHttpEquiv):
+        * page/Settings.in:
+
 2015-07-02  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         [Streams API] Remove ReadableStreamController.enqueue() custom binding
index 8d6e96a..e502669 100644 (file)
@@ -3023,6 +3023,9 @@ void Document::processHttpEquiv(const String& equiv, const String& content)
 {
     ASSERT(!equiv.isNull() && !content.isNull());
 
+    if (page() && !page()->settings().httpEquivEnabled())
+        return;
+
     Frame* frame = this->frame();
 
     HTTPHeaderName headerName;
@@ -3043,9 +3046,6 @@ void Document::processHttpEquiv(const String& equiv, const String& content)
         break;
 
     case HTTPHeaderName::Refresh: {
-        if (page() && !page()->settings().metaRefreshEnabled())
-            break;
-
         double delay;
         String urlString;
         if (frame && parseHTTPRefresh(content, true, delay, urlString)) {
index d07181e..127ae96 100644 (file)
@@ -242,4 +242,4 @@ attachmentElementEnabled initial=true, conditional=ATTACHMENT_ELEMENT
 
 newBlockInsideInlineModelEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
 
-metaRefreshEnabled initial=true
+httpEquivEnabled initial=true
index 8cf7175..379c1fc 100644 (file)
@@ -1,3 +1,25 @@
+2015-07-02  Brady Eidson  <beidson@apple.com>
+
+        Add preference to disable all http-equiv.
+        <rdar://problem/9091261> and https://bugs.webkit.org/show_bug.cgi?id=146553
+
+        Reviewed by Sam Weinig.
+        
+        * WebView/WebPreferenceKeysPrivate.h:
+        
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences setMetaRefreshEnabled:]): Still expose this SPI, but have it affect
+          the "httpEquivEnabled" setting.
+        (-[WebPreferences metaRefreshEnabled]): Ditto.
+        (-[WebPreferences setHTTPEquivEnabled:]):
+        (-[WebPreferences httpEquivEnabled]):
+        * WebView/WebPreferencesPrivate.h:
+        
+        * WebView/WebView.mm:
+        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+        (-[WebView _preferencesChanged:]):
+
 2015-07-02  Timothy Horton  <timothy_horton@apple.com>
 
         iOS WebKitLegacy should match WebKit2's viewport behavior
index f5be96f..d14a9c2 100644 (file)
 #define WebKitDebugFullPageZoomPreferenceKey @"WebKitDebugFullPageZoomPreferenceKey"
 #define WebKitMinimumZoomFontSizePreferenceKey @"WebKitMinimumZoomFontSizePreferenceKey"
 #define WebKitAntialiasedFontDilationEnabledKey @"AntialiasedFontDilationEnabled"
-#define WebKitMetaRefreshEnabledPreferenceKey @"WebKitMetaRefreshEnabled"
+#define WebKitHTTPEquivEnabledPreferenceKey @"WebKitHTTPEquivEnabled"
 
 #if TARGET_OS_IPHONE
 #define WebKitStandalonePreferenceKey @"WebKitStandalonePreferenceKey"
index 6fec021..e819203 100644 (file)
@@ -443,7 +443,8 @@ public:
 #endif
         [NSNumber numberWithBool:YES],  WebKitPluginsEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitDatabasesEnabledPreferenceKey,
-        [NSNumber numberWithBool:YES],  WebKitMetaRefreshEnabledPreferenceKey,
+        [NSNumber numberWithBool:YES],  WebKitHTTPEquivEnabledPreferenceKey,
+
 #if PLATFORM(IOS)
         [NSNumber numberWithBool:NO],   WebKitStorageTrackerEnabledPreferenceKey,
 #endif
@@ -2538,12 +2539,22 @@ static NSString *classIBCreatorID = nil;
 
 - (void)setMetaRefreshEnabled:(BOOL)enabled
 {
-    [self _setBoolValue:enabled forKey:WebKitMetaRefreshEnabledPreferenceKey];
+    [self setHTTPEquivEnabled:enabled];
 }
 
 - (BOOL)metaRefreshEnabled
 {
-    return [self _boolValueForKey:WebKitMetaRefreshEnabledPreferenceKey];
+    return [self metaRefreshEnabled];
+}
+
+- (void)setHTTPEquivEnabled:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitHTTPEquivEnabledPreferenceKey];
+}
+
+- (BOOL)httpEquivEnabled
+{
+    return [self _boolValueForKey:WebKitHTTPEquivEnabledPreferenceKey];
 }
 
 - (BOOL)javaScriptMarkupEnabled
index bff9c14..5637547 100644 (file)
@@ -448,6 +448,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setMetaRefreshEnabled:(BOOL)flag;
 - (BOOL)metaRefreshEnabled;
 
+- (void)setHTTPEquivEnabled:(BOOL)flag;
+- (BOOL)httpEquivEnabled;
+
 @property (nonatomic) BOOL javaScriptMarkupEnabled;
 
 #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
index 7d17a2e..2a5d78f 100644 (file)
@@ -1233,7 +1233,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     _private->page->settings().setMinimumFontSize([_private->preferences minimumFontSize]);
 
     // This is a workaround for <rdar://problem/21309911>.
-    _private->page->settings().setMetaRefreshEnabled([_private->preferences metaRefreshEnabled]);
+    _private->page->settings().setHTTPEquivEnabled([_private->preferences httpEquivEnabled]);
 
     _private->page->setGroupName(groupName);
 
@@ -2327,7 +2327,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
     }
 
     settings.setPlugInSnapshottingEnabled([preferences plugInSnapshottingEnabled]);
-    settings.setMetaRefreshEnabled([preferences metaRefreshEnabled]);
+    settings.setHttpEquivEnabled([preferences httpEquivEnabled]);
 
     settings.setFixedPositionCreatesStackingContext(true);
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
index 48ce607..2f3b2bf 100644 (file)
@@ -1,3 +1,26 @@
+2015-07-02  Brady Eidson  <beidson@apple.com>
+
+        Add preference to disable all http-equiv.
+        <rdar://problem/9091261> and https://bugs.webkit.org/show_bug.cgi?id=146553
+
+        Reviewed by Sam Weinig.
+
+        * Shared/WebPreferencesDefinitions.h:
+        
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetMetaRefreshEnabled): Still expose this SPI, but have it affect
+          the "httpEquivEnabled" setting.
+        (WKPreferencesGetMetaRefreshEnabled): Ditto
+        (WKPreferencesSetHTTPEquivEnabled):
+        (WKPreferencesGetHTTPEquivEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2015-07-02  Mark Lam  <mark.lam@apple.com>
 
         WKWebView evaluateJavaScript:completionHandler: should reuse its JSContext instance.
index 1423cab..16852af 100644 (file)
     macro(LongMousePressEnabled, longMousePressEnabled, Bool, bool, false) \
     macro(NewBlockInsideInlineModelEnabled, newBlockInsideInlineModelEnabled, Bool, bool, false) \
     macro(AntialiasedFontDilationEnabled, antialiasedFontDilationEnabled, Bool, bool, false) \
-    macro(MetaRefreshEnabled, metaRefreshEnabled, Bool, bool, true) \
+    macro(HTTPEquivEnabled, httpEquivEnabled, Bool, bool, true) \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
     macro(IncrementalRenderingSuppressionTimeout, incrementalRenderingSuppressionTimeout, Double, double, 5) \
index 5a534c0..56fa264 100644 (file)
@@ -1359,12 +1359,22 @@ bool WKPreferencesGetIgnoreViewportScalingConstraints(WKPreferencesRef preferenc
 
 void WKPreferencesSetMetaRefreshEnabled(WKPreferencesRef preferencesRef, bool enabled)
 {
-    toImpl(preferencesRef)->setMetaRefreshEnabled(enabled);
+    toImpl(preferencesRef)->setHTTPEquivEnabled(enabled);
 }
 
 bool WKPreferencesGetMetaRefreshEnabled(WKPreferencesRef preferencesRef)
 {
-    return toImpl(preferencesRef)->metaRefreshEnabled();
+    return toImpl(preferencesRef)->httpEquivEnabled();
+}
+
+void WKPreferencesSetHTTPEquivEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setHTTPEquivEnabled(enabled);
+}
+
+bool WKPreferencesGetHTTPEquivEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->httpEquivEnabled();
 }
 
 void WKPreferencesSetAllowsAirPlayForMediaPlayback(WKPreferencesRef preferencesRef, bool enabled)
index e59a7fc..45cb09c 100644 (file)
@@ -373,6 +373,10 @@ WK_EXPORT WKJavaScriptRuntimeFlagSet WKPreferencesGetJavaScriptRuntimeFlags(WKPr
 WK_EXPORT void WKPreferencesSetMetaRefreshEnabled(WKPreferencesRef preferences, bool enabled);
 WK_EXPORT bool WKPreferencesGetMetaRefreshEnabled(WKPreferencesRef preferences);
 
+// Defaults to true.
+WK_EXPORT void WKPreferencesSetHTTPEquivEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetHTTPEquivEnabled(WKPreferencesRef preferences);
+
 #ifdef __cplusplus
 }
 #endif
index 36b60c7..7f37a4d 100644 (file)
@@ -74,7 +74,7 @@ public:
     static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);
 
     void fetchData(WebsiteDataTypes, std::function<void (Vector<WebsiteDataRecord>)> completionHandler);
-    void removeData(WebsiteDataTypes, std::chrono::system_clock::time_point modifiedSince, std::function<void ()> completionHandler);
+//    void removeData(WebsiteDataTypes, std::chrono::system_clock::time_point modifiedSince, std::function<void ()> completionHandler);
     void removeData(WebsiteDataTypes, const Vector<WebsiteDataRecord>&, std::function<void ()> completionHandler);
 
     StorageManager* storageManager() { return m_storageManager.get(); }
index 76d7703..0393658 100644 (file)
@@ -207,7 +207,7 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
     macro(WebKitEnableCaretBrowsing, CaretBrowsingEnabled, caretBrowsingEnabled) \
     macro(WebKitDisplayImagesKey, LoadsImagesAutomatically, loadsImagesAutomatically) \
     macro(WebKitMediaStreamEnabled, MediaStreamEnabled, mediaStreamEnabled) \
-    macro(WebKitMetaRefreshEnabled, MetaRefreshEnabled, metaRefreshEnabled)
+    macro(WebKitHTTPEquivEnabled, HttpEquivEnabled, httpEquivEnabled)
 
 #define OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES(TestRunnerName, SettingsName, WebPreferencesName) \
     if (preference == #TestRunnerName) { \
index a9c6efc..1554dbc 100644 (file)
@@ -2784,7 +2784,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings.setInteractiveFormValidationEnabled(store.getBoolValueForKey(WebPreferencesKey::interactiveFormValidationEnabledKey()));
     settings.setSpatialNavigationEnabled(store.getBoolValueForKey(WebPreferencesKey::spatialNavigationEnabledKey()));
 
-    settings.setMetaRefreshEnabled(store.getBoolValueForKey(WebPreferencesKey::metaRefreshEnabledKey()));
+    settings.setHttpEquivEnabled(store.getBoolValueForKey(WebPreferencesKey::httpEquivEnabledKey()));
 
     DatabaseManager::singleton().setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));