Changeset 230456 in webkit


Ignore:
Timestamp:
Apr 9, 2018 5:17:49 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION(r229929): localStorage is broken for WebInspector
https://bugs.webkit.org/show_bug.cgi?id=184382
<rdar://problem/39257355>

Patch by Sihui Liu <sihui_liu@apple.com> on 2018-04-09
Reviewed by Chris Dumez.

Source/WebCore:

Removed an if condition that caused false positive cases of database error. As per
https://www.sqlite.org/c3ref/errcode.html, return value of sqlite3_errcode() is undefined
on successful API call, so we should not use the code to check if there is an error. We
should only use it when there is an error.
After moving this condition, LocalStorage might return empty string instead of NULL on
sqlite3_column_blob() error.

Modified a test to cover this case:
TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm.

  • platform/sql/SQLiteStatement.cpp:

(WebCore::SQLiteStatement::getColumnBlobAsString):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:

(TEST):

  • TestWebKitAPI/Tests/WebKitCocoa/localstorage-empty-string-value.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r230454 r230456  
     12018-04-09  Sihui Liu  <sihui_liu@apple.com>
     2
     3        REGRESSION(r229929): localStorage is broken for WebInspector
     4        https://bugs.webkit.org/show_bug.cgi?id=184382
     5        <rdar://problem/39257355>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Removed an if condition that caused false positive cases of database error. As per
     10        https://www.sqlite.org/c3ref/errcode.html, return value of sqlite3_errcode() is undefined
     11        on successful API call, so we should not use the code to check if there is an error. We
     12        should only use it when there is an error.
     13        After moving this condition, LocalStorage might return empty string instead of NULL on
     14        sqlite3_column_blob() error.
     15
     16        Modified a test to cover this case:
     17        TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm.
     18
     19        * platform/sql/SQLiteStatement.cpp:
     20        (WebCore::SQLiteStatement::getColumnBlobAsString):
     21
    1222018-04-09  Brent Fulgham  <bfulgham@apple.com>
    223
  • trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp

    r229929 r230456  
    384384
    385385    const void* blob = sqlite3_column_blob(m_statement, col);
    386     if (m_database.lastError() != SQLITE_OK)
    387         return String();
    388386    if (!blob)
    389387        return emptyString();
  • trunk/Tools/ChangeLog

    r230391 r230456  
     12018-04-09  Sihui Liu  <sihui_liu@apple.com>
     2
     3        REGRESSION(r229929): localStorage is broken for WebInspector
     4        https://bugs.webkit.org/show_bug.cgi?id=184382
     5        <rdar://problem/39257355>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:
     10        (TEST):
     11        * TestWebKitAPI/Tests/WebKitCocoa/localstorage-empty-string-value.html:
     12
    1132018-04-09  Zan Dobersek  <zdobersek@igalia.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm

    r229929 r230456  
    7979        receivedScriptMessage = false;
    8080        RetainPtr<NSString> string1 = (NSString *)[lastScriptMessage body];
    81         EXPECT_WK_STREQ(@"", string1.get());
     81        EXPECT_WK_STREQ(@"setItem EmptyString", string1.get());
    8282   
    8383        // Ditch this web view (ditch the in-memory local storage).
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/localstorage-empty-string-value.html

    r229929 r230456  
    88    localStorage.setItem(key, value);
    99    localStorage.setItem(testKey, 'test');
     10    window.webkit.messageHandlers.testHandler.postMessage("setItem " + key);
     11  } else {
     12    window.webkit.messageHandlers.testHandler.postMessage("" + localStorage.getItem(key));
    1013  }
    11    
    12   var result = localStorage.getItem(key);
    13   window.webkit.messageHandlers.testHandler.postMessage("" + result);
    1414</script>
    1515</body>
Note: See TracChangeset for help on using the changeset viewer.