Bug 1534638 - Part 1: remove unused arguments from session history listeners. r=qdot
authorPeter Van der Beken <peterv@propagandism.org>
Thu, 04 Apr 2019 16:18:48 +0000
changeset 468979 04b7ce8eb70e647aed7fe05319d71246c5f7d00f
parent 468978 e9ce8726a788f4619b2ca2a5fcf68868957d8475
child 468980 bd1df73257d565abbc787394c924bc3d1b76be2f
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1534638
milestone68.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 1534638 - Part 1: remove unused arguments from session history listeners. r=qdot Differential Revision: https://phabricator.services.mozilla.com/D25761
browser/components/sessionstore/ContentRestore.jsm
browser/components/sessionstore/ContentSessionStore.jsm
docshell/base/nsDocShell.cpp
docshell/shistory/nsISHistory.idl
docshell/shistory/nsISHistoryListener.idl
docshell/shistory/nsSHistory.cpp
docshell/shistory/nsSHistory.h
docshell/test/browser/file_bug422543_script.js
mobile/android/chrome/content/browser.js
toolkit/components/browser/nsWebBrowser.cpp
toolkit/components/browser/nsWebBrowser.h
--- a/browser/components/sessionstore/ContentRestore.jsm
+++ b/browser/components/sessionstore/ContentRestore.jsm
@@ -368,19 +368,19 @@ HistoryListener.prototype = {
 
   uninstall() {
     let shistory = this.webNavigation.sessionHistory.legacySHistory;
     if (shistory) {
       shistory.removeSHistoryListener(this);
     }
   },
 
-  OnHistoryGotoIndex(index, gotoURI) {},
-  OnHistoryPurge(numEntries) {},
-  OnHistoryReplaceEntry(index) {},
+  OnHistoryGotoIndex() {},
+  OnHistoryPurge() {},
+  OnHistoryReplaceEntry() {},
 
   // This will be called for a pending tab when loadURI(uri) is called where
   // the given |uri| only differs in the fragment.
   OnHistoryNewEntry(newURI) {
     let currentURI = this.webNavigation.currentURI;
 
     // Ignore new SHistory entries with the same URI as those do not indicate
     // a navigation inside a document by changing the #hash part of the URL.
@@ -400,17 +400,17 @@ HistoryListener.prototype = {
     let flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
     let loadURIOptions = {
       triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
       loadFlags: flags,
     };
     this.webNavigation.loadURI(newURI.spec, loadURIOptions);
   },
 
-  OnHistoryReload(reloadURI, reloadFlags) {
+  OnHistoryReload() {
     this.callback();
 
     // Cancel the load.
     return false;
   },
 };
 
 /**
--- a/browser/components/sessionstore/ContentSessionStore.jsm
+++ b/browser/components/sessionstore/ContentSessionStore.jsm
@@ -267,31 +267,31 @@ class SessionHistoryListener extends Han
     this.collect();
   }
 
   OnHistoryNewEntry(newURI, oldIndex) {
     // We ought to collect the previously current entry as well, see bug 1350567.
     this.collectFrom(oldIndex);
   }
 
-  OnHistoryGotoIndex(index, gotoURI) {
+  OnHistoryGotoIndex() {
     // We ought to collect the previously current entry as well, see bug 1350567.
     this.collectFrom(kLastIndex);
   }
 
-  OnHistoryPurge(numEntries) {
+  OnHistoryPurge() {
     this.collect();
   }
 
-  OnHistoryReload(reloadURI, reloadFlags) {
+  OnHistoryReload() {
     this.collect();
     return true;
   }
 
-  OnHistoryReplaceEntry(index) {
+  OnHistoryReplaceEntry() {
     this.collect();
   }
 }
 SessionHistoryListener.prototype.QueryInterface =
   ChromeUtils.generateQI([Ci.nsISHistoryListener,
                           Ci.nsISupportsWeakReference]);
 
 /**
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4540,18 +4540,17 @@ nsDocShell::Reload(uint32_t aReloadFlags
   uint32_t loadType = MAKE_LOAD_TYPE(LOAD_RELOAD_NORMAL, aReloadFlags);
   NS_ENSURE_TRUE(IsValidLoadType(loadType), NS_ERROR_INVALID_ARG);
 
   // Send notifications to the HistoryListener if any, about the impending
   // reload
   RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
   bool canReload = true;
   if (rootSH) {
-    rootSH->LegacySHistory()->NotifyOnHistoryReload(mCurrentURI, aReloadFlags,
-                                                    &canReload);
+    rootSH->LegacySHistory()->NotifyOnHistoryReload(&canReload);
   }
 
   if (!canReload) {
     return NS_OK;
   }
 
   /* If you change this part of code, make sure bug 45297 does not re-occur */
   if (mOSHE) {
--- a/docshell/shistory/nsISHistory.idl
+++ b/docshell/shistory/nsISHistory.idl
@@ -166,25 +166,19 @@ interface nsISHistory: nsISupports
    * @param aReplaceEntry     The replacement entry for the index.
    */
   void replaceEntry(in long aIndex, in nsISHEntry aReplaceEntry);
 
   /**
    * Notifies all registered session history listeners about an impending
    * reload.
    *
-   * @param aReloadURI        The URI of the document to be reloaded.
-   * @param aReloadFlags      Flags that indicate how the document is to be
-   *                          refreshed. See constants on the nsIWebNavigation
-   *                          interface.
-   *
    * @return                  Whether the operation can proceed.
    */
-  boolean notifyOnHistoryReload(in nsIURI aReloadURI,
-                                in unsigned long aReloadFlags);
+  boolean notifyOnHistoryReload();
 
   /**
    * Evict content viewers which don't lie in the "safe" range around aIndex.
    * In practice, this should leave us with no more than gHistoryMaxViewers
    * viewers associated with this SHistory object.
    *
    * Also make sure that the total number of content viewers in all windows is
    * not greater than our global max; if it is, evict viewers as appropriate.
--- a/docshell/shistory/nsISHistoryListener.idl
+++ b/docshell/shistory/nsISHistoryListener.idl
@@ -35,55 +35,34 @@ interface nsISHistoryListener : nsISuppo
    * @param aOldIndex   The index of the current history item before the
    *                    operation.
    */
   void OnHistoryNewEntry(in nsIURI aNewURI, in long aOldIndex);
 
   /**
    * Called before the current document is reloaded, for example due to a
    * nsIWebNavigation::reload() call.
-   *
-   * @param aReloadURI    The URI of the document to be reloaded.
-   * @param aReloadFlags  Flags that indicate how the document is to be
-   *                      refreshed. See constants on the nsIWebNavigation
-   *                      interface.
-   * @return              Whether the operation can proceed.
-   *
-   * @see  nsIWebNavigation
    */
-  boolean OnHistoryReload(in nsIURI aReloadURI, in unsigned long aReloadFlags);
+  boolean OnHistoryReload();
 
   /**
    * Called before navigating to a session history entry by index, for example,
    * when nsIWebNavigation::gotoIndex() is called.
-   *
-   * @param aIndex        The index in session history of the entry to be
-   *                      loaded.
-   * @param aGotoURI      The URI of the session history entry to be loaded.
-   *                      It could be null in case of a grouped session history
-   *                      navigation since we have no URI information of entries
-   *                      existing in other partial histories.
    */
-  void OnHistoryGotoIndex(in long aIndex, in nsIURI aGotoURI);
+  void OnHistoryGotoIndex();
 
   /**
    * Called before entries are removed from session history. Entries can be
    * removed from session history for various reasons, for example to control
    * the memory usage of the browser, to prevent users from loading documents
    * from history, to erase evidence of prior page loads, etc.
    *
    * To purge documents from session history call nsISHistory::PurgeHistory().
-   *
-   * @param aNumEntries   The number of entries to be removed from session
-   *                      history.
    */
-  void OnHistoryPurge(in long aNumEntries);
+  void OnHistoryPurge();
 
   /**
    * Called before an entry is replaced in the session history. Entries are
    * replaced when navigating away from non-persistent history entries (such as
    * about pages) and when history.replaceState is called.
-   *
-   * @param aIndex        The index in session history of the entry being
-   *                      replaced.
    */
-  void OnHistoryReplaceEntry(in long aIndex);
+  void OnHistoryReplaceEntry();
 };
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -563,17 +563,17 @@ nsSHistory::AddEntry(nsISHEntry* aSHEntr
   // If we have a root docshell, update the docshell id of the root shentry to
   // match the id of that docshell
   if (mRootDocShell) {
     nsID docshellID = mRootDocShell->HistoryID();
     aSHEntry->SetDocshellID(&docshellID);
   }
 
   if (currentTxn && !currentTxn->GetPersist()) {
-    NOTIFY_LISTENERS(OnHistoryReplaceEntry, (mIndex));
+    NOTIFY_LISTENERS(OnHistoryReplaceEntry, ());
     aSHEntry->SetPersist(aPersist);
     mEntries[mIndex] = aSHEntry;
     return NS_OK;
   }
 
   nsCOMPtr<nsIURI> uri = aSHEntry->GetURI();
   NOTIFY_LISTENERS(OnHistoryNewEntry, (uri, mIndex));
 
@@ -693,17 +693,17 @@ void nsSHistory::WindowIndices(int32_t a
 NS_IMETHODIMP
 nsSHistory::PurgeHistory(int32_t aNumEntries) {
   if (Length() <= 0 || aNumEntries <= 0) {
     return NS_ERROR_FAILURE;
   }
 
   aNumEntries = std::min(aNumEntries, Length());
 
-  NOTIFY_LISTENERS(OnHistoryPurge, (aNumEntries));
+  NOTIFY_LISTENERS(OnHistoryPurge, ());
 
   // Remove the first `aNumEntries` entries.
   mEntries.RemoveElementsAt(0, aNumEntries);
 
   // Adjust the indices, but don't let them go below -1.
   mIndex -= aNumEntries;
   mIndex = std::max(mIndex, -1);
   mRequestedIndex -= aNumEntries;
@@ -758,29 +758,27 @@ nsSHistory::ReplaceEntry(int32_t aIndex,
         "The entry has been associated to another nsISHistory instance. "
         "Try nsISHEntry.clone() and nsISHEntry.abandonBFCacheEntry() "
         "first if you're copying an entry from another nsISHistory.");
     return NS_ERROR_FAILURE;
   }
 
   aReplaceEntry->SetSHistory(this);
 
-  NOTIFY_LISTENERS(OnHistoryReplaceEntry, (aIndex));
+  NOTIFY_LISTENERS(OnHistoryReplaceEntry, ());
 
   aReplaceEntry->SetPersist(true);
   mEntries[aIndex] = aReplaceEntry;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSHistory::NotifyOnHistoryReload(nsIURI* aReloadURI, uint32_t aReloadFlags,
-                                  bool* aCanReload) {
-  NOTIFY_LISTENERS_CANCELABLE(OnHistoryReload, *aCanReload,
-                              (aReloadURI, aReloadFlags, aCanReload));
+nsSHistory::NotifyOnHistoryReload(bool* aCanReload) {
+  NOTIFY_LISTENERS_CANCELABLE(OnHistoryReload, *aCanReload, (aCanReload));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHistory::EvictOutOfRangeContentViewers(int32_t aIndex) {
   // Check our per SHistory object limit in the currently navigated SHistory
   EvictOutOfRangeWindowContentViewers(aIndex);
   // Check our total limit across all SHistory objects
@@ -812,37 +810,29 @@ nsresult nsSHistory::Reload(uint32_t aRe
     loadType = LOAD_RELOAD_CHARSET_CHANGE;
   } else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_MIXED_CONTENT) {
     loadType = LOAD_RELOAD_ALLOW_MIXED_CONTENT;
   } else {
     loadType = LOAD_RELOAD_NORMAL;
   }
 
   // We are reloading. Send Reload notifications.
-  // nsDocShellLoadFlagType is not public, where as nsIWebNavigation
-  // is public. So send the reload notifications with the
-  // nsIWebNavigation flags.
   bool canNavigate = true;
-  nsCOMPtr<nsIURI> currentURI;
-  GetCurrentURI(getter_AddRefs(currentURI));
-  NOTIFY_LISTENERS_CANCELABLE(OnHistoryReload, canNavigate,
-                              (currentURI, aReloadFlags, &canNavigate));
+  NOTIFY_LISTENERS_CANCELABLE(OnHistoryReload, canNavigate, (&canNavigate));
   if (!canNavigate) {
     return NS_OK;
   }
 
   return LoadEntry(mIndex, loadType, HIST_CMD_RELOAD);
 }
 
 NS_IMETHODIMP
 nsSHistory::ReloadCurrentEntry() {
   // Notify listeners
-  nsCOMPtr<nsIURI> currentURI;
-  GetCurrentURI(getter_AddRefs(currentURI));
-  NOTIFY_LISTENERS(OnHistoryGotoIndex, (mIndex, currentURI));
+  NOTIFY_LISTENERS(OnHistoryGotoIndex, ());
 
   return LoadEntry(mIndex, LOAD_HISTORY, HIST_CMD_RELOAD);
 }
 
 void nsSHistory::EvictOutOfRangeWindowContentViewers(int32_t aIndex) {
   // XXX rename method to EvictContentViewersExceptAroundIndex, or something.
 
   // We need to release all content viewers that are no longer in the range
@@ -1291,30 +1281,16 @@ nsSHistory::UpdateIndex() {
   if (mIndex != mRequestedIndex && mRequestedIndex != -1) {
     mIndex = mRequestedIndex;
   }
 
   mRequestedIndex = -1;
   return NS_OK;
 }
 
-nsresult nsSHistory::GetCurrentURI(nsIURI** aResultURI) {
-  NS_ENSURE_ARG_POINTER(aResultURI);
-  nsresult rv;
-
-  nsCOMPtr<nsISHEntry> currentEntry;
-  rv = GetEntryAtIndex(mIndex, getter_AddRefs(currentEntry));
-  if (NS_FAILED(rv) && !currentEntry) {
-    return rv;
-  }
-  nsCOMPtr<nsIURI> uri = currentEntry->GetURI();
-  uri.forget(aResultURI);
-  return rv;
-}
-
 NS_IMETHODIMP
 nsSHistory::GotoIndex(int32_t aIndex) {
   return LoadEntry(aIndex, LOAD_HISTORY, HIST_CMD_GOTOINDEX);
 }
 
 nsresult nsSHistory::LoadNextPossibleEntry(int32_t aNewIndex, long aLoadType,
                                            uint32_t aHistCmd) {
   mRequestedIndex = -1;
@@ -1359,17 +1335,17 @@ nsresult nsSHistory::LoadEntry(int32_t a
   nsCOMPtr<nsIURI> nextURI = nextEntry->GetURI();
 
   MOZ_ASSERT((prevEntry && nextEntry && nextURI),
              "prevEntry, nextEntry and nextURI can't be null");
 
   // Send appropriate listener notifications.
   if (aHistCmd == HIST_CMD_GOTOINDEX) {
     // We are going somewhere else. This is not reload either
-    NOTIFY_LISTENERS(OnHistoryGotoIndex, (aIndex, nextURI));
+    NOTIFY_LISTENERS(OnHistoryGotoIndex, ());
   }
 
   if (mRequestedIndex == mIndex) {
     // Possibly a reload case
     return InitiateLoad(nextEntry, mRootDocShell, aLoadType);
   }
 
   // Going back or forward.
--- a/docshell/shistory/nsSHistory.h
+++ b/docshell/shistory/nsSHistory.h
@@ -58,17 +58,16 @@ class nsSHistory final : public mozilla:
                                  // whose children will correspond to aEntry
   };
 
   nsSHistory();
   NS_DECL_ISUPPORTS
   NS_DECL_NSISHISTORY
 
   nsresult Reload(uint32_t aReloadFlags);
-  nsresult GetCurrentURI(nsIURI** aResultURI);
 
   // One time initialization method called upon docshell module construction
   static nsresult Startup();
   static void Shutdown();
   static void UpdatePrefs();
 
   // Max number of total cached content viewers.  If the pref
   // browser.sessionhistory.max_total_viewers is negative, then
--- a/docshell/test/browser/file_bug422543_script.js
+++ b/docshell/test/browser/file_bug422543_script.js
@@ -6,30 +6,30 @@ function SHistoryListener() {
 SHistoryListener.prototype = {
   retval: true,
   last: "initial",
 
   OnHistoryNewEntry(aNewURI) {
     this.last = "newentry";
   },
 
-  OnHistoryGotoIndex(aIndex, aGotoURI) {
+  OnHistoryGotoIndex() {
     this.last = "gotoindex";
   },
 
-  OnHistoryPurge(aNumEntries) {
+  OnHistoryPurge() {
     this.last = "purge";
   },
 
-  OnHistoryReload(aReloadURI, aReloadFlags) {
+  OnHistoryReload() {
     this.last = "reload";
     return this.retval;
   },
 
-  OnHistoryReplaceEntry(aIndex) {},
+  OnHistoryReplaceEntry() {},
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsISHistoryListener,
                                           Ci.nsISupportsWeakReference]),
 };
 
 let testAPI = {
   shistory: null,
   listeners: [ new SHistoryListener(),
@@ -60,18 +60,17 @@ let testAPI = {
       listener.last = "initial";
     }
 
     sendAsyncMessage("bug422543:resetListeners:return", {});
   },
 
   notifyReload() {
     let history = this.shistory.legacySHistory;
-    let rval =
-      history.notifyOnHistoryReload(content.document.documentURIObject, 0);
+    let rval = history.notifyOnHistoryReload();
     sendAsyncMessage("bug422543:notifyReload:return", { rval });
   },
 
   setRetval({ num, val }) {
     this.listeners[num].retval = val;
     sendAsyncMessage("bug422543:setRetval:return", {});
   },
 };
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4687,30 +4687,30 @@ Tab.prototype = {
 
     GlobalEventDispatcher.sendRequest(message);
   },
 
   OnHistoryNewEntry: function(newURI, oldIndex) {
     Services.obs.notifyObservers(this.browser, "Content:HistoryChange");
   },
 
-  OnHistoryReload: function(reloadURI, reloadFlags) {
+  OnHistoryReload: function() {
     Services.obs.notifyObservers(this.browser, "Content:HistoryChange");
     return true;
   },
 
-  OnHistoryGotoIndex: function(index, gotoURI) {
+  OnHistoryGotoIndex: function() {
     Services.obs.notifyObservers(this.browser, "Content:HistoryChange");
   },
 
-  OnHistoryPurge: function(numEntries) {
+  OnHistoryPurge: function() {
     Services.obs.notifyObservers(this.browser, "Content:HistoryChange");
   },
 
-  OnHistoryReplaceEntry: function(index) {
+  OnHistoryReplaceEntry: function() {
     Services.obs.notifyObservers(this.browser, "Content:HistoryChange");
   },
 
   UpdateMediaPlaybackRelatedObserver: function(active) {
     // Media control is only used for the tab which has playing media, so we
     // only need to register observer after having the active media. And the
     // "media-playback-resumed" is sent when user resume paused media from
     // page, it notifies us that we should change the icon and content in media
--- a/toolkit/components/browser/nsWebBrowser.cpp
+++ b/toolkit/components/browser/nsWebBrowser.cpp
@@ -128,21 +128,23 @@ already_AddRefed<nsWebBrowser> nsWebBrow
                         &browser->mBackgroundColor);
 
   // HACK ALERT - this registration registers the nsDocShellTreeOwner as a
   // nsIWebBrowserListener so it can setup its MouseListener in one of the
   // progress callbacks. If we can register the MouseListener another way, this
   // registration can go away, and nsDocShellTreeOwner can stop implementing
   // nsIWebProgressListener.
   RefPtr<nsDocShellTreeOwner> docShellTreeOwner = browser->mDocShellTreeOwner;
-  nsCOMPtr<nsISupports> supports = nullptr;
-  Unused << docShellTreeOwner->QueryInterface(
-      NS_GET_IID(nsIWebProgressListener),
-      static_cast<void**>(getter_AddRefs(supports)));
-  Unused << browser->BindListener(supports, NS_GET_IID(nsIWebProgressListener));
+  NS_ASSERTION(
+      browser->mWebProgress,
+      "this should only be called after we've retrieved a progress iface");
+  if (browser->mWebProgress) {
+    Unused << browser->mWebProgress->AddProgressListener(
+        docShellTreeOwner, nsIWebProgress::NOTIFY_ALL);
+  }
 
   nsCOMPtr<nsIBaseWindow> docShellAsWin = browser->mDocShellAsWin;
   NS_ENSURE_SUCCESS(
       docShellAsWin->InitWindow(nullptr, docShellParentWidget, 0, 0, 0, 0),
       nullptr);
 
   docShell->SetTreeOwner(docShellTreeOwner);
 
@@ -253,48 +255,16 @@ nsWebBrowser::GetInterface(const nsIID& 
   return NS_NOINTERFACE;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIWebBrowser
 //*****************************************************************************
 
 NS_IMETHODIMP
-nsWebBrowser::BindListener(nsISupports* aListener, const nsIID& aIID) {
-  NS_ENSURE_ARG_POINTER(aListener);
-  NS_ASSERTION(
-      mWebProgress,
-      "this should only be called after we've retrieved a progress iface");
-  nsresult rv = NS_OK;
-
-  // register this listener for the specified interface id
-  if (aIID.Equals(NS_GET_IID(nsIWebProgressListener))) {
-    nsCOMPtr<nsIWebProgressListener> listener =
-        do_QueryInterface(aListener, &rv);
-    if (NS_FAILED(rv)) {
-      return rv;
-    }
-    NS_ENSURE_STATE(mWebProgress);
-    rv =
-        mWebProgress->AddProgressListener(listener, nsIWebProgress::NOTIFY_ALL);
-  } else if (aIID.Equals(NS_GET_IID(nsISHistoryListener))) {
-    nsCOMPtr<nsISHistory> shistory(do_GetInterface(mDocShell, &rv));
-    if (NS_FAILED(rv)) {
-      return rv;
-    }
-    nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(aListener, &rv));
-    if (NS_FAILED(rv)) {
-      return rv;
-    }
-    rv = shistory->AddSHistoryListener(listener);
-  }
-  return rv;
-}
-
-NS_IMETHODIMP
 nsWebBrowser::EnableGlobalHistory(bool aEnable) {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShell->SetUseGlobalHistory(aEnable);
 }
 
 NS_IMETHODIMP
 nsWebBrowser::GetContainerWindow(nsIWebBrowserChrome** aTopWindow) {
--- a/toolkit/components/browser/nsWebBrowser.h
+++ b/toolkit/components/browser/nsWebBrowser.h
@@ -113,17 +113,16 @@ class nsWebBrowser final : public nsIWeb
 
  protected:
   virtual ~nsWebBrowser();
   NS_IMETHOD InternalDestroy();
 
   // XXXbz why are these NS_IMETHOD?  They're not interface methods!
   NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
   NS_IMETHOD EnsureDocShellTreeOwner();
-  NS_IMETHOD BindListener(nsISupports* aListener, const nsIID& aIID);
   NS_IMETHOD EnableGlobalHistory(bool aEnable);
 
   nsIWidget* EnsureWidget();
 
   // nsIWidgetListener methods for WidgetListenerDelegate.
   MOZ_CAN_RUN_SCRIPT void WindowActivated();
   MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
   MOZ_CAN_RUN_SCRIPT bool PaintWindow(nsIWidget* aWidget,