mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
moebius#30 and #37: ForgetAboutSite.jsm - promise - serialize vs. parallel + a comment
https://github.com/MoonchildProductions/moebius/pull/30 https://github.com/MoonchildProductions/moebius/pull/37
This commit is contained in:
parent
41ad5496ae
commit
82205cf721
7 changed files with 179 additions and 156 deletions
|
|
@ -257,7 +257,7 @@ function* test_history_cleared_with_direct_match()
|
|||
do_check_false(yield promiseIsURIVisited(TEST_URI));
|
||||
yield PlacesTestUtils.addVisits(TEST_URI);
|
||||
do_check_true(yield promiseIsURIVisited(TEST_URI));
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
do_check_false(yield promiseIsURIVisited(TEST_URI));
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ function* test_history_cleared_with_subdomain()
|
|||
do_check_false(yield promiseIsURIVisited(TEST_URI));
|
||||
yield PlacesTestUtils.addVisits(TEST_URI);
|
||||
do_check_true(yield promiseIsURIVisited(TEST_URI));
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
do_check_false(yield promiseIsURIVisited(TEST_URI));
|
||||
}
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ function* test_history_not_cleared_with_uri_contains_domain()
|
|||
do_check_false(yield promiseIsURIVisited(TEST_URI));
|
||||
yield PlacesTestUtils.addVisits(TEST_URI);
|
||||
do_check_true(yield promiseIsURIVisited(TEST_URI));
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
do_check_true(yield promiseIsURIVisited(TEST_URI));
|
||||
|
||||
// Clear history since we left something there from this test.
|
||||
|
|
@ -285,52 +285,52 @@ function* test_history_not_cleared_with_uri_contains_domain()
|
|||
}
|
||||
|
||||
// Cookie Service
|
||||
function test_cookie_cleared_with_direct_match()
|
||||
function* test_cookie_cleared_with_direct_match()
|
||||
{
|
||||
const TEST_DOMAIN = "mozilla.org";
|
||||
add_cookie(TEST_DOMAIN);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_cookie_exists(TEST_DOMAIN, false);
|
||||
}
|
||||
|
||||
function test_cookie_cleared_with_subdomain()
|
||||
function* test_cookie_cleared_with_subdomain()
|
||||
{
|
||||
const TEST_DOMAIN = "www.mozilla.org";
|
||||
add_cookie(TEST_DOMAIN);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_cookie_exists(TEST_DOMAIN, false);
|
||||
}
|
||||
|
||||
function test_cookie_not_cleared_with_uri_contains_domain()
|
||||
function* test_cookie_not_cleared_with_uri_contains_domain()
|
||||
{
|
||||
const TEST_DOMAIN = "ilovemozilla.org";
|
||||
add_cookie(TEST_DOMAIN);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_cookie_exists(TEST_DOMAIN, true);
|
||||
}
|
||||
|
||||
// Login Manager
|
||||
function test_login_manager_disabled_hosts_cleared_with_direct_match()
|
||||
function* test_login_manager_disabled_hosts_cleared_with_direct_match()
|
||||
{
|
||||
const TEST_HOST = "http://mozilla.org";
|
||||
add_disabled_host(TEST_HOST);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_disabled_host(TEST_HOST, false);
|
||||
}
|
||||
|
||||
function test_login_manager_disabled_hosts_cleared_with_subdomain()
|
||||
function* test_login_manager_disabled_hosts_cleared_with_subdomain()
|
||||
{
|
||||
const TEST_HOST = "http://www.mozilla.org";
|
||||
add_disabled_host(TEST_HOST);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_disabled_host(TEST_HOST, false);
|
||||
}
|
||||
|
||||
function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain()
|
||||
function* test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain()
|
||||
{
|
||||
const TEST_HOST = "http://ilovemozilla.org";
|
||||
add_disabled_host(TEST_HOST);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_disabled_host(TEST_HOST, true);
|
||||
|
||||
// Reset state
|
||||
|
|
@ -340,27 +340,27 @@ function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain(
|
|||
check_disabled_host(TEST_HOST, false);
|
||||
}
|
||||
|
||||
function test_login_manager_logins_cleared_with_direct_match()
|
||||
function* test_login_manager_logins_cleared_with_direct_match()
|
||||
{
|
||||
const TEST_HOST = "http://mozilla.org";
|
||||
add_login(TEST_HOST);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_login_exists(TEST_HOST, false);
|
||||
}
|
||||
|
||||
function test_login_manager_logins_cleared_with_subdomain()
|
||||
function* test_login_manager_logins_cleared_with_subdomain()
|
||||
{
|
||||
const TEST_HOST = "http://www.mozilla.org";
|
||||
add_login(TEST_HOST);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_login_exists(TEST_HOST, false);
|
||||
}
|
||||
|
||||
function test_login_manager_logins_not_cleared_with_uri_contains_domain()
|
||||
function* test_login_manager_logins_not_cleared_with_uri_contains_domain()
|
||||
{
|
||||
const TEST_HOST = "http://ilovemozilla.org";
|
||||
add_login(TEST_HOST);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_login_exists(TEST_HOST, true);
|
||||
|
||||
let lm = Cc["@mozilla.org/login-manager;1"].
|
||||
|
|
@ -370,27 +370,27 @@ function test_login_manager_logins_not_cleared_with_uri_contains_domain()
|
|||
}
|
||||
|
||||
// Permission Manager
|
||||
function test_permission_manager_cleared_with_direct_match()
|
||||
function* test_permission_manager_cleared_with_direct_match()
|
||||
{
|
||||
const TEST_URI = uri("http://mozilla.org");
|
||||
add_permission(TEST_URI);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_permission_exists(TEST_URI, false);
|
||||
}
|
||||
|
||||
function test_permission_manager_cleared_with_subdomain()
|
||||
function* test_permission_manager_cleared_with_subdomain()
|
||||
{
|
||||
const TEST_URI = uri("http://www.mozilla.org");
|
||||
add_permission(TEST_URI);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_permission_exists(TEST_URI, false);
|
||||
}
|
||||
|
||||
function test_permission_manager_not_cleared_with_uri_contains_domain()
|
||||
function* test_permission_manager_not_cleared_with_uri_contains_domain()
|
||||
{
|
||||
const TEST_URI = uri("http://ilovemozilla.org");
|
||||
add_permission(TEST_URI);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
check_permission_exists(TEST_URI, true);
|
||||
|
||||
// Reset state
|
||||
|
|
@ -427,7 +427,7 @@ function* test_content_preferences_cleared_with_direct_match()
|
|||
do_check_false(yield preference_exists(TEST_URI));
|
||||
yield add_preference(TEST_URI);
|
||||
do_check_true(yield preference_exists(TEST_URI));
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield waitForPurgeNotification();
|
||||
do_check_false(yield preference_exists(TEST_URI));
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ function* test_content_preferences_cleared_with_subdomain()
|
|||
do_check_false(yield preference_exists(TEST_URI));
|
||||
yield add_preference(TEST_URI);
|
||||
do_check_true(yield preference_exists(TEST_URI));
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield waitForPurgeNotification();
|
||||
do_check_false(yield preference_exists(TEST_URI));
|
||||
}
|
||||
|
|
@ -449,12 +449,12 @@ function* test_content_preferences_not_cleared_with_uri_contains_domain()
|
|||
do_check_false(yield preference_exists(TEST_URI));
|
||||
yield add_preference(TEST_URI);
|
||||
do_check_true(yield preference_exists(TEST_URI));
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield waitForPurgeNotification();
|
||||
do_check_true(yield preference_exists(TEST_URI));
|
||||
|
||||
// Reset state
|
||||
ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
|
||||
yield waitForPurgeNotification();
|
||||
do_check_false(yield preference_exists(TEST_URI));
|
||||
}
|
||||
|
|
@ -535,7 +535,7 @@ function* test_push_cleared()
|
|||
}
|
||||
|
||||
// Cache
|
||||
function test_cache_cleared()
|
||||
function* test_cache_cleared()
|
||||
{
|
||||
// Because this test is asynchronous, it should be the last test
|
||||
do_check_true(tests[tests.length - 1] == arguments.callee);
|
||||
|
|
@ -557,7 +557,7 @@ function test_cache_cleared()
|
|||
}
|
||||
};
|
||||
os.addObserver(observer, "cacheservice:empty-cache", false);
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
do_test_pending();
|
||||
}
|
||||
|
||||
|
|
@ -588,7 +588,7 @@ function* test_storage_cleared()
|
|||
do_check_eq(storage.getItem("test"), "value" + i);
|
||||
}
|
||||
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
yield waitForPurgeNotification();
|
||||
|
||||
do_check_eq(s[0].getItem("test"), null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue