Title: [149035] trunk/Source/WebKit
Revision
149035
Author
jber...@webkit.org
Date
2013-04-24 08:15:50 -0700 (Wed, 24 Apr 2013)

Log Message

Assertion failure (crash in release) attempting to delete database storage in WK1 without
creating a WebView first
https://bugs.webkit.org/show_bug.cgi?id=115065

Reviewed by Brady Eidson.

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj:
Remove WebDatabaseManagerInternal.h.

Source/WebKit/mac:

Make sure the WebPlatformStrategies is initialized before using the WebDatabaseManager.

* Storage/WebDatabaseManager.mm:
(-[WebDatabaseManager init]):
Move the logic from WebKitInitializeDatabasesIfNecessary here, and add a call to
WebPlatformStrategies::initializeIfNecessary.

* Storage/WebDatabaseManagerInternal.h: Removed.

* WebCoreSupport/WebPlatformStrategies.h:
(WebPlatformStrategies):
Change "initialize" to "initalizeIfNecessary".
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::initializeIfNecessary):
Only call setPlatformStrategies once.

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
Updated for the name change from initialize to initializeIfNecessary.
Instead of calling WebKitInitializeDatabasesIfNecessary, call [WebDatabaseManager
sharedWebDatabaseManager].
(+[WebView _setLoadResourcesSerially:]):
Updated for the name change from initialize to initializeIfNecessary.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (149034 => 149035)


--- trunk/Source/WebKit/ChangeLog	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/ChangeLog	2013-04-24 15:15:50 UTC (rev 149035)
@@ -1,3 +1,14 @@
+2013-04-24  Jessie Berlin  <jber...@apple.com>
+
+        Assertion failure (crash in release) attempting to delete database storage in WK1 without
+        creating a WebView first
+        https://bugs.webkit.org/show_bug.cgi?id=115065
+
+        Reviewed by Brady Eidson.
+
+        * WebKit.xcodeproj/project.pbxproj:
+        Remove WebDatabaseManagerInternal.h.
+
 2013-04-23  Benjamin Poulain  <bpoul...@apple.com>
 
         Remove the WebKit layer of wxWebKit

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (149034 => 149035)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2013-04-24 15:15:50 UTC (rev 149035)
@@ -99,7 +99,6 @@
 		5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */; };
 		5185F62610712B80007AA393 /* WebNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F62510712B80007AA393 /* WebNavigationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F62710712B97007AA393 /* WebNavigationData.mm */; };
-		51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */; };
 		51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; };
 		51C714FB0B20F79F00E5E33C /* WebBackForwardListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */; };
 		51CBFCAD0D10E6C5002DBF51 /* WebCachedFramePlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */; };
@@ -512,7 +511,6 @@
 		51A8B579042834F700CA2D3A /* WebView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		51A8B57A042834F700CA2D3A /* WebView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-		51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerInternal.h; sourceTree = "<group>"; };
 		51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseDelegate.h; sourceTree = "<group>"; };
 		51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListInternal.h; sourceTree = "<group>"; };
 		51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCachedFramePlatformData.h; sourceTree = "<group>"; };
@@ -1031,7 +1029,6 @@
 				511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
 				511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */,
 				511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */,
-				51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */,
 				511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
 				A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */,
 				A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */,
@@ -1430,7 +1427,6 @@
 				939810160824BF01008DF038 /* WebCoreStatistics.h in Headers */,
 				93E2A1A4123B0B3C009FE12A /* WebDashboardRegion.h in Headers */,
 				511F3FD70CECC88F00852565 /* WebDatabaseManagerClient.h in Headers */,
-				51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */,
 				511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */,
 				A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */,
 				9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,

Modified: trunk/Source/WebKit/mac/ChangeLog (149034 => 149035)


--- trunk/Source/WebKit/mac/ChangeLog	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-04-24 15:15:50 UTC (rev 149035)
@@ -1,3 +1,35 @@
+2013-04-24  Jessie Berlin  <jber...@apple.com>
+
+        Assertion failure (crash in release) attempting to delete database storage in WK1 without
+        creating a WebView first
+        https://bugs.webkit.org/show_bug.cgi?id=115065
+
+        Reviewed by Brady Eidson.
+
+        Make sure the WebPlatformStrategies is initialized before using the WebDatabaseManager.
+
+        * Storage/WebDatabaseManager.mm:
+        (-[WebDatabaseManager init]):
+        Move the logic from WebKitInitializeDatabasesIfNecessary here, and add a call to
+        WebPlatformStrategies::initializeIfNecessary.
+
+        * Storage/WebDatabaseManagerInternal.h: Removed.
+
+        * WebCoreSupport/WebPlatformStrategies.h:
+        (WebPlatformStrategies):
+        Change "initialize" to "initalizeIfNecessary".
+        * WebCoreSupport/WebPlatformStrategies.mm:
+        (WebPlatformStrategies::initializeIfNecessary):
+        Only call setPlatformStrategies once.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        Updated for the name change from initialize to initializeIfNecessary.
+        Instead of calling WebKitInitializeDatabasesIfNecessary, call [WebDatabaseManager
+        sharedWebDatabaseManager].
+        (+[WebView _setLoadResourcesSerially:]):
+        Updated for the name change from initialize to initializeIfNecessary.
+
 2013-04-23  Antoine Quint  <grao...@apple.com>
 
         Initial advance of text runs should be taken into account

Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm (149034 => 149035)


--- trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm	2013-04-24 15:15:50 UTC (rev 149035)
@@ -27,11 +27,11 @@
  */
 
 #import "WebDatabaseManagerPrivate.h"
-#import "WebDatabaseManagerInternal.h"
 
 #if ENABLE(SQL_DATABASE)
 
 #import "WebDatabaseManagerClient.h"
+#import "WebPlatformStrategies.h"
 #import "WebSecurityOriginInternal.h"
 
 #import <WebCore/DatabaseManager.h>
@@ -59,6 +59,24 @@
     return sharedManager;
 }
 
+- (id)init
+{
+    if (!(self = [super init]))
+        return nil;
+
+    WebPlatformStrategies::initializeIfNecessary();
+
+    DatabaseManager& dbManager = DatabaseManager::manager();
+
+    // Set the database root path in WebCore
+    dbManager.initialize(databasesDirectoryPath());
+
+    // Set the DatabaseManagerClient
+    dbManager.setClient(WebDatabaseManagerClient::sharedWebDatabaseManagerClient());
+
+    return self;
+}
+
 - (NSArray *)origins
 {
     Vector<RefPtr<SecurityOrigin> > coreOrigins;
@@ -131,21 +149,4 @@
     return [databasesDirectory stringByStandardizingPath];
 }
 
-void WebKitInitializeDatabasesIfNecessary()
-{
-    static BOOL initialized = NO;
-    if (initialized)
-        return;
-
-    DatabaseManager& dbManager = DatabaseManager::manager();
-
-    // Set the database root path in WebCore
-    dbManager.initialize(databasesDirectoryPath());
-
-    // Set the DatabaseManagerClient
-    dbManager.setClient(WebDatabaseManagerClient::sharedWebDatabaseManagerClient());
-    
-    initialized = YES;
-}
-
 #endif

Deleted: trunk/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h (149034 => 149035)


--- trunk/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h	2013-04-24 15:15:50 UTC (rev 149035)
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(SQL_DATABASE)
-
-void WebKitInitializeDatabasesIfNecessary();
-
-#endif

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h (149034 => 149035)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h	2013-04-24 15:15:50 UTC (rev 149035)
@@ -38,7 +38,7 @@
 
 class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy, private WebCore::VisitedLinkStrategy {
 public:
-    static void initialize();
+    static void initializeIfNecessary();
     
 private:
     WebPlatformStrategies();

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm (149034 => 149035)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm	2013-04-24 15:15:50 UTC (rev 149035)
@@ -38,10 +38,13 @@
 
 using namespace WebCore;
 
-void WebPlatformStrategies::initialize()
+void WebPlatformStrategies::initializeIfNecessary()
 {
-    DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, ());
-    setPlatformStrategies(&platformStrategies);
+    static WebPlatformStrategies* platformStrategies;
+    if (!platformStrategies) {
+        platformStrategies = new WebPlatformStrategies;
+        setPlatformStrategies(platformStrategies);
+    }
 }
 
 WebPlatformStrategies::WebPlatformStrategies()

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (149034 => 149035)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2013-04-24 14:27:13 UTC (rev 149034)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2013-04-24 15:15:50 UTC (rev 149035)
@@ -44,7 +44,7 @@
 #import "WebContextMenuClient.h"
 #import "WebDOMOperationsPrivate.h"
 #import "WebDataSourceInternal.h"
-#import "WebDatabaseManagerInternal.h"
+#import "WebDatabaseManagerPrivate.h"
 #import "WebDefaultEditingDelegate.h"
 #import "WebDefaultPolicyDelegate.h"
 #import "WebDefaultUIDelegate.h"
@@ -712,10 +712,10 @@
 
         // Initialize our platform strategies first before invoking the rest
         // of the initialization code which may depend on the strategies.
-        WebPlatformStrategies::initialize();
+        WebPlatformStrategies::initializeIfNecessary();
 
 #if ENABLE(SQL_DATABASE)
-        WebKitInitializeDatabasesIfNecessary();
+        [WebDatabaseManager sharedWebDatabaseManager];
 #endif
 
         WebKitInitializeStorageIfNecessary();
@@ -3053,7 +3053,7 @@
 
 + (void)_setLoadResourcesSerially:(BOOL)serialize 
 {
-    WebPlatformStrategies::initialize();
+    WebPlatformStrategies::initializeIfNecessary();
     resourceLoadScheduler()->setSerialLoadingEnabled(serialize);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to