Bug 1342508 - [1.0] Add GeckoView.reload. r=snorp
authorEugen Sawin <esawin@mozilla.com>
Wed, 01 Feb 2017 16:21:25 +0100
changeset 394105 de31af4868b396fb7d80dbfe1d60f1803ff1ee02
parent 394104 1bc4a653e92ef65cfd84e508f0d5227d54d9046e
child 394106 35286e286abadc6f2ebdbcd2739a014d2d3e6051
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1342508
milestone54.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 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);
   }