Backed out changeset 80bcfbcc44ea (bug 1511303) for bc failures on browser_alltabslistener.js. CLOSED TREE

This commit is contained in:
Brindusan Cristian 2018-12-18 18:39:39 +02:00
parent 8f375ba526
commit d2dd4a1581
3 changed files with 17 additions and 30 deletions

View File

@ -69,7 +69,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
info("Reload tracking cookies tab");
securityChanged = waitForSecurityChange(2, tabbrowser.ownerGlobal);
securityChanged = waitForSecurityChange(3, tabbrowser.ownerGlobal);
tabbrowser.reload();
await securityChanged;
@ -78,7 +78,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
await BrowserTestUtils.waitForEvent(ContentBlocking.animatedIcon, "animationend");
info("Reload tracking tab");
securityChanged = waitForSecurityChange(3, tabbrowser.ownerGlobal);
securityChanged = waitForSecurityChange(4, tabbrowser.ownerGlobal);
tabbrowser.selectedTab = trackingTab;
tabbrowser.reload();
await securityChanged;

View File

@ -135,13 +135,8 @@ function testTrackingPage(window) {
ok(!hidden("#identity-popup-content-blocking-category-tracking-protection"),
"Showing trackers category");
if (gTrackingPageURL == COOKIE_PAGE) {
ok(!hidden("#identity-popup-content-blocking-category-cookies"),
"Showing cookie restrictions category");
} else {
ok(hidden("#identity-popup-content-blocking-category-cookies"),
"Not showing cookie restrictions category");
}
ok(!hidden("#identity-popup-content-blocking-category-cookies"),
"Showing cookie restrictions category");
}
function testTrackingPageUnblocked(blockedByTP, window) {
@ -163,13 +158,8 @@ function testTrackingPageUnblocked(blockedByTP, window) {
ok(!hidden("#identity-popup-content-blocking-category-tracking-protection"),
"Showing trackers category");
if (gTrackingPageURL == COOKIE_PAGE) {
ok(!hidden("#identity-popup-content-blocking-category-cookies"),
"Showing cookie restrictions category");
} else {
ok(hidden("#identity-popup-content-blocking-category-cookies"),
"Not showing cookie restrictions category");
}
ok(!hidden("#identity-popup-content-blocking-category-cookies"),
"Showing cookie restrictions category");
}
async function testContentBlocking(tab) {

View File

@ -38,25 +38,22 @@ ServiceWorkerInterceptController::ShouldPrepareForIntercept(
return NS_OK;
}
nsCOMPtr<nsIPrincipal> principal = BasePrincipal::CreateCodebasePrincipal(
aURI, loadInfo->GetOriginAttributes());
// First check with the ServiceWorkerManager for a matching service worker.
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (!swm || !swm->IsAvailable(principal, aURI)) {
return NS_OK;
}
// Then check to see if we are allowed to control the window.
// It is important to check for the availability of the service worker first
// to avoid showing warnings about the use of third-party cookies in the UI
// unnecessarily when no service worker is being accessed.
if (nsContentUtils::StorageAllowedForChannel(aChannel) !=
nsContentUtils::StorageAccess::eAllow) {
return NS_OK;
}
*aShouldIntercept = true;
nsCOMPtr<nsIPrincipal> principal = BasePrincipal::CreateCodebasePrincipal(
aURI, loadInfo->GetOriginAttributes());
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (!swm) {
return NS_OK;
}
// We're allowed to control a window, so check with the ServiceWorkerManager
// for a matching service worker.
*aShouldIntercept = swm->IsAvailable(principal, aURI);
return NS_OK;
}