diff --git a/dom/indexedDB/test/browser_permissionsPrompt.html b/dom/indexedDB/test/browser_permissionsPrompt.html index 37c55775cb00..0ee698b97bf2 100644 --- a/dom/indexedDB/test/browser_permissionsPrompt.html +++ b/dom/indexedDB/test/browser_permissionsPrompt.html @@ -19,7 +19,7 @@ let event = yield undefined; if (event.type == "success") { - testResult = event.target.result; + testResult = event.target.result instanceof IDBDatabase; } else { testException = event.target.error.name; diff --git a/dom/indexedDB/test/browser_permissionsPromptAllow.js b/dom/indexedDB/test/browser_permissionsPromptAllow.js index 577ad252862c..dd0921872571 100644 --- a/dom/indexedDB/test/browser_permissionsPromptAllow.js +++ b/dom/indexedDB/test/browser_permissionsPromptAllow.js @@ -24,8 +24,8 @@ function test1() gBrowser.selectedBrowser.addEventListener("load", function () { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); - setFinishedCallback(function(result, exception) { - ok(result instanceof IDBDatabase, + setFinishedCallback(function(isIDBDatabase, exception) { + ok(isIDBDatabase, "First database creation was successful"); ok(!exception, "No exception"); is(getPermission(testPageURL, "indexedDB"), @@ -60,8 +60,8 @@ function test2() gBrowser.selectedBrowser.addEventListener("load", function () { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); - setFinishedCallback(function(result, exception) { - ok(result instanceof IDBDatabase, + setFinishedCallback(function(isIDBDatabase, exception) { + ok(isIDBDatabase, "First database creation was successful"); ok(!exception, "No exception"); is(getPermission(testPageURL, "indexedDB"), diff --git a/dom/indexedDB/test/browser_perwindow_privateBrowsing.js b/dom/indexedDB/test/browser_perwindow_privateBrowsing.js index e872a0650b1e..08d329cbc4c6 100644 --- a/dom/indexedDB/test/browser_perwindow_privateBrowsing.js +++ b/dom/indexedDB/test/browser_perwindow_privateBrowsing.js @@ -25,8 +25,8 @@ function test1() } gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); - setFinishedCallback(function(result, exception) { - ok(result instanceof IDBDatabase, + setFinishedCallback(function(isIDBDatabase, exception) { + ok(isIDBDatabase, "First database creation was successful"); ok(!exception, "No exception"); gBrowser.removeCurrentTab(); @@ -57,8 +57,8 @@ function test3(win) } win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); - setFinishedCallback(function(result, exception) { - ok(!result, "No database"); + setFinishedCallback(function(isIDBDatabase, exception) { + ok(!isIDBDatabase, "No database"); is(exception, "InvalidStateError", "Correct exception"); win.gBrowser.removeCurrentTab(); diff --git a/dom/indexedDB/test/head.js b/dom/indexedDB/test/head.js index 9021c3e2c3a8..898a40e8f7b3 100644 --- a/dom/indexedDB/test/head.js +++ b/dom/indexedDB/test/head.js @@ -92,13 +92,16 @@ function setFinishedCallback(callback, win) if (!win) { win = window; } - let testPage = win.gBrowser.selectedBrowser.contentWindow.wrappedJSObject; - testPage.testFinishedCallback = function(result, exception) { - setTimeout(function() { - info("got finished callback"); - callback(result, exception); - }, 0); - } + ContentTask.spawn(win.gBrowser.selectedBrowser, null, function*() { + return yield new Promise(resolve => { + content.wrappedJSObject.testFinishedCallback = (result, exception) => { + info("got finished callback"); + resolve({result, exception}); + }; + }); + }).then(({result, exception}) => { + callback(result, exception); + }); } function dispatchEvent(eventName)