RESOLVED DUPLICATE of bug 101618111784
Inspector: activate/deactivate IndexedDB transactions when inspecting IDB
https://bugs.webkit.org/show_bug.cgi?id=111784
Summary Inspector: activate/deactivate IndexedDB transactions when inspecting IDB
Alec Flett
Reported 2013-03-07 15:34:58 PST
Inspector: activate/deactivate IndexedDB transactions when inspecting IDB
Attachments
Patch (2.16 KB, patch)
2013-03-07 15:39 PST, Alec Flett
no flags
Patch (1.71 KB, patch)
2013-03-07 17:03 PST, Alec Flett
no flags
Patch (9.21 KB, patch)
2013-03-11 11:00 PDT, Alec Flett
no flags
Alec Flett
Comment 1 2013-03-07 15:39:13 PST
Alec Flett
Comment 2 2013-03-07 15:51:29 PST
vsevik: This may not be an ideal place for this, but it works great. abarth@ - any insight here? Basically we have V8RecursionScope (which requires ScriptExecutionContext) which does some IDB-specific work, in addition to delivering MutationObserver changes. CC'ing adamk@ in case he has any ideas here since I don't know what MutationObserver is supposed to do with inspector mutation changes and he may want that. I tried to put the V8RecursionScope outside of InspectorIndexedDBAgent itself (it probably belongs somewhere around InspectorController::dispatchFromFrontEnd() but there's no easily-accessible ScriptExecutionContext at that level) and that means it has to go somewhere in the code generator for InspectorBackendDispatcherImpl::dispatch() In addition, this adds additional V8-specific code to Inspector, also probably not ideal. (JSC has a similar problem across the codebase being addressed in bug 106732, but not for this particular issue in the inspector) we could put something in WebCore, but it would be Yet Another Scoping object. So a totally different alternative would be to replicate the one line of V8RecursionScope that we need: IDBPendingTransactionMonitor::deactivateNewTransactions(); inside InspectorIDBAgent - less v8 specific, but I'm concerned that any future changes to V8RecursionScope will be missed, and that does seem like the place that we're trying to deliver microtask-based events.
Alec Flett
Comment 3 2013-03-07 15:52:04 PST
hmm.. autocomplete. adding abarth@ - see my previous comment.
Adam Barth
Comment 4 2013-03-07 16:04:07 PST
Comment on attachment 192098 [details] Patch This seems odd. I don't understand why this would be needed. We're not spinning a nested event loop, are we?
Adam Klein
Comment 5 2013-03-07 16:10:38 PST
V8RecursionScope is just semantically wrong here: it's supposed to be counting script invocations (which is what defines a microtask); I take it from the fact that adding this scope was necessary that no script ran Note that MutationObservers have a separate mechanism for firing when no script has run: see http://trac.webkit.org/browser/trunk/Source/WebKit/chromium/src/WebKit.cpp#L78 But that doesn't really help address your cross-platform problem, as other platforms haven't added support for this end-of-task hook (as evidenced by the fact that bug 78290 is still open).
Alec Flett
Comment 6 2013-03-07 16:46:32 PST
Comment on attachment 192098 [details] Patch yeah I'm now reasonably convinced that V8RecursionScope is the wrong thing here.
Alec Flett
Comment 7 2013-03-07 17:03:38 PST
Alec Flett
Comment 8 2013-03-07 17:03:58 PST
ok, back to IDB-specific code. abarth@ - r?
Adam Barth
Comment 9 2013-03-07 17:08:21 PST
Comment on attachment 192114 [details] Patch I don't really understand what this patch is doing. Should we have a test for this patch?
Alec Flett
Comment 10 2013-03-07 17:27:56 PST
abarth@ sorry. I can ask vsevik if there is a reasonable way to test this stuff. Whats basically happening is that we're calling into IDB from C++, bypassing V8 altogether. IDB's transaction state management (part of the stuff that auto-commits after a microtask) relies on the transaction being inactive as IDB starts to process them. Normally this happens as soon as you leave v8: basically: - script (V8) calls into IDB API - objects must be in an 'active' state during the script. - script finishes, tells IDB to deactivate objects - IDB starts processing transactions, 'activating' them as necessary. That 3rd step has a lot of ASSERTions around making sure that the transactions really are inactive, otherwise something has gone horribly wrong. This bug makes it so that the inspector can call into IDB and the behavior stays the same.
Vsevolod Vlasov
Comment 11 2013-03-11 08:12:05 PDT
I assume this is the same issue as https://bugs.webkit.org/show_bug.cgi?id=101618 ? If so, it is already (implicitly) covered with tests, we just need to adjust the expectations.
Alec Flett
Comment 12 2013-03-11 11:00:13 PDT
Alec Flett
Comment 13 2013-03-11 11:03:07 PDT
abarth@ - And here is a patch with a Layout Test. I'm following the existing patterns in the inspector of firing an event (the inspector has its own event-dispatching system) The test now selects (see 'objectStoreElement.select()') the objectStore, which is the user interaction that will cause IndexedDB to fire an assertion. I'm working on a whole series of features to the inspector, so I have actual, new tests coming soon.
Alec Flett
Comment 14 2013-03-11 11:30:00 PDT
vsevik@ - I'd say this is kind of a dupe yes - but it is not implicitly covered by tests - database-data.html does not test this a best as I can tell. *** This bug has been marked as a duplicate of bug 101618 ***
Note You need to log in before you can comment on or make changes to this bug.