replace occurrences of window with global

this change enables webworkers to use IDBWrapper as well