[webkit-reviews] review granted: [Bug 196128] Blob type cannot be stored correctly in IDB when IDBObjectStore has autoIncrement and keyPath options : [Attachment 366396] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Apr 2 16:09:20 PDT 2019
Geoffrey Garen <ggaren at apple.com> has granted Sihui Liu <sihui_liu at apple.com>'s
request for review:
Bug 196128: Blob type cannot be stored correctly in IDB when IDBObjectStore has
autoIncrement and keyPath options
https://bugs.webkit.org/show_bug.cgi?id=196128
Attachment 366396: Patch
https://bugs.webkit.org/attachment.cgi?id=366396&action=review
--- Comment #12 from Geoffrey Garen <ggaren at apple.com> ---
Comment on attachment 366396
--> https://bugs.webkit.org/attachment.cgi?id=366396
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=366396&action=review
I love this approach!
r=me, with one suggestion
> Source/WebCore/bindings/js/JSIDBRequestCustom.cpp:83
> + auto& keys = getAllResult.keys();
> + auto& values = getAllResult.values();
> + auto& keyPath = getAllResult.keyPath();
> + Vector<JSC::JSValue> results;
> + for (unsigned i = 0; i < values.size(); i ++) {
> + auto result = deserializeIDBValueWithKeyInjection(state,
values[i], keys[i], keyPath);
> + if (!result)
> + return jsNull();
> + results.append(result.value());
> + }
> +
> + auto scope = DECLARE_THROW_SCOPE(state.vm());
> + JSC::MarkedArgumentBuffer list;
> + for (auto& result : results)
> + list.append(result);
> + if (UNLIKELY(list.hasOverflowed())) {
> + propagateException(state, scope, Exception(UnknownError));
> + return jsNull();
> + }
> + return JSValue(JSC::constructArray(&state, nullptr,
state.lexicalGlobalObject(), list));
To avoid copying into a MarkedArgumentBuffer, you can use this helper function
instead:
inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile*
profile, JSGlobalObject* globalObject, const JSValue* values, unsigned length,
JSValue newTarget = JSValue())
values is results.data() and length is results.size().
More information about the webkit-reviews
mailing list