Bug 1342508 - [1.0] Add GeckoView.reload. r=snorp
authorEugen Sawin <esawin@mozilla.com>
Wed, 01 Feb 2017 16:21:25 +0100
changeset 374155 de31af4868b396fb7d80dbfe1d60f1803ff1ee02
parent 374154 1bc4a653e92ef65cfd84e508f0d5227d54d9046e
child 374156 35286e286abadc6f2ebdbcd2739a014d2d3e6051
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1342508
milestone54.0a1
Bug 1342508 - [1.0] Add GeckoView.reload. r=snorp
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoView.java
mobile/android/modules/GeckoViewNavigation.jsm
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoView.java
@@ -315,16 +315,23 @@ public class GeckoView extends LayerView
 
         if (GeckoThread.isRunning()) {
             window.loadUri(uri, flags);
         }  else {
             GeckoThread.queueNativeCall(window, "loadUri", String.class, uri, flags);
         }
     }
 
+    /**
+    * Reload the current URI.
+    */
+    public void reload() {
+        eventDispatcher.dispatch("GeckoView:Reload", null);
+    }
+
     /* package */ void setInputConnectionListener(final InputConnectionListener icl) {
         mInputConnectionListener = icl;
     }
 
     /**
     * Go back in history.
     */
     public void goBack() {
--- a/mobile/android/modules/GeckoViewNavigation.jsm
+++ b/mobile/android/modules/GeckoViewNavigation.jsm
@@ -37,16 +37,17 @@ class GeckoViewNavigation extends GeckoV
     // event may be dispatched before this object is constructed.
     this.registerProgressListener();
 
     this.eventDispatcher.registerListener(this, [
       "GeckoViewNavigation:Active",
       "GeckoViewNavigation:Inactive",
       "GeckoView:GoBack",
       "GeckoView:GoForward",
+      "GeckoView:Reload",
     ]);
   }
 
   // Bundle event handler.
   onEvent(event, data, callback) {
     debug("onEvent: event=" + event + ", data=" + JSON.stringify(data));
 
     switch (event) {
@@ -57,16 +58,19 @@ class GeckoViewNavigation extends GeckoV
         this.unregisterProgressListener();
         break;
       case "GeckoView:GoBack":
         this.browser.goBack();
         break;
       case "GeckoView:GoForward":
         this.browser.goForward();
         break;
+      case "GeckoView:Reload":
+        this.browser.reload();
+        break;
     }
   }
 
   // Message manager event handler.
   receiveMessage(msg) {
     debug("receiveMessage " + msg.name);
   }