Backed out 7 changesets (bug 872147, bug 872143, bug 877467, bug 877200, bug 870063, bug 872149) for robocop-2 failures on a CLOSED TREE.

Backed out changeset 3a1e8e7ac07e (bug 870063)
Backed out changeset 8904d2bf5da0 (bug 877200)
Backed out changeset 80455a25276b (bug 872149)
Backed out changeset c3b5567f1271 (bug 872147)
Backed out changeset d3106edd4a5a (bug 872143)
Backed out changeset 4fd2ae88da98 (bug 870063)
Backed out changeset 1797dc46e862 (bug 877467)
This commit is contained in:
Ryan VanderMeulen 2013-06-03 15:04:51 -04:00
parent 3dd3218865
commit f644566996
5 changed files with 174 additions and 119 deletions

View File

@ -72,26 +72,34 @@ var FeedHandler = {
// First, let's decide on which feed to subscribe
let feedIndex = -1;
if (feeds.length > 1) {
let p = new Prompt({
window: browser.contentWindow,
}).setSingleChoiceItems(feeds.map(function(feed) {
return { label: feed.title || feed.href }
})).show((function(data) {
feedIndex = data.button;
// JSON for Prompt
let feedResult = {
type: "Prompt:Show",
multiple: false,
selected: [],
listitems: []
};
// Build the list of feeds
for (let i = 0; i < feeds.length; i++) {
let item = {
label: feeds[i].title || feeds[i].href,
isGroup: false,
inGroup: false,
disabled: false,
id: i
};
feedResult.listitems.push(item);
}
feedIndex = JSON.parse(sendMessageToJava(feedResult)).button;
} else {
// Only a single feed on the page
feedIndex = 0;
}
if (feedIndex == -1)
return;
this.loadFeed(feeds[feedIndex], browser);
}).bind(this));
return;
}
this.loadFeed(feeds[0], browser);
}
},
loadFeed: function fh_loadFeed(aFeed, aBrowser) {
let feedURL = aFeed.href;
let feedURL = feeds[feedIndex].href;
// Next, we decide on which service to send the feed
let handlers = this.getContentHandlers(this.TYPE_MAYBE_FEED);
@ -99,21 +107,34 @@ var FeedHandler = {
return;
// JSON for Prompt
let p = new Prompt({
window: aBrowser.contentWindow
}).setSingleChoiceItems(handlers.map(function(handler) {
return { label: handler.name };
})).show(function(data) {
if (data.button == -1)
let handlerResult = {
type: "Prompt:Show",
multiple: false,
selected: [],
listitems: []
};
// Build the list of handlers
for (let i = 0; i < handlers.length; ++i) {
let item = {
label: handlers[i].name,
isGroup: false,
inGroup: false,
disabled: false,
id: i
};
handlerResult.listitems.push(item);
}
let handlerIndex = JSON.parse(sendMessageToJava(handlerResult)).button;
if (handlerIndex == -1)
return;
// Merge the handler URL and the feed URL
let readerURL = handlers[data.button].uri;
let readerURL = handlers[handlerIndex].uri;
readerURL = readerURL.replace(/%s/gi, encodeURIComponent(feedURL));
// Open the resultant URL in a new tab
BrowserApp.addTab(readerURL, { parentId: BrowserApp.selectedTab.id });
});
}
}
};

View File

