Bug 1544542 - Don't try to call history delegate if we don't have one r=droeh
authorJames Willcox <snorp@snorp.net>
Mon, 15 Apr 2019 21:01:43 +0000
changeset 469575 1eec26ba4a75
parent 469574 da28ce3af312
child 469576 252732b54408
push id35874
push userccoroiu@mozilla.com
push dateTue, 16 Apr 2019 04:04:58 +0000
treeherdermozilla-central@be3f40425b52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdroeh
bugs1544542
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 1544542 - Don't try to call history delegate if we don't have one r=droeh This also fixes a doc build issue. Differential Revision: https://phabricator.services.mozilla.com/D27576
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -599,23 +599,24 @@ public class GeckoSession implements Par
                                         message.getBoolean("success"));
                 } else if ("GeckoView:ProgressChanged".equals(event)) {
                     delegate.onProgressChange(GeckoSession.this,
                                               message.getInt("progress"));
                 } else if ("GeckoView:SecurityChanged".equals(event)) {
                     final GeckoBundle identity = message.getBundle("identity");
                     delegate.onSecurityChange(GeckoSession.this, new ProgressDelegate.SecurityInformation(identity));
                 } else if ("GeckoView:StateUpdated".equals(event)) {
+                    final HistoryDelegate historyDelegate = getHistoryDelegate();
                     final GeckoBundle update = message.getBundle("data");
                     if (update != null) {
                         mStateCache.updateSessionState(update);
                         final SessionState state = new SessionState(mStateCache);
                         delegate.onSessionStateChange(GeckoSession.this, state);
-                        if (update.getBundle("historychange") != null) {
-                            getHistoryDelegate().onHistoryStateChange(GeckoSession.this, state);
+                        if (historyDelegate != null && update.getBundle("historychange") != null) {
+                            historyDelegate.onHistoryStateChange(GeckoSession.this, state);
                         }
                     }
                 }
             }
         };
 
     private final GeckoSessionHandler<ScrollDelegate> mScrollHandler =
         new GeckoSessionHandler<ScrollDelegate>(
@@ -1604,17 +1605,17 @@ public class GeckoSession implements Par
     @AnyThread
     public void goForward() {
         mEventDispatcher.dispatch("GeckoView:GoForward", null);
     }
 
     /**
      * Navigate to an index in browser history; the index of the currently
      * viewed page can be retrieved from an up-to-date HistoryList by
-     * calling {@link HistoryList#getCurrentIndex()}.
+     * calling {@link HistoryDelegate.HistoryList#getCurrentIndex()}.
      *
      * @param index The index of the location in browser history you want
      *              to navigate to.
      */
     @AnyThread
     public void gotoHistoryIndex(final int index) {
         final GeckoBundle msg = new GeckoBundle(1);
         msg.putInt("index", index);