Bug 226124

Summary: Make error returned by SQLiteIDBBackingStore::getOrEstablishDatabaseInfo more detailed
Product: WebKit Reporter: Sihui Liu <sihui_liu>
Component: WebCore Misc.Assignee: Sihui Liu <sihui_liu>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, alecflett, beidson, cdumez, ews-watchlist, jsbell, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

Description Sihui Liu 2021-05-21 16:33:10 PDT
To help debug rdar://77532291.
Comment 1 Sihui Liu 2021-05-21 16:42:11 PDT
Created attachment 429361 [details]
Patch
Comment 2 Sihui Liu 2021-05-24 14:03:47 PDT
Created attachment 429562 [details]
Patch
Comment 3 Chris Dumez 2021-05-25 09:00:37 PDT
Comment on attachment 429562 [details]
Patch

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

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:-262
> -            LOG_ERROR("Unable to prepare statement to fetch schema for the Records table.");

Unclear why this patch is getting rid of all the LOG_ERROR(). You can both LOG_ERROR AND return a useful IDBError. Why trade one for the other?

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:257
> +    String tableStatement = database.tableSQL("Records"_s);

Why is it named Statement and not schema like it used to be? If I see statement, I expect a SQLiteStatement.

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:262
> +        return IDBError { };

wouldn't `return { };` work?

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:267
> +        return IDBError { };

wouldn't `return { };` work?

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:293
> +    return IDBError { };

wouldn't `return { };` work?
Comment 4 Sihui Liu 2021-05-25 14:14:22 PDT
(In reply to Chris Dumez from comment #3)
> Comment on attachment 429562 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=429562&action=review
> 
> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:-262
> > -            LOG_ERROR("Unable to prepare statement to fetch schema for the Records table.");
> 
> Unclear why this patch is getting rid of all the LOG_ERROR(). You can both
> LOG_ERROR AND return a useful IDBError. Why trade one for the other?
> 

As the error is more detailed, we can add error logging at higher level.
Will add logging in UniqueIDBDatabase::performCurrentOpenOperation().

> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:257
> > +    String tableStatement = database.tableSQL("Records"_s);
> 
> Why is it named Statement and not schema like it used to be? If I see
> statement, I expect a SQLiteStatement.
> 

I think schema is for describing the whole database and this is a column of an entry in schema table, which is usually text of the original statement to create the table.

> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:262
> > +        return IDBError { };
> 
> wouldn't `return { };` work?
> 

No, chosen constructor is explicit in copy-initialization. (IDBError's constructor is explicit, we may change that)

> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:267
> > +        return IDBError { };
> 
> wouldn't `return { };` work?
> 
> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:293
> > +    return IDBError { };
> 
> wouldn't `return { };` work?
Comment 5 Sihui Liu 2021-05-25 14:51:34 PDT
Created attachment 429695 [details]
Patch for landing
Comment 6 EWS 2021-05-25 15:35:03 PDT
Committed r278053 (238138@main): <https://commits.webkit.org/238138@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429695 [details].
Comment 7 Radar WebKit Bug Importer 2021-05-25 15:36:20 PDT
<rdar://problem/78480040>