Bug 1425363 - remove onWindowTitleChanged given that nobody uses it, r?bgrins draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 14 Dec 2017 21:55:44 -0600
changeset 712827 51591e0a3b42e20be472de8349d113198c3f8c6a
parent 712826 bbe7413bfedd7a0833f7caf016bcefaf5d847ede
child 744160 c7149fadf4de01d1dd9c982fdc0e04b116768f1e
push id93451
push usergijskruitbosch@gmail.com
push dateMon, 18 Dec 2017 21:48:39 +0000
reviewersbgrins
bugs1425363
milestone59.0a1
Bug 1425363 - remove onWindowTitleChanged given that nobody uses it, r?bgrins MozReview-Commit-ID: ALslAwZo4K9
browser/base/content/test/general/browser_bug553455.js
browser/base/content/test/general/browser_bug676619.js
browser/base/content/test/general/browser_fullscreen-window-open.js
browser/extensions/pdfjs/test/browser_pdfjs_savedialog.js
devtools/client/webide/modules/runtimes.js
devtools/server/actors/webbrowser.js
devtools/shared/security/prompt.js
dom/security/test/general/browser_test_data_download.js
dom/security/test/general/browser_test_data_text_csv.js
dom/url/tests/browser_download_after_revoke.js
mobile/android/tests/browser/chrome/test_awsy_lite.html
mobile/android/tests/browser/robocop/roboextender/bootstrap.js
netwerk/test/browser/browser_NetUtil.js
testing/talos/talos/tests/tabswitch/bootstrap.js
toolkit/components/viewsource/test/browser/head.js
toolkit/mozapps/extensions/test/browser/browser_bug567127.js
toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
toolkit/mozapps/extensions/test/browser/head.js
toolkit/mozapps/extensions/test/xpinstall/head.js
xpfe/appshell/nsIWindowMediator.idl
xpfe/appshell/nsIWindowMediatorListener.idl
xpfe/appshell/nsWindowMediator.cpp
xpfe/appshell/nsXULWindow.cpp
--- a/browser/base/content/test/general/browser_bug553455.js
+++ b/browser/base/content/test/general/browser_bug553455.js
@@ -153,18 +153,16 @@ async function waitForInstallDialog() {
   let window = await new Promise(resolve => {
     Services.wm.addListener({
       onOpenWindow(aXULWindow) {
         Services.wm.removeListener(this);
         resolve(aXULWindow);
       },
       onCloseWindow(aXULWindow) {
       },
-      onWindowTitleChange(aXULWindow, aNewTitle) {
-      }
     });
   });
   info("Install dialog opened, waiting for focus");
 
   let domwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
                         .getInterface(Ci.nsIDOMWindow);
   await new Promise(resolve => {
     waitForFocus(function() {
--- a/browser/base/content/test/general/browser_bug676619.js
+++ b/browser/base/content/test/general/browser_bug676619.js
@@ -12,17 +12,16 @@ function waitForNewWindow() {
           resolve(domwindow);
         }
 
         var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                                   .getInterface(Ci.nsIDOMWindow);
         domwindow.addEventListener("load", downloadOnLoad, true);
       },
       onCloseWindow: aXULWindow => {},
-      onWindowTitleChange: (aXULWindow, aNewTitle) => {}
     };
 
     Services.wm.addListener(listener);
   });
 }
 
 async function testLink(link, name) {
   info("Checking " + link + " with name: " + name);
--- a/browser/base/content/test/general/browser_fullscreen-window-open.js
+++ b/browser/base/content/test/general/browser_fullscreen-window-open.js
@@ -340,12 +340,11 @@ WindowListener.prototype = {
       } else {
         domwindow.close();
         executeSoon(this.callBack_onFinalize);
       }
     };
     domwindow.addEventListener("load", onLoad, true);
   },
   onCloseWindow(aXULWindow) {},
-  onWindowTitleChange(aXULWindow, aNewTitle) {},
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowMediatorListener,
                                          Ci.nsISupports]),
 };
--- a/browser/extensions/pdfjs/test/browser_pdfjs_savedialog.js
+++ b/browser/extensions/pdfjs/test/browser_pdfjs_savedialog.js
@@ -51,11 +51,10 @@ function addWindowListener(aURL, aCallba
                                 .getInterface(Ci.nsIDOMWindow);
       waitForFocus(function() {
         is(domwindow.document.location.href, aURL, "should have seen the right window open");
         domwindow.close();
         aCallback();
       }, domwindow);
     },
     onCloseWindow(aXULWindow) { },
-    onWindowTitleChange(aXULWindow, aNewTitle) { }
   });
 }
