Reviewed by Adam Roben.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Feb 2008 15:36:28 +0000 (15:36 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Feb 2008 15:36:28 +0000 (15:36 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=17207
        Database example doesn't work (requires not-yet-released Safari)

        * mac/WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::exceededDatabaseQuota): Check Safari version, and allow 5 megabytes of storage
        if it's too old.

        * win/WebChromeClient.cpp:
        (WebChromeClient::exceededDatabaseQuota): Check Safari version, and allow 5 megabytes of storage
        if it's too old.

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

WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebChromeClient.mm
WebKit/win/ChangeLog
WebKit/win/WebChromeClient.cpp

index 73e23b1c5d919c2e714a4f26ce4d05f7570c1209..71ec2b34b414427c50f950dd7e026f849d978951 100644 (file)
@@ -1,3 +1,14 @@
+2008-02-14  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Adam Roben.
+
+        http://bugs.webkit.org/show_bug.cgi?id=17207
+        Database example doesn't work (requires not-yet-released Safari)
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::exceededDatabaseQuota): Check Safari version, and allow 5 megabytes of storage
+        if it's too old.
+
 2008-02-11  Darin Adler  <darin@apple.com>
 
         - roll out fix for <rdar://problem/5726016> REGRESSION: Xcode News window renders
index 48354c1eaeb9f46fc3e3f3da423cb8ea7996ccfd..fcbecf42282134454e735c7b65b4e781706ede00 100644 (file)
@@ -35,6 +35,7 @@
 #import "WebFrameView.h"
 #import "WebHTMLView.h"
 #import "WebHTMLViewPrivate.h"
+#import "WebKitSystemInterface.h"
 #import "WebNSURLRequestExtras.h"
 #import "WebSecurityOriginPrivate.h"
 #import "WebSecurityOriginInternal.h"
@@ -416,7 +417,12 @@ void WebChromeClient::print(Frame* frame)
 void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
 {
     WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
-    CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName);
+    // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
+    if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) {
+        const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
+        [webOrigin setQuota:defaultQuota];
+    } else
+        CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName);
     [webOrigin release];
 }
     
index 6f7ec4b7877818aec5e1ca69b1f7bd5a361519b1..60aec76cf3f92beb46a8e11fdee934fcc5290fae 100644 (file)
@@ -1,3 +1,14 @@
+2008-02-14  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Adam Roben.
+
+        http://bugs.webkit.org/show_bug.cgi?id=17207
+        Database example doesn't work (requires not-yet-released Safari)
+
+        * WebChromeClient.cpp:
+        (WebChromeClient::exceededDatabaseQuota): Check Safari version, and allow 5 megabytes of storage
+        if it's too old.
+
 2008-02-13  Ada Chan  <adachan@apple.com>
 
         <rdar://problem/5740656> Leak in postDidAddIconNotification in WebIconDatabase
index 1df5716c6d154ac94763fef780b63e69378375ff..269b90bd84847382c7f80421082036c319d61d3d 100644 (file)
@@ -40,6 +40,8 @@
 #include <WebCore/WindowFeatures.h>
 #pragma warning(pop)
 
+#include <tchar.h>
+
 using namespace WebCore;
 
 WebChromeClient::WebChromeClient(WebView* webView)
@@ -467,6 +469,28 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database
         COMPtr<IWebUIDelegatePrivate3> uiDelegatePrivate3(Query, uiDelegate);
         if (uiDelegatePrivate3)
             uiDelegatePrivate3->exceededDatabaseQuota(m_webView, kit(frame), origin.get(), BString(databaseIdentifier));
+        else {
+            // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
+            TCHAR path[MAX_PATH];
+            GetModuleFileName(GetModuleHandle(TEXT("Safari.exe")), path, ARRAYSIZE(path));
+            DWORD handle;
+            DWORD versionSize = GetFileVersionInfoSize(path, &handle);
+            if (!versionSize)
+                return;
+            Vector<char> data(versionSize);
+            if (!GetFileVersionInfo(path, 0, versionSize, data.data()))
+                return;
+
+            LPCTSTR productVersion;
+            UINT productVersionLength;
+            if (!VerQueryValue(data.data(), TEXT("\\StringFileInfo\\040904b0\\ProductVersion"), (void**)&productVersion, &productVersionLength))
+                return;
+            if (_tcsncmp(TEXT("3.1"), productVersion, productVersionLength) > 0) {
+                ::MessageBox(0, TEXT("workaround"), 0, 0);
+                const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
+                origin->setQuota(defaultQuota);
+            }
+        }
     }
 }