Changeset 258707 in webkit


Ignore:
Timestamp:
Mar 19, 2020 10:23:58 AM (4 years ago)
Author:
sihui_liu@apple.com
Message:

Flaky Test: storage/indexeddb/cursor-leak.html and storage/indexeddb/cursor-leak-private.html
https://bugs.webkit.org/show_bug.cgi?id=209256
<rdar://problem/60097171>

Reviewed by Geoffrey Garen.

gc() does not guarantee all objects to be collected due to our conservative GC. To make the test more stable, we
now test if there is at lease one object is collected, which is enough to show cursor does not hold strong
reference to script value properties.

  • storage/indexeddb/cursor-leak-expected.txt:
  • storage/indexeddb/cursor-leak-private-expected.txt:
  • storage/indexeddb/resources/cursor-leak.js:

(onOpen.tx.oncomplete):
(onOpen.cursorRequest.onsuccess): Deleted.

Location:
trunk/LayoutTests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r258703 r258707  
     12020-03-19  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Flaky Test: storage/indexeddb/cursor-leak.html and storage/indexeddb/cursor-leak-private.html
     4        https://bugs.webkit.org/show_bug.cgi?id=209256
     5        <rdar://problem/60097171>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        gc() does not guarantee all objects to be collected due to our conservative GC. To make the test more stable, we
     10        now test if there is at lease one object is collected, which is enough to show cursor does not hold strong
     11        reference to script value properties.
     12
     13        * storage/indexeddb/cursor-leak-expected.txt:
     14        * storage/indexeddb/cursor-leak-private-expected.txt:
     15        * storage/indexeddb/resources/cursor-leak.js:
     16        (onOpen.tx.oncomplete):
     17        (onOpen.cursorRequest.onsuccess): Deleted.
     18
    1192020-03-19  Jason Lawrence  <lawrence.j@apple.com>
    220
  • trunk/LayoutTests/storage/indexeddb/cursor-leak-expected.txt

    r242986 r258707  
    88indexedDB.deleteDatabase(dbname)
    99indexedDB.open(dbname)
    10 PASS cursorObserver.wasCollected is true
     10PASS cursorObservers.length is 10000
     11PASS anyCollected is true
    1112PASS successfullyParsed is true
    1213
  • trunk/LayoutTests/storage/indexeddb/cursor-leak-private-expected.txt

    r242986 r258707  
    88indexedDB.deleteDatabase(dbname)
    99indexedDB.open(dbname)
    10 PASS cursorObserver.wasCollected is true
     10PASS cursorObservers.length is 10000
     11PASS anyCollected is true
    1112PASS successfullyParsed is true
    1213
  • trunk/LayoutTests/storage/indexeddb/resources/cursor-leak.js

    r195299 r258707  
    44}
    55
    6 description("Verify that that cursors weakly hold script value properties");
     6description('Verify that that cursors weakly hold script value properties');
    77
    88if (window.internals) {
     
    2525
    2626    db = evt.target.result;
    27     tx = db.transaction('store');
     27    tx = db.transaction('store', 'readonly');
    2828    store = tx.objectStore('store');
    29     cursorRequest = store.openCursor();
    30     cursorRequest.onsuccess = function() {
    31         cursor = cursorRequest.result;
    32     };
     29    cursorObservers = [];
     30    for (let i = 0; i < 10000; ++i) {
     31        store.openCursor().onsuccess = (event) => {
     32            cursor = event.target.result
     33            cursor.key.cursor = cursor;
     34            cursor.primaryKey.cursor = cursor;
     35            cursor.value.cursor = cursor;
     36            cursorObservers.push(internals.observeGC(cursor));
     37            cursor = null;
     38        };
     39    }
    3340    tx.oncomplete = function() {
    3441        db.close();
    35 
    36         // Try and induce a leak by a reference cycle from DOM to V8 and back.
    37         // If the v8 value of cursor.key (etc) is only held by the cursor's
    38         // V8 wrapper then there will be no leak.
    39         cursor.key.cursor = cursor;
    40         cursor.primaryKey.cursor = cursor;
    41         cursor.value.cursor = cursor;
    42 
    43         cursorObserver = internals.observeGC(cursor);
    44 
    45         cursorRequest = null;
    46         cursor = null;
     42        shouldBe('cursorObservers.length', '10000');
    4743
    4844        gc();
    4945
    50         shouldBeTrue("cursorObserver.wasCollected");
     46        anyCollected = false;
     47        for (let observer of cursorObservers) {
     48            if (observer.wasCollected)
     49                anyCollected = true;
     50        }
     51
     52        shouldBeTrue('anyCollected');
    5153        finishJSTest();
    5254    };
Note: See TracChangeset for help on using the changeset viewer.