diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 90f18fd1ff2..3a925665ed9 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -249,7 +249,6 @@ var BrowserApp = { _tabs: [], _selectedTab: null, _prefObservers: [], - _promptHandlers: {}, get isTablet() { let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2); @@ -299,7 +298,6 @@ var BrowserApp = { Services.obs.addObserver(this, "FormHistory:Init", false); Services.obs.addObserver(this, "gather-telemetry", false); Services.obs.addObserver(this, "keyword-search", false); - Services.obs.addObserver(this, "Prompt:Reply", false); Services.obs.addObserver(this, "sessionstore-state-purge-complete", false); @@ -1428,18 +1426,6 @@ var BrowserApp = { browser.contentDocument.mozCancelFullScreen(); break; - case "Prompt:Reply": - { - let data = JSON.parse(aData); - let guid = data.guid; - let handler = this._promptHandlers[guid]; - if (!handler) - break; - this._promptHandlers[guid]; - handler(data); - } - break; - case "Viewport:Change": if (this.isBrowserContentDocumentDisplayed()) this.selectedTab.setViewport(JSON.parse(aData)); @@ -1504,35 +1490,26 @@ var BrowserApp = { // selecting selIndex(if fromIndex<=selIndex<=toIndex) showHistory: function(fromIndex, toIndex, selIndex) { let browser = this.selectedBrowser; - let guid = uuidgen.generateUUID().toString(); - let result = { - type: "Prompt:Show", - multiple: false, - async: true, - guid: guid, - selected: [], - listitems: [] - }; let hist = browser.sessionHistory; + let listitems = []; for (let i = toIndex; i >= fromIndex; i--) { let entry = hist.getEntryAtIndex(i, false); let item = { label: entry.title || entry.URI.spec, - isGroup: false, - inGroup: false, - disabled: false, - id: i + selected: (i == selIndex) }; - result.listitems.push(item); - result.selected.push(i == selIndex); + listitems.push(item); } - this._promptHandlers[guid] = function (data) { + + let p = new Prompt({ + window: browser.contentWindow + }).setSingleChoiceItems(listitems).show(function(data) { let selected = data.button; if (selected == -1) return; + browser.gotoIndex(toIndex-selected); - }; - sendMessageToJava(result); + }); }, };