Bug 1453517 - Remove nsPopupWindowManager and related XPCOM bits; r=bz
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 11 Apr 2018 16:16:13 -0700
changeset 467483 f154057ddc01b537e163386065a768bf514d2c4b
parent 467482 77694987ba61cf176fc403badc29431158f3f831
child 467484 9f8c088dce9f9ec8a0ca3c708e14ac298e207414
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1453517
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1453517 - Remove nsPopupWindowManager and related XPCOM bits; r=bz MozReview-Commit-ID: JIDdZfnNN8E
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/html/HTMLInputElement.cpp
dom/media/MediaManager.cpp
extensions/cookie/moz.build
extensions/cookie/nsCookieModule.cpp
extensions/cookie/nsPopupWindowManager.cpp
extensions/cookie/nsPopupWindowManager.h
xpfe/appshell/moz.build
xpfe/appshell/nsIPopupWindowManager.idl
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -177,20 +177,16 @@
 
 #include "nsWindowRoot.h"
 #include "nsNetCID.h"
 #include "nsIArray.h"
 
 #include "nsBindingManager.h"
 #include "nsXBLService.h"
 
-// used for popup blocking, needs to be converted to something
-// belonging to the back-end like nsIContentPolicy
-#include "nsIPopupWindowManager.h"
-
 #include "nsIDragService.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Selection.h"
 #include "nsFrameLoader.h"
 #include "nsISupportsPrimitives.h"
 #include "nsXPCOMCID.h"
 #include "mozilla/Logging.h"
 #include "prenv.h"
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -178,20 +178,16 @@
 #include "nsIArray.h"
 
 #include "XULDocument.h"
 #include "nsIDOMXULCommandDispatcher.h"
 
 #include "nsBindingManager.h"
 #include "nsXBLService.h"
 
-// used for popup blocking, needs to be converted to something
-// belonging to the back-end like nsIContentPolicy
-#include "nsIPopupWindowManager.h"
-
 #include "nsIDragService.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Selection.h"
 #include "nsFrameLoader.h"
 #include "nsISupportsPrimitives.h"
 #include "nsXPCOMCID.h"
 #include "mozilla/Logging.h"
 #include "prenv.h"
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -82,17 +82,16 @@
 #include "mozilla/dom/FileSystem.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/FileList.h"
 #include "nsIFile.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIContentPrefService2.h"
 #include "nsIMIMEService.h"
 #include "nsIObserverService.h"
-#include "nsIPopupWindowManager.h"
 #include "nsGlobalWindow.h"
 
 // input type=image
 #include "nsImageLoadingContent.h"
 #include "imgRequestProxy.h"
 
 #include "mozAutoDocUpdate.h"
 #include "nsContentCreatorFunctions.h"
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -14,17 +14,16 @@
 #include "nsArray.h"
 #include "nsContentUtils.h"
 #include "nsGlobalWindow.h"
 #include "nsHashPropertyBag.h"
 #include "nsIEventTarget.h"
 #include "nsIUUIDGenerator.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIPermissionManager.h"
-#include "nsIPopupWindowManager.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIIDNService.h"
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "nsICryptoHash.h"
--- a/extensions/cookie/moz.build
+++ b/extensions/cookie/moz.build
@@ -6,17 +6,16 @@
 
 TEST_DIRS += ['test']
 
 UNIFIED_SOURCES += [
     'nsCookieModule.cpp',
     'nsCookiePermission.cpp',
     'nsPermission.cpp',
     'nsPermissionManager.cpp',
-    'nsPopupWindowManager.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '/caps',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
--- a/extensions/cookie/nsCookieModule.cpp
+++ b/extensions/cookie/nsCookieModule.cpp
@@ -2,42 +2,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "mozilla/ModuleUtils.h"
 #include "nsIServiceManager.h"
 #include "nsPermissionManager.h"
-#include "nsPopupWindowManager.h"
 #include "nsICategoryManager.h"
 #include "nsCookiePermission.h"
 #include "nsString.h"
 
 // Define the constructor function for the objects
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPermissionManager,
   nsPermissionManager::GetXPCOMSingleton)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPopupWindowManager, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsCookiePermission)
 
 NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_POPUPWINDOWMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_COOKIEPERMISSION_CID);
 
 
 static const mozilla::Module::CIDEntry kCookieCIDs[] = {
     { &kNS_PERMISSIONMANAGER_CID, false, nullptr, nsIPermissionManagerConstructor },
-    { &kNS_POPUPWINDOWMANAGER_CID, false, nullptr, nsPopupWindowManagerConstructor },
     { &kNS_COOKIEPERMISSION_CID, false, nullptr, nsCookiePermissionConstructor },
     { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kCookieContracts[] = {
     { NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID },
-    { NS_POPUPWINDOWMANAGER_CONTRACTID, &kNS_POPUPWINDOWMANAGER_CID },
     { NS_COOKIEPERMISSION_CONTRACTID, &kNS_COOKIEPERMISSION_CID },
     { nullptr }
 };
 
 static const mozilla::Module kCookieModule = {
     mozilla::Module::kVersion,
     kCookieCIDs,
     kCookieContracts
deleted file mode 100644
--- a/extensions/cookie/nsPopupWindowManager.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsPopupWindowManager.h"
-
-#include "nsCRT.h"
-#include "nsIServiceManager.h"
-#include "nsIPrefService.h"
-#include "nsIPrefBranch.h"
-#include "nsIPrincipal.h"
-#include "nsIURI.h"
-#include "mozilla/Services.h"
-
-/**
- * The Popup Window Manager maintains popup window permissions by website.
- */
-
-static const char kPopupDisablePref[] = "dom.disable_open_during_load";
-
-//*****************************************************************************
-//*** nsPopupWindowManager object management and nsISupports
-//*****************************************************************************
-
-nsPopupWindowManager::nsPopupWindowManager() :
-  mPolicy(ALLOW_POPUP)
-{
-}
-
-nsPopupWindowManager::~nsPopupWindowManager()
-{
-}
-
-NS_IMPL_ISUPPORTS(nsPopupWindowManager,
-                  nsIPopupWindowManager,
-                  nsIObserver,
-                  nsISupportsWeakReference)
-
-nsresult
-nsPopupWindowManager::Init()
-{
-  nsresult rv;
-  mPermissionManager = mozilla::services::GetPermissionManager();
-
-  nsCOMPtr<nsIPrefBranch> prefBranch =
-    do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
-  if (NS_SUCCEEDED(rv)) {
-    bool permission;
-    rv = prefBranch->GetBoolPref(kPopupDisablePref, &permission);
-    if (NS_FAILED(rv)) {
-      permission = true;
-    }
-    mPolicy = permission ? (uint32_t) DENY_POPUP : (uint32_t) ALLOW_POPUP;
-
-    prefBranch->AddObserver(kPopupDisablePref, this, true);
-  }
-
-  return NS_OK;
-}
-
-//*****************************************************************************
-//*** nsPopupWindowManager::nsIPopupWindowManager
-//*****************************************************************************
-
-NS_IMETHODIMP
-nsPopupWindowManager::TestPermission(nsIPrincipal* aPrincipal,
-                                     uint32_t *aPermission)
-{
-  NS_ENSURE_ARG_POINTER(aPrincipal);
-  NS_ENSURE_ARG_POINTER(aPermission);
-
-  uint32_t permit;
-  *aPermission = mPolicy;
-
-  if (mPermissionManager) {
-    if (NS_SUCCEEDED(mPermissionManager->TestPermissionFromPrincipal(aPrincipal, "popup", &permit))) {
-      // Share some constants between interfaces?
-      if (permit == nsIPermissionManager::ALLOW_ACTION) {
-        *aPermission = ALLOW_POPUP;
-      } else if (permit == nsIPermissionManager::DENY_ACTION) {
-        *aPermission = DENY_POPUP;
-      }
-    }
-  }
-
-  return NS_OK;
-}
-
-//*****************************************************************************
-//*** nsPopupWindowManager::nsIObserver
-//*****************************************************************************
-NS_IMETHODIMP
-nsPopupWindowManager::Observe(nsISupports *aSubject,
-                              const char *aTopic,
-                              const char16_t *aData)
-{
-  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(aSubject);
-  NS_ASSERTION(!nsCRT::strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic),
-               "unexpected topic - we only deal with pref changes!");
-
-  if (prefBranch) {
-    // refresh our local copy of the "disable popups" pref
-    bool permission = true;
-    prefBranch->GetBoolPref(kPopupDisablePref, &permission);
-
-    mPolicy = permission ? (uint32_t) DENY_POPUP : (uint32_t) ALLOW_POPUP;
-  }
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/extensions/cookie/nsPopupWindowManager.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsPopupWindowManager_h__
-#define nsPopupWindowManager_h__
-
-#include "nsCOMPtr.h"
-
-#include "nsIObserver.h"
-#include "nsIPermissionManager.h"
-#include "nsIPopupWindowManager.h"
-#include "nsWeakReference.h"
-
-class nsPopupWindowManager : public nsIPopupWindowManager,
-                             public nsIObserver,
-                             public nsSupportsWeakReference {
-
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIPOPUPWINDOWMANAGER
-  NS_DECL_NSIOBSERVER
-
-  nsPopupWindowManager();
-  nsresult Init();
-
-private:
-  virtual ~nsPopupWindowManager();
-
-  uint32_t                       mPolicy;
-  nsCOMPtr<nsIPermissionManager> mPermissionManager;
-};
-
-// {822bcd11-6432-48be-9e9d-36f7804b7747}
-#define NS_POPUPWINDOWMANAGER_CID \
- {0x822bcd11, 0x6432, 0x48be, {0x9e, 0x9d, 0x36, 0xf7, 0x80, 0x4b, 0x77, 0x47}}
-
-#endif /* nsPopupWindowManager_h__ */
--- a/xpfe/appshell/moz.build
+++ b/xpfe/appshell/moz.build
@@ -6,17 +6,16 @@
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "Window Management")
 
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
 
 XPIDL_SOURCES += [
     'nsIAppShellService.idl',
-    'nsIPopupWindowManager.idl',
     'nsIWindowlessBrowser.idl',
     'nsIWindowMediator.idl',
     'nsIWindowMediatorListener.idl',
     'nsIXULBrowserWindow.idl',
     'nsIXULWindow.idl',
 ]
 
 XPIDL_MODULE = 'appshell'
deleted file mode 100644
--- a/xpfe/appshell/nsIPopupWindowManager.idl
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * This is the interface to the Popup Window Manager: an object which
- * maintains popup window permissions by website.
- */
-
-#include "nsISupports.idl"
-
-interface nsIPrincipal;
-
-[scriptable, uuid(66386aa9-2088-4bae-82c7-9f58bc02be64)]
-interface nsIPopupWindowManager : nsISupports {
-
-  /**
-   * These values are returned by the testPermission method
-   */
-  const uint32_t ALLOW_POPUP = 1;
-  const uint32_t DENY_POPUP = 2;
-  const uint32_t ALLOW_POPUP_WITH_PREJUDICE = 3;
-
-  /**
-   * Test whether a website has permission to show a popup window.
-   * @param   principal is the principal to be tested
-   * @return  one of the enumerated permission actions defined above
-   */
-  uint32_t testPermission(in nsIPrincipal principal);
-};
-
-%{ C++
-#define NS_POPUPWINDOWMANAGER_CONTRACTID "@mozilla.org/PopupWindowManager;1"
-%}