--- a/devtools/client/webide/modules/runtimes.js
+++ b/devtools/client/webide/modules/runtimes.js
@@ -397,17 +397,16 @@ WiFiRuntime.prototype = {
             return;
           }
           // Found the window
           promptWindow = win;
           Services.wm.removeListener(windowListener);
         }, {once: true});
       },
       onCloseWindow() {},
-      onWindowTitleChange() {}
     };
     Services.wm.addListener(windowListener);
 
     // |openDialog| is typically a blocking API, so |executeSoon| to get around this
     DevToolsUtils.executeSoon(() => {
       // Height determines the size of the QR code.  Force a minimum size to
       // improve scanability.
       const MIN_HEIGHT = 600;
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -610,18 +610,16 @@ BrowserTabList.prototype._listenToMediat
  * nsIWindowMediatorListener implementation.
  *
  * See _onTabClosed for explanation of why we needn't actually tweak any
  * actors or tables here.
  *
  * An nsIWindowMediatorListener's methods get passed all sorts of windows; we
  * only care about the tab containers. Those have 'getBrowser' methods.
  */
-BrowserTabList.prototype.onWindowTitleChange = () => { };
-
 BrowserTabList.prototype.onOpenWindow =
 DevToolsUtils.makeInfallible(function (window) {
   let handleLoad = DevToolsUtils.makeInfallible(() => {
     /* We don't want any further load events from this window. */
     window.removeEventListener("load", handleLoad);
 
     if (appShellDOMWindowType(window) !== DebuggerServer.chromeWindowType) {
       return;
--- a/devtools/shared/security/prompt.js
+++ b/devtools/shared/security/prompt.js
@@ -69,17 +69,16 @@ Client.defaultSendOOB = ({ authResult, o
           return;
         }
         // Found the window
         promptWindow = win;
         Services.wm.removeListener(windowListener);
       }, {once: true});
     },
     onCloseWindow() {},
-    onWindowTitleChange() {}
   };
   Services.wm.addListener(windowListener);
 
   // nsIPrompt is typically a blocking API, so |executeSoon| to get around this
   DevToolsUtils.executeSoon(() => {
     prompt.confirmEx(null, title, msg, flags, null, null, null, null,
                      { value: false });
   });
--- a/dom/security/test/general/browser_test_data_download.js
+++ b/dom/security/test/general/browser_test_data_download.js
@@ -12,17 +12,16 @@ function addWindowListener(aURL, aCallba
       var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                                 .getInterface(Ci.nsIDOMWindow);
       waitForFocus(function() {
         is(domwindow.document.location.href, aURL, "should have seen the right window open");
         aCallback(domwindow);
       }, domwindow);
     },
     onCloseWindow(aXULWindow) { },
-    onWindowTitleChange(aXULWindow, aNewTitle) { }
   });
 }
 
 function test() {
   waitForExplicitFinish();
   Services.prefs.setBoolPref("security.data_uri.block_toplevel_data_uri_navigations", true);
   registerCleanupFunction(function() {
     Services.prefs.clearUserPref("security.data_uri.block_toplevel_data_uri_navigations");
--- a/dom/security/test/general/browser_test_data_text_csv.js
+++ b/dom/security/test/general/browser_test_data_text_csv.js
@@ -12,17 +12,16 @@ function addWindowListener(aURL, aCallba
       var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                                 .getInterface(Ci.nsIDOMWindow);
       waitForFocus(function() {
         is(domwindow.document.location.href, aURL, "should have seen the right window open");
         aCallback(domwindow);
       }, domwindow);
     },
     onCloseWindow(aXULWindow) { },
-    onWindowTitleChange(aXULWindow, aNewTitle) { }
   });
 }
 
 function test() {
   waitForExplicitFinish();
   Services.prefs.setBoolPref("security.data_uri.block_toplevel_data_uri_navigations", true);
   registerCleanupFunction(function() {
     Services.prefs.clearUserPref("security.data_uri.block_toplevel_data_uri_navigations");
--- a/dom/url/tests/browser_download_after_revoke.js
+++ b/dom/url/tests/browser_download_after_revoke.js
@@ -20,17 +20,16 @@ function test () {
 	  finish();
         }
 
         var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                                   .getInterface(Ci.nsIDOMWindow);
         domwindow.addEventListener("load", downloadOnLoad, true);
       },
       onCloseWindow: function(aXULWindow) {},
-      onWindowTitleChange: function(aXULWindow, aNewTitle) {}
     }
 
     Services.wm.addListener(listener);
 
     info("Creating BlobURL and clicking on a HTMLAnchorElement...");
     ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
       let blob = new content.Blob(['test'], { type: 'text/plain' });
       let url = content.URL.createObjectURL(blob);
--- a/mobile/android/tests/browser/chrome/test_awsy_lite.html
+++ b/mobile/android/tests/browser/chrome/test_awsy_lite.html
@@ -53,19 +53,16 @@
         win.addEventListener("UIReady", function(aEvent) {
             attachTo(win);
         }, {once: true});
     },
 
     onCloseWindow: function(aWindow) {
         detachFrom(aWindow);
     },
-
-    onWindowTitleChange: function(aWindow, aTitle) {
-    }
   };
 
   function doFullGc(aCallback, aIterations) {
     var threadMan = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
     var domWindowUtils = gWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
 
     function runSoon(f) {
         threadMan.dispatchToMainThread({ run: f });
--- a/mobile/android/tests/browser/robocop/roboextender/bootstrap.js
+++ b/mobile/android/tests/browser/robocop/roboextender/bootstrap.js
@@ -26,17 +26,16 @@ var windowListener = {
             cheight: XPCNativeWrapper.unwrap(e.target).documentElement.clientHeight,
           };
           EventDispatcher.instance.sendRequest(message);
         });
       }
     }, {once: true});
   },
   onCloseWindow: function(aWindow) { },
