mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1102518 - Test for disabling tracking protection. r=mfinkle
This commit is contained in:
parent
ee604e506b
commit
7837c60c40
@ -15,7 +15,7 @@ function ok(passed, text) {
|
||||
do_report_result(passed, text, Components.stack.caller, false);
|
||||
}
|
||||
|
||||
function promiseLoadEvent(browser, url, eventType="load") {
|
||||
function promiseLoadEvent(browser, url, eventType="load", runBeforeLoad) {
|
||||
return new Promise((resolve, reject) => {
|
||||
do_print("Wait browser event: " + eventType);
|
||||
|
||||
@ -30,7 +30,11 @@ function promiseLoadEvent(browser, url, eventType="load") {
|
||||
resolve(event);
|
||||
}
|
||||
|
||||
browser.addEventListener(eventType, handle, true, true);
|
||||
browser.addEventListener(eventType, handle, true);
|
||||
|
||||
if (runBeforeLoad) {
|
||||
runBeforeLoad();
|
||||
}
|
||||
if (url) {
|
||||
browser.loadURI(url);
|
||||
}
|
||||
@ -122,6 +126,19 @@ add_task(function* () {
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
Messaging.sendRequest({ type: "Test:Expected", expected: "tracking_content_blocked" });
|
||||
|
||||
// Simulate a click on the "Disable protection" button in the site identity popup.
|
||||
// We need to wait for a "load" event because "Session:Reload" will cause a full page reload.
|
||||
yield promiseLoadEvent(browser, undefined, undefined, () => {
|
||||
Services.obs.notifyObservers(null, "Session:Reload", "{\"allowContent\":true,\"contentType\":\"tracking\"}");
|
||||
});
|
||||
Messaging.sendRequest({ type: "Test:Expected", expected: "tracking_content_loaded" });
|
||||
|
||||
// Simulate a click on the "Enable protection" button in the site identity popup.
|
||||
yield promiseLoadEvent(browser, undefined, undefined, () => {
|
||||
Services.obs.notifyObservers(null, "Session:Reload", "{\"allowContent\":false,\"contentType\":\"tracking\"}");
|
||||
});
|
||||
Messaging.sendRequest({ type: "Test:Expected", expected: "tracking_content_blocked" });
|
||||
|
||||
// Disable Tracking Protection
|
||||
Services.prefs.setBoolPref(PREF, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user