Title: [98513] trunk/Source/WebKit2
Revision
98513
Author
je...@apple.com
Date
2011-10-26 13:19:14 -0700 (Wed, 26 Oct 2011)

Log Message

WebKit2 should respect secret WebKitOmitPDFSupport preference on the Mac
https://bugs.webkit.org/show_bug.cgi?id=70943
        
If WebKitOmitPDFSupport pref is set, disable both the new "plug-in" for subframes and the PDFKit-based support for the main frame only.

Reviewed by Alexey Proskuryakov.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::getPlugins): Don't register built-in PDF plugin if WebKitOmitPDFSupport pref is set.
        
* UIProcess/WebContext.h: Added omitPDFSupport().
        
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::canShowMIMEType): Don't show PDFs if WebKitOmitPDFSupport is set.
        
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::omitPDFSupport): Added.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (98512 => 98513)


--- trunk/Source/WebKit2/ChangeLog	2011-10-26 19:57:36 UTC (rev 98512)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-26 20:19:14 UTC (rev 98513)
@@ -1,3 +1,23 @@
+2011-10-26  Jeff Miller  <je...@apple.com>
+
+        WebKit2 should respect secret WebKitOmitPDFSupport preference on the Mac
+        https://bugs.webkit.org/show_bug.cgi?id=70943
+        
+        If WebKitOmitPDFSupport pref is set, disable both the new "plug-in" for subframes and the PDFKit-based support for the main frame only.
+
+        Reviewed by Alexey Proskuryakov.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::getPlugins): Don't register built-in PDF plugin if WebKitOmitPDFSupport pref is set.
+        
+        * UIProcess/WebContext.h: Added omitPDFSupport().
+        
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::canShowMIMEType): Don't show PDFs if WebKitOmitPDFSupport is set.
+        
+        * UIProcess/mac/WebContextMac.mm:
+        (WebKit::WebContext::omitPDFSupport): Added.
+
 2011-10-26  Sam Weinig  <s...@webkit.org>
 
         Add initial setting to WKBrowsingContextGroup

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (98512 => 98513)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2011-10-26 19:57:36 UTC (rev 98512)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2011-10-26 20:19:14 UTC (rev 98513)
@@ -568,7 +568,8 @@
 
 #if PLATFORM(MAC)
     // Add built-in PDF last, so that it's not used when a real plug-in is installed.
-    pluginInfos.append(BuiltInPDFView::pluginInfo());
+    if (!omitPDFSupport())
+        pluginInfos.append(BuiltInPDFView::pluginInfo());
 #endif
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (98512 => 98513)


--- trunk/Source/WebKit2/UIProcess/WebContext.h	2011-10-26 19:57:36 UTC (rev 98512)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h	2011-10-26 20:19:14 UTC (rev 98513)
@@ -184,6 +184,10 @@
     void getWebCoreStatistics(PassRefPtr<DictionaryCallback>);
     void garbageCollectJavaScriptObjects();
 
+#if PLATFORM(MAC)
+    static bool omitPDFSupport();
+#endif
+
 private:
     WebContext(ProcessModel, const String& injectedBundlePath);
 

Modified: trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp (98512 => 98513)


--- trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp	2011-10-26 19:57:36 UTC (rev 98512)
+++ trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp	2011-10-26 20:19:14 UTC (rev 98513)
@@ -111,7 +111,7 @@
 #if PLATFORM(MAC)
     // On Mac, we can show PDFs.
     if (!mimeType.isEmpty())
-        return WebContext::pdfAndPostScriptMIMETypes().contains(mimeType);
+        return WebContext::pdfAndPostScriptMIMETypes().contains(mimeType) && !WebContext::omitPDFSupport();
 #endif
 
     return false;

Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (98512 => 98513)


--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2011-10-26 19:57:36 UTC (rev 98512)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2011-10-26 20:19:14 UTC (rev 98513)
@@ -139,5 +139,11 @@
     return [localStorageDirectory stringByStandardizingPath];
 }
 
+bool WebContext::omitPDFSupport()
+{
+    // Since this is a "secret default" we don't bother registering it.
+    return [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
+}
+
 } // namespace WebKit
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to