зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1484496: Part 5b - Convert toolkit/ nsISimpleEnumerator users to use JS iteration. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D3730 --HG-- extra : rebase_source : 935f166ec2c6581ba6f3fffe912404e81c8dc3d6 extra : histedit_source : ba701801de5205dcce6cfdccabe7b26aa7c7859c
This commit is contained in:
Родитель
80327d3561
Коммит
6adf9223ce
|
@ -75,9 +75,7 @@ function performanceCountersEnabled() {
|
||||||
let tabFinder = {
|
let tabFinder = {
|
||||||
update() {
|
update() {
|
||||||
this._map = new Map();
|
this._map = new Map();
|
||||||
let windows = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let win = windows.getNext();
|
|
||||||
let tabbrowser = win.gBrowser;
|
let tabbrowser = win.gBrowser;
|
||||||
for (let browser of tabbrowser.browsers) {
|
for (let browser of tabbrowser.browsers) {
|
||||||
let id = browser.outerWindowID; // May be `null` if the browser isn't loaded yet
|
let id = browser.outerWindowID; // May be `null` if the browser isn't loaded yet
|
||||||
|
|
|
@ -200,9 +200,7 @@ function moveWindowToReplace(aReplacedAlert) {
|
||||||
|
|
||||||
// Move windows that come after the replaced alert if the height is different.
|
// Move windows that come after the replaced alert if the height is different.
|
||||||
if (heightDelta != 0) {
|
if (heightDelta != 0) {
|
||||||
let windows = Services.wm.getEnumerator("alert:alert");
|
for (let alertWindow of Services.wm.getEnumerator("alert:alert")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let alertWindow = windows.getNext();
|
|
||||||
// boolean to determine if the alert window is after the replaced alert.
|
// boolean to determine if the alert window is after the replaced alert.
|
||||||
let alertIsAfter = gOrigin & NS_ALERT_TOP ?
|
let alertIsAfter = gOrigin & NS_ALERT_TOP ?
|
||||||
alertWindow.screenY > aReplacedAlert.screenY :
|
alertWindow.screenY > aReplacedAlert.screenY :
|
||||||
|
@ -230,9 +228,7 @@ function moveWindowToEnd() {
|
||||||
screen.availTop + screen.availHeight - window.outerHeight;
|
screen.availTop + screen.availHeight - window.outerHeight;
|
||||||
|
|
||||||
// Position the window at the end of all alerts.
|
// Position the window at the end of all alerts.
|
||||||
let windows = Services.wm.getEnumerator("alert:alert");
|
for (let alertWindow of Services.wm.getEnumerator("alert:alert")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let alertWindow = windows.getNext();
|
|
||||||
if (alertWindow != window) {
|
if (alertWindow != window) {
|
||||||
if (gOrigin & NS_ALERT_TOP) {
|
if (gOrigin & NS_ALERT_TOP) {
|
||||||
y = Math.max(y, alertWindow.screenY + alertWindow.outerHeight - WINDOW_SHADOW_SPREAD);
|
y = Math.max(y, alertWindow.screenY + alertWindow.outerHeight - WINDOW_SHADOW_SPREAD);
|
||||||
|
@ -253,9 +249,7 @@ function onAlertBeforeUnload() {
|
||||||
if (!gIsReplaced) {
|
if (!gIsReplaced) {
|
||||||
// Move other alert windows to fill the gap left by closing alert.
|
// Move other alert windows to fill the gap left by closing alert.
|
||||||
let heightDelta = window.outerHeight + WINDOW_MARGIN - WINDOW_SHADOW_SPREAD;
|
let heightDelta = window.outerHeight + WINDOW_MARGIN - WINDOW_SHADOW_SPREAD;
|
||||||
let windows = Services.wm.getEnumerator("alert:alert");
|
for (let alertWindow of Services.wm.getEnumerator("alert:alert")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let alertWindow = windows.getNext();
|
|
||||||
if (alertWindow != window) {
|
if (alertWindow != window) {
|
||||||
if (gOrigin & NS_ALERT_TOP) {
|
if (gOrigin & NS_ALERT_TOP) {
|
||||||
if (alertWindow.screenY > window.screenY) {
|
if (alertWindow.screenY > window.screenY) {
|
||||||
|
|
|
@ -23,9 +23,7 @@ var PropertyBagConverter = {
|
||||||
throw new TypeError("Not a property bag");
|
throw new TypeError("Not a property bag");
|
||||||
}
|
}
|
||||||
let result = {};
|
let result = {};
|
||||||
let enumerator = bag.enumerator;
|
for (let {name, value: property} of bag.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let {name, value: property} = enumerator.getNext().QueryInterface(Ci.nsIProperty);
|
|
||||||
let value = this.toValue(property);
|
let value = this.toValue(property);
|
||||||
result[name] = value;
|
result[name] = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,7 @@ const CookieCleaner = {
|
||||||
|
|
||||||
return new Promise((aResolve, aReject) => {
|
return new Promise((aResolve, aReject) => {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
while (aEnumerator.hasMoreElements()) {
|
for (let cookie of aEnumerator) {
|
||||||
let cookie = aEnumerator.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
if (aCb(cookie)) {
|
if (aCb(cookie)) {
|
||||||
Services.cookies.remove(cookie.host, cookie.name, cookie.path,
|
Services.cookies.remove(cookie.host, cookie.name, cookie.path,
|
||||||
false, cookie.originAttributes);
|
false, cookie.originAttributes);
|
||||||
|
@ -514,9 +513,7 @@ const AuthCacheCleaner = {
|
||||||
const PermissionsCleaner = {
|
const PermissionsCleaner = {
|
||||||
deleteByHost(aHost, aOriginAttributes) {
|
deleteByHost(aHost, aOriginAttributes) {
|
||||||
return new Promise(aResolve => {
|
return new Promise(aResolve => {
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let perm of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let perm = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
try {
|
try {
|
||||||
if (eTLDService.hasRootDomain(perm.principal.URI.host, aHost)) {
|
if (eTLDService.hasRootDomain(perm.principal.URI.host, aHost)) {
|
||||||
Services.perms.removePermission(perm);
|
Services.perms.removePermission(perm);
|
||||||
|
@ -590,10 +587,8 @@ const SecuritySettingsCleaner = {
|
||||||
Ci.nsISiteSecurityService.HEADER_HPKP]) {
|
Ci.nsISiteSecurityService.HEADER_HPKP]) {
|
||||||
// Also remove HSTS/HPKP/OMS information for subdomains by enumerating
|
// Also remove HSTS/HPKP/OMS information for subdomains by enumerating
|
||||||
// the information in the site security service.
|
// the information in the site security service.
|
||||||
let enumerator = sss.enumerate(type);
|
for (let entry of sss.enumerate(type)) {
|
||||||
while (enumerator.hasMoreElements()) {
|
let hostname = entry.hostname;
|
||||||
let entry = enumerator.getNext();
|
|
||||||
let hostname = entry.QueryInterface(Ci.nsISiteSecurityState).hostname;
|
|
||||||
if (eTLDService.hasRootDomain(hostname, aHost)) {
|
if (eTLDService.hasRootDomain(hostname, aHost)) {
|
||||||
// This uri is used as a key to remove the state.
|
// This uri is used as a key to remove the state.
|
||||||
let uri = Services.io.newURI("https://" + hostname);
|
let uri = Services.io.newURI("https://" + hostname);
|
||||||
|
|
|
@ -473,10 +473,7 @@ _ContextualIdentityService.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_forEachContainerTab(callback, userContextId = 0) {
|
_forEachContainerTab(callback, userContextId = 0) {
|
||||||
let windowList = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (windowList.hasMoreElements()) {
|
|
||||||
let win = windowList.getNext();
|
|
||||||
|
|
||||||
if (win.closed || !win.gBrowser) {
|
if (win.closed || !win.gBrowser) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -530,10 +527,7 @@ _ContextualIdentityService.prototype = {
|
||||||
// Collect the userContextIds currently used by any stored cookie.
|
// Collect the userContextIds currently used by any stored cookie.
|
||||||
let cookiesUserContextIds = new Set();
|
let cookiesUserContextIds = new Set();
|
||||||
|
|
||||||
const enumerator = Services.cookies.enumerator;
|
for (let cookie of Services.cookies.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
const cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
|
|
||||||
|
|
||||||
// Skip any userContextIds that should not be cleared.
|
// Skip any userContextIds that should not be cleared.
|
||||||
if (cookie.originAttributes.userContextId >= minUserContextId &&
|
if (cookie.originAttributes.userContextId >= minUserContextId &&
|
||||||
!keepDataContextIds.includes(cookie.originAttributes.userContextId)) {
|
!keepDataContextIds.includes(cookie.originAttributes.userContextId)) {
|
||||||
|
|
|
@ -35,9 +35,7 @@ function createCookie(userContextId) {
|
||||||
|
|
||||||
function hasCookie(userContextId) {
|
function hasCookie(userContextId) {
|
||||||
let found = false;
|
let found = false;
|
||||||
let enumerator = Services.cookies.getCookiesFromHost(BASE_URL, {userContextId});
|
for (let cookie of Services.cookies.getCookiesFromHost(BASE_URL, {userContextId})) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
|
|
||||||
if (cookie.originAttributes.userContextId == userContextId) {
|
if (cookie.originAttributes.userContextId == userContextId) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -63,9 +63,7 @@ var DownloadUIHelper = {
|
||||||
XPCOMUtils.defineLazyGetter(DownloadUIHelper, "strings", function() {
|
XPCOMUtils.defineLazyGetter(DownloadUIHelper, "strings", function() {
|
||||||
let strings = {};
|
let strings = {};
|
||||||
let sb = Services.strings.createBundle(kStringBundleUrl);
|
let sb = Services.strings.createBundle(kStringBundleUrl);
|
||||||
let enumerator = sb.getSimpleEnumeration();
|
for (let string of sb.getSimpleEnumeration()) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
|
|
||||||
let stringName = string.key;
|
let stringName = string.key;
|
||||||
if (stringName in kStringsRequiringFormatting) {
|
if (stringName in kStringsRequiringFormatting) {
|
||||||
strings[stringName] = function() {
|
strings[stringName] = function() {
|
||||||
|
|
|
@ -962,7 +962,7 @@ var ExtensionContent = {
|
||||||
let enum_ = docShell.getDocShellEnumerator(docShell.typeContent,
|
let enum_ = docShell.getDocShellEnumerator(docShell.typeContent,
|
||||||
docShell.ENUMERATE_FORWARDS);
|
docShell.ENUMERATE_FORWARDS);
|
||||||
|
|
||||||
for (let docShell of XPCOMUtils.IterSimpleEnumerator(enum_, Ci.nsIDocShell)) {
|
for (let docShell of enum_) {
|
||||||
try {
|
try {
|
||||||
yield docShell.domWindow;
|
yield docShell.domWindow;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -278,7 +278,7 @@ const query = function* (detailsIn, props, context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const cookie of XPCOMUtils.IterSimpleEnumerator(enumerator, Ci.nsICookie2)) {
|
for (const cookie of enumerator) {
|
||||||
if (matches(cookie)) {
|
if (matches(cookie)) {
|
||||||
yield {cookie, isPrivate, storeId};
|
yield {cookie, isPrivate, storeId};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1354,10 +1354,7 @@ class WindowTrackerBase extends EventEmitter {
|
||||||
// fires for browser windows when they're in that in-between state, and just
|
// fires for browser windows when they're in that in-between state, and just
|
||||||
// before we register our own "domwindowcreated" listener.
|
// before we register our own "domwindowcreated" listener.
|
||||||
|
|
||||||
let e = Services.wm.getEnumerator("");
|
for (let window of Services.wm.getEnumerator("")) {
|
||||||
while (e.hasMoreElements()) {
|
|
||||||
let window = e.getNext();
|
|
||||||
|
|
||||||
let ok = includeIncomplete;
|
let ok = includeIncomplete;
|
||||||
if (window.document.readyState === "complete") {
|
if (window.document.readyState === "complete") {
|
||||||
ok = this.isBrowserWindow(window);
|
ok = this.isBrowserWindow(window);
|
||||||
|
|
|
@ -22,9 +22,7 @@ if (AppConstants.MOZ_BUILD_APP === "mobile/android") {
|
||||||
}
|
}
|
||||||
|
|
||||||
function* iterBrowserWindows() {
|
function* iterBrowserWindows() {
|
||||||
let enm = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (enm.hasMoreElements()) {
|
|
||||||
let win = enm.getNext();
|
|
||||||
if (!win.closed && getBrowserApp(win)) {
|
if (!win.closed && getBrowserApp(win)) {
|
||||||
yield win;
|
yield win;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,9 +139,8 @@ async function testCookies(options) {
|
||||||
|
|
||||||
function getCookies(host) {
|
function getCookies(host) {
|
||||||
let cookies = [];
|
let cookies = [];
|
||||||
let enum_ = cookieSvc.getCookiesFromHost(host, {});
|
for (let cookie of cookieSvc.getCookiesFromHost(host, {})) {
|
||||||
while (enum_.hasMoreElements()) {
|
cookies.push(cookie);
|
||||||
cookies.push(enum_.getNext().QueryInterface(Ci.nsICookie2));
|
|
||||||
}
|
}
|
||||||
return cookies.sort((a, b) => a.name.localeCompare(b.name));
|
return cookies.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,14 +153,10 @@ add_task(async function test_localStorage_on_session_lifetimePolicy() {
|
||||||
domStorageStoredValue,
|
domStorageStoredValue,
|
||||||
} = await ContentTask.spawn(addonBrowser, {uuid, isRemoteBrowser}, (params) => {
|
} = await ContentTask.spawn(addonBrowser, {uuid, isRemoteBrowser}, (params) => {
|
||||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
|
||||||
let windowEnumerator = Services.ww.getWindowEnumerator();
|
|
||||||
|
|
||||||
let bgPageWindow;
|
let bgPageWindow;
|
||||||
|
|
||||||
// Search the background page window in the process where the extension is running.
|
// Search the background page window in the process where the extension is running.
|
||||||
while (windowEnumerator.hasMoreElements()) {
|
for (let win of Services.ww.getWindowEnumerator()) {
|
||||||
let win = windowEnumerator.getNext();
|
|
||||||
|
|
||||||
// When running in remote-webextension mode the window enumerator
|
// When running in remote-webextension mode the window enumerator
|
||||||
// will only include top level windows related to the extension process
|
// will only include top level windows related to the extension process
|
||||||
// (the background page and the "about:blank" related to the addonBrowser
|
// (the background page and the "about:blank" related to the addonBrowser
|
||||||
|
|
|
@ -12,9 +12,7 @@ server.registerPathHandler("/return_headers.sjs", (request, response) => {
|
||||||
response.setHeader("Content-Type", "text/plain", false);
|
response.setHeader("Content-Type", "text/plain", false);
|
||||||
|
|
||||||
let headers = {};
|
let headers = {};
|
||||||
// Why on earth is this a nsISimpleEnumerator...
|
for (let {data: header} of request.headers) {
|
||||||
for (let {data: header} of XPCOMUtils.IterSimpleEnumerator(request.headers,
|
|
||||||
Ci.nsISupportsString)) {
|
|
||||||
headers[header.toLowerCase()] = request.getHeader(header);
|
headers[header.toLowerCase()] = request.getHeader(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,7 @@ server.registerPathHandler("/return_headers.sjs", (request, response) => {
|
||||||
response.setHeader("Content-Type", "text/plain", false);
|
response.setHeader("Content-Type", "text/plain", false);
|
||||||
|
|
||||||
let headers = {};
|
let headers = {};
|
||||||
// Why on earth is this a nsISimpleEnumerator...
|
for (let {data: header} of request.headers) {
|
||||||
for (let {data: header} of XPCOMUtils.IterSimpleEnumerator(request.headers,
|
|
||||||
Ci.nsISupportsString)) {
|
|
||||||
headers[header.toLowerCase()] = request.getHeader(header);
|
headers[header.toLowerCase()] = request.getHeader(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +182,6 @@ add_task(async function test_set_responseHeaders() {
|
||||||
let headerPromise = new Promise(resolve => { resolveHeaderPromise = resolve; });
|
let headerPromise = new Promise(resolve => { resolveHeaderPromise = resolve; });
|
||||||
{
|
{
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
||||||
|
|
||||||
let ssm = Services.scriptSecurityManager;
|
let ssm = Services.scriptSecurityManager;
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,7 @@ class ShieldFrameChild extends ActorChild {
|
||||||
break;
|
break;
|
||||||
case "GetRemoteValue:ShieldTranslations":
|
case "GetRemoteValue:ShieldTranslations":
|
||||||
const strings = {};
|
const strings = {};
|
||||||
const e = gStringBundle.getSimpleEnumeration();
|
for (let str of gStringBundle.getSimpleEnumeration()) {
|
||||||
while (e.hasMoreElements()) {
|
|
||||||
var str = e.getNext().QueryInterface(Ci.nsIPropertyElement);
|
|
||||||
strings[str.key] = str.value;
|
strings[str.key] = str.value;
|
||||||
}
|
}
|
||||||
const brandName = gBrandBundle.GetStringFromName("brandShortName");
|
const brandName = gBrandBundle.GetStringFromName("brandShortName");
|
||||||
|
|
|
@ -30,9 +30,7 @@ let anyWindowsWithInjectedCss = false;
|
||||||
// Add cleanup handler for CSS injected into windows by Heartbeat
|
// Add cleanup handler for CSS injected into windows by Heartbeat
|
||||||
CleanupManager.addCleanupHandler(() => {
|
CleanupManager.addCleanupHandler(() => {
|
||||||
if (anyWindowsWithInjectedCss) {
|
if (anyWindowsWithInjectedCss) {
|
||||||
const windowEnumerator = Services.wm.getEnumerator("navigator:browser");
|
for (let window of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (windowEnumerator.hasMoreElements()) {
|
|
||||||
const window = windowEnumerator.getNext();
|
|
||||||
if (windowsWithInjectedCss.has(window)) {
|
if (windowsWithInjectedCss.has(window)) {
|
||||||
const utils = window.windowUtils;
|
const utils = window.windowUtils;
|
||||||
utils.removeSheet(HEARTBEAT_CSS_URI, window.AGENT_SHEET);
|
utils.removeSheet(HEARTBEAT_CSS_URI, window.AGENT_SHEET);
|
||||||
|
|
|
@ -61,10 +61,8 @@ nsDefaultCLH.prototype = {
|
||||||
false))) {
|
false))) {
|
||||||
out = "print-xpcom-dirlist(\"" + printDirList + "\"): ";
|
out = "print-xpcom-dirlist(\"" + printDirList + "\"): ";
|
||||||
try {
|
try {
|
||||||
var list = getDirectoryService().get(printDirList,
|
for (let file of getDirectoryService().get(printDirList, nsISimpleEnumerator))
|
||||||
nsISimpleEnumerator);
|
out += file.path + ";";
|
||||||
while (list.hasMoreElements())
|
|
||||||
out += list.getNext().QueryInterface(nsIFile).path + ";";
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
out += "<Not Provided>";
|
out += "<Not Provided>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,9 +336,7 @@ var LoginHelper = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let propEnum = aNewLoginData.enumerator;
|
for (let prop of aNewLoginData.enumerator) {
|
||||||
while (propEnum.hasMoreElements()) {
|
|
||||||
let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty);
|
|
||||||
switch (prop.name) {
|
switch (prop.name) {
|
||||||
// nsILoginInfo
|
// nsILoginInfo
|
||||||
case "hostname":
|
case "hostname":
|
||||||
|
|
|
@ -402,10 +402,7 @@ LoginManager.prototype = {
|
||||||
log.debug("Getting a list of all disabled origins");
|
log.debug("Getting a list of all disabled origins");
|
||||||
|
|
||||||
let disabledHosts = [];
|
let disabledHosts = [];
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let perm of Services.perms.enumerator) {
|
||||||
|
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let perm = enumerator.getNext();
|
|
||||||
if (perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION) {
|
if (perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION) {
|
||||||
disabledHosts.push(perm.principal.URI.displayPrePath);
|
disabledHosts.push(perm.principal.URI.displayPrePath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1435,9 +1435,7 @@ LoginManagerPrompter.prototype = {
|
||||||
return { win: chromeWin, browser };
|
return { win: chromeWin, browser };
|
||||||
}
|
}
|
||||||
|
|
||||||
let windows = Services.wm.getEnumerator(null);
|
for (let win of Services.wm.getEnumerator(null)) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let win = windows.getNext();
|
|
||||||
let tabbrowser = win.gBrowser || win.getBrowser();
|
let tabbrowser = win.gBrowser || win.getBrowser();
|
||||||
let browser = tabbrowser.getBrowserForContentWindow(aWindow);
|
let browser = tabbrowser.getBrowserForContentWindow(aWindow);
|
||||||
if (browser) {
|
if (browser) {
|
||||||
|
|
|
@ -260,9 +260,7 @@ this.LoginManagerStorage_json.prototype = {
|
||||||
let realMatchData = {};
|
let realMatchData = {};
|
||||||
let options = {};
|
let options = {};
|
||||||
// Convert nsIPropertyBag to normal JS object
|
// Convert nsIPropertyBag to normal JS object
|
||||||
let propEnum = matchData.enumerator;
|
for (let prop of matchData.enumerator) {
|
||||||
while (propEnum.hasMoreElements()) {
|
|
||||||
let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty);
|
|
||||||
switch (prop.name) {
|
switch (prop.name) {
|
||||||
// Some property names aren't field names but are special options to affect the search.
|
// Some property names aren't field names but are special options to affect the search.
|
||||||
case "schemeUpgrades": {
|
case "schemeUpgrades": {
|
||||||
|
|
|
@ -402,9 +402,7 @@ LoginManagerStorage_mozStorage.prototype = {
|
||||||
let realMatchData = {};
|
let realMatchData = {};
|
||||||
let options = {};
|
let options = {};
|
||||||
// Convert nsIPropertyBag to normal JS object
|
// Convert nsIPropertyBag to normal JS object
|
||||||
let propEnum = matchData.enumerator;
|
for (let prop of matchData.enumerator) {
|
||||||
while (propEnum.hasMoreElements()) {
|
|
||||||
let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty);
|
|
||||||
switch (prop.name) {
|
switch (prop.name) {
|
||||||
// Some property names aren't field names but are special options to affect the search.
|
// Some property names aren't field names but are special options to affect the search.
|
||||||
case "schemeUpgrades": {
|
case "schemeUpgrades": {
|
||||||
|
|
|
@ -8,24 +8,15 @@ function getSelectDialogDoc() {
|
||||||
// Trudge through all the open windows, until we find the one
|
// Trudge through all the open windows, until we find the one
|
||||||
// that has selectDialog.xul loaded.
|
// that has selectDialog.xul loaded.
|
||||||
// var enumerator = Services.wm.getEnumerator("navigator:browser");
|
// var enumerator = Services.wm.getEnumerator("navigator:browser");
|
||||||
var enumerator = Services.wm.getXULWindowEnumerator(null);
|
for (let {docShell} of Services.wm.getEnumerator(null)) {
|
||||||
|
var containedDocShells = docShell.getDocShellEnumerator(
|
||||||
while (enumerator.hasMoreElements()) {
|
docShell.typeChrome,
|
||||||
var win = enumerator.getNext();
|
docShell.ENUMERATE_FORWARDS);
|
||||||
var windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
|
for (let childDocShell of containedDocShells) {
|
||||||
|
|
||||||
var containedDocShells = windowDocShell.getDocShellEnumerator(
|
|
||||||
Ci.nsIDocShellTreeItem.typeChrome,
|
|
||||||
Ci.nsIDocShell.ENUMERATE_FORWARDS);
|
|
||||||
while (containedDocShells.hasMoreElements()) {
|
|
||||||
// Get the corresponding document for this docshell
|
|
||||||
var childDocShell = containedDocShells.getNext();
|
|
||||||
// We don't want it if it's not done loading.
|
// We don't want it if it's not done loading.
|
||||||
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
|
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
|
||||||
continue;
|
continue;
|
||||||
var childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
|
var childDoc = childDocShell.contentViewer.DOMDocument;
|
||||||
.contentViewer
|
|
||||||
.DOMDocument;
|
|
||||||
|
|
||||||
if (childDoc.location.href == "chrome://global/content/selectDialog.xul")
|
if (childDoc.location.href == "chrome://global/content/selectDialog.xul")
|
||||||
return childDoc;
|
return childDoc;
|
||||||
|
|
|
@ -49,24 +49,15 @@ function getDialogDoc() {
|
||||||
// Find the <browser> which contains notifyWindow, by looking
|
// Find the <browser> which contains notifyWindow, by looking
|
||||||
// through all the open windows and all the <browsers> in each.
|
// through all the open windows and all the <browsers> in each.
|
||||||
// var enumerator = SpecialPowers.Services.wm.getEnumerator("navigator:browser");
|
// var enumerator = SpecialPowers.Services.wm.getEnumerator("navigator:browser");
|
||||||
var enumerator = SpecialPowers.Services.wm.getXULWindowEnumerator(null);
|
for (let {docShell} of SpecialPowers.Services.wm.getXULWindowEnumerator(null)) {
|
||||||
|
var containedDocShells = docShell.getDocShellEnumerator(
|
||||||
while (enumerator.hasMoreElements()) {
|
docShell.typeChrome,
|
||||||
var win = enumerator.getNext();
|
docShell.ENUMERATE_FORWARDS);
|
||||||
var windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
|
for (let childDocShell of containedDocShells) {
|
||||||
|
|
||||||
var containedDocShells = windowDocShell.getDocShellEnumerator(
|
|
||||||
Ci.nsIDocShellTreeItem.typeChrome,
|
|
||||||
Ci.nsIDocShell.ENUMERATE_FORWARDS);
|
|
||||||
while (containedDocShells.hasMoreElements()) {
|
|
||||||
// Get the corresponding document for this docshell
|
|
||||||
var childDocShell = containedDocShells.getNext();
|
|
||||||
// We don't want it if it's not done loading.
|
// We don't want it if it's not done loading.
|
||||||
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
|
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
|
||||||
continue;
|
continue;
|
||||||
var childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
|
var childDoc = childDocShell.contentViewer.DOMDocument;
|
||||||
.contentViewer
|
|
||||||
.DOMDocument;
|
|
||||||
|
|
||||||
// ok(true, "Got window: " + childDoc.location.href);
|
// ok(true, "Got window: " + childDoc.location.href);
|
||||||
if (childDoc.location.href == "chrome://global/content/commonDialog.xul")
|
if (childDoc.location.href == "chrome://global/content/commonDialog.xul")
|
||||||
|
|
|
@ -68,10 +68,7 @@ function checkStorageData(storage, ref_disabledHosts, ref_logins)
|
||||||
|
|
||||||
function getAllDisabledHostsFromPermissionManager() {
|
function getAllDisabledHostsFromPermissionManager() {
|
||||||
let disabledHosts = [];
|
let disabledHosts = [];
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let perm of Services.perms.enumerator) {
|
||||||
|
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let perm = enumerator.getNext();
|
|
||||||
if (perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION) {
|
if (perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION) {
|
||||||
disabledHosts.push(perm.principal.URI.prePath);
|
disabledHosts.push(perm.principal.URI.prePath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -808,17 +808,15 @@ function ProcessSnapshot({xpcom, probes}) {
|
||||||
this.componentsData = [];
|
this.componentsData = [];
|
||||||
|
|
||||||
let subgroups = new Map();
|
let subgroups = new Map();
|
||||||
let enumeration = xpcom.getComponentsData().enumerate();
|
for (let data of xpcom.getComponentsData().enumerate(Ci.nsIPerformanceStats)) {
|
||||||
while (enumeration.hasMoreElements()) {
|
let stat = (new PerformanceDataLeaf({xpcom: data, probes}));
|
||||||
let xpcom = enumeration.getNext().QueryInterface(Ci.nsIPerformanceStats);
|
|
||||||
let stat = (new PerformanceDataLeaf({xpcom, probes}));
|
|
||||||
|
|
||||||
if (!xpcom.parentId) {
|
if (!data.parentId) {
|
||||||
this.componentsData.push(stat);
|
this.componentsData.push(stat);
|
||||||
} else {
|
} else {
|
||||||
let siblings = subgroups.get(xpcom.parentId);
|
let siblings = subgroups.get(data.parentId);
|
||||||
if (!siblings) {
|
if (!siblings) {
|
||||||
subgroups.set(xpcom.parentId, (siblings = []));
|
subgroups.set(data.parentId, (siblings = []));
|
||||||
}
|
}
|
||||||
siblings.push(stat);
|
siblings.push(stat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,9 +245,7 @@ add_task(async function test() {
|
||||||
// Attach titles to components.
|
// Attach titles to components.
|
||||||
let titles = [];
|
let titles = [];
|
||||||
let map = new Map();
|
let map = new Map();
|
||||||
let windows = Services.wm.getEnumerator("navigator:browser");
|
for (let window of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let window = windows.getNext();
|
|
||||||
let tabbrowser = window.gBrowser;
|
let tabbrowser = window.gBrowser;
|
||||||
for (let browser of tabbrowser.browsers) {
|
for (let browser of tabbrowser.browsers) {
|
||||||
let id = browser.outerWindowID; // May be `null` if the browser isn't loaded yet
|
let id = browser.outerWindowID; // May be `null` if the browser isn't loaded yet
|
||||||
|
|
|
@ -12,9 +12,7 @@ function commonDialogOnLoad() {
|
||||||
.QueryInterface(Ci.nsIWritablePropertyBag);
|
.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||||
// Convert to a JS object
|
// Convert to a JS object
|
||||||
args = {};
|
args = {};
|
||||||
let propEnum = propBag.enumerator;
|
for (let prop of propBag.enumerator) {
|
||||||
while (propEnum.hasMoreElements()) {
|
|
||||||
let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty);
|
|
||||||
args[prop.name] = prop.value;
|
args[prop.name] = prop.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,24 +200,16 @@ function getDialogDoc() {
|
||||||
// Trudge through all the open windows, until we find the one
|
// Trudge through all the open windows, until we find the one
|
||||||
// that has either commonDialog.xul or selectDialog.xul loaded.
|
// that has either commonDialog.xul or selectDialog.xul loaded.
|
||||||
// var enumerator = Services.wm.getEnumerator("navigator:browser");
|
// var enumerator = Services.wm.getEnumerator("navigator:browser");
|
||||||
var enumerator = Services.wm.getXULWindowEnumerator(null);
|
for (let {docShell} of Services.wm.getEnumerator(null)) {
|
||||||
|
var containedDocShells = docShell.getDocShellEnumerator(
|
||||||
while (enumerator.hasMoreElements()) {
|
docShell.typeChrome,
|
||||||
var win = enumerator.getNext();
|
docShell.ENUMERATE_FORWARDS);
|
||||||
var windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
|
for (let childDocShell of containedDocShells) {
|
||||||
|
|
||||||
var containedDocShells = windowDocShell.getDocShellEnumerator(
|
|
||||||
Ci.nsIDocShellTreeItem.typeChrome,
|
|
||||||
Ci.nsIDocShell.ENUMERATE_FORWARDS);
|
|
||||||
while (containedDocShells.hasMoreElements()) {
|
|
||||||
// Get the corresponding document for this docshell
|
// Get the corresponding document for this docshell
|
||||||
var childDocShell = containedDocShells.getNext();
|
|
||||||
// We don't want it if it's not done loading.
|
// We don't want it if it's not done loading.
|
||||||
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
|
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
|
||||||
continue;
|
continue;
|
||||||
var childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
|
var childDoc = childDocShell.contentViewer.DOMDocument;
|
||||||
.contentViewer
|
|
||||||
.DOMDocument;
|
|
||||||
|
|
||||||
if (childDoc.location.href != "chrome://global/content/commonDialog.xul" &&
|
if (childDoc.location.href != "chrome://global/content/commonDialog.xul" &&
|
||||||
childDoc.location.href != "chrome://global/content/selectDialog.xul")
|
childDoc.location.href != "chrome://global/content/selectDialog.xul")
|
||||||
|
|
|
@ -2807,11 +2807,10 @@ SearchService.prototype = {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// NS_APP_DISTRIBUTION_SEARCH_DIR_LIST is defined by each app
|
// NS_APP_DISTRIBUTION_SEARCH_DIR_LIST is defined by each app
|
||||||
// so this throws during unit tests (but not xpcshell tests).
|
// so this throws during unit tests (but not xpcshell tests).
|
||||||
locations = {hasMoreElements: () => false};
|
locations = [];
|
||||||
|
|
||||||
}
|
}
|
||||||
while (locations.hasMoreElements()) {
|
for (let dir of locations) {
|
||||||
let dir = locations.getNext().QueryInterface(Ci.nsIFile);
|
|
||||||
if (dir.directoryEntries.nextFile)
|
if (dir.directoryEntries.nextFile)
|
||||||
distDirs.push(dir);
|
distDirs.push(dir);
|
||||||
}
|
}
|
||||||
|
@ -2873,10 +2872,9 @@ SearchService.prototype = {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// NS_APP_DISTRIBUTION_SEARCH_DIR_LIST is defined by each app
|
// NS_APP_DISTRIBUTION_SEARCH_DIR_LIST is defined by each app
|
||||||
// so this throws during unit tests (but not xpcshell tests).
|
// so this throws during unit tests (but not xpcshell tests).
|
||||||
locations = {hasMoreElements: () => false};
|
locations = [];
|
||||||
}
|
}
|
||||||
while (locations.hasMoreElements()) {
|
for (let dir of locations) {
|
||||||
let dir = locations.getNext().QueryInterface(Ci.nsIFile);
|
|
||||||
let iterator = new OS.File.DirectoryIterator(dir.path,
|
let iterator = new OS.File.DirectoryIterator(dir.path,
|
||||||
{ winPattern: "*.xml" });
|
{ winPattern: "*.xml" });
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -62,10 +62,7 @@ SecurityReporter.prototype = {
|
||||||
let asciiCertChain = [];
|
let asciiCertChain = [];
|
||||||
|
|
||||||
if (transportSecurityInfo.failedCertChain) {
|
if (transportSecurityInfo.failedCertChain) {
|
||||||
let certs = transportSecurityInfo.failedCertChain.getEnumerator();
|
for (let cert of transportSecurityInfo.failedCertChain.getEnumerator()) {
|
||||||
while (certs.hasMoreElements()) {
|
|
||||||
let cert = certs.getNext();
|
|
||||||
cert.QueryInterface(Ci.nsIX509Cert);
|
|
||||||
asciiCertChain.push(btoa(getDERString(cert)));
|
asciiCertChain.push(btoa(getDERString(cert)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1400,9 +1400,7 @@ var Impl = {
|
||||||
getOpenTabsCount: function getOpenTabsCount() {
|
getOpenTabsCount: function getOpenTabsCount() {
|
||||||
let tabCount = 0;
|
let tabCount = 0;
|
||||||
|
|
||||||
let browserEnum = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (browserEnum.hasMoreElements()) {
|
|
||||||
let win = browserEnum.getNext();
|
|
||||||
tabCount += win.gBrowser.tabs.length;
|
tabCount += win.gBrowser.tabs.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,9 +153,7 @@ TimerManager.prototype = {
|
||||||
|
|
||||||
var catMan = Cc["@mozilla.org/categorymanager;1"].
|
var catMan = Cc["@mozilla.org/categorymanager;1"].
|
||||||
getService(Ci.nsICategoryManager);
|
getService(Ci.nsICategoryManager);
|
||||||
var entries = catMan.enumerateCategory(CATEGORY_UPDATE_TIMER);
|
for (let {data: entry} of catMan.enumerateCategory(CATEGORY_UPDATE_TIMER)) {
|
||||||
while (entries.hasMoreElements()) {
|
|
||||||
let entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
|
|
||||||
let value = catMan.getCategoryEntry(CATEGORY_UPDATE_TIMER, entry);
|
let value = catMan.getCategoryEntry(CATEGORY_UPDATE_TIMER, entry);
|
||||||
let [cid, method, timerID, prefInterval, defaultInterval, maxInterval] = value.split(",");
|
let [cid, method, timerID, prefInterval, defaultInterval, maxInterval] = value.split(",");
|
||||||
|
|
||||||
|
|
|
@ -332,9 +332,7 @@ function run_test() {
|
||||||
gPref.setBoolPref(PREF_APP_UPDATE_LOG_ALL, true);
|
gPref.setBoolPref(PREF_APP_UPDATE_LOG_ALL, true);
|
||||||
|
|
||||||
// Remove existing update timers to prevent them from being notified
|
// Remove existing update timers to prevent them from being notified
|
||||||
let entries = gCatMan.enumerateCategory(CATEGORY_UPDATE_TIMER);
|
for (let {data: entry} of gCatMan.enumerateCategory(CATEGORY_UPDATE_TIMER)) {
|
||||||
while (entries.hasMoreElements()) {
|
|
||||||
let entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
|
|
||||||
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, entry, false);
|
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, entry, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,13 +472,11 @@ function check_test0thru7() {
|
||||||
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[1].desc, true);
|
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[1].desc, true);
|
||||||
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[2].desc, true);
|
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[2].desc, true);
|
||||||
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[3].desc, true);
|
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[3].desc, true);
|
||||||
let entries = gCatMan.enumerateCategory(CATEGORY_UPDATE_TIMER);
|
for (let {data: entry} of gCatMan.enumerateCategory(CATEGORY_UPDATE_TIMER)) {
|
||||||
while (entries.hasMoreElements()) {
|
|
||||||
let entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
|
|
||||||
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, entry, false);
|
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, entry, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
entries = gCatMan.enumerateCategory(CATEGORY_UPDATE_TIMER);
|
let entries = gCatMan.enumerateCategory(CATEGORY_UPDATE_TIMER);
|
||||||
Assert.ok(!entries.hasMoreElements(),
|
Assert.ok(!entries.hasMoreElements(),
|
||||||
"no " + CATEGORY_UPDATE_TIMER + " categories should still be " +
|
"no " + CATEGORY_UPDATE_TIMER + " categories should still be " +
|
||||||
"registered");
|
"registered");
|
||||||
|
|
|
@ -29,9 +29,7 @@ function findCurrentProfile() {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
if (cpd) {
|
if (cpd) {
|
||||||
let itr = ProfileService.profiles;
|
for (let profile of ProfileService.profiles) {
|
||||||
while (itr.hasMoreElements()) {
|
|
||||||
let profile = itr.getNext().QueryInterface(Ci.nsIToolkitProfile);
|
|
||||||
if (profile.rootDir.path == cpd.path) {
|
if (profile.rootDir.path == cpd.path) {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
@ -60,9 +58,7 @@ function refreshUI() {
|
||||||
|
|
||||||
let currentProfile = findCurrentProfile();
|
let currentProfile = findCurrentProfile();
|
||||||
|
|
||||||
let iter = ProfileService.profiles;
|
for (let profile of ProfileService.profiles) {
|
||||||
while (iter.hasMoreElements()) {
|
|
||||||
let profile = iter.getNext().QueryInterface(Ci.nsIToolkitProfile);
|
|
||||||
let isCurrentProfile = profile == currentProfile;
|
let isCurrentProfile = profile == currentProfile;
|
||||||
let isInUse = isCurrentProfile;
|
let isInUse = isCurrentProfile;
|
||||||
if (!isInUse) {
|
if (!isInUse) {
|
||||||
|
@ -290,9 +286,7 @@ function removeProfile(profile) {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
if (isSelected || isDefault) {
|
if (isSelected || isDefault) {
|
||||||
let itr = ProfileService.profiles;
|
for (let p of ProfileService.profiles) {
|
||||||
while (itr.hasMoreElements()) {
|
|
||||||
let p = itr.getNext().QueryInterface(Ci.nsIToolkitProfile);
|
|
||||||
if (profile == p) {
|
if (profile == p) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,7 @@ function closeWindow(aClose, aPromptFunction) {
|
||||||
// Closing the last window doesn't quit the application on OS X.
|
// Closing the last window doesn't quit the application on OS X.
|
||||||
if (AppConstants.platform != "macosx") {
|
if (AppConstants.platform != "macosx") {
|
||||||
var windowCount = 0;
|
var windowCount = 0;
|
||||||
var e = Services.wm.getEnumerator(null);
|
for (let w of Services.wm.getEnumerator(null)) {
|
||||||
|
|
||||||
while (e.hasMoreElements()) {
|
|
||||||
var w = e.getNext();
|
|
||||||
if (w.closed) {
|
if (w.closed) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
function macWindowMenuDidShow() {
|
function macWindowMenuDidShow() {
|
||||||
let windows = Services.wm.getEnumerator("");
|
|
||||||
let frag = document.createDocumentFragment();
|
let frag = document.createDocumentFragment();
|
||||||
while (windows.hasMoreElements()) {
|
for (let win of Services.wm.getEnumerator("")) {
|
||||||
let win = windows.getNext();
|
|
||||||
if (win.document.documentElement.getAttribute("inwindowmenu") == "false") {
|
if (win.document.documentElement.getAttribute("inwindowmenu") == "false") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ var EXPORTED_SYMBOLS = ["CertUtils"];
|
||||||
const Ce = Components.Exception;
|
const Ce = Components.Exception;
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a set of expected certificate attributes from preferences. The returned
|
* Reads a set of expected certificate attributes from preferences. The returned
|
||||||
|
@ -153,10 +152,8 @@ function checkCert(aChannel, aAllowNonBuiltInCerts, aCerts) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let certEnumerator = sslStatus.succeededCertChain.getEnumerator();
|
|
||||||
let issuerCert = null;
|
let issuerCert = null;
|
||||||
for (issuerCert of XPCOMUtils.IterSimpleEnumerator(certEnumerator,
|
for (issuerCert of sslStatus.succeededCertChain.getEnumerator());
|
||||||
Ci.nsIX509Cert));
|
|
||||||
|
|
||||||
const certNotBuiltInErr = "Certificate issuer is not built-in.";
|
const certNotBuiltInErr = "Certificate issuer is not built-in.";
|
||||||
if (!issuerCert) {
|
if (!issuerCert) {
|
||||||
|
|
|
@ -32,9 +32,7 @@ var ResetProfile = {
|
||||||
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].
|
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].
|
||||||
getService(Ci.nsIToolkitProfileService);
|
getService(Ci.nsIToolkitProfileService);
|
||||||
let currentProfileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
let currentProfileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||||
let profileEnumerator = profileService.profiles;
|
for (let profile of profileService.profiles) {
|
||||||
while (profileEnumerator.hasMoreElements()) {
|
|
||||||
let profile = profileEnumerator.getNext().QueryInterface(Ci.nsIToolkitProfile);
|
|
||||||
if (profile.rootDir && profile.rootDir.equals(currentProfileDir)) {
|
if (profile.rootDir && profile.rootDir.equals(currentProfileDir)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,12 +186,10 @@ var dataProviders = {
|
||||||
|
|
||||||
data.numTotalWindows = 0;
|
data.numTotalWindows = 0;
|
||||||
data.numRemoteWindows = 0;
|
data.numRemoteWindows = 0;
|
||||||
let winEnumer = Services.wm.getEnumerator("navigator:browser");
|
for (let {docShell} of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (winEnumer.hasMoreElements()) {
|
|
||||||
data.numTotalWindows++;
|
data.numTotalWindows++;
|
||||||
let remote = winEnumer.getNext().docShell.
|
let remote = docShell.QueryInterface(Ci.nsILoadContext)
|
||||||
QueryInterface(Ci.nsILoadContext).
|
.useRemoteTabs;
|
||||||
useRemoteTabs;
|
|
||||||
if (remote) {
|
if (remote) {
|
||||||
data.numRemoteWindows++;
|
data.numRemoteWindows++;
|
||||||
}
|
}
|
||||||
|
@ -357,9 +355,8 @@ var dataProviders = {
|
||||||
|
|
||||||
data.numTotalWindows = 0;
|
data.numTotalWindows = 0;
|
||||||
data.numAcceleratedWindows = 0;
|
data.numAcceleratedWindows = 0;
|
||||||
let winEnumer = Services.ww.getWindowEnumerator();
|
for (let win of Services.ww.getWindowEnumerator()) {
|
||||||
while (winEnumer.hasMoreElements()) {
|
let winUtils = win.windowUtils;
|
||||||
let winUtils = winEnumer.getNext().windowUtils;
|
|
||||||
try {
|
try {
|
||||||
// NOTE: windowless browser's windows should not be reported in the graphics troubleshoot report
|
// NOTE: windowless browser's windows should not be reported in the graphics troubleshoot report
|
||||||
if (winUtils.layerManagerType == "None" || !winUtils.layerManagerRemote) {
|
if (winUtils.layerManagerType == "None" || !winUtils.layerManagerRemote) {
|
||||||
|
|
|
@ -183,7 +183,7 @@ const SecurityInfo = {
|
||||||
|
|
||||||
getCertificateChain(certChain, options = {}) {
|
getCertificateChain(certChain, options = {}) {
|
||||||
let certificates = [];
|
let certificates = [];
|
||||||
for (let cert of XPCOMUtils.IterSimpleEnumerator(certChain.getEnumerator(), Ci.nsIX509Cert)) {
|
for (let cert of certChain.getEnumerator()) {
|
||||||
certificates.push(this.parseCertificateInfo(cert, options));
|
certificates.push(this.parseCertificateInfo(cert, options));
|
||||||
}
|
}
|
||||||
return certificates;
|
return certificates;
|
||||||
|
|
|
@ -24,14 +24,11 @@ const EXPORTED_SYMBOLS = ["WebNavigationFrames"];
|
||||||
* A generator function which iterates over a docShell tree, given a root docShell.
|
* A generator function which iterates over a docShell tree, given a root docShell.
|
||||||
*
|
*
|
||||||
* @param {nsIDocShell} docShell - the root docShell object
|
* @param {nsIDocShell} docShell - the root docShell object
|
||||||
|
* @returns {Iterator<nsIDocShell>}
|
||||||
*/
|
*/
|
||||||
function* iterateDocShellTree(docShell) {
|
function iterateDocShellTree(docShell) {
|
||||||
let docShellsEnum = docShell.getDocShellEnumerator(
|
return docShell.getDocShellEnumerator(
|
||||||
docShell.typeContent, docShell.ENUMERATE_FORWARDS);
|
docShell.typeContent, docShell.ENUMERATE_FORWARDS);
|
||||||
|
|
||||||
while (docShellsEnum.hasMoreElements()) {
|
|
||||||
yield docShellsEnum.getNext().QueryInterface(Ci.nsIDocShell);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -217,9 +217,7 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
// because the original one is definitely gone (and nsIFilePicker doesn't like
|
// because the original one is definitely gone (and nsIFilePicker doesn't like
|
||||||
// a null parent):
|
// a null parent):
|
||||||
gDownloadLastDir = this._mDownloadDir;
|
gDownloadLastDir = this._mDownloadDir;
|
||||||
let windowsEnum = Services.wm.getEnumerator("");
|
for (let someWin of Services.wm.getEnumerator("")) {
|
||||||
while (windowsEnum.hasMoreElements()) {
|
|
||||||
let someWin = windowsEnum.getNext();
|
|
||||||
// We need to make sure we don't end up with this dialog, because otherwise
|
// We need to make sure we don't end up with this dialog, because otherwise
|
||||||
// that's going to go away when the user clicks "Save", and that breaks the
|
// that's going to go away when the user clicks "Save", and that breaks the
|
||||||
// windows file picker that's supposed to show up if we let the user choose
|
// windows file picker that's supposed to show up if we let the user choose
|
||||||
|
|
|
@ -785,9 +785,7 @@ var AddonManagerInternal = {
|
||||||
// Load any providers registered in the category manager
|
// Load any providers registered in the category manager
|
||||||
let catman = Cc["@mozilla.org/categorymanager;1"].
|
let catman = Cc["@mozilla.org/categorymanager;1"].
|
||||||
getService(Ci.nsICategoryManager);
|
getService(Ci.nsICategoryManager);
|
||||||
let entries = catman.enumerateCategory(CATEGORY_PROVIDER_MODULE);
|
for (let {data: entry} of catman.enumerateCategory(CATEGORY_PROVIDER_MODULE)) {
|
||||||
while (entries.hasMoreElements()) {
|
|
||||||
let entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
|
|
||||||
let url = catman.getCategoryEntry(CATEGORY_PROVIDER_MODULE, entry);
|
let url = catman.getCategoryEntry(CATEGORY_PROVIDER_MODULE, entry);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1242,9 +1242,7 @@ var gViewController = {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let browser = getBrowserElement();
|
let browser = getBrowserElement();
|
||||||
let files = fp.files;
|
for (let file of fp.files) {
|
||||||
while (files.hasMoreElements()) {
|
|
||||||
let file = files.getNext();
|
|
||||||
let install = await AddonManager.getInstallForFile(file);
|
let install = await AddonManager.getInstallForFile(file);
|
||||||
AddonManager.installAddonFromAOM(browser, document.documentURIObject, install);
|
AddonManager.installAddonFromAOM(browser, document.documentURIObject, install);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,10 +95,8 @@ function promiseFocus(window) {
|
||||||
|
|
||||||
// Helper to register test failures and close windows if any are left open
|
// Helper to register test failures and close windows if any are left open
|
||||||
function checkOpenWindows(aWindowID) {
|
function checkOpenWindows(aWindowID) {
|
||||||
let windows = Services.wm.getEnumerator(aWindowID);
|
|
||||||
let found = false;
|
let found = false;
|
||||||
while (windows.hasMoreElements()) {
|
for (let win of Services.wm.getEnumerator(aWindowID)) {
|
||||||
let win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
|
|
||||||
if (!win.closed) {
|
if (!win.closed) {
|
||||||
found = true;
|
found = true;
|
||||||
win.close();
|
win.close();
|
||||||
|
|
|
@ -37,9 +37,7 @@ async function run_test() {
|
||||||
|
|
||||||
// Finds the test plugin library
|
// Finds the test plugin library
|
||||||
function get_test_plugin() {
|
function get_test_plugin() {
|
||||||
var pluginEnum = Services.dirsvc.get("APluginsDL", Ci.nsISimpleEnumerator);
|
for (let dir of Services.dirsvc.get("APluginsDL", Ci.nsISimpleEnumerator)) {
|
||||||
while (pluginEnum.hasMoreElements()) {
|
|
||||||
let dir = pluginEnum.getNext().QueryInterface(Ci.nsIFile);
|
|
||||||
let plugin = dir.clone();
|
let plugin = dir.clone();
|
||||||
// OSX plugin
|
// OSX plugin
|
||||||
plugin.append("npswftest.plugin");
|
plugin.append("npswftest.plugin");
|
||||||
|
|
|
@ -154,9 +154,7 @@ var dialog = {
|
||||||
let gIOSvc = Cc["@mozilla.org/gio-service;1"]
|
let gIOSvc = Cc["@mozilla.org/gio-service;1"]
|
||||||
.getService(Ci.nsIGIOService);
|
.getService(Ci.nsIGIOService);
|
||||||
var gioApps = gIOSvc.getAppsForURIScheme(this._URI.scheme);
|
var gioApps = gIOSvc.getAppsForURIScheme(this._URI.scheme);
|
||||||
let enumerator = gioApps.enumerate();
|
for (let handler of gioApps.enumerate()) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let handler = enumerator.getNext().QueryInterface(Ci.nsIHandlerApp);
|
|
||||||
// OS handler share the same name, it's most likely the same app, skipping...
|
// OS handler share the same name, it's most likely the same app, skipping...
|
||||||
if (handler.name == this._handlerInfo.defaultDescription) {
|
if (handler.name == this._handlerInfo.defaultDescription) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -156,9 +156,7 @@ function checkProfileName(profileNameToCheck) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function profileExists(aName) {
|
function profileExists(aName) {
|
||||||
var profiles = gProfileService.profiles;
|
for (let profile of gProfileService.profiles) {
|
||||||
while (profiles.hasMoreElements()) {
|
|
||||||
var profile = profiles.getNext().QueryInterface(I.nsIToolkitProfile);
|
|
||||||
if (profile.name.toLowerCase() == aName.toLowerCase())
|
if (profile.name.toLowerCase() == aName.toLowerCase())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,7 @@ function startup() {
|
||||||
|
|
||||||
var profilesElement = document.getElementById("profiles");
|
var profilesElement = document.getElementById("profiles");
|
||||||
|
|
||||||
var profileList = gProfileService.profiles;
|
for (let profile of gProfileService.profiles.entries(I.nsIToolkitProfile)) {
|
||||||
while (profileList.hasMoreElements()) {
|
|
||||||
var profile = profileList.getNext().QueryInterface(I.nsIToolkitProfile);
|
|
||||||
|
|
||||||
var listitem = profilesElement.appendItem(profile.name, "");
|
var listitem = profilesElement.appendItem(profile.name, "");
|
||||||
|
|
||||||
var tooltiptext =
|
var tooltiptext =
|
||||||
|
|
Загрузка…
Ссылка в новой задаче