-  onWindowTitleChange: function(aWindow, aTitle) { }
 };
 
 function startup(aData, aReason) {
   let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
 
   // Load into any new windows
   wm.addListener(windowListener);
   EventDispatcher.instance.registerListener(function(event, data, callback) {
--- a/netwerk/test/browser/browser_NetUtil.js
+++ b/netwerk/test/browser/browser_NetUtil.js
@@ -81,10 +81,9 @@ WindowListener.prototype = {
 
       // Allow other window load listeners to execute before passing to callback
       executeSoon(function() {
         self.callback(domwindow);
       });
     }, {once: true});
   },
   onCloseWindow: function(aXULWindow) {},
-  onWindowTitleChange: function(aXULWindow, aNewTitle) {}
 }
--- a/testing/talos/talos/tests/tabswitch/bootstrap.js
+++ b/testing/talos/talos/tests/tabswitch/bootstrap.js
@@ -30,19 +30,16 @@ var windowListener = {
       loadIntoWindow(window);
     };
     window.addEventListener("load", cb);
   },
 
   onCloseWindow(aWindow) {
     aboutNewTabService.resetNewTabURL();
   },
-
-  onWindowTitleChange(aWindow, aTitle) {
-  }
 };
 
 function promiseOneEvent(target, eventName, capture) {
   let deferred = Promise.defer();
   target.addEventListener(eventName, function handler(event) {
     deferred.resolve();
   }, {capture, once: true});
   return deferred.promise;
--- a/toolkit/components/viewsource/test/browser/head.js
+++ b/toolkit/components/viewsource/test/browser/head.js
@@ -77,17 +77,16 @@ async function waitForViewSourceTabOrWin
             }
             // Found the window
             sourceLoadedPromise = waitForSourceLoaded(win);
             resolve(win);
             Services.wm.removeListener(windowListener);
           }, {once: true});
         },
         onCloseWindow() {},
-        onWindowTitleChange() {}
       };
       Services.wm.addListener(windowListener);
     });
   }
 
   await open();
 
   let tabOrWindow = await tabOrWindowPromise;
--- a/toolkit/mozapps/extensions/test/browser/browser_bug567127.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug567127.js
@@ -38,18 +38,16 @@ function checkInstallConfirmation(...url
     let listener = {
       handleEvent(event) {
         let window = event.currentTarget;
         is(window.document.location.href, INSTALL_URI, "Should have opened the correct window");
 
         executeSoon(() => handleDialog(window));
       },
 
-      onWindowTitleChange() { },
-
       onOpenWindow(window) {
         windows.add(window);
         let domwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIDOMWindow);
         domwindow.addEventListener("load", this, false, {once: true});
       },
 
       onCloseWindow(window) {
--- a/toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
@@ -42,18 +42,16 @@ function checkInstallConfirmation(...url
   let listener = {
     handleEvent(event) {
       let window = event.currentTarget;
       is(window.document.location.href, INSTALL_URI, "Should have opened the correct window");
 
       executeSoon(() => handleDialog(window));
     },
 
-    onWindowTitleChange() { },
-
     onOpenWindow(window) {
       windows.add(window);
       let domwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
                             .getInterface(Ci.nsIDOMWindow);
       domwindow.addEventListener("load", this, false, {once: true});
     },
 
     onCloseWindow(window) {
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -453,19 +453,16 @@ function wait_for_window_open(aCallback)
         executeSoon(function() {
           aCallback(domwindow);
         });
       }, {once: true});
     },
 
     onCloseWindow(aWindow) {
     },
-
-    onWindowTitleChange(aWindow, aTitle) {
-    }
   });
 }
 
 function get_string(aName, ...aArgs) {
   var bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/extensions.properties");
   if (aArgs.length == 0)
     return bundle.GetStringFromName(aName);
   return bundle.formatStringFromName(aName, aArgs, aArgs.length);
--- a/toolkit/mozapps/extensions/test/xpinstall/head.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/head.js
@@ -279,19 +279,16 @@ var Harness = {
       });
       this.expectingCancelled = false;
       this.endTest();
     }
   },
 
   // nsIWindowMediatorListener
 
