File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -501,13 +501,24 @@ def clear_indexed_db(self):
501501 <script src="browser_reporting.js"></script>
502502 <script>
503503 // Clear the cache, so that the next test starts from a clean slate.
504- indexedDB.databases().then(dbs => {
505- Promise.all(dbs.map(db => {
506- return indexedDB.deleteDatabase(db.name);
507- })).then(() => {
508- reportResultToServer("clear");
504+ if (indexedDB.databases) {
505+ // If the tested browser supports IndexedDB 3.0 API, then enumerate all
506+ // available databases and delete them.
507+ indexedDB.databases().then(dbs => {
508+ Promise.all(dbs.map(db => {
509+ return indexedDB.deleteDatabase(db.name);
510+ })).then(() => {
511+ reportResultToServer("clear");
512+ });
509513 });
510- });
514+ } else {
515+ // Testing an old browser that does not support indexedDB.databases():
516+ // Delete the fixed database EM_PRELOAD_CACHE (this is hardcoded in
517+ // file packager)
518+ indexedDB.deleteDatabase('EM_PRELOAD_CACHE').onsuccess = () => {
519+ reportResultToServer("clear");
520+ };
521+ }
511522 </script>
512523 ''' )
513524 self .run_browser ('clear_indexed_db.html' , '/report_result?clear' )
You can’t perform that action at this time.
0 commit comments