Bug 1496165 - Rename UrlbarInput event handlers to be more readable. r=Standard8
authorDão Gottwald <dao@mozilla.com>
Wed, 03 Oct 2018 19:33:41 +0000
changeset 495206 35617edceddab3f598412be21028155ada286e62
parent 495205 2d5a7c965683ec6c52f881d194551db628b18821
child 495207 b37b275c93648fc79fd82633e2db3b969cd14e46
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1496165
milestone64.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 1496165 - Rename UrlbarInput event handlers to be more readable. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D7635
browser/components/urlbar/UrlbarInput.jsm
--- a/browser/components/urlbar/UrlbarInput.jsm
+++ b/browser/components/urlbar/UrlbarInput.jsm
@@ -163,17 +163,17 @@ class UrlbarInput {
   }
 
   /**
    * Passes DOM events for the textbox to the _on<event type> methods.
    * @param {Event} event
    *   DOM event from the <textbox>.
    */
   handleEvent(event) {
-    let methodName = "_on" + event.type;
+    let methodName = "_on_" + event.type;
     if (methodName in this) {
       this[methodName](event);
     } else {
       throw "Unrecognized urlbar event: " + event.type;
     }
   }
 
   // Getters and Setters below.
@@ -314,87 +314,87 @@ class UrlbarInput {
       }
     }
 
     return action;
   }
 
   // Event handlers below.
 
-  _onblur(event) {
+  _on_blur(event) {
     this.formatValue();
   }
 
-  _onfocus(event) {
+  _on_focus(event) {
     this.formatValue();
   }
 
-  _onmousedown(event) {
+  _on_mousedown(event) {
     if (event.button == 0 &&
         event.detail == 2 &&
         UrlbarPrefs.get("doubleClickSelectsAll")) {
       this.editor.selectAll();
       event.preventDefault();
     }
   }
 
-  _oninput(event) {
+  _on_input(event) {
     this.valueIsTyped = true;
 
     // XXX Fill in lastKey, and add anything else we need.
     this.controller.startQuery(new QueryContext({
       searchString: event.target.value,
       lastKey: "",
       maxResults: UrlbarPrefs.get("maxRichResults"),
       isPrivate: this.isPrivate,
     }));
   }
 
-  _onselect(event) {
+  _on_select(event) {
     if (!Services.clipboard.supportsSelectionClipboard()) {
       return;
     }
 
     if (!this.window.windowUtils.isHandlingUserInput) {
       return;
     }
 
     let val = this._getSelectedValueForClipboard();
     if (!val) {
       return;
     }
 
     ClipboardHelper.copyStringToClipboard(val, Services.clipboard.kSelectionClipboard);
   }
 
-  _onoverflow(event) {
+  _on_overflow(event) {
     const targetIsPlaceholder =
       !event.originalTarget.classList.contains("anonymous-div");
     // We only care about the non-placeholder text.
     // This shouldn't be needed, see bug 1487036.
     if (targetIsPlaceholder) {
       return;
     }
     this._inOverflow = true;
     this._updateTextOverflow();
   }
 
-  _onunderflow(event) {
+  _on_underflow(event) {
     const targetIsPlaceholder =
       !event.originalTarget.classList.contains("anonymous-div");
     // We only care about the non-placeholder text.
     // This shouldn't be needed, see bug 1487036.
     if (targetIsPlaceholder) {
       return;
     }
     this._inOverflow = false;
     this._updateTextOverflow();
   }
 
-  _onscrollend(event) {
+  _on_scrollend(event) {
     this._updateTextOverflow();
   }
 }
 
 /**
  * Handles copy and cut commands for the urlbar.
  */
 class CopyCutController {