Bug 69277 - A little more WebSQLDatabase thread safety
Summary: A little more WebSQLDatabase thread safety
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Nordman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-03 12:06 PDT by Michael Nordman
Modified: 2011-10-03 16:06 PDT (History)
3 users (show)

See Also:


Attachments
safer (12.22 KB, patch)
2011-10-03 12:12 PDT, Michael Nordman
no flags Details | Formatted Diff | Diff
safer (12.23 KB, patch)
2011-10-03 12:27 PDT, Michael Nordman
ap: commit-queue-
Details | Formatted Diff | Diff
safer (12.21 KB, patch)
2011-10-03 14:23 PDT, Michael Nordman
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nordman 2011-10-03 12:06:47 PDT
We're getting reports of INVALID_STATE exceptions being throw from the openDatabase method. It looks like there some unsafe initialization code paths that may be the culprit.
Comment 1 Michael Nordman 2011-10-03 12:12:08 PDT
Created attachment 109505 [details]
safer
Comment 2 WebKit Review Bot 2011-10-03 12:13:46 PDT
Attachment 109505 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/ChangeLog:5:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
Source/WebCore/ChangeLog:6:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
Total errors found: 2 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Michael Nordman 2011-10-03 12:27:41 PDT
Created attachment 109508 [details]
safer

made some whitespace changes in the changelog file
Comment 4 Alexey Proskuryakov 2011-10-03 14:11:56 PDT
Comment on attachment 109508 [details]
safer

View in context: https://bugs.webkit.org/attachment.cgi?id=109508&action=review

I don't understand thread-safe string copying well enough, so leaving this for someone else (Dave Levin?) to review.

> Source/WebCore/storage/AbstractDatabase.cpp:51
> +static const char versionKey[] = "WebKitDatabaseVersionKey";

Is this actually guaranteed to not use initialization, or do you need to use a pointer?

> Source/WebCore/storage/AbstractDatabase.cpp:298
> +            const String tableName(infoTableName);

We don't use local const variables in WebKit.

> Source/WebCore/storage/AbstractDatabase.cpp:396
> +    const String query(String("SELECT value FROM ") + infoTableName +  " WHERE key = '" + versionKey + "';");

We don't use local const variables in WebKit.

> Source/WebCore/storage/AbstractDatabase.cpp:416
> +    const String query(String("INSERT INTO ") + infoTableName +  " (key, value) VALUES ('" + versionKey + "', ?);");

We don't use local const variables in WebKit.
Comment 5 Michael Nordman 2011-10-03 14:23:49 PDT
Created attachment 109530 [details]
safer
Comment 6 Michael Nordman 2011-10-03 14:26:11 PDT
> Is this actually guaranteed to not use initialization, or do you need to use a pointer?

Yes, no.

> We don't use local const variables in WebKit.

Done x 3
Comment 7 David Levin 2011-10-03 14:57:17 PDT
Comment on attachment 109530 [details]
safer

View in context: https://bugs.webkit.org/attachment.cgi?id=109530&action=review

Looks great!

> Source/WebCore/storage/AbstractDatabase.cpp:2
> + * Copyright (C) 2011 Google Inc. All rights reserved.

In WebKit, we leave the year in tact, so this would become 2010, 2011.

But you don't need to change this back -- just fyi for future changes.
Comment 8 Michael Nordman 2011-10-03 14:58:47 PDT
thank you good reviewer sir!
Comment 9 WebKit Review Bot 2011-10-03 16:06:43 PDT
Comment on attachment 109530 [details]
safer

Clearing flags on attachment: 109530

Committed r96554: <http://trac.webkit.org/changeset/96554>
Comment 10 WebKit Review Bot 2011-10-03 16:06:47 PDT
All reviewed patches have been landed.  Closing bug.