11cb0ef41Sopenharmony_ci// META: global=window,worker
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cipromise_test(async t => {
41cb0ef41Sopenharmony_ci  const db_name = "WebAssembly";
51cb0ef41Sopenharmony_ci  const obj_store = "store";
61cb0ef41Sopenharmony_ci  const module_key = "module";
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci  await new Promise((resolve, reject) => {
91cb0ef41Sopenharmony_ci    const delete_request = indexedDB.deleteDatabase(db_name);
101cb0ef41Sopenharmony_ci    delete_request.onsuccess = resolve;
111cb0ef41Sopenharmony_ci    delete_request.onerror = reject;
121cb0ef41Sopenharmony_ci  });
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci  const db = await new Promise((resolve, reject) => {
151cb0ef41Sopenharmony_ci    const open_request = indexedDB.open(db_name);
161cb0ef41Sopenharmony_ci    open_request.onupgradeneeded = function() {
171cb0ef41Sopenharmony_ci      open_request.result.createObjectStore(obj_store);
181cb0ef41Sopenharmony_ci    };
191cb0ef41Sopenharmony_ci    open_request.onsuccess = function() {
201cb0ef41Sopenharmony_ci      resolve(open_request.result);
211cb0ef41Sopenharmony_ci    };
221cb0ef41Sopenharmony_ci    open_request.onerror = reject;
231cb0ef41Sopenharmony_ci  });
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci  const mod = await WebAssembly.compileStreaming(fetch('../incrementer.wasm'));
261cb0ef41Sopenharmony_ci  const tx = db.transaction(obj_store, 'readwrite');
271cb0ef41Sopenharmony_ci  const store = tx.objectStore(obj_store);
281cb0ef41Sopenharmony_ci  assert_throws_dom("DataCloneError", () => store.put(mod, module_key));
291cb0ef41Sopenharmony_ci});
30