bug 1549708: docshell: add nsIDocShell.isForceReloading; r=bzbarsky
authorAndreas Tolfsen <ato@sny.no>
Mon, 04 Nov 2019 13:28:23 +0000
changeset 500860 ece31d77808bb891c83cf4dacfd9284782a6c936
parent 500859 6aae6b40fcbe55b94b5c63b240e9c96cfaccad47
child 500861 ad943fb7937ed6e6f2ae728a0230834b45c6ef98
push id114166
push userapavel@mozilla.com
push dateThu, 07 Nov 2019 10:04:01 +0000
treeherdermozilla-inbound@d271c572a9bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1549708
milestone72.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 1549708: docshell: add nsIDocShell.isForceReloading; r=bzbarsky Exposes a new nsIDocShell API, isForceReloading, to determine if the loaded document was force-reloaded or not. It relies on the underlying behaviour of nsDocShell::IsForceReloading(), which again relies on nsDocShell::IsForceReloadType(mLoadType). The getter is used in the remote agent to test that Page.reload({ignoreCache: true}) works as intended. Differential Revision: https://phabricator.services.mozilla.com/D51435
docshell/base/nsDocShell.cpp
docshell/base/nsIDocShell.idl
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -13337,16 +13337,22 @@ nsDocShell::GetColorMatrix(nsTArray<floa
            MATRIX_LENGTH * sizeof(float));
   }
 
   return NS_OK;
 }
 
 #undef MATRIX_LENGTH
 
+NS_IMETHODIMP
+nsDocShell::GetIsForceReloading(bool* aForceReload) {
+  *aForceReload = IsForceReloading();
+  return NS_OK;
+}
+
 bool nsDocShell::IsForceReloading() { return IsForceReloadType(mLoadType); }
 
 NS_IMETHODIMP
 nsDocShell::GetBrowsingContextXPCOM(BrowsingContext** aBrowsingContext) {
   *aBrowsingContext = do_AddRef(mBrowsingContext).take();
   return NS_OK;
 }
 
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -1069,16 +1069,22 @@ interface nsIDocShell : nsIDocShellTreeI
    * nullptr; for example if the docshell has created a real window and document
    * already.
    */
   [noscript, nostdcall, notxpcom]
   UniqueClientSource TakeInitialClientSource();
 
   void setColorMatrix(in Array<float> aMatrix);
 
+  /**
+   * Returns true if the current load is a forced reload,
+   * e.g. started by holding shift whilst triggering reload.
+   */
+  readonly attribute bool isForceReloading;
+
   Array<float> getColorMatrix();
 
   /**
    * Initialize session history for this docshell. The docshell must be the root
    * docshell.
    */
   void initSessionHistory();