Backed out changeset 3956dbb7e65d (bug 1511303) for browser_ignore_same_page_navigation.js failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2018-12-19 00:57:37 +02:00
Родитель 36e0a3f5a9
Коммит d7c417565a
4 изменённых файлов: 23 добавлений и 30 удалений

Просмотреть файл

@ -151,6 +151,7 @@ function startTest1() {
gAllNotifications = [
"onStateChange",
"onSecurityChange",
"onLocationChange",
"onSecurityChange",
"onStateChange",
@ -163,6 +164,7 @@ function startTest2() {
info("\nTest 2");
gAllNotifications = [
"onStateChange",
"onSecurityChange",
"onLocationChange",
"onSecurityChange",
"onStateChange",
@ -175,6 +177,7 @@ function startTest3() {
info("\nTest 3");
gAllNotifications = [
"onStateChange",
"onSecurityChange",
"onLocationChange",
"onSecurityChange",
"onStateChange",
@ -187,6 +190,7 @@ function startTest4() {
info("\nTest 4");
gAllNotifications = [
"onStateChange",
"onSecurityChange",
"onLocationChange",
"onSecurityChange",
"onStateChange",
@ -207,6 +211,7 @@ function startTest5() {
gAllNotifications = [
"onStateChange",
"onSecurityChange",
"onLocationChange",
"onSecurityChange",
"onStateChange",
@ -219,6 +224,7 @@ function startTest6() {
info("\nTest 6");
gAllNotifications = [
"onStateChange",
"onSecurityChange",
"onLocationChange",
"onSecurityChange",
"onStateChange",

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;
}