@ -23,18 +23,21 @@ var InputWidgetHelper = {
show: function(aElement) {
let type = aElement.getAttribute('type');
let p = new Prompt({
window: aElement.ownerDocument.defaultView,
let msg = {
type: "Prompt:Show",
title: Strings.browser.GetStringFromName("inputWidgetHelper." + aElement.getAttribute('type')),
buttons: [
Strings.browser.GetStringFromName("inputWidgetHelper.set"),
Strings.browser.GetStringFromName("inputWidgetHelper.clear"),
Strings.browser.GetStringFromName("inputWidgetHelper.cancel")
],
}).addDatePicker({
value: aElement.value,
type: type,
}).show((function(data) {
inputs: [
{ type: type, value: aElement.value }
]
};
let data = JSON.parse(sendMessageToJava(msg));
let changed = false;
if (data.button == -1) {
// This type is not supported with this android version.
@ -49,7 +52,7 @@ var InputWidgetHelper = {
} else if (data.button == 0) {
// Commit the new value.
if (aElement.value != data[type]) {
aElement.value = data[type + "0"];
aElement.value = data[type];
changed = true;
}
}
@ -57,7 +60,7 @@ var InputWidgetHelper = {
if (changed)
this.fireOnChange(aElement);
}).bind(this));
},
_isValidInput: function(aElement) {

View File

@ -249,6 +249,7 @@ var BrowserApp = {
_tabs: [],
_selectedTab: null,
_prefObservers: [],
_promptHandlers: {},
get isTablet() {
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
@ -298,6 +299,7 @@ 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);
@ -1426,6 +1428,18 @@ 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));
@ -1490,26 +1504,35 @@ 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,
selected: (i == selIndex)
isGroup: false,
inGroup: false,
disabled: false,
id: i
};
listitems.push(item);
result.listitems.push(item);
result.selected.push(i == selIndex);
}
let p = new Prompt({
window: browser.contentWindow
}).setSingleChoiceItems(listitems).show(function(data) {
this._promptHandlers[guid] = function (data) {
let selected = data.button;
if (selected == -1)
return;
browser.gotoIndex(toIndex-selected);
});
};
sendMessageToJava(result);
},
};
@ -1889,8 +1912,10 @@ var NativeWindow = {
icon: item.icon,
label: item.label,
id: id,
isGroup: false,
inGroup: false,
disabled: item.disabled,
parent: item instanceof Ci.nsIDOMHTMLMenuElement
isParent: item instanceof Ci.nsIDOMHTMLMenuElement
}
}
};
@ -2015,11 +2040,12 @@ var NativeWindow = {
if (itemArray.length == 0)
return;
let prompt = new Prompt({
window: aTarget.ownerDocument.defaultView,
title: title
}).setSingleChoiceItems(itemArray)
.show(function(data) {
let msg = {
type: "Prompt:Show",
title: title,
listitems: itemArray
};
let data = JSON.parse(sendMessageToJava(msg));
if (data.button == -1) {
// prompt was cancelled
return;
@ -2044,7 +2070,6 @@ var NativeWindow = {
selectedItem.callback.call(selectedItem, aTarget, aX, aY);
}
}
});
},
handleEvent: function(aEvent) {

View File

@ -82,19 +82,28 @@ PaymentUI.prototype = {
requestText += " (" + request.productPrice[0].amount + " " +
request.productPrice[0].currency + ")";
}
listItems.push({ label: requestText });
listItems.push({
label: requestText,
isGroup: false,
inGroup: false,
disabled: false,
id: i
});
}
let p = new Prompt({
window: null,
let result = this.sendMessageToJava({
type: "Prompt:Show",
title: this.bundle.GetStringFromName("payments.providerdialog.title"),
}).setSingleChoiceItems(listItems).show(function(data) {
if (data.button > -1 && aSuccessCb) {
aSuccessCb.onresult(aRequestId, aRequests[data.button].wrappedJSObject.type);
multiple: false,
selected: [],
listItems: listItems,
});
if (result.button > -1 && aSuccessCb) {
aSuccessCb.onresult(aRequestId, aRequests[result.button].wrappedJSObject.type);
} else {
_error(aRequestId, "USER_CANCELED");
}
});
},
_error: function(aCallback) {

View File

@ -48,8 +48,6 @@ Prompt.prototype = {
obj.id = aOptions.id || (aOptions.type + this[aOptions.type + "_count"]);
this[aOptions.type + "_count"]++;
if (!this.msg.inputs)
this.msg.inputs = [];
this.msg.inputs.push(obj);
return this;
},
@ -83,13 +81,6 @@ Prompt.prototype = {
});
},
addDatePicker: function(aOptions) {
return this._addInput({
type: aOptions.type || "date",
value: aOptions.value,
});
},
addMenulist: function(aOptions) {
return this._addInput({
type: "menulist",
@ -121,13 +112,17 @@ Prompt.prototype = {
this.callback(data);
},
_setListItems: function(aItems) {
_setListItems: function(aItems, aInGroup) {
let hasSelected = false;
if (!aInGroup)
this.msg.listitems = [];
aItems.forEach(function(item) {
let obj = { id: item.id };
if (aInGroup !== undefined)
obj.inGroup = aInGroup;
obj.label = item.label;
if (item.disabled)
@ -141,17 +136,19 @@ Prompt.prototype = {
this.msg.selected[this.msg.listitems.length] = item.selected;
}
if (item.header)
if (item.children) {
obj.isGroup = true;
if (item.menu)
} else if (item.submenu) {
obj.isParent = true;
}
if (item.child)
obj.inGroup = true;
// Order matters in the java message, so make sure we add the obj
// to the list before we add its children
this.msg.listitems.push(obj);
if (item.children)
this._setListItems(item.children, true);
}, this);
return this;
},