Fix Bug 16786: "Display images when page opens" preference affects Inspector
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2008 02:45:51 +0000 (02:45 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2008 02:45:51 +0000 (02:45 +0000)
        <http://bugs.webkit.org/show_bug.cgi?id=16786>
        <rdar://5712914>

        Reviewed by Anders and Darin.

        * WebInspectorClient.cpp:
        (WebInspectorClient::createPage): Create our own custom WebPreferences
        so that we won't be affected by global preference changes. This
        matches what Mac does.

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

WebKit/win/ChangeLog
WebKit/win/WebInspectorClient.cpp

index 7fff8b2..05a3622 100644 (file)
@@ -1,5 +1,20 @@
 2008-01-29  Adam Roben  <aroben@apple.com>
 
+        Fix Bug 16786: "Display images when page opens" preference affects
+        Inspector
+
+        <http://bugs.webkit.org/show_bug.cgi?id=16786>
+        <rdar://5712914>
+
+        Reviewed by Anders and Darin.
+
+        * WebInspectorClient.cpp:
+        (WebInspectorClient::createPage): Create our own custom WebPreferences
+        so that we won't be affected by global preference changes. This
+        matches what Mac does.
+
+2008-01-29  Adam Roben  <aroben@apple.com>
+
         Fix <rdar://5713302> Web Inspector on Windows is not using the
         localized strings
 
index cf3287f..fe1d0f8 100644 (file)
@@ -115,6 +115,37 @@ Page* WebInspectorClient::createPage()
 
     m_webView.adoptRef(WebView::createInstance());
 
+    // Keep preferences separate from the rest of the client, making sure we are using expected preference values.
+    // One reason this is good is that it keeps the inspector out of history via "private browsing".
+    COMPtr<WebPreferences> preferences(AdoptCOM, WebPreferences::createInstance());
+    if (FAILED(preferences->setAutosaves(FALSE)))
+        return 0;
+    if (FAILED(preferences->setPrivateBrowsingEnabled(TRUE)))
+        return 0;
+    if (FAILED(preferences->setLoadsImagesAutomatically(TRUE)))
+        return 0;
+    if (FAILED(preferences->setAuthorAndUserStylesEnabled(TRUE)))
+        return 0;
+    if (FAILED(preferences->setAllowsAnimatedImages(TRUE)))
+        return 0;
+    if (FAILED(preferences->setLoadsImagesAutomatically(TRUE)))
+        return 0;
+    if (FAILED(preferences->setPlugInsEnabled(FALSE)))
+        return 0;
+    if (FAILED(preferences->setJavaEnabled(FALSE)))
+        return 0;
+    if (FAILED(preferences->setUserStyleSheetEnabled(FALSE)))
+        return 0;
+    if (FAILED(preferences->setTabsToLinks(FALSE)))
+        return 0;
+    if (FAILED(preferences->setMinimumFontSize(0)))
+        return 0;
+    if (FAILED(preferences->setMinimumLogicalFontSize(9)))
+        return 0;
+
+    if (FAILED(m_webView->setPreferences(preferences.get())))
+        return 0;
+
     if (FAILED(m_webView->setHostWindow((OLE_HANDLE)(ULONG64)m_hwnd)))
         return 0;