diff options
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_asyncBlocklistLoad.js')
-rw-r--r-- | toolkit/mozapps/webextensions/test/xpcshell/test_asyncBlocklistLoad.js | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_asyncBlocklistLoad.js b/toolkit/mozapps/webextensions/test/xpcshell/test_asyncBlocklistLoad.js deleted file mode 100644 index 38e563979..000000000 --- a/toolkit/mozapps/webextensions/test/xpcshell/test_asyncBlocklistLoad.js +++ /dev/null @@ -1,44 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function run_test() { - run_next_test(); -} - -add_task(function* () { - let blocklist = AM_Cc["@mozilla.org/extensions/blocklist;1"]. - getService().wrappedJSObject; - let scope = Components.utils.import("resource://gre/modules/osfile.jsm"); - - // sync -> async - blocklist._loadBlocklist(); - do_check_true(blocklist._isBlocklistLoaded()); - yield blocklist._preloadBlocklist(); - do_check_false(blocklist._isBlocklistPreloaded()); - blocklist._clear(); - - // async -> sync - yield blocklist._preloadBlocklist(); - do_check_false(blocklist._isBlocklistLoaded()); - do_check_true(blocklist._isBlocklistPreloaded()); - blocklist._loadBlocklist(); - do_check_true(blocklist._isBlocklistLoaded()); - do_check_false(blocklist._isBlocklistPreloaded()); - blocklist._clear(); - - // async -> sync -> async - let read = scope.OS.File.read; - scope.OS.File.read = function(...args) { - return new Promise((resolve, reject) => { - do_execute_soon(() => { - blocklist._loadBlocklist(); - resolve(read(...args)); - }); - }); - } - - yield blocklist._preloadBlocklist(); - do_check_true(blocklist._isBlocklistLoaded()); - do_check_false(blocklist._isBlocklistPreloaded()); -}); |