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

Side by Side Diff: lib/ui.js

Issue 6612223174639616: Issue 1602 - Use ES6 generators instead of legacy generators (Closed)
Patch Set: Created March 31, 2015, 6:24 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/synchronizer.js ('k') | metadata.gecko » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 get applicationWindows() 650 get applicationWindows()
651 { 651 {
652 let {isKnownWindow} = require("appSupport"); 652 let {isKnownWindow} = require("appSupport");
653 653
654 let enumerator = Services.wm.getZOrderDOMWindowEnumerator(null, true); 654 let enumerator = Services.wm.getZOrderDOMWindowEnumerator(null, true);
655 if (!enumerator.hasMoreElements()) 655 if (!enumerator.hasMoreElements())
656 { 656 {
657 // On Linux the list returned will be empty, see bug 156333. Fall back to random order. 657 // On Linux the list returned will be empty, see bug 156333. Fall back to random order.
658 enumerator = Services.wm.getEnumerator(null); 658 enumerator = Services.wm.getEnumerator(null);
659 } 659 }
660 while (enumerator.hasMoreElements()) 660
661 let generate = function*()
661 { 662 {
662 let window = enumerator.getNext().QueryInterface(Ci.nsIDOMWindow); 663 while (enumerator.hasMoreElements())
663 if (isKnownWindow(window)) 664 {
664 yield window; 665 let window = enumerator.getNext().QueryInterface(Ci.nsIDOMWindow);
665 } 666 if (isKnownWindow(window))
667 yield window;
668 }
669 };
670
671 return generate();
666 }, 672 },
667 673
668 /** 674 /**
669 * Returns the top-most application window or null if none exists. 675 * Returns the top-most application window or null if none exists.
670 * @type Window 676 * @type Window
671 */ 677 */
672 get currentWindow() 678 get currentWindow()
673 { 679 {
674 for (let window of this.applicationWindows) 680 for (let window of this.applicationWindows)
675 return window; 681 return window;
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 1963 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
1958 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 1964 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
1959 ]; 1965 ];
1960 1966
1961 onShutdown.add(function() 1967 onShutdown.add(function()
1962 { 1968 {
1963 for (let window in UI.applicationWindows) 1969 for (let window in UI.applicationWindows)
1964 if (UI.isBottombarOpen(window)) 1970 if (UI.isBottombarOpen(window))
1965 UI.toggleBottombar(window); 1971 UI.toggleBottombar(window);
1966 }); 1972 });
OLDNEW
« no previous file with comments | « lib/synchronizer.js ('k') | metadata.gecko » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld