WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
102552
IndexedDB: Obtain ScriptState from IDL binding generator
https://bugs.webkit.org/show_bug.cgi?id=102552
Summary
IndexedDB: Obtain ScriptState from IDL binding generator
Michael Pruett
Reported
2012-11-16 12:43:56 PST
Currently when serializing a ScriptValue in IDBObjectStore::put(), the ScriptValue is serialized using the ScriptState provided by ScriptState::current(). In JSC there is no ScriptState::current(), and it will be necessary to obtain an ExecState from DOMRequestState to serialize the ScriptValue.
Attachments
Patch
(4.17 KB, patch)
2012-11-16 14:27 PST
,
Michael Pruett
no flags
Details
Formatted Diff
Diff
Patch
(10.92 KB, patch)
2012-11-21 12:57 PST
,
Michael Pruett
haraken
: review+
Details
Formatted Diff
Diff
Patch
(10.85 KB, patch)
2012-11-21 17:13 PST
,
Michael Pruett
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Michael Pruett
Comment 1
2012-11-16 14:27:05 PST
Created
attachment 174760
[details]
Patch
Alec Flett
Comment 2
2012-11-16 15:08:53 PST
Comment on
attachment 174760
[details]
Patch This looks ok to me. I'd be curious what abarth thinks. I've always found it a little odd that SerializedScriptValue::deserialize takes a ScriptState and not something better. (In fact I wonder now if there's a way we can fix SerializedScriptValue rather than fix this here)
Michael Pruett
Comment 3
2012-11-16 15:29:26 PST
Another possible approach would be to update DOMRequestState to add a method to return the ScriptState* (presumably with ScriptState::forContext()); we could then use requestState.scriptState() for both V8 and JSC and skip adding the new serializeIDBValue() function.
Adam Barth
Comment 4
2012-11-17 09:57:46 PST
Can't you just add a CallWith=ScriptState to the IDL to get the script state from the bindings layer?
Michael Pruett
Comment 5
2012-11-19 14:24:33 PST
(In reply to
comment #4
)
> Can't you just add a CallWith=ScriptState to the IDL to get the script state from the bindings layer?
That solution would be ideal. However it seems that adding CallWith=ScriptState to a function causes the V8 binding generator to invoke the function with an EmptyScriptState rather than with ScriptState::current(). And at the beginning of ScriptValue::serialize(), a ScriptScope is created with this EmptyScriptState. Since the EmptyScriptState has a null v8::Context, the v8::Context::Scope in ScriptScope enters the null context, triggering an assertion failure in V8.
Adam Barth
Comment 6
2012-11-19 14:59:07 PST
> However it seems that adding CallWith=ScriptState to a function causes the V8 binding generator to invoke the function with an EmptyScriptState rather than with ScriptState::current().
That sounds like a bug in the code generator that we should fix.
Michael Pruett
Comment 7
2012-11-21 12:57:01 PST
Created
attachment 175501
[details]
Patch
Michael Pruett
Comment 8
2012-11-21 13:00:46 PST
Now that the V8 binding generator has been updated in <
https://bugs.webkit.org/show_bug.cgi?id=102739
>, I've created a new patch which obtains the ScriptState from the IDL binding generator. Creating a new serializeIDBValue() utility function is no longer necessary.
Joshua Bell
Comment 9
2012-11-21 16:21:15 PST
Comment on
attachment 175501
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=175501&action=review
IDB changes LGTM but would be nice to start off with consistent naming, i.e....
> Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp:136 > + return put(IDBObjectStoreBackendInterface::AddOrUpdate, IDBAny::create(this), scriptState, value, key, ec);
^^^ "scriptState" vs.
> Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp:139 > +PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptState* state, ScriptValue& value, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec)
^^^ "state"
Kentaro Hara
Comment 10
2012-11-21 16:30:01 PST
Comment on
attachment 175501
[details]
Patch LGTM. Please address jsbell's comments before landing.
Michael Pruett
Comment 11
2012-11-21 17:13:52 PST
Created
attachment 175550
[details]
Patch I've changed variables previously named 'scriptState' to 'state' for the sake of consistency.
WebKit Review Bot
Comment 12
2012-11-21 20:35:21 PST
Comment on
attachment 175550
[details]
Patch Clearing flags on attachment: 175550 Committed
r135471
: <
http://trac.webkit.org/changeset/135471
>
WebKit Review Bot
Comment 13
2012-11-21 20:35:25 PST
All reviewed patches have been landed. Closing bug.
Adam Barth
Comment 14
2012-11-21 22:53:59 PST
Comment on
attachment 175550
[details]
Patch Thanks for improving the code generator. I think this patch came out very nicely this way.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug