[Webkit-unassigned] [Bug 69138] Local storage getItem() for an empty string returned UNDEFINED value.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 13 14:05:59 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=69138

--- Comment #20 from Chris Dumez <cdumez at apple.com> ---
Comment on attachment 335723
  --> https://bugs.webkit.org/attachment.cgi?id=335723
Patch

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

> ChangeLog:9
> +        * ManualTests/localstorage-empty-string-value.html: Added.

Outdated changelog. Also, this probably needs an API test.

> Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp:47
> +#define BLOB_NORMAL 0

We usually avoid #define statements in WebKit and prefer global statics. e.g.
const int normalBlob = 0;
const int emptyBlob = 1;

However, in this case, I think we don't even need these constants.

> Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp:115
> +    if (!m_database.executeCommand("CREATE TABLE IF NOT EXISTS ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL, type INTEGER NOT NULL ON CONFLICT FAIL DEFAULT 0)")) {

Maybe rename type to isBlobEmpty ?

> Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp:191
> +        int type = query.getColumnInt(2);

bool isBlobEmpty = !!query.getColumnInt(2); ?

> Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp:342
> +            // If the blob is an empty string, set the type to BLOB_EMPTY.

statement.bindInt(3, it->value.isEmpty()); ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180313/8f56b822/attachment-0001.html>


More information about the webkit-unassigned mailing list