mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 877200 - Make history menu use async prompts. r=mfinkle
This commit is contained in:
parent
694702d6d7
commit
000d7f03ff
@ -252,7 +252,6 @@ var BrowserApp = {
|
||||
_tabs: [],
|
||||
_selectedTab: null,
|
||||
_prefObservers: [],
|
||||
_promptHandlers: {},
|
||||
|
||||
get isTablet() {
|
||||
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
|
||||
@ -302,7 +301,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);
|
||||
|
||||
@ -1429,18 +1427,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);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user