mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 20:44:11 +01:00
Recognize new-style iterators in util.objectToString.
This commit is contained in:
@@ -1426,7 +1426,7 @@ function octal(decimal) parseInt(decimal, 8);
|
||||
* @param {nsIJSIID} iface The interface to which to query all elements.
|
||||
* @returns {Generator}
|
||||
*/
|
||||
let _iterator = "@@iterator" in [] ? "@@iterator" : "iterator";
|
||||
iter.iteratorProp = "@@iterator" in [] ? "@@iterator" : "iterator";
|
||||
function iter(obj, iface) {
|
||||
if (arguments.length == 2 && iface instanceof Ci.nsIJSIID)
|
||||
return iter(obj).map(item => item.QueryInterface(iface));
|
||||
@@ -1444,7 +1444,7 @@ function iter(obj, iface) {
|
||||
;
|
||||
else if (isinstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList]))
|
||||
res = array.iterItems(obj);
|
||||
else if (_iterator in obj && callable(obj[_iterator]) && !("__iterator__" in obj))
|
||||
else if (iter.iteratorProp in obj && callable(obj[iter.iteratorProp]) && !("__iterator__" in obj))
|
||||
res = (x for (x of obj));
|
||||
else if (ctypes && ctypes.CData && obj instanceof ctypes.CData) {
|
||||
while (obj.constructor instanceof ctypes.PointerType)
|
||||
|
||||
Reference in New Issue
Block a user