Backed out 4 changesets (bug 1429169) for failing browser chrome at browser/components/enterprisepolicies/tests/browser/browser_policy_cookie_settings.js on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Fri, 30 Mar 2018 03:35:01 +0300
changeset 775170 deee0d19a09095d3c5b8f833ae81c16f3870be0b
parent 775169 5deb310542a943a654533cbfb593f62587647b09
child 775171 35db8e10d775fc8b6740f17a5d10d0d532c4ccf6
push id104638
push userbmo:jlorenzo@mozilla.com
push dateFri, 30 Mar 2018 13:27:33 +0000
bugs1429169
milestone61.0a1
backs outa49df97d2ad98b4bfd97e60000b2b2cc1c1663cf
437f677d38080a3045a29370ed6dd6e136ffc916
2f744fd3d77c9329cb23eee8a795ecd2316ea095
dd305f45f7469391334fd7e4955bbb9d49c0d5b1
Backed out 4 changesets (bug 1429169) for failing browser chrome at browser/components/enterprisepolicies/tests/browser/browser_policy_cookie_settings.js on a CLOSED TREE Backed out changeset a49df97d2ad9 (bug 1429169) Backed out changeset 437f677d3808 (bug 1429169) Backed out changeset 2f744fd3d77c (bug 1429169) Backed out changeset dd305f45f746 (bug 1429169)
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/schemas/policies-schema.json
browser/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm
browser/components/enterprisepolicies/tests/browser/browser.ini
browser/components/enterprisepolicies/tests/browser/browser_policy_cookie_settings.js
browser/components/enterprisepolicies/tests/browser/browser_policy_disable_flash_plugin.js
browser/components/enterprisepolicies/tests/browser/browser_policy_disable_popup_blocker.js
browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
netwerk/cookie/nsCookieService.cpp
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -113,58 +113,16 @@ var Policies = {
       if (param.Block) {
         const hosts = param.Block.map(uri => uri.host).sort().join("\n");
         runOncePerModification("clearCookiesForBlockedHosts", hosts, () => {
           for (let blocked of param.Block) {
             Services.cookies.removeCookiesWithOriginAttributes("{}", blocked.host);
           }
         });
       }
-
-      if (param.Default !== undefined ||
-          param.AcceptThirdParty !== undefined ||
-          param.Locked) {
-        const ACCEPT_COOKIES = 0;
-        const REJECT_THIRD_PARTY_COOKIES = 1;
-        const REJECT_ALL_COOKIES = 2;
-        const REJECT_UNVISITED_THIRD_PARTY = 3;
-
-        let newCookieBehavior = ACCEPT_COOKIES;
-        if (param.Default !== undefined && !param.Default) {
-          newCookieBehavior = REJECT_ALL_COOKIES;
-        } else if (param.AcceptThirdParty) {
-          if (param.AcceptThirdParty == "none") {
-            newCookieBehavior = REJECT_THIRD_PARTY_COOKIES;
-          } else if (param.AcceptThirdParty == "from-visited") {
-            newCookieBehavior = REJECT_UNVISITED_THIRD_PARTY;
-          }
-        }
-
-        if (param.Locked) {
-          setAndLockPref("network.cookie.cookieBehavior", newCookieBehavior);
-        } else {
-          setDefaultPref("network.cookie.cookieBehavior", newCookieBehavior);
-        }
-      }
-
-      const KEEP_COOKIES_UNTIL_EXPIRATION = 0;
-      const KEEP_COOKIES_UNTIL_END_OF_SESSION = 2;
-
-      if (param.ExpireAtSessionEnd !== undefined || param.Locked) {
-        let newLifetimePolicy = KEEP_COOKIES_UNTIL_EXPIRATION;
-        if (param.ExpireAtSessionEnd) {
-          newLifetimePolicy = KEEP_COOKIES_UNTIL_END_OF_SESSION;
-        }
-
-        if (param.Locked) {
-          setAndLockPref("network.cookie.lifetimePolicy", newLifetimePolicy);
-        } else {
-          setDefaultPref("network.cookie.lifetimePolicy", newLifetimePolicy);
-        }
-      }
     }
   },
 
   "CreateMasterPassword": {
     onBeforeUIStartup(manager, param) {
       if (!param) {
         manager.disallowFeature("createMasterPassword");
       }
@@ -386,34 +344,16 @@ var Policies = {
         }
       }
     }
   },
 
   "FlashPlugin": {
     onBeforeUIStartup(manager, param) {
       addAllowDenyPermissions("plugin:flash", param.Allow, param.Block);
-
-      const FLASH_NEVER_ACTIVATE = 0;
-      const FLASH_ASK_TO_ACTIVATE = 1;
-      const FLASH_ALWAYS_ACTIVATE = 2;
-
-      let flashPrefVal;
-      if (param.Default === undefined) {
-        flashPrefVal = FLASH_ASK_TO_ACTIVATE;
-      } else if (param.Default) {
-        flashPrefVal = FLASH_ALWAYS_ACTIVATE;
-      } else {
-        flashPrefVal = FLASH_NEVER_ACTIVATE;
-      }
-      if (param.Locked) {
-        setAndLockPref("plugin.state.flash", flashPrefVal);
-      } else if (param.Default !== undefined) {
-        setDefaultPref("plugin.state.flash", flashPrefVal);
-      }
     }
   },
 
   "Homepage": {
     onBeforeUIStartup(manager, param) {
       // |homepages| will be a string containing a pipe-separated ('|') list of
       // URLs because that is what the "Home page" section of about:preferences
       // (and therefore what the pref |browser.startup.homepage|) accepts.
@@ -451,29 +391,19 @@ var Policies = {
   "NoDefaultBookmarks": {
     onProfileAfterChange(manager, param) {
       if (param) {
         manager.disallowFeature("defaultBookmarks");
       }
     }
   },
 
-  "PopupBlocking": {
+  "Popups": {
     onBeforeUIStartup(manager, param) {
       addAllowDenyPermissions("popup", param.Allow, null);
-
-      if (param.Locked) {
-        let blockValue = true;
-        if (param.Default !== undefined && !param.Default) {
-          blockValue = false;
-        }
-        setAndLockPref("dom.disable_open_during_load", blockValue);
-      } else if (param.Default !== undefined) {
-        setDefaultPref("dom.disable_open_during_load", !!param.Default);
-      }
     }
   },
 
   "Proxy": {
     onBeforeAddons(manager, param) {
       if (param.Locked) {
         manager.disallowFeature("changeProxySettings");
         ProxyPolicies.configureProxySettings(param, setAndLockPref);
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -83,33 +83,16 @@
           }
         },
 
         "Block": {
           "type": "array",
           "items": {
             "type": "origin"
           }
-        },
-
-        "Default": {
-          "type": "boolean"
-        },
-
-        "AcceptThirdParty": {
-          "type": "string",
-          "enum": ["all", "none", "from-visited"]
-        },
-
-        "ExpireAtSessionEnd": {
-          "type": "boolean"
-        },
-
-        "Locked": {
-          "type": "boolean"
         }
       }
     },
 
     "CreateMasterPassword": {
       "description": "If false, removes access to create a master password.",
       "first_available": "60.0",
 
@@ -288,24 +271,16 @@
           }
         },
 
         "Block": {
           "type": "array",
           "items": {
             "type": "origin"
           }
-        },
-
-        "Default": {
-          "type": "boolean"
-        },
-
-        "Locked": {
-          "type": "boolean"
         }
       }
     },
 
     "Homepage": {
       "description": "Set and optionally lock the homepage.",
       "first_available": "60.0",
       "enterprise_only": true,
@@ -345,35 +320,27 @@
 
     "NoDefaultBookmarks": {
       "description": "Don't create the default bookmarks bundled with Firefox, nor the Smart Bookmarks (Most Visited, Recent Tags). Note: this policy is only effective if used before the first run of the profile.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
-    "PopupBlocking": {
+    "Popups": {
       "description": "Allow or deny popup usage.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
         "Allow": {
           "type": "array",
           "items": {
             "type": "origin"
           }
-        },
-
-        "Default": {
-          "type": "boolean"
-        },
-
-        "Locked": {
-          "type": "boolean"
         }
       }
     },
 
     "Proxy": {
       "description": "Configure Proxy settings.",
       "first_available": "60.0",
 
--- a/browser/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm
+++ b/browser/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm
@@ -130,20 +130,20 @@ var PoliciesPrefTracker = {
     let defaults = new Preferences({defaultBranch: true});
 
     for (let [prefName, stored] of this._originalValues) {
       // If a pref was used through setDefaultPref instead
       // of setAndLockPref, it wasn't locked, but calling
       // unlockPref is harmless
       Preferences.unlock(prefName);
 
-      if (stored.originalDefaultValue !== undefined) {
+      if (stored.originalDefaultValue) {
         defaults.set(prefName, stored.originalDefaultValue);
       }
 
-      if (stored.originalUserValue !== undefined) {
+      if (stored.originalUserValue) {
         Preferences.set(prefName, stored.originalUserValue);
       }
     }
 
     this._originalValues.clear();
   },
 };
--- a/browser/components/enterprisepolicies/tests/browser/browser.ini
+++ b/browser/components/enterprisepolicies/tests/browser/browser.ini
@@ -20,25 +20,22 @@ support-files =
 [browser_policy_app_update.js]
 [browser_policy_block_about_addons.js]
 [browser_policy_block_about_config.js]
 [browser_policy_block_about_profiles.js]
 [browser_policy_block_about_support.js]
 [browser_policy_block_set_desktop_background.js]
 [browser_policy_bookmarks.js]
 [browser_policy_clear_blocked_cookies.js]
-[browser_policy_cookie_settings.js]
 [browser_policy_default_browser_check.js]
 [browser_policy_disable_feedback_commands.js]
-[browser_policy_disable_flash_plugin.js]
 [browser_policy_disable_fxaccounts.js]
 [browser_policy_disable_masterpassword.js]
 [browser_policy_disable_pdfjs.js]
 [browser_policy_disable_pocket.js]
-[browser_policy_disable_popup_blocker.js]
 [browser_policy_disable_privatebrowsing.js]
 [browser_policy_disable_safemode.js]
 [browser_policy_disable_shield.js]
 [browser_policy_disable_telemetry.js]
 [browser_policy_display_bookmarks.js]
 [browser_policy_display_menu.js]
 [browser_policy_extensions.js]
 [browser_policy_proxy.js]
deleted file mode 100644
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_cookie_settings.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm", {});
-XPCOMUtils.defineLazyServiceGetter(Services, "cookies",
-                                   "@mozilla.org/cookieService;1",
-                                   "nsICookieService");
-XPCOMUtils.defineLazyServiceGetter(Services, "cookiemgr",
-                                   "@mozilla.org/cookiemanager;1",
-                                   "nsICookieManager");
-
-function restore_prefs() {
-  Services.prefs.clearUserPref("network.cookie.cookieBehavior");
-  Services.prefs.clearUserPref("network.cookie.lifetimePolicy");
-}
-registerCleanupFunction(restore_prefs);
-
-async function fake_profile_change() {
-  await new Promise(resolve => {
-    Services.obs.addObserver(function waitForDBClose() {
-      Services.obs.removeObserver(waitForDBClose, "cookie-db-closed");
-      resolve();
-    }, "cookie-db-closed");
-    Services.cookies.QueryInterface(Ci.nsIObserver).observe(null, "profile-before-change", "shutdown-persist");
-  });
-  await new Promise(resolve => {
-    Services.obs.addObserver(function waitForDBOpen() {
-      Services.obs.removeObserver(waitForDBOpen, "cookie-db-read");
-      resolve();
-    }, "cookie-db-read");
-    Services.cookies.QueryInterface(Ci.nsIObserver).observe(null, "profile-do-change", "");
-  });
-}
-
-async function test_cookie_settings({
-                                      cookiesEnabled,
-                                      thirdPartyCookiesEnabled,
-                                      cookiesExpireAfterSession,
-                                      cookieSettingsLocked
-                                    }) {
-  let firstPartyURI = NetUtil.newURI("http://example.com/");
-  let thirdPartyURI = NetUtil.newURI("http://example.org/");
-  let channel = NetUtil.newChannel({uri: firstPartyURI,
-                                    loadUsingSystemPrincipal: true});
-  channel.QueryInterface(Ci.nsIHttpChannelInternal).forceAllowThirdPartyCookie = true;
-  Services.cookies.removeAll();
-  Services.cookies.setCookieString(firstPartyURI, null, "key=value", channel);
-  Services.cookies.setCookieString(thirdPartyURI, null, "key=value", channel);
-
-  let expectedFirstPartyCookies = 1;
-  let expectedThirdPartyCookies = 1;
-  if (!cookiesEnabled) {
-    expectedFirstPartyCookies = 0;
-  }
-  if (!cookiesEnabled || !thirdPartyCookiesEnabled) {
-    expectedThirdPartyCookies = 0;
-  }
-  is(Services.cookiemgr.countCookiesFromHost(firstPartyURI.host),
-     expectedFirstPartyCookies,
-     "Number of first-party cookies should match expected");
-  is(Services.cookiemgr.countCookiesFromHost(thirdPartyURI.host),
-     expectedThirdPartyCookies,
-     "Number of third-party cookies should match expected");
-
-  // Add a cookie so we can check if it persists past the end of the session
-  // but, first remove existing cookies set by this host to put us in a known state
-  Services.cookies.removeAll();
-  Services.cookies.setCookieString(firstPartyURI, null, "key=value; max-age=1000", channel);
-
-  await fake_profile_change();
-
-  // Now check if the cookie persisted or not
-  let expectedCookieCount = 1;
-  if (cookiesExpireAfterSession || !cookiesEnabled) {
-    expectedCookieCount = 0;
-  }
-  is(Services.cookies.countCookiesFromHost(firstPartyURI.host), expectedCookieCount,
-     "Number of cookies was not what expected after restarting session");
-
-  is(Services.prefs.prefIsLocked("network.cookie.cookieBehavior"), cookieSettingsLocked,
-     "Cookie behavior pref lock status should be what is expected");
-  is(Services.prefs.prefIsLocked("network.cookie.lifetimePolicy"), cookieSettingsLocked,
-     "Cookie lifetime pref lock status should be what is expected");
-}
-
-add_task(async function test_initial_state() {
-  await test_cookie_settings({
-    cookiesEnabled: true,
-    thirdPartyCookiesEnabled: true,
-    cookiesExpireAfterSession: false,
-    cookieSettingsLocked: false
-  });
-  restore_prefs();
-});
-
-add_task(async function test_undefined_unlocked() {
-  Services.prefs.setIntPref("network.cookie.cookieBehavior", 3);
-  Services.prefs.setIntPref("network.cookie.lifetimePolicy", 2);
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-      }
-    }
-  });
-  is(Services.prefs.getIntPref("network.cookie.cookieBehavior", undefined), 3,
-     "An empty cookie policy should not have changed the cookieBehavior preference");
-  is(Services.prefs.getIntPref("network.cookie.lifetimePolicy", undefined), 2,
-     "An empty cookie policy should not have changed the lifetimePolicy preference");
-  restore_prefs();
-});
-
-add_task(async function test_disabled() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "Default": false
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: false,
-    thirdPartyCookiesEnabled: true,
-    cookiesExpireAfterSession: false,
-    cookieSettingsLocked: false
-  });
-  restore_prefs();
-});
-
-add_task(async function test_third_party_disabled() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "AcceptThirdParty": "none"
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: true,
-    thirdPartyCookiesEnabled: false,
-    cookiesExpireAfterSession: false,
-    cookieSettingsLocked: false
-  });
-  restore_prefs();
-});
-
-add_task(async function test_disabled_and_third_party_disabled() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "Default": false,
-        "AcceptThirdParty": "none"
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: false,
-    thirdPartyCookiesEnabled: false,
-    cookiesExpireAfterSession: false,
-    cookieSettingsLocked: false
-  });
-  restore_prefs();
-});
-
-add_task(async function test_disabled_and_third_party_disabled_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "Default": false,
-        "AcceptThirdParty": "none",
-        "Locked": true
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: false,
-    thirdPartyCookiesEnabled: false,
-    cookiesExpireAfterSession: false,
-    cookieSettingsLocked: true
-  });
-  restore_prefs();
-});
-
-add_task(async function test_undefined_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "Locked": true
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: true,
-    thirdPartyCookiesEnabled: true,
-    cookiesExpireAfterSession: false,
-    cookieSettingsLocked: true
-  });
-  restore_prefs();
-});
-
-add_task(async function test_cookie_expire() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "ExpireAtSessionEnd": true
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: true,
-    thirdPartyCookiesEnabled: true,
-    cookiesExpireAfterSession: true,
-    cookieSettingsLocked: false
-  });
-  restore_prefs();
-});
-
-add_task(async function test_cookie_expire_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "ExpireAtSessionEnd": true,
-        "Locked": true
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: true,
-    thirdPartyCookiesEnabled: true,
-    cookiesExpireAfterSession: true,
-    cookieSettingsLocked: true
-  });
-  restore_prefs();
-});
-
-add_task(async function test_disabled_cookie_expire_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "Cookies": {
-        "Default": false,
-        "AcceptThirdParty": "none",
-        "ExpireAtSessionEnd": true,
-        "Locked": true
-      }
-    }
-  });
-
-  await test_cookie_settings({
-    cookiesEnabled: false,
-    thirdPartyCookiesEnabled: false,
-    cookiesExpireAfterSession: true,
-    cookieSettingsLocked: true
-  });
-  restore_prefs();
-});
deleted file mode 100644
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_flash_plugin.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const labelTextAlwaysActivate = "Always Activate";
-const labelTextAskToActivate = "Ask to Activate";
-const labelTextNeverActivate = "Never Activate";
-
-function restore_prefs() {
-  Services.prefs.clearUserPref("plugin.state.flash");
-}
-registerCleanupFunction(restore_prefs);
-
-async function test_flash_status({expectedLabelText, locked}) {
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
-  await BrowserOpenAddonsMgr("addons://list/plugin");
-  await ContentTask.spawn(tab.linkedBrowser, {aExpectedLabelText: expectedLabelText, aLocked: locked}, async function({aExpectedLabelText, aLocked}) {
-    let list = content.document.getElementById("addon-list");
-    let flashEntry = list.getElementsByAttribute("name", "Shockwave Flash")[0];
-    let dropDown = content.document.getAnonymousElementByAttribute(flashEntry, "anonid", "state-menulist");
-
-    is(dropDown.label, aExpectedLabelText,
-       "Flash setting text should match the expected value");
-    is(dropDown.disabled, aLocked,
-       "Flash controls disabled state should match policy locked state");
-  });
-  BrowserTestUtils.removeTab(tab);
-
-  is(Services.prefs.prefIsLocked("plugin.state.flash"), locked,
-     "Flash pref lock state should match policy lock state");
-}
-
-add_task(async function test_enabled() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "FlashPlugin": {
-        "Default": true
-      }
-    }
-  });
-
-  await test_flash_status({
-    expectedLabelText: labelTextAlwaysActivate,
-    locked: false
-  });
-
-  restore_prefs();
-});
-
-add_task(async function test_enabled_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "FlashPlugin": {
-        "Default": true,
-        "Locked": true
-      }
-    }
-  });
-
-  await test_flash_status({
-    expectedLabelText: labelTextAlwaysActivate,
-    locked: true
-  });
-
-  restore_prefs();
-});
-
-add_task(async function test_disabled() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "FlashPlugin": {
-        "Default": false
-      }
-    }
-  });
-
-  await test_flash_status({
-    expectedLabelText: labelTextNeverActivate,
-    locked: false
-  });
-
-  restore_prefs();
-});
-
-add_task(async function test_disabled_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "FlashPlugin": {
-        "Default": false,
-        "Locked": true
-      }
-    }
-  });
-
-  await test_flash_status({
-    expectedLabelText: labelTextNeverActivate,
-    locked: true
-  });
-
-  restore_prefs();
-});
-
-add_task(async function test_ask() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "FlashPlugin": {
-      }
-    }
-  });
-
-  await test_flash_status({
-    expectedLabelText: labelTextAskToActivate,
-    locked: false
-  });
-
-  restore_prefs();
-});
-
-add_task(async function test_ask_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "FlashPlugin": {
-        "Locked": true
-      }
-    }
-  });
-
-  await test_flash_status({
-    expectedLabelText: labelTextAskToActivate,
-    locked: true
-  });
-
-  restore_prefs();
-});
deleted file mode 100644
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_popup_blocker.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function restore_prefs() {
-  Services.prefs.clearUserPref("dom.disable_open_during_load");
-}
-
-let ORIGINAL_PREF_VALUE = undefined;
-add_task(async function setup() {
-  // It seems that this pref is given a special testing value for some reason.
-  // Unset that value for this test, but save the old value
-  if (Services.prefs.prefHasUserValue("dom.disable_open_during_load")) {
-    ORIGINAL_PREF_VALUE = Services.prefs.getBoolPref("dom.disable_open_during_load");
-    Services.prefs.clearUserPref("dom.disable_open_during_load");
-  }
-});
-registerCleanupFunction(async function cleanup_prefs() {
-  if (ORIGINAL_PREF_VALUE === undefined) {
-    Services.prefs.clearUserPref("dom.disable_open_during_load");
-  } else {
-    Services.prefs.setBoolPref("dom.disable_open_during_load", ORIGINAL_PREF_VALUE);
-  }
-});
-
-async function test_popup_blocker_disabled({disabled, locked}) {
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
-  // eslint-disable-next-line no-shadow
-  await ContentTask.spawn(tab.linkedBrowser, {disabled, locked}, async function({disabled, locked}) {
-    let checkbox = content.document.getElementById("popupPolicy");
-    is(checkbox.checked, !disabled,
-       "Checkbox checked state should match policy's Block status");
-    is(checkbox.disabled, locked,
-       "Checkbox disabled state should match policy's Locked status");
-  });
-  BrowserTestUtils.removeTab(tab);
-
-  is(Services.prefs.prefIsLocked("dom.disable_open_during_load"), locked,
-     "Flash pref lock state should match policy lock state");
-}
-
-add_task(async function test_initial_state() {
-  await test_popup_blocker_disabled({disabled: false, locked: false});
-});
-
-add_task(async function test_empty_policy() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "PopupBlocking": {
-      }
-    }
-  });
-
-  await test_popup_blocker_disabled({disabled: false, locked: false});
-
-  restore_prefs();
-});
-
-add_task(async function test_block() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "PopupBlocking": {
-        "Default": true
-      }
-    }
-  });
-
-  await test_popup_blocker_disabled({disabled: false, locked: false});
-
-  restore_prefs();
-});
-
-add_task(async function test_block_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "PopupBlocking": {
-        "Default": true,
-        "Locked": true
-      }
-    }
-  });
-
-  await test_popup_blocker_disabled({disabled: false, locked: true});
-
-  restore_prefs();
-});
-
-add_task(async function test_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "PopupBlocking": {
-        "Locked": true
-      }
-    }
-  });
-
-  await test_popup_blocker_disabled({disabled: false, locked: true});
-
-  restore_prefs();
-});
-
-add_task(async function test_disabled() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "PopupBlocking": {
-        "Default": false
-      }
-    }
-  });
-
-  await test_popup_blocker_disabled({disabled: true, locked: false});
-
-  restore_prefs();
-});
-
-add_task(async function test_disabled_locked() {
-  await setupPolicyEngineWithJson({
-    "policies": {
-      "PopupBlocking": {
-        "Default": false,
-        "Locked": true
-      }
-    }
-  });
-
-  await test_popup_blocker_disabled({disabled: true, locked: true});
-
-  restore_prefs();
-});
--- a/browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
+++ b/browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
@@ -1,11 +1,11 @@
 {
   "policies": {
-    "PopupBlocking": {
+    "Popups": {
       "Allow": [
         "https://www.allow.com",
         "https://www.pre-existing-deny.com"
       ]
     },
 
     "Cookies": {
       "Allow": [
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -1480,17 +1480,17 @@ nsCookieService::InitDBConn()
     }
   }
   mInitializedDBConn = true;
 
   COOKIE_LOGSTRING(LogLevel::Debug, ("InitDBConn(): mInitializedDBConn = true"));
   mEndInitDBConn = mozilla::TimeStamp::Now();
 
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
-  if (os) {
+  if (os && !mReadArray.IsEmpty()) {
     os->NotifyObservers(nullptr, "cookie-db-read", nullptr);
     mReadArray.Clear();
   }
 }
 
 nsresult
 nsCookieService::InitDBConnInternal()
 {