Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/ui.js

Issue 10989110: Worked around Fennec bug: selecting a subscription in the list is ignored (Closed)
Patch Set: Created July 9, 2013, 5:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/ui.js
===================================================================
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -186,21 +186,31 @@ let optionsObserver =
if (currentSubscription && list.selectedIndex < 0)
{
list.appendItem(currentSubscription.title, currentSubscription.url, null);
list.selectedIndex = list.itemCount - 1;
}
}
- list.addEventListener("command", function(event)
+ var listener = function()
{
if (list.value)
UI.setSubscription(list.value, list.label);
- }, false);
+ }
+ list.addEventListener("command", listener, false);
+
+ // xul:menulist in Fennec is broken and doesn't trigger any events
+ // on selection. Have to detect selectIndex changes instead.
+ // See http://hg.mozilla.org/mozilla-central/file/04d8c309fe72/mobile/android/chrome/content/SelectHelper.js#l40
+ list.watch("selectedIndex", function(prop, oldval, newval)
+ {
+ Utils.runAsync(listener);
+ return newval;
+ });
}, false);
request.send();
}
}
},
observe: function(subject, topic, data)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld