Bug 112976

Summary: IndexedDB: Ensure script wrappers can be collected after context is stopped
Product: WebKit Reporter: Joshua Bell <jsbell>
Component: New BugsAssignee: Joshua Bell <jsbell>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dgrogan, haraken, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Joshua Bell 2013-03-21 16:09:51 PDT
IndexedDB: Ensure script wrappers can be collected after context is stopped
Comment 1 Joshua Bell 2013-03-21 16:12:32 PDT
Created attachment 194374 [details]
Patch
Comment 2 Joshua Bell 2013-03-21 16:14:10 PDT
This could use some tests but I haven't thought about where to put them yet - trivial webkit_unit_tests might work just to avoid regressions.

haraken@, abarth@ - can you take a look?
Comment 3 Adam Barth 2013-03-21 16:17:58 PDT
We don't have a good way to test these sorts of changes.  :(
Comment 4 WebKit Review Bot 2013-03-21 16:54:40 PDT
Comment on attachment 194374 [details]
Patch

Clearing flags on attachment: 194374

Committed r146540: <http://trac.webkit.org/changeset/146540>
Comment 5 WebKit Review Bot 2013-03-21 16:54:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 David Grogan 2013-03-21 22:38:24 PDT
IntVersion tests flaked after this was rolled into chromium.

http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20(dbg)(1)/builds/24146/steps/content_browsertests/logs/IntVersionTests1

[7826:7826:0321/221757:1974942344:INFO:layout_browsertest.cc(157)] Navigating to URL file:///mnt/data/b/build/slave/Linux_Tests__dbg__1_/build/src/content/test/data/layout_tests/LayoutTests/storage/indexeddb/intversion-close-in-upgradeneeded.html and blocking.
ASSERTION FAILED: m_state == Finished
../../third_party/WebKit/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp(119) : virtual WebCore::IDBTransaction::~IDBTransaction()
1   0x7fabd2cf3a5b
2   0x7fabd2cf3bec
3   0x7fabd2c9f536
4   0x7fabd3a6082c
5   0x7fabd2dfe2e4
6   0x7fabd2e53e82
7   0x7fabd621f434
8   0x7fabd621da8b
9   0x7fabd6241d77
10  0x7fabd6240fe6
11  0x7fabd6198836
12  0x7fabd6353ce1
13  0x7fabd63dda23
14  0x7fabd63de277
15  0x1a99337062ee
[7826:7826:0321/221757:1975821025:INFO:layout_browsertest.cc(162)] Navigation completed.
../../content/test/layout_browsertest.cc:191: Failure
Value of: actual_text
Actual: "#CRASHED - renderer (pid 7856)\n"
Expected: expected_text
Which is: "Test that when db.close is called in upgradeneeded, the db is cleaned up on refresh.\n\nOn success, you will see a series of \"PASS\" messages, followed by \"TEST COMPLETE\".\n\n\nindexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;\n\ndbname = \"intversion-close-in-upgradeneeded.html\"\nindexedDB.deleteDatabase(dbname)\nrequest = indexedDB.open(dbname, 7)\n\n\nupgradeNeeded():\ndb = event.target.result\nPASS event.newVersion is 7\ntransaction = event.target.transaction\ndb.createObjectStore('os')\ndb.close()\n\ntransaction.oncomplete:\nsawTransactionComplete = true\n\nopenError():\nPASS sawTransactionComplete is true\nPASS event.target.error.name is 'AbortError'\nPASS event.result is undefined\n\nVerify that the old connection is unchanged and was closed:\nPASS db is non-null.\nPASS db.version is 7\nExpecting exception from db.transaction('os')\nPASS Exception was thrown.\nPASS code is DOMException.INVALID_STATE_ERR\nPASS ename is 'InvalidStateError'\nPASS successfullyParsed is true\n\nTEST COMPLETE\n\n"
[7826:7826:0321/221757:1975822278:INFO:layout_browsertest.cc(157)] Navigating to URL file:///mnt/data/b/build/slave/Linux_Tests__dbg__1_/build/src/content/test/data/layout_tests/LayoutTests/storage/indexeddb/delete-in-upgradeneeded-close-in-open-success.html and blocking.
[7826:7826:0321/221758:1976465721:INFO:layout_browsertest.cc(162)] Navigation completed.
Comment 7 Joshua Bell 2013-03-21 22:41:59 PDT
Thanks. It can be rolled out if necessary. It's likely that the state isn't driven to finished if the context is stopped before the final event comes in. We can probably tweak that.
Comment 8 Yury Semikhatsky 2013-03-22 01:37:46 PDT
Comment on attachment 194374 [details]
Patch

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

> Source/WebCore/ChangeLog:12
> +        No new tests - suggestions welcome.

How about repeating scenario described in https://code.google.com/p/chromium/issues/detail?id=222678 ? You could take heap snapshot before and after reload and check that number of say Window objects or IDBDatabases didn't grow.