summaryrefslogtreecommitdiffstats
path: root/toolkit/forgetaboutsite/test
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-24 19:23:04 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-24 19:23:04 +0200
commit846bbb9930e6588516a28f58b2f80c2b04e1b372 (patch)
treeac06dde167b320f52677d5f1416981e9f88d21f0 /toolkit/forgetaboutsite/test
parentbccb9c1708f007ada1ea8c4879db88a587f0a450 (diff)
downloadUXP-846bbb9930e6588516a28f58b2f80c2b04e1b372.tar
UXP-846bbb9930e6588516a28f58b2f80c2b04e1b372.tar.gz
UXP-846bbb9930e6588516a28f58b2f80c2b04e1b372.tar.lz
UXP-846bbb9930e6588516a28f58b2f80c2b04e1b372.tar.xz
UXP-846bbb9930e6588516a28f58b2f80c2b04e1b372.zip
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
Diffstat (limited to 'toolkit/forgetaboutsite/test')
-rw-r--r--toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js9
-rw-r--r--toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js68
2 files changed, 36 insertions, 41 deletions
diff --git a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
index ec0a70228..ca0d394c3 100644
--- a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
+++ b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
@@ -37,7 +37,7 @@ function setTestPluginEnabledState(newEnabledState, plugin) {
});
}
-add_task(function* setup() {
+add_task(function* () {
var tags = pluginHost.getPluginTags();
// Find the test plugin
@@ -50,12 +50,9 @@ add_task(function* setup() {
}
if (!pluginTag) {
ok(false, "Test Plug-in not available, can't run test");
- finish();
+ return;
}
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, pluginTag);
-});
-
-add_task(function* () {
yield BrowserTestUtils.openNewForegroundTab(gBrowser, testURL);
// Set data for the plugin after the page load.
@@ -87,5 +84,3 @@ add_task(function* () {
gBrowser.removeCurrentTab();
});
-
-
diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
index f6ace1e64..d2db95e6a 100644
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -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);