-  onWindowTitleChange(window, title) {
-  },
-
   onOpenWindow(window) {
     var domwindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                           .getInterface(Components.interfaces.nsIDOMWindow);
     var self = this;
     waitForFocus(function() {
       self.windowReady(domwindow);
     }, domwindow);
   },
--- a/xpfe/appshell/nsIWindowMediator.idl
+++ b/xpfe/appshell/nsIWindowMediator.idl
@@ -98,24 +98,16 @@ interface nsIWindowMediator: nsISupports
 
   /** Call this method when a window gains focus. It's a primitive means of
     * determining the most recent window. It's no longer necessary and it
     * really should be removed.
     * @param aWindow the window which has gained focus
     */
   [noscript] void updateWindowTimeStamp(in nsIXULWindow aWindow);
 
-  /** Call this method when a window's title changes. Listeners (see
-    * addListener) will be notified through their onWindowTitleChange method.
-    * @param aWindow the window whose title has changed
-    * @param inTitle the window's new title
-    */
-  [noscript] void updateWindowTitle(in nsIXULWindow aWindow,
-                                    in AString inTitle);
-
   /* z-ordering: */
 
   const unsigned long zLevelTop    = 1;
   const unsigned long zLevelBottom = 2;
   const unsigned long zLevelBelow  = 3; // below some window
 
   /** A window wants to be moved in z-order. Calculate whether and how
     * it should be constrained. Note this method is advisory only:
--- a/xpfe/appshell/nsIWindowMediatorListener.idl
+++ b/xpfe/appshell/nsIWindowMediatorListener.idl
@@ -5,14 +5,12 @@
 
 #include "nsISupports.idl"
 
 interface nsIXULWindow;
 
 [scriptable, uuid(2F276982-0D60-4377-A595-D350BA516395)]
 interface nsIWindowMediatorListener : nsISupports
 {
-    void onWindowTitleChange(in nsIXULWindow window, in AString newTitle);
-
     void onOpenWindow(in nsIXULWindow window);
     void onCloseWindow(in nsIXULWindow window);
 };
 
--- a/xpfe/appshell/nsWindowMediator.cpp
+++ b/xpfe/appshell/nsWindowMediator.cpp
@@ -389,32 +389,16 @@ nsWindowMediator::UpdateWindowTimeStamp(
   if (info) {
     // increment the window's time stamp
     info->mTimeStamp = ++mTimeStamp;
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP
-nsWindowMediator::UpdateWindowTitle(nsIXULWindow* inWindow,
-                                    const nsAString& inTitle)
-{
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-  NS_ENSURE_STATE(mReady);
-  if (GetInfoFor(inWindow)) {
-    ListenerArray::ForwardIterator iter(mListeners);
-    while (iter.HasMore()) {
-      iter.GetNext()->OnWindowTitleChange(inWindow, inTitle);
-    }
-  }
-
-  return NS_OK;
-}
-
 /* This method's plan is to intervene only when absolutely necessary.
    We will get requests to place our windows behind unknown windows.
    For the most part, we need to leave those alone (turning them into
    explicit requests to be on top breaks Windows.) So generally we
    calculate a change as seldom as possible.
 */
 NS_IMETHODIMP
 nsWindowMediator::CalculateZPosition(
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -897,24 +897,16 @@ NS_IMETHODIMP nsXULWindow::GetTitle(nsAS
 }
 
 NS_IMETHODIMP nsXULWindow::SetTitle(const nsAString& aTitle)
 {
   NS_ENSURE_STATE(mWindow);
   mTitle.Assign(aTitle);
   mTitle.StripCRLF();
   NS_ENSURE_SUCCESS(mWindow->SetTitle(mTitle), NS_ERROR_FAILURE);
-
-  // Tell the window mediator that a title has changed
-  nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
-  if (!windowMediator)
-    return NS_OK;
-
-  windowMediator->UpdateWindowTitle(static_cast<nsIXULWindow*>(this), aTitle);
-
   return NS_OK;
 }
 
 
 //*****************************************************************************
 // nsXULWindow: Helpers
 //*****************************************************************************