author | wesj <wjohnston@mozilla.com> |
Fri, 26 Sep 2014 11:31:12 -0700 | |
changeset 207477 | dd5ffa28355ab2238e4f69d2f3031195744076ae |
parent 207476 | 5cd5fb2dc27eeae36f913d1afd1ccd5edad9fea5 |
child 207478 | fa7043f61be0f6c2521d70dfb01c555400a0bb18 |
push id | 27555 |
push user | ryanvm@gmail.com |
push date | Fri, 26 Sep 2014 20:30:28 +0000 |
treeherder | autoland@4ff52be673f6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | margaret |
bugs | 1071076 |
milestone | 35.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
|
--- a/mobile/android/modules/NetErrorHelper.jsm +++ b/mobile/android/modules/NetErrorHelper.jsm @@ -6,16 +6,18 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Messaging.jsm"); Cu.import("resource://gre/modules/UITelemetry.jsm"); this.EXPORTED_SYMBOLS = ["NetErrorHelper"]; +const KEY_CODE_ENTER = 13; + /* Handlers is a list of objects that will be notified when an error page is shown * or when an event occurs on the page that they are registered to handle. Registration * is done by just adding yourself to the dictionary. * * handlers.myKey = { * onPageShown: function(browser) { }, * handleEvent: function(event) { }, * } @@ -73,22 +75,31 @@ handlers.searchbutton = { let tab = browserWin.BrowserApp.getTabForBrowser(browser); // If there is no stored userRequested, just hide the searchbox if (!tab.userRequested) { search.style.display = "none"; } else { let text = browser.contentDocument.querySelector("#searchtext"); text.value = tab.userRequested; + text.addEventListener("keypress", (event) => { + if (event.keyCode === KEY_CODE_ENTER) { + this.doSearch(event.target.value); + } + }); } }, handleClick: function(event) { + let value = event.target.previousElementSibling.value; + this.doSearch(value); + }, + + doSearch: function(value) { let engine = Services.search.defaultEngine; - let value = event.target.previousElementSibling.value; let uri = engine.getSubmission(value).uri; let browserWin = Services.wm.getMostRecentWindow("navigator:browser"); // Reset the user search to whatever the new search term was browserWin.BrowserApp.loadURI(uri.spec, undefined, { isSearch: true, userRequested: value }); } };