forked from mirrors/gecko-dev
Bug 1484496: Part 5e - Convert remaining nsISimpleEnumerator users to use JS iteration. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3733 --HG-- extra : rebase_source : c0fac176d7b3d840c4dbb14f8d95ccfc7f83a5a8 extra : histedit_source : a92c40117d0808a3ad68c972f622a7a42c9ae8ba
This commit is contained in:
parent
9a8a840c9d
commit
3a5c05e76f
74 changed files with 144 additions and 384 deletions
|
|
@ -67,9 +67,8 @@ var AccessFu = {
|
||||||
Services.obs.addObserver(this, "inprocess-browser-shown");
|
Services.obs.addObserver(this, "inprocess-browser-shown");
|
||||||
Services.ww.registerNotification(this);
|
Services.ww.registerNotification(this);
|
||||||
|
|
||||||
let windows = Services.wm.getEnumerator(null);
|
for (let win of Services.wm.getEnumerator(null)) {
|
||||||
while (windows.hasMoreElements()) {
|
this._attachWindow(win);
|
||||||
this._attachWindow(windows.getNext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.info("AccessFu:Enabled");
|
Logger.info("AccessFu:Enabled");
|
||||||
|
|
@ -89,9 +88,8 @@ var AccessFu = {
|
||||||
Services.obs.removeObserver(this, "inprocess-browser-shown");
|
Services.obs.removeObserver(this, "inprocess-browser-shown");
|
||||||
Services.ww.unregisterNotification(this);
|
Services.ww.unregisterNotification(this);
|
||||||
|
|
||||||
let windows = Services.wm.getEnumerator(null);
|
for (let win of Services.wm.getEnumerator(null)) {
|
||||||
while (windows.hasMoreElements()) {
|
this._detachWindow(win);
|
||||||
this._detachWindow(windows.getNext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete this._notifyOutputPref;
|
delete this._notifyOutputPref;
|
||||||
|
|
|
||||||
|
|
@ -160,13 +160,9 @@ var Utils = { // jshint ignore:line
|
||||||
let attributes = {};
|
let attributes = {};
|
||||||
|
|
||||||
if (aAccessible && aAccessible.attributes) {
|
if (aAccessible && aAccessible.attributes) {
|
||||||
let attributesEnum = aAccessible.attributes.enumerate();
|
|
||||||
|
|
||||||
// Populate |attributes| object with |aAccessible|'s attribute key-value
|
// Populate |attributes| object with |aAccessible|'s attribute key-value
|
||||||
// pairs.
|
// pairs.
|
||||||
while (attributesEnum.hasMoreElements()) {
|
for (let attribute of aAccessible.attributes.enumerate()) {
|
||||||
let attribute = attributesEnum.getNext().QueryInterface(
|
|
||||||
Ci.nsIPropertyElement);
|
|
||||||
attributes[attribute.key] = attribute.value;
|
attributes[attribute.key] = attribute.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -757,9 +753,8 @@ PivotContext.prototype = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let getHeaders = function* getHeaders(aHeaderCells) {
|
let getHeaders = function* getHeaders(aHeaderCells) {
|
||||||
let enumerator = aHeaderCells.enumerate();
|
for (let {name} of aHeaderCells.enumerate(Ci.nsIAccessible)) {
|
||||||
while (enumerator.hasMoreElements()) {
|
yield name;
|
||||||
yield enumerator.getNext().QueryInterface(Ci.nsIAccessible).name;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,11 +246,8 @@ function addAccessibleTask(doc, task) {
|
||||||
}
|
}
|
||||||
|
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
let observers = Services.obs.enumerateObservers("accessible-event");
|
for (let observer of Services.obs.enumerateObservers("accessible-event")) {
|
||||||
while (observers.hasMoreElements()) {
|
Services.obs.removeObserver(observer, "accessible-event");
|
||||||
Services.obs.removeObserver(
|
|
||||||
observers.getNext().QueryInterface(Ci.nsIObserver),
|
|
||||||
"accessible-event");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -319,10 +319,7 @@ function testAttrsInternal(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs,
|
||||||
function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
|
function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
|
||||||
aAbsentAttrs) {
|
aAbsentAttrs) {
|
||||||
// Check if all obtained attributes are expected and have expected value.
|
// Check if all obtained attributes are expected and have expected value.
|
||||||
var enumerate = aAttrs.enumerate();
|
for (let prop of aAttrs.enumerate()) {
|
||||||
while (enumerate.hasMoreElements()) {
|
|
||||||
let prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
|
|
||||||
|
|
||||||
if (!(prop.key in aExpectedAttrs)) {
|
if (!(prop.key in aExpectedAttrs)) {
|
||||||
if (!aSkipUnexpectedAttrs)
|
if (!aSkipUnexpectedAttrs)
|
||||||
ok(false, "Unexpected attribute '" + prop.key + "' having '" +
|
ok(false, "Unexpected attribute '" + prop.key + "' having '" +
|
||||||
|
|
@ -355,9 +352,7 @@ function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
|
||||||
for (var name in aAbsentAttrs) {
|
for (var name in aAbsentAttrs) {
|
||||||
var wasFound = false;
|
var wasFound = false;
|
||||||
|
|
||||||
enumerate = aAttrs.enumerate();
|
for (let prop of aAttrs.enumerate()) {
|
||||||
while (enumerate.hasMoreElements()) {
|
|
||||||
let prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
|
|
||||||
if (prop.key == name)
|
if (prop.key == name)
|
||||||
wasFound = true;
|
wasFound = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,7 @@ function testRelation(aIdentifier, aRelType, aRelatedIdentifiers) {
|
||||||
// Check if all given related accessibles are targets of obtained relation.
|
// Check if all given related accessibles are targets of obtained relation.
|
||||||
for (let idx = 0; idx < targets.length; idx++) {
|
for (let idx = 0; idx < targets.length; idx++) {
|
||||||
var isFound = false;
|
var isFound = false;
|
||||||
let enumerate = actualTargets.enumerate();
|
for (let relatedAcc of actualTargets.enumerate(Ci.nsIAccessible)) {
|
||||||
while (enumerate.hasMoreElements()) {
|
|
||||||
let relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
|
|
||||||
if (targets[idx] == relatedAcc) {
|
if (targets[idx] == relatedAcc) {
|
||||||
isFound = true;
|
isFound = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -89,9 +87,7 @@ function testRelation(aIdentifier, aRelType, aRelatedIdentifiers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all obtained targets are given related accessibles.
|
// Check if all obtained targets are given related accessibles.
|
||||||
let enumerate = actualTargets.enumerate();
|
for (let relatedAcc of actualTargets.enumerate(Ci.nsIAccessible)) {
|
||||||
while (enumerate.hasMoreElements()) {
|
|
||||||
let relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
|
|
||||||
let idx;
|
let idx;
|
||||||
for (idx = 0; idx < targets.length && relatedAcc != targets[idx]; idx++);
|
for (idx = 0; idx < targets.length && relatedAcc != targets[idx]; idx++);
|
||||||
|
|
||||||
|
|
@ -140,9 +136,7 @@ function testAbsentRelation(aIdentifier, aRelType, aUnrelatedIdentifiers) {
|
||||||
// Any found targets that match given accessibles should be called out.
|
// Any found targets that match given accessibles should be called out.
|
||||||
for (let idx = 0; idx < targets.length; idx++) {
|
for (let idx = 0; idx < targets.length; idx++) {
|
||||||
var notFound = true;
|
var notFound = true;
|
||||||
var enumerate = actualTargets.enumerate();
|
for (let relatedAcc of actualTargets.enumerate(Ci.nsIAccessible)) {
|
||||||
while (enumerate.hasMoreElements()) {
|
|
||||||
var relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
|
|
||||||
if (targets[idx] == relatedAcc) {
|
if (targets[idx] == relatedAcc) {
|
||||||
notFound = false;
|
notFound = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,5 @@ function getChildDocShells() {
|
||||||
Ci.nsIDocShell.ENUMERATE_FORWARDS
|
Ci.nsIDocShell.ENUMERATE_FORWARDS
|
||||||
);
|
);
|
||||||
|
|
||||||
let docShells = [];
|
return Array.from(docShellsEnum);
|
||||||
while (docShellsEnum.hasMoreElements()) {
|
|
||||||
let ds = docShellsEnum.getNext();
|
|
||||||
docShells.push(ds);
|
|
||||||
}
|
|
||||||
return docShells;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,12 +102,10 @@ function xpcEnumerateContentWindows(callback) {
|
||||||
var Ci = SpecialPowers.Ci;
|
var Ci = SpecialPowers.Ci;
|
||||||
var ww = SpecialPowers.Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
var ww = SpecialPowers.Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
||||||
.getService(Ci.nsIWindowWatcher);
|
.getService(Ci.nsIWindowWatcher);
|
||||||
var enumerator = ww.getWindowEnumerator();
|
|
||||||
|
|
||||||
var contentWindows = [];
|
var contentWindows = [];
|
||||||
|
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let win of ww.getWindowEnumerator()) {
|
||||||
var win = enumerator.getNext();
|
|
||||||
if (win.isChromeWindow) {
|
if (win.isChromeWindow) {
|
||||||
var docshellTreeNode = win.docShell;
|
var docshellTreeNode = win.docShell;
|
||||||
var childCount = docshellTreeNode.childCount;
|
var childCount = docshellTreeNode.childCount;
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@ addMessageListener("getCookieFromManager", ({ host, path }) => {
|
||||||
.getService(Ci.nsICookieManager);
|
.getService(Ci.nsICookieManager);
|
||||||
let values = [];
|
let values = [];
|
||||||
path = path.substring(0, path.lastIndexOf("/") + 1);
|
path = path.substring(0, path.lastIndexOf("/") + 1);
|
||||||
let e = cm.enumerator;
|
for (let cookie of cm.enumerator) {
|
||||||
while (e.hasMoreElements()) {
|
|
||||||
let cookie = e.getNext().QueryInterface(Ci.nsICookie);
|
|
||||||
if (!cookie) {
|
if (!cookie) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,20 +28,16 @@ var setPaymentNums = 0;
|
||||||
|
|
||||||
addMessageListener("payment-num-set", function() {
|
addMessageListener("payment-num-set", function() {
|
||||||
setPaymentNums = 0;
|
setPaymentNums = 0;
|
||||||
const paymentEnum = paymentSrv.enumerate();
|
for (let payment of paymentSrv.enumerate()) {
|
||||||
while (paymentEnum.hasMoreElements()) {
|
|
||||||
setPaymentNums = setPaymentNums + 1;
|
setPaymentNums = setPaymentNums + 1;
|
||||||
paymentEnum.getNext();
|
|
||||||
}
|
}
|
||||||
sendAsyncMessage("payment-num-set-complete");
|
sendAsyncMessage("payment-num-set-complete");
|
||||||
});
|
});
|
||||||
|
|
||||||
addMessageListener("payment-num-check", function(expectedNumPayments) {
|
addMessageListener("payment-num-check", function(expectedNumPayments) {
|
||||||
const paymentEnum = paymentSrv.enumerate();
|
|
||||||
let numPayments = 0;
|
let numPayments = 0;
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payment of paymentSrv.enumerate()) {
|
||||||
numPayments = numPayments + 1;
|
numPayments = numPayments + 1;
|
||||||
paymentEnum.getNext();
|
|
||||||
}
|
}
|
||||||
if (numPayments !== expectedNumPayments + setPaymentNums) {
|
if (numPayments !== expectedNumPayments + setPaymentNums) {
|
||||||
emitTestFail("Expected '" + expectedNumPayments +
|
emitTestFail("Expected '" + expectedNumPayments +
|
||||||
|
|
|
||||||
|
|
@ -353,8 +353,7 @@ function checkSimplestRequestHandler() {
|
||||||
if (!paymentEnum.hasMoreElements()) {
|
if (!paymentEnum.hasMoreElements()) {
|
||||||
emitTestFail("PaymentRequestService should have at least one payment request.");
|
emitTestFail("PaymentRequestService should have at least one payment request.");
|
||||||
}
|
}
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payRequest of paymentEnum) {
|
||||||
let payRequest = paymentEnum.getNext().QueryInterface(Ci.nsIPaymentRequest);
|
|
||||||
if (!payRequest) {
|
if (!payRequest) {
|
||||||
emitTestFail("Fail to get existing payment request.");
|
emitTestFail("Fail to get existing payment request.");
|
||||||
break;
|
break;
|
||||||
|
|
@ -370,8 +369,7 @@ function checkComplexRequestHandler() {
|
||||||
if (!paymentEnum.hasMoreElements()) {
|
if (!paymentEnum.hasMoreElements()) {
|
||||||
emitTestFail("PaymentRequestService should have at least one payment request.");
|
emitTestFail("PaymentRequestService should have at least one payment request.");
|
||||||
}
|
}
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payRequest of paymentEnum) {
|
||||||
let payRequest = paymentEnum.getNext().QueryInterface(Ci.nsIPaymentRequest);
|
|
||||||
if (!payRequest) {
|
if (!payRequest) {
|
||||||
emitTestFail("Fail to get existing payment request.");
|
emitTestFail("Fail to get existing payment request.");
|
||||||
break;
|
break;
|
||||||
|
|
@ -387,8 +385,7 @@ function checkNonBasicCardRequestHandler() {
|
||||||
if (!paymentEnum.hasMoreElements()) {
|
if (!paymentEnum.hasMoreElements()) {
|
||||||
emitTestFail("PaymentRequestService should have at least one payment request.");
|
emitTestFail("PaymentRequestService should have at least one payment request.");
|
||||||
}
|
}
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payRequest of paymentEnum) {
|
||||||
let payRequest = paymentEnum.getNext().QueryInterface(Ci.nsIPaymentRequest);
|
|
||||||
if (!payRequest) {
|
if (!payRequest) {
|
||||||
emitTestFail("Fail to get existing payment request.");
|
emitTestFail("Fail to get existing payment request.");
|
||||||
break;
|
break;
|
||||||
|
|
@ -404,8 +401,7 @@ function checkMultipleRequestsHandler () {
|
||||||
if (!paymentEnum.hasMoreElements()) {
|
if (!paymentEnum.hasMoreElements()) {
|
||||||
emitTestFail("PaymentRequestService should have at least one payment request.");
|
emitTestFail("PaymentRequestService should have at least one payment request.");
|
||||||
}
|
}
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payRequest of paymentEnum) {
|
||||||
let payRequest = paymentEnum.getNext().QueryInterface(Ci.nsIPaymentRequest);
|
|
||||||
if (!payRequest) {
|
if (!payRequest) {
|
||||||
emitTestFail("Fail to get existing payment request.");
|
emitTestFail("Fail to get existing payment request.");
|
||||||
break;
|
break;
|
||||||
|
|
@ -425,8 +421,7 @@ function checkCrossOriginTopLevelPrincipalHandler() {
|
||||||
if (!paymentEnum.hasMoreElements()) {
|
if (!paymentEnum.hasMoreElements()) {
|
||||||
emitTestFail("PaymentRequestService should have at least one payment request.");
|
emitTestFail("PaymentRequestService should have at least one payment request.");
|
||||||
}
|
}
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payRequest of paymentEnum) {
|
||||||
let payRequest = paymentEnum.getNext().QueryInterface(Ci.nsIPaymentRequest);
|
|
||||||
if (!payRequest) {
|
if (!payRequest) {
|
||||||
emitTestFail("Fail to get existing payment request.");
|
emitTestFail("Fail to get existing payment request.");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,7 @@ function checkLowerCaseCurrency() {
|
||||||
"PaymentRequestService should have at least one payment request.";
|
"PaymentRequestService should have at least one payment request.";
|
||||||
sendAsyncMessage("test-fail", msg);
|
sendAsyncMessage("test-fail", msg);
|
||||||
}
|
}
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payRequest of paymentEnum) {
|
||||||
const payRequest = paymentEnum
|
|
||||||
.getNext()
|
|
||||||
.QueryInterface(Ci.nsIPaymentRequest);
|
|
||||||
if (!payRequest) {
|
if (!payRequest) {
|
||||||
sendAsyncMessage("test-fail", "Fail to get existing payment request.");
|
sendAsyncMessage("test-fail", "Fail to get existing payment request.");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,13 @@ add_task(async () => {
|
||||||
const paymentSrv = Cc[
|
const paymentSrv = Cc[
|
||||||
"@mozilla.org/dom/payments/payment-request-service;1"
|
"@mozilla.org/dom/payments/payment-request-service;1"
|
||||||
].getService(Ci.nsIPaymentRequestService);
|
].getService(Ci.nsIPaymentRequestService);
|
||||||
ok(paymentSrv, "Fail to get PaymentRequestService.");
|
|
||||||
const paymentEnum = paymentSrv.enumerate();
|
const paymentEnum = paymentSrv.enumerate();
|
||||||
ok(
|
ok(
|
||||||
paymentEnum.hasMoreElements(),
|
paymentEnum.hasMoreElements(),
|
||||||
"PaymentRequestService should have at least one payment request."
|
"PaymentRequestService should have at least one payment request."
|
||||||
);
|
);
|
||||||
const payments = new Set();
|
const payments = new Set();
|
||||||
while (paymentEnum.hasMoreElements()) {
|
for (let payment of paymentEnum) {
|
||||||
const payment = paymentEnum.getNext().QueryInterface(Ci.nsIPaymentRequest);
|
|
||||||
ok(payment, "Fail to get existing payment request.");
|
ok(payment, "Fail to get existing payment request.");
|
||||||
checkSimplePayment(payment);
|
checkSimplePayment(payment);
|
||||||
payments.add(payment);
|
payments.add(payment);
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,7 @@ function allow_all_plugins() {
|
||||||
|
|
||||||
// Finds the test plugin library
|
// Finds the test plugin library
|
||||||
function get_test_plugin(secondplugin=false) {
|
function get_test_plugin(secondplugin=false) {
|
||||||
var pluginEnum = gDirSvc.get("APluginsDL", Ci.nsISimpleEnumerator);
|
for (let dir of gDirSvc.get("APluginsDL", Ci.nsISimpleEnumerator)) {
|
||||||
while (pluginEnum.hasMoreElements()) {
|
|
||||||
let dir = pluginEnum.getNext().QueryInterface(Ci.nsIFile);
|
|
||||||
let name = get_platform_specific_plugin_name(secondplugin);
|
let name = get_platform_specific_plugin_name(secondplugin);
|
||||||
let plugin = dir.clone();
|
let plugin = dir.clone();
|
||||||
plugin.append(name);
|
plugin.append(name);
|
||||||
|
|
@ -100,9 +98,7 @@ function get_platform_specific_plugin_suffix() {
|
||||||
function get_test_plugin_no_symlink() {
|
function get_test_plugin_no_symlink() {
|
||||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
|
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
|
||||||
.getService(Ci.nsIProperties);
|
.getService(Ci.nsIProperties);
|
||||||
let pluginEnum = dirSvc.get("APluginsDL", Ci.nsISimpleEnumerator);
|
for (let dir of dirSvc.get("APluginsDL", Ci.nsISimpleEnumerator)) {
|
||||||
while (pluginEnum.hasMoreElements()) {
|
|
||||||
let dir = pluginEnum.getNext().QueryInterface(Ci.nsIFile);
|
|
||||||
let plugin = dir.clone();
|
let plugin = dir.clone();
|
||||||
plugin.append(get_platform_specific_plugin_name());
|
plugin.append(get_platform_specific_plugin_name());
|
||||||
if (plugin.exists()) {
|
if (plugin.exists()) {
|
||||||
|
|
|
||||||
|
|
@ -182,9 +182,7 @@ PushRecord.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
isTabOpen() {
|
isTabOpen() {
|
||||||
let windows = Services.wm.getEnumerator("navigator:browser");
|
for (let window of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let window = windows.getNext();
|
|
||||||
if (window.closed || PrivateBrowsingUtils.isWindowPrivate(window)) {
|
if (window.closed || PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,8 @@ function assertThrows(fun, message) {
|
||||||
ok(throws, message);
|
ok(throws, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function* generateDebuggers() {
|
function generateDebuggers() {
|
||||||
let e = wdm.getWorkerDebuggerEnumerator();
|
return wdm.getWorkerDebuggerEnumerator();
|
||||||
while (e.hasMoreElements()) {
|
|
||||||
let dbg = e.getNext().QueryInterface(Ci.nsIWorkerDebugger);
|
|
||||||
yield dbg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function findDebugger(url) {
|
function findDebugger(url) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ let cs = Cc["@mozilla.org/cookiemanager;1"]
|
||||||
|
|
||||||
addMessageListener("getCookieCountAndClear", () => {
|
addMessageListener("getCookieCountAndClear", () => {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
for (let list = cs.enumerator; list.hasMoreElements(); list.getNext())
|
for (let cookie of cs.enumerator)
|
||||||
++count;
|
++count;
|
||||||
cs.removeAll();
|
cs.removeAll();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,7 @@ obs.prototype = {
|
||||||
|
|
||||||
function getCookieCount(cs) {
|
function getCookieCount(cs) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let list = cs.enumerator;
|
for (let cookie of cs.enumerator) {
|
||||||
while (list.hasMoreElements()) {
|
|
||||||
let cookie = list.getNext().QueryInterface(Ci.nsICookie);
|
|
||||||
info("cookie: " + cookie);
|
info("cookie: " + cookie);
|
||||||
info("cookie host " + cookie.host + " path " + cookie.path + " name " + cookie.name +
|
info("cookie host " + cookie.host + " path " + cookie.path + " name " + cookie.name +
|
||||||
" value " + cookie.value + " isSecure " + cookie.isSecure + " expires " + cookie.expires);
|
" value " + cookie.value + " isSecure " + cookie.isSecure + " expires " + cookie.expires);
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,8 @@ function do_set_cookies(uri, channel, session, expected) {
|
||||||
|
|
||||||
function do_count_enumerator(enumerator) {
|
function do_count_enumerator(enumerator) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cookie of enumerator) {
|
||||||
enumerator.getNext();
|
void cookie;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
|
|
|
||||||
|
|
@ -185,10 +185,7 @@ function run_test() {
|
||||||
function getCookieCount() {
|
function getCookieCount() {
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
|
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
|
||||||
var enumerator = cm.enumerator;
|
for (let cookie of cm.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
if (!(enumerator.getNext() instanceof Ci.nsICookie2))
|
|
||||||
throw new Error("not a cookie");
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,7 @@ function* do_run_test()
|
||||||
setCookies("tasty.horse.radish", 50, futureExpiry);
|
setCookies("tasty.horse.radish", 50, futureExpiry);
|
||||||
Assert.equal(countCookies("horse.radish", "horse.radish"), 50);
|
Assert.equal(countCookies("horse.radish", "horse.radish"), 50);
|
||||||
|
|
||||||
let enumerator = Services.cookiemgr.enumerator;
|
for (let cookie of Services.cookiemgr.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
|
|
||||||
if (cookie.host == "horse.radish")
|
if (cookie.host == "horse.radish")
|
||||||
do_throw("cookies not evicted by lastAccessed order");
|
do_throw("cookies not evicted by lastAccessed order");
|
||||||
}
|
}
|
||||||
|
|
@ -77,9 +74,7 @@ function* do_run_test()
|
||||||
false, false, false, futureExpiry, {});
|
false, false, false, futureExpiry, {});
|
||||||
Assert.equal(countCookies("captchart.com", "captchart.com"), 50);
|
Assert.equal(countCookies("captchart.com", "captchart.com"), 50);
|
||||||
|
|
||||||
enumerator = Services.cookiemgr.getCookiesFromHost("captchart.com", {});
|
for (let cookie of Services.cookiemgr.getCookiesFromHost("captchart.com", {})) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
Assert.ok(cookie.expiry == futureExpiry);
|
Assert.ok(cookie.expiry == futureExpiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,14 +99,10 @@ setCookies(aHost, aNumber, aExpiry)
|
||||||
function
|
function
|
||||||
countCookies(aBaseDomain, aHost)
|
countCookies(aBaseDomain, aHost)
|
||||||
{
|
{
|
||||||
let enumerator = Services.cookiemgr.enumerator;
|
|
||||||
|
|
||||||
// count how many cookies are within domain 'aBaseDomain' using the cookie
|
// count how many cookies are within domain 'aBaseDomain' using the cookie
|
||||||
// enumerator.
|
// enumerator.
|
||||||
let cookies = [];
|
let cookies = [];
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cookie of Services.cookiemgr.enumerator) {
|
||||||
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
|
|
||||||
if (cookie.host.length >= aBaseDomain.length &&
|
if (cookie.host.length >= aBaseDomain.length &&
|
||||||
cookie.host.slice(cookie.host.length - aBaseDomain.length) == aBaseDomain)
|
cookie.host.slice(cookie.host.length - aBaseDomain.length) == aBaseDomain)
|
||||||
cookies.push(cookie);
|
cookies.push(cookie);
|
||||||
|
|
@ -123,10 +114,7 @@ countCookies(aBaseDomain, aHost)
|
||||||
cookies.length);
|
cookies.length);
|
||||||
Assert.equal(Services.cookiemgr.countCookiesFromHost(aHost), cookies.length);
|
Assert.equal(Services.cookiemgr.countCookiesFromHost(aHost), cookies.length);
|
||||||
|
|
||||||
enumerator = Services.cookiemgr.getCookiesFromHost(aHost, {});
|
for (let cookie of Services.cookiemgr.getCookiesFromHost(aHost, {})) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
|
|
||||||
if (cookie.host.length >= aBaseDomain.length &&
|
if (cookie.host.length >= aBaseDomain.length &&
|
||||||
cookie.host.slice(cookie.host.length - aBaseDomain.length) == aBaseDomain) {
|
cookie.host.slice(cookie.host.length - aBaseDomain.length) == aBaseDomain) {
|
||||||
let found = false;
|
let found = false;
|
||||||
|
|
|
||||||
|
|
@ -231,11 +231,8 @@ function get_creationTime(i)
|
||||||
// time, if both the limit on total cookies (maxNumber + 10%) and the purge age
|
// time, if both the limit on total cookies (maxNumber + 10%) and the purge age
|
||||||
// + 10% are exceeded.
|
// + 10% are exceeded.
|
||||||
function check_remaining_cookies(aNumberTotal, aNumberOld, aNumberToExpect) {
|
function check_remaining_cookies(aNumberTotal, aNumberOld, aNumberToExpect) {
|
||||||
var enumerator = Services.cookiemgr.enumerator;
|
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cookie of Services.cookiemgr.enumerator) {
|
||||||
var cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
if (aNumberTotal != aNumberToExpect) {
|
if (aNumberTotal != aNumberToExpect) {
|
||||||
|
|
|
||||||
|
|
@ -215,9 +215,7 @@ add_task(async function do_test() {
|
||||||
// be found.
|
// be found.
|
||||||
function findCapabilityViaEnum(origin = TEST_ORIGIN, type = TEST_PERMISSION) {
|
function findCapabilityViaEnum(origin = TEST_ORIGIN, type = TEST_PERMISSION) {
|
||||||
let result = undefined;
|
let result = undefined;
|
||||||
let e = Services.perms.enumerator;
|
for (let perm of Services.perms.enumerator) {
|
||||||
while (e.hasMoreElements()) {
|
|
||||||
let perm = e.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
if (perm.matchesURI(origin, true) &&
|
if (perm.matchesURI(origin, true) &&
|
||||||
perm.type == type) {
|
perm.type == type) {
|
||||||
if (result !== undefined) {
|
if (result !== undefined) {
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,7 @@ add_task(async function test() {
|
||||||
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));
|
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));
|
||||||
|
|
||||||
// Force initialization of the nsPermissionManager
|
// Force initialization of the nsPermissionManager
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let permission of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
let isExpected = false;
|
let isExpected = false;
|
||||||
|
|
||||||
expected.forEach((it, i) => {
|
expected.forEach((it, i) => {
|
||||||
|
|
|
||||||
|
|
@ -176,9 +176,7 @@ add_task(function test() {
|
||||||
let found = expected.map((it) => 0);
|
let found = expected.map((it) => 0);
|
||||||
|
|
||||||
// Force initialization of the nsPermissionManager
|
// Force initialization of the nsPermissionManager
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let permission of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
let isExpected = false;
|
let isExpected = false;
|
||||||
|
|
||||||
expected.forEach((it, i) => {
|
expected.forEach((it, i) => {
|
||||||
|
|
|
||||||
|
|
@ -218,9 +218,7 @@ add_task(async function test() {
|
||||||
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));
|
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));
|
||||||
|
|
||||||
// Force initialization of the nsPermissionManager
|
// Force initialization of the nsPermissionManager
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let permission of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
let isExpected = false;
|
let isExpected = false;
|
||||||
|
|
||||||
expected.forEach((it, i) => {
|
expected.forEach((it, i) => {
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,7 @@ add_task(function test() {
|
||||||
let found = expected.map((it) => 0);
|
let found = expected.map((it) => 0);
|
||||||
|
|
||||||
// Force initialization of the nsPermissionManager
|
// Force initialization of the nsPermissionManager
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let permission of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
let isExpected = false;
|
let isExpected = false;
|
||||||
|
|
||||||
expected.forEach((it, i) => {
|
expected.forEach((it, i) => {
|
||||||
|
|
|
||||||
|
|
@ -218,9 +218,7 @@ add_task(async function test() {
|
||||||
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));
|
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));
|
||||||
|
|
||||||
// Force initialization of the nsPermissionManager
|
// Force initialization of the nsPermissionManager
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let permission of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
let isExpected = false;
|
let isExpected = false;
|
||||||
|
|
||||||
expected.forEach((it, i) => {
|
expected.forEach((it, i) => {
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,7 @@ add_task(function test() {
|
||||||
let found = expected.map((it) => 0);
|
let found = expected.map((it) => 0);
|
||||||
|
|
||||||
// Force initialization of the nsPermissionManager
|
// Force initialization of the nsPermissionManager
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let permission of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
let isExpected = false;
|
let isExpected = false;
|
||||||
|
|
||||||
expected.forEach((it, i) => {
|
expected.forEach((it, i) => {
|
||||||
|
|
|
||||||
|
|
@ -198,9 +198,7 @@ add_task(async function test() {
|
||||||
await PlacesTestUtils.addVisits(Services.io.newURI("https://localhost:8080"));
|
await PlacesTestUtils.addVisits(Services.io.newURI("https://localhost:8080"));
|
||||||
|
|
||||||
// Force initialization of the nsPermissionManager
|
// Force initialization of the nsPermissionManager
|
||||||
let enumerator = Services.perms.enumerator;
|
for (let permission of Services.perms.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
let isExpected = false;
|
let isExpected = false;
|
||||||
|
|
||||||
expected.forEach((it, i) => {
|
expected.forEach((it, i) => {
|
||||||
|
|
|
||||||
|
|
@ -413,10 +413,9 @@ var XPCOMUtils = {
|
||||||
* @param e The nsISimpleEnumerator to iterate over.
|
* @param e The nsISimpleEnumerator to iterate over.
|
||||||
* @param i The expected interface for each element.
|
* @param i The expected interface for each element.
|
||||||
*/
|
*/
|
||||||
IterSimpleEnumerator: function* XPCU_IterSimpleEnumerator(e, i)
|
IterSimpleEnumerator: function XPCU_IterSimpleEnumerator(e, i)
|
||||||
{
|
{
|
||||||
while (e.hasMoreElements())
|
return e.entries(i);
|
||||||
yield e.getNext().QueryInterface(i);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -437,7 +436,7 @@ var XPCOMUtils = {
|
||||||
enumerateCategoryEntries: function* XPCOMUtils_enumerateCategoryEntries(aCategory)
|
enumerateCategoryEntries: function* XPCOMUtils_enumerateCategoryEntries(aCategory)
|
||||||
{
|
{
|
||||||
let category = this.categoryManager.enumerateCategory(aCategory);
|
let category = this.categoryManager.enumerateCategory(aCategory);
|
||||||
for (let entry of this.IterSimpleEnumerator(category, Ci.nsISupportsCString)) {
|
for (let entry of category) {
|
||||||
yield [entry.data, this.categoryManager.getCategoryEntry(aCategory, entry.data)];
|
yield [entry.data, this.categoryManager.getCategoryEntry(aCategory, entry.data)];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
4
layout/tools/reftest/bootstrap.js
vendored
4
layout/tools/reftest/bootstrap.js
vendored
|
|
@ -24,9 +24,7 @@ var WindowListener = {
|
||||||
let win = xulWin.docShell.domWindow;
|
let win = xulWin.docShell.domWindow;
|
||||||
win.addEventListener("load", function listener() {
|
win.addEventListener("load", function listener() {
|
||||||
// Load into any existing windows.
|
// Load into any existing windows.
|
||||||
let windows = Services.wm.getEnumerator("navigator:browser");
|
for (win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,7 @@ async function checkCookies(expectedValues, time) {
|
||||||
function getCookiesFromManager(userContextId) {
|
function getCookiesFromManager(userContextId) {
|
||||||
let cookies = {};
|
let cookies = {};
|
||||||
let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({userContextId}));
|
let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({userContextId}));
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cookie of enumerator) {
|
||||||
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
|
|
||||||
cookies[cookie.name] = cookie.value;
|
cookies[cookie.name] = cookie.value;
|
||||||
}
|
}
|
||||||
return cookies;
|
return cookies;
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,10 @@ function checkCookie(cookie, cookieObj) {
|
||||||
|
|
||||||
function countCookies(enumerator) {
|
function countCookies(enumerator) {
|
||||||
let cnt = 0;
|
let cnt = 0;
|
||||||
|
for (let cookie of enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
void cookie;
|
||||||
cnt++;
|
cnt++;
|
||||||
enumerator.getNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,10 +223,8 @@ async function test_basic_eviction(base_host, subdomain_host, other_subdomain_ho
|
||||||
// Verify that the given cookie names exist, and are ordered from least to most recently accessed
|
// Verify that the given cookie names exist, and are ordered from least to most recently accessed
|
||||||
function verifyCookies(names, uri) {
|
function verifyCookies(names, uri) {
|
||||||
Assert.equal(cm.countCookiesFromHost(uri.host), names.length);
|
Assert.equal(cm.countCookiesFromHost(uri.host), names.length);
|
||||||
let cookies = cm.getCookiesFromHost(uri.host, {});
|
|
||||||
let actual_cookies = [];
|
let actual_cookies = [];
|
||||||
while (cookies.hasMoreElements()) {
|
for (let cookie of cm.getCookiesFromHost(uri.host, {})) {
|
||||||
let cookie = cookies.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
actual_cookies.push(cookie);
|
actual_cookies.push(cookie);
|
||||||
}
|
}
|
||||||
if (names.length != actual_cookies.length) {
|
if (names.length != actual_cookies.length) {
|
||||||
|
|
|
||||||
|
|
@ -146,9 +146,7 @@ function parsePropertyBag2(bag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let attributes = [];
|
let attributes = [];
|
||||||
let enumerator = bag.enumerator;
|
for (let {name} of bag.enumerator) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let name = enumerator.getNext().QueryInterface(Ci.nsIProperty).name;
|
|
||||||
let value = bag.getPropertyAsACString(name);
|
let value = bag.getPropertyAsACString(name);
|
||||||
attributes.push({
|
attributes.push({
|
||||||
"name": name,
|
"name": name,
|
||||||
|
|
|
||||||
|
|
@ -838,9 +838,7 @@ function _propertyBagToObject(propBag) {
|
||||||
let result = {};
|
let result = {};
|
||||||
if (propBag.QueryInterface) {
|
if (propBag.QueryInterface) {
|
||||||
propBag.QueryInterface(Ci.nsIPropertyBag2);
|
propBag.QueryInterface(Ci.nsIPropertyBag2);
|
||||||
let propEnum = propBag.enumerator;
|
for (let prop of propBag.enumerator) {
|
||||||
while (propEnum.hasMoreElements()) {
|
|
||||||
let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty);
|
|
||||||
result[prop.name] = prop.value.toString();
|
result[prop.name] = prop.value.toString();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,8 @@ function run_test() {
|
||||||
cm.add("example.com", "/", "C", "V", false, true, false, time, {});
|
cm.add("example.com", "/", "C", "V", false, true, false, time, {});
|
||||||
const now = Math.floor((new Date()).getTime() / 1000);
|
const now = Math.floor((new Date()).getTime() / 1000);
|
||||||
|
|
||||||
var enumerator = cm.enumerator, found = false;
|
var found = false;
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cookie of cm.enumerator) {
|
||||||
var cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
if (cookie.host == "example.com" &&
|
if (cookie.host == "example.com" &&
|
||||||
cookie.path == "/" &&
|
cookie.path == "/" &&
|
||||||
cookie.name == "C") {
|
cookie.name == "C") {
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,7 @@ function run_test() {
|
||||||
// setting up an observer
|
// setting up an observer
|
||||||
let networkActivity = function(subject, topic, value) {
|
let networkActivity = function(subject, topic, value) {
|
||||||
subject.QueryInterface(Ci.nsIMutableArray);
|
subject.QueryInterface(Ci.nsIMutableArray);
|
||||||
let enumerator = subject.enumerate();
|
for (let data of subject.enumerate()) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let data = enumerator.getNext();
|
|
||||||
data.QueryInterface(Ci.nsINetworkActivityData);
|
|
||||||
results.push(data);
|
results.push(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,7 @@ function run_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// test the enumerator ...
|
// test the enumerator ...
|
||||||
var j = 0;
|
var perms = Array.from(pm.enumerator);
|
||||||
var perms = new Array();
|
|
||||||
var enumerator = pm.enumerator;
|
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
perms[j] = enumerator.getNext().QueryInterface(Ci.nsIPermission);
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
Assert.equal(perms.length, hosts.length);
|
Assert.equal(perms.length, hosts.length);
|
||||||
|
|
||||||
// ... remove all the hosts ...
|
// ... remove all the hosts ...
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,7 @@ function doConfirm(msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function RefreshDeviceList() {
|
function RefreshDeviceList() {
|
||||||
let modules = secmoddb.listModules();
|
for (let module of secmoddb.listModules()) {
|
||||||
for (let module of XPCOMUtils.IterSimpleEnumerator(modules,
|
|
||||||
Ci.nsIPKCS11Module)) {
|
|
||||||
let slots = module.listSlots();
|
let slots = module.listSlots();
|
||||||
AddModule(module, slots);
|
AddModule(module, slots);
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +79,7 @@ function AddModule(module, slots) {
|
||||||
row.appendChild(cell);
|
row.appendChild(cell);
|
||||||
item.appendChild(row);
|
item.appendChild(row);
|
||||||
var parent = document.createElement("treechildren");
|
var parent = document.createElement("treechildren");
|
||||||
for (let slot of XPCOMUtils.IterSimpleEnumerator(slots, Ci.nsIPKCS11Slot)) {
|
for (let slot of slots) {
|
||||||
var child_item = document.createElement("treeitem");
|
var child_item = document.createElement("treeitem");
|
||||||
var child_row = document.createElement("treerow");
|
var child_row = document.createElement("treerow");
|
||||||
var child_cell = document.createElement("treecell");
|
var child_cell = document.createElement("treecell");
|
||||||
|
|
|
||||||
|
|
@ -288,13 +288,7 @@ function getChainForUsage(results, usage) {
|
||||||
for (let result of results) {
|
for (let result of results) {
|
||||||
if (certificateUsages[result.usageString] == usage &&
|
if (certificateUsages[result.usageString] == usage &&
|
||||||
result.errorCode == PRErrorCodeSuccess) {
|
result.errorCode == PRErrorCodeSuccess) {
|
||||||
let array = [];
|
return Array.from(result.chain.getEnumerator());
|
||||||
let enumerator = result.chain.getEnumerator();
|
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
array.push(cert);
|
|
||||||
}
|
|
||||||
return array;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,7 @@ function checkDialogContents(win, notBefore, notAfter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findCertByCommonName(commonName) {
|
function findCertByCommonName(commonName) {
|
||||||
let certEnumerator = certDB.getCerts().getEnumerator();
|
for (let cert of certDB.getCerts().getEnumerator()) {
|
||||||
while (certEnumerator.hasMoreElements()) {
|
|
||||||
let cert = certEnumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (cert.commonName == commonName) {
|
if (cert.commonName == commonName) {
|
||||||
return cert;
|
return cert;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ const TEST_CERT_PASSWORD = "黒い";
|
||||||
const TEST_OUTPUT_PASSWORD = "other password";
|
const TEST_OUTPUT_PASSWORD = "other password";
|
||||||
|
|
||||||
function findCertByCommonName(commonName) {
|
function findCertByCommonName(commonName) {
|
||||||
let certEnumerator = gCertDB.getCerts().getEnumerator();
|
for (let cert of gCertDB.getCerts().getEnumerator()) {
|
||||||
while (certEnumerator.hasMoreElements()) {
|
|
||||||
let cert = certEnumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (cert.commonName == commonName) {
|
if (cert.commonName == commonName) {
|
||||||
return cert;
|
return cert;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,7 @@ const gPromptFactory = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function findCertByCommonName(commonName) {
|
function findCertByCommonName(commonName) {
|
||||||
let certEnumerator = gCertDB.getCerts().getEnumerator();
|
for (let cert of gCertDB.getCerts().getEnumerator()) {
|
||||||
while (certEnumerator.hasMoreElements()) {
|
|
||||||
let cert = certEnumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (cert.commonName == commonName) {
|
if (cert.commonName == commonName) {
|
||||||
return cert;
|
return cert;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,7 @@ function getCertAsByteArray(certPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function commonFindCertBy(propertyName, value) {
|
function commonFindCertBy(propertyName, value) {
|
||||||
let certEnumerator = gCertDB.getCerts().getEnumerator();
|
for (let cert of gCertDB.getCerts().getEnumerator()) {
|
||||||
while (certEnumerator.hasMoreElements()) {
|
|
||||||
let cert = certEnumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (cert[propertyName] == value) {
|
if (cert[propertyName] == value) {
|
||||||
return cert;
|
return cert;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,7 @@ let gTestcases = [
|
||||||
|
|
||||||
function doesCertExist(commonName) {
|
function doesCertExist(commonName) {
|
||||||
let allCerts = gCertDB.getCerts();
|
let allCerts = gCertDB.getCerts();
|
||||||
let enumerator = allCerts.getEnumerator();
|
for (let cert of allCerts.getEnumerator()) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (cert.isBuiltInRoot) {
|
if (cert.isBuiltInRoot) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,7 @@ function getCertAsByteArray(certPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findCertByCommonName(commonName) {
|
function findCertByCommonName(commonName) {
|
||||||
let certEnumerator = gCertDB.getCerts().getEnumerator();
|
for (let cert of gCertDB.getCerts().getEnumerator()) {
|
||||||
while (certEnumerator.hasMoreElements()) {
|
|
||||||
let cert = certEnumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (cert.commonName == commonName) {
|
if (cert.commonName == commonName) {
|
||||||
return cert;
|
return cert;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,9 @@ function check_no_enterprise_roots_imported(certDB, dbKey = undefined) {
|
||||||
function check_some_enterprise_roots_imported(certDB) {
|
function check_some_enterprise_roots_imported(certDB) {
|
||||||
let enterpriseRoots = certDB.getEnterpriseRoots();
|
let enterpriseRoots = certDB.getEnterpriseRoots();
|
||||||
notEqual(enterpriseRoots, null, "should have imported some enterprise roots");
|
notEqual(enterpriseRoots, null, "should have imported some enterprise roots");
|
||||||
let enumerator = enterpriseRoots.getEnumerator();
|
|
||||||
let foundNonBuiltIn = false;
|
let foundNonBuiltIn = false;
|
||||||
let savedDBKey = null;
|
let savedDBKey = null;
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cert of enterpriseRoots.getEnumerator()) {
|
||||||
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (!cert.isBuiltInRoot && !savedDBKey) {
|
if (!cert.isBuiltInRoot && !savedDBKey) {
|
||||||
foundNonBuiltIn = true;
|
foundNonBuiltIn = true;
|
||||||
savedDBKey = cert.dbKey;
|
savedDBKey = cert.dbKey;
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ function checkTestModuleNotPresent() {
|
||||||
let modules = gModuleDB.listModules();
|
let modules = gModuleDB.listModules();
|
||||||
ok(modules.hasMoreElements(),
|
ok(modules.hasMoreElements(),
|
||||||
"One or more modules should be present with test module not present");
|
"One or more modules should be present with test module not present");
|
||||||
while (modules.hasMoreElements()) {
|
for (let module of modules) {
|
||||||
let module = modules.getNext().QueryInterface(Ci.nsIPKCS11Module);
|
|
||||||
notEqual(module.name, "PKCS11 Test Module",
|
notEqual(module.name, "PKCS11 Test Module",
|
||||||
"Non-test module name shouldn't equal 'PKCS11 Test Module'");
|
"Non-test module name shouldn't equal 'PKCS11 Test Module'");
|
||||||
ok(!(module.libName && module.libName.includes("pkcs11testmodule")),
|
ok(!(module.libName && module.libName.includes("pkcs11testmodule")),
|
||||||
|
|
@ -37,8 +36,7 @@ function checkTestModuleExists() {
|
||||||
ok(modules.hasMoreElements(),
|
ok(modules.hasMoreElements(),
|
||||||
"One or more modules should be present with test module present");
|
"One or more modules should be present with test module present");
|
||||||
let testModule = null;
|
let testModule = null;
|
||||||
while (modules.hasMoreElements()) {
|
for (let module of modules) {
|
||||||
let module = modules.getNext().QueryInterface(Ci.nsIPKCS11Module);
|
|
||||||
if (module.name == "PKCS11 Test Module") {
|
if (module.name == "PKCS11 Test Module") {
|
||||||
testModule = module;
|
testModule = module;
|
||||||
break;
|
break;
|
||||||
|
|
@ -90,12 +88,8 @@ function run_test() {
|
||||||
let testModule = checkTestModuleExists();
|
let testModule = checkTestModuleExists();
|
||||||
|
|
||||||
// Check that listing the slots for the test module works.
|
// Check that listing the slots for the test module works.
|
||||||
let slots = testModule.listSlots();
|
let testModuleSlotNames = Array.from(testModule.listSlots(),
|
||||||
let testModuleSlotNames = [];
|
slot => slot.name);
|
||||||
while (slots.hasMoreElements()) {
|
|
||||||
let slot = slots.getNext().QueryInterface(Ci.nsIPKCS11Slot);
|
|
||||||
testModuleSlotNames.push(slot.name);
|
|
||||||
}
|
|
||||||
testModuleSlotNames.sort();
|
testModuleSlotNames.sort();
|
||||||
const expectedSlotNames = ["Empty PKCS11 Slot", "Test PKCS11 Slot", "Test PKCS11 Slot 二"];
|
const expectedSlotNames = ["Empty PKCS11 Slot", "Test PKCS11 Slot", "Test PKCS11 Slot 二"];
|
||||||
deepEqual(testModuleSlotNames, expectedSlotNames,
|
deepEqual(testModuleSlotNames, expectedSlotNames,
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@ function run_test() {
|
||||||
Services.strings.createBundle("chrome://pipnss/locale/pipnss.properties");
|
Services.strings.createBundle("chrome://pipnss/locale/pipnss.properties");
|
||||||
let rootsModuleName = bundle.GetStringFromName("RootCertModuleName");
|
let rootsModuleName = bundle.GetStringFromName("RootCertModuleName");
|
||||||
let foundRootsModule = false;
|
let foundRootsModule = false;
|
||||||
for (let module of XPCOMUtils.IterSimpleEnumerator(moduleDB.listModules(),
|
for (let module of moduleDB.listModules()) {
|
||||||
Ci.nsIPKCS11Module)) {
|
|
||||||
if (module.name == rootsModuleName) {
|
if (module.name == rootsModuleName) {
|
||||||
foundRootsModule = true;
|
foundRootsModule = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@
|
||||||
do_get_profile();
|
do_get_profile();
|
||||||
|
|
||||||
function find_slot_by_name(module, name) {
|
function find_slot_by_name(module, name) {
|
||||||
for (let slot of XPCOMUtils.IterSimpleEnumerator(module.listSlots(),
|
for (let slot of module.listSlots()) {
|
||||||
Ci.nsIPKCS11Slot)) {
|
|
||||||
if (slot.name == name) {
|
if (slot.name == name) {
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
@ -19,8 +18,7 @@ function find_slot_by_name(module, name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function find_module_by_name(moduleDB, name) {
|
function find_module_by_name(moduleDB, name) {
|
||||||
for (let slot of XPCOMUtils.IterSimpleEnumerator(moduleDB.listModules(),
|
for (let slot of moduleDB.listModules()) {
|
||||||
Ci.nsIPKCS11Module)) {
|
|
||||||
if (slot.name == name) {
|
if (slot.name == name) {
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,13 +64,7 @@ function insertEntries() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEntries(type) {
|
function getEntries(type) {
|
||||||
let entryEnumerator = sss.enumerate(type);
|
return Array.from(sss.enumerate(type));
|
||||||
let entries = [];
|
|
||||||
while (entryEnumerator.hasMoreElements()) {
|
|
||||||
let entry = entryEnumerator.getNext();
|
|
||||||
entries.push(entry.QueryInterface(Ci.nsISiteSecurityState));
|
|
||||||
}
|
|
||||||
return entries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkSiteSecurityStateAttrs(entries) {
|
function checkSiteSecurityStateAttrs(entries) {
|
||||||
|
|
@ -92,11 +86,9 @@ function checkSiteSecurityStateAttrs(entries) {
|
||||||
|
|
||||||
function checkSha256Keys(hpkpEntries) {
|
function checkSha256Keys(hpkpEntries) {
|
||||||
for (let hpkpEntry of hpkpEntries) {
|
for (let hpkpEntry of hpkpEntries) {
|
||||||
let enumerator = hpkpEntry.QueryInterface(Ci.nsISiteHPKPState).sha256Keys;
|
let keys = Array.from(hpkpEntry.QueryInterface(Ci.nsISiteHPKPState).sha256Keys,
|
||||||
let keys = [];
|
key => key.QueryInterface(Ci.nsIVariant));
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
keys.push(enumerator.getNext().QueryInterface(Ci.nsIVariant));
|
|
||||||
}
|
|
||||||
equal(keys.length, KEY_HASHES.length, "Should get correct number of keys");
|
equal(keys.length, KEY_HASHES.length, "Should get correct number of keys");
|
||||||
keys.sort();
|
keys.sort();
|
||||||
for (let i = 0; i < KEY_HASHES.length; i++) {
|
for (let i = 0; i < KEY_HASHES.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -375,11 +375,9 @@ function downloadAndParseChromePins(filename,
|
||||||
// nicknames and digests of the SPKInfo for the mozilla trust store
|
// nicknames and digests of the SPKInfo for the mozilla trust store
|
||||||
function loadNSSCertinfo(extraCertificates) {
|
function loadNSSCertinfo(extraCertificates) {
|
||||||
let allCerts = gCertDB.getCerts();
|
let allCerts = gCertDB.getCerts();
|
||||||
let enumerator = allCerts.getEnumerator();
|
|
||||||
let certNameToSKD = {};
|
let certNameToSKD = {};
|
||||||
let certSKDToName = {};
|
let certSKDToName = {};
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cert of allCerts.getEnumerator()) {
|
||||||
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (!cert.isBuiltInRoot) {
|
if (!cert.isBuiltInRoot) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,10 +172,7 @@ function insertTrustAnchorsFromDatabase() {
|
||||||
const TRUST_TYPE = Ci.nsIX509CertDB.TRUSTED_SSL;
|
const TRUST_TYPE = Ci.nsIX509CertDB.TRUSTED_SSL;
|
||||||
|
|
||||||
// Iterate through the whole Cert DB
|
// Iterate through the whole Cert DB
|
||||||
let enumerator = CertDb.getCerts().getEnumerator();
|
for (let cert of CertDb.getCerts().getEnumerator()) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
|
|
||||||
// Find the certificate in our existing list. Do it here because we need to check if
|
// Find the certificate in our existing list. Do it here because we need to check if
|
||||||
// it's untrusted too.
|
// it's untrusted too.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,10 +227,9 @@ add_task(async function test_logFileError() {
|
||||||
function countLogFiles() {
|
function countLogFiles() {
|
||||||
let logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
|
let logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let entries = logsdir.directoryEntries;
|
for (let entry of logsdir.directoryEntries) {
|
||||||
while (entries.hasMoreElements()) {
|
void entry;
|
||||||
count += 1;
|
count += 1;
|
||||||
entries.getNext();
|
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,7 @@ TabStore.prototype = {
|
||||||
|
|
||||||
let allTabs = [];
|
let allTabs = [];
|
||||||
|
|
||||||
let winEnum = this.getWindowEnumerator();
|
for (let win of this.getWindowEnumerator()) {
|
||||||
while (winEnum.hasMoreElements()) {
|
|
||||||
let win = winEnum.getNext();
|
|
||||||
if (this.shouldSkipWindow(win)) {
|
if (this.shouldSkipWindow(win)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -235,9 +233,8 @@ TabStore.prototype = {
|
||||||
// first syncs.
|
// first syncs.
|
||||||
let ids = {};
|
let ids = {};
|
||||||
let allWindowsArePrivate = false;
|
let allWindowsArePrivate = false;
|
||||||
let wins = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (wins.hasMoreElements()) {
|
if (PrivateBrowsingUtils.isWindowPrivate(win)) {
|
||||||
if (PrivateBrowsingUtils.isWindowPrivate(wins.getNext())) {
|
|
||||||
// Ensure that at least there is a private window.
|
// Ensure that at least there is a private window.
|
||||||
allWindowsArePrivate = true;
|
allWindowsArePrivate = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -320,17 +317,15 @@ TabTracker.prototype = {
|
||||||
|
|
||||||
onStart() {
|
onStart() {
|
||||||
Svc.Obs.add("domwindowopened", this.asyncObserver);
|
Svc.Obs.add("domwindowopened", this.asyncObserver);
|
||||||
let wins = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (wins.hasMoreElements()) {
|
this._registerListenersForWindow(win);
|
||||||
this._registerListenersForWindow(wins.getNext());
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onStop() {
|
onStop() {
|
||||||
Svc.Obs.remove("domwindowopened", this.asyncObserver);
|
Svc.Obs.remove("domwindowopened", this.asyncObserver);
|
||||||
let wins = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (wins.hasMoreElements()) {
|
this._unregisterListenersForWindow(win);
|
||||||
this._unregisterListenersForWindow(wins.getNext());
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,14 +241,7 @@ function mockGetWindowEnumerator(url, numWindows, numTabs, indexes, moreURLs) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return elements.values();
|
||||||
hasMoreElements() {
|
|
||||||
return elements.length;
|
|
||||||
},
|
|
||||||
getNext() {
|
|
||||||
return elements.shift();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to get the sync telemetry and add the typically used test
|
// Helper function to get the sync telemetry and add the typically used test
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,8 @@ function fakeSvcWinMediator() {
|
||||||
// actions on windows are captured in logs
|
// actions on windows are captured in logs
|
||||||
let logs = [];
|
let logs = [];
|
||||||
delete Services.wm;
|
delete Services.wm;
|
||||||
Services.wm = {
|
|
||||||
getEnumerator() {
|
function getNext() {
|
||||||
return {
|
|
||||||
cnt: 2,
|
|
||||||
hasMoreElements() {
|
|
||||||
return this.cnt-- > 0;
|
|
||||||
},
|
|
||||||
getNext() {
|
|
||||||
let elt = {addTopics: [], remTopics: [], numAPL: 0, numRPL: 0};
|
let elt = {addTopics: [], remTopics: [], numAPL: 0, numRPL: 0};
|
||||||
logs.push(elt);
|
logs.push(elt);
|
||||||
return {
|
return {
|
||||||
|
|
@ -43,7 +37,10 @@ function fakeSvcWinMediator() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
Services.wm = {
|
||||||
|
getEnumerator() {
|
||||||
|
return [getNext(), getNext()];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return logs;
|
return logs;
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,7 @@ function load_test_vacuum_component() {
|
||||||
let catMan = Cc["@mozilla.org/categorymanager;1"].
|
let catMan = Cc["@mozilla.org/categorymanager;1"].
|
||||||
getService(Ci.nsICategoryManager);
|
getService(Ci.nsICategoryManager);
|
||||||
let found = false;
|
let found = false;
|
||||||
let entries = catMan.enumerateCategory(CATEGORY_NAME);
|
for (let {data: entry} of catMan.enumerateCategory(CATEGORY_NAME)) {
|
||||||
while (entries.hasMoreElements()) {
|
|
||||||
let entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
|
|
||||||
print("Check if the found category entry (" + entry + ") is expected.");
|
print("Check if the found category entry (" + entry + ") is expected.");
|
||||||
if (EXPECTED_ENTRIES.includes(entry)) {
|
if (EXPECTED_ENTRIES.includes(entry)) {
|
||||||
print("Check that only one test entry exists.");
|
print("Check that only one test entry exists.");
|
||||||
|
|
|
||||||
|
|
@ -370,11 +370,9 @@ function downloadAndParseChromePins(filename,
|
||||||
// nicknames and digests of the SPKInfo for the mozilla trust store
|
// nicknames and digests of the SPKInfo for the mozilla trust store
|
||||||
function loadNSSCertinfo(extraCertificates) {
|
function loadNSSCertinfo(extraCertificates) {
|
||||||
let allCerts = gCertDB.getCerts();
|
let allCerts = gCertDB.getCerts();
|
||||||
let enumerator = allCerts.getEnumerator();
|
|
||||||
let certNameToSKD = {};
|
let certNameToSKD = {};
|
||||||
let certSKDToName = {};
|
let certSKDToName = {};
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let cert of allCerts.getEnumerator()) {
|
||||||
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
|
||||||
if (!cert.isBuiltInRoot) {
|
if (!cert.isBuiltInRoot) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -383,9 +383,7 @@ class MarionetteParentProcess {
|
||||||
// When Firefox starts on Windows, an additional GFX sanity test
|
// When Firefox starts on Windows, an additional GFX sanity test
|
||||||
// window may appear off-screen. Marionette should wait for it
|
// window may appear off-screen. Marionette should wait for it
|
||||||
// to close.
|
// to close.
|
||||||
let winEn = Services.wm.getEnumerator(null);
|
for (let win of Services.wm.getEnumerator(null)) {
|
||||||
while (winEn.hasMoreElements()) {
|
|
||||||
let win = winEn.getNext();
|
|
||||||
if (win.document.documentURI == "chrome://gfxsanity/content/sanityparent.html") {
|
if (win.document.documentURI == "chrome://gfxsanity/content/sanityparent.html") {
|
||||||
this.gfxWindow = win;
|
this.gfxWindow = win;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -209,9 +209,8 @@ cookie.iter = function* (host, currentPath = "/") {
|
||||||
|
|
||||||
const isForCurrentPath = path => currentPath.includes(path);
|
const isForCurrentPath = path => currentPath.includes(path);
|
||||||
|
|
||||||
let en = cookie.manager.getCookiesFromHost(host, {});
|
let cookies = cookie.manager.getCookiesFromHost(host, {});
|
||||||
while (en.hasMoreElements()) {
|
for (let cookie of cookies) {
|
||||||
let cookie = en.getNext().QueryInterface(Ci.nsICookie2);
|
|
||||||
// take the hostname and progressively shorten
|
// take the hostname and progressively shorten
|
||||||
let hostname = host;
|
let hostname = host;
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -92,24 +92,6 @@ const globalMessageManager = Services.mm;
|
||||||
* @namespace driver
|
* @namespace driver
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function for converting a {@link nsISimpleEnumerator} to a
|
|
||||||
* JavaScript iterator.
|
|
||||||
*
|
|
||||||
* @memberof driver
|
|
||||||
*
|
|
||||||
* @param {nsISimpleEnumerator} enumerator
|
|
||||||
* Enumerator to turn into iterator.
|
|
||||||
*
|
|
||||||
* @return {Iterable}
|
|
||||||
* Iterator.
|
|
||||||
*/
|
|
||||||
function* enumeratorIterator(enumerator) {
|
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
yield enumerator.getNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements (parts of) the W3C WebDriver protocol. GeckoDriver lives
|
* Implements (parts of) the W3C WebDriver protocol. GeckoDriver lives
|
||||||
* in chrome space and mediates calls to the message listener of the current
|
* in chrome space and mediates calls to the message listener of the current
|
||||||
|
|
@ -243,7 +225,7 @@ Object.defineProperty(GeckoDriver.prototype, "timeouts", {
|
||||||
|
|
||||||
Object.defineProperty(GeckoDriver.prototype, "windows", {
|
Object.defineProperty(GeckoDriver.prototype, "windows", {
|
||||||
get() {
|
get() {
|
||||||
return enumeratorIterator(Services.wm.getEnumerator(null));
|
return Services.wm.getEnumerator(null);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,7 @@ modal.addHandler = function(handler) {
|
||||||
modal.findModalDialogs = function(context) {
|
modal.findModalDialogs = function(context) {
|
||||||
// First check if there is a modal dialog already present for the
|
// First check if there is a modal dialog already present for the
|
||||||
// current browser window.
|
// current browser window.
|
||||||
let winEn = Services.wm.getEnumerator(null);
|
for (let win of Services.wm.getEnumerator(null)) {
|
||||||
while (winEn.hasMoreElements()) {
|
|
||||||
let win = winEn.getNext();
|
|
||||||
|
|
||||||
// Modal dialogs which do not have an opener set, we cannot detect
|
// Modal dialogs which do not have an opener set, we cannot detect
|
||||||
// as long as GetZOrderDOMWindowEnumerator doesn't work on Linux
|
// as long as GetZOrderDOMWindowEnumerator doesn't work on Linux
|
||||||
// (Bug 156333).
|
// (Bug 156333).
|
||||||
|
|
|
||||||
|
|
@ -42,21 +42,8 @@ cookie.manager = {
|
||||||
getCookiesFromHost(host) {
|
getCookiesFromHost(host) {
|
||||||
let hostCookies = this.cookies.filter(c => c.host === host ||
|
let hostCookies = this.cookies.filter(c => c.host === host ||
|
||||||
c.host === "." + host);
|
c.host === "." + host);
|
||||||
let nextIndex = 0;
|
|
||||||
|
|
||||||
return {
|
return hostCookies;
|
||||||
hasMoreElements() {
|
|
||||||
return nextIndex < hostCookies.length;
|
|
||||||
},
|
|
||||||
|
|
||||||
getNext() {
|
|
||||||
return {
|
|
||||||
QueryInterface() {
|
|
||||||
return hostCookies[nextIndex++];
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,9 +129,7 @@ this.mochikit = class extends ExtensionAPI {
|
||||||
|
|
||||||
onShutdown() {
|
onShutdown() {
|
||||||
if (AppConstants.platform != "android") {
|
if (AppConstants.platform != "android") {
|
||||||
let windows = Services.wm.getEnumerator("navigator:browser");
|
for (let win of Services.wm.getEnumerator("navigator:browser")) {
|
||||||
while (windows.hasMoreElements()) {
|
|
||||||
let win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
|
|
||||||
WindowListener.tearDownWindow(win);
|
WindowListener.tearDownWindow(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -537,9 +537,7 @@ Tester.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForGraphicsTestWindowToBeGone(aCallback) {
|
waitForGraphicsTestWindowToBeGone(aCallback) {
|
||||||
let windowsEnum = Services.wm.getEnumerator(null);
|
for (let win of Services.wm.getEnumerator(null)) {
|
||||||
while (windowsEnum.hasMoreElements()) {
|
|
||||||
let win = windowsEnum.getNext();
|
|
||||||
if (win != window && !win.closed &&
|
if (win != window && !win.closed &&
|
||||||
win.document.documentURI == "chrome://gfxsanity/content/sanityparent.html") {
|
win.document.documentURI == "chrome://gfxsanity/content/sanityparent.html") {
|
||||||
this.BrowserTestUtils.domWindowClosed(win).then(aCallback);
|
this.BrowserTestUtils.domWindowClosed(win).then(aCallback);
|
||||||
|
|
@ -586,9 +584,7 @@ Tester.prototype = {
|
||||||
|
|
||||||
// Remove stale windows
|
// Remove stale windows
|
||||||
this.structuredLogger.info("checking window state");
|
this.structuredLogger.info("checking window state");
|
||||||
let windowsEnum = Services.wm.getEnumerator(null);
|
for (let win of Services.wm.getEnumerator(null)) {
|
||||||
while (windowsEnum.hasMoreElements()) {
|
|
||||||
let win = windowsEnum.getNext();
|
|
||||||
if (win != window && !win.closed &&
|
if (win != window && !win.closed &&
|
||||||
win.document.documentElement.getAttribute("id") != "browserTestHarness") {
|
win.document.documentElement.getAttribute("id") != "browserTestHarness") {
|
||||||
let type = win.document.documentElement.getAttribute("windowtype");
|
let type = win.document.documentElement.getAttribute("windowtype");
|
||||||
|
|
|
||||||
|
|
@ -262,13 +262,10 @@ SpecialPowersObserverAPI.prototype = {
|
||||||
// First create observers from the category manager.
|
// First create observers from the category manager.
|
||||||
let cm =
|
let cm =
|
||||||
Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
|
Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
|
||||||
let enumerator = cm.enumerateCategory(topic);
|
|
||||||
|
|
||||||
let observers = [];
|
let observers = [];
|
||||||
|
|
||||||
while (enumerator.hasMoreElements()) {
|
for (let {data: entry} of cm.enumerateCategory(topic)) {
|
||||||
let entry =
|
|
||||||
enumerator.getNext().QueryInterface(Ci.nsISupportsCString).data;
|
|
||||||
let contractID = cm.getCategoryEntry(topic, entry);
|
let contractID = cm.getCategoryEntry(topic, entry);
|
||||||
|
|
||||||
let factoryFunction;
|
let factoryFunction;
|
||||||
|
|
@ -289,14 +286,11 @@ SpecialPowersObserverAPI.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next enumerate the registered observers.
|
// Next enumerate the registered observers.
|
||||||
enumerator = Services.obs.enumerateObservers(topic);
|
for (let observer of Services.obs.enumerateObservers(topic)) {
|
||||||
while (enumerator.hasMoreElements()) {
|
if (observer instanceof Ci.nsIObserver &&
|
||||||
try {
|
!observers.includes(observer)) {
|
||||||
let observer = enumerator.getNext().QueryInterface(Ci.nsIObserver);
|
|
||||||
if (!observers.includes(observer)) {
|
|
||||||
observers.push(observer);
|
observers.push(observer);
|
||||||
}
|
}
|
||||||
} catch (e) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
observers.forEach(function(observer) {
|
observers.forEach(function(observer) {
|
||||||
|
|
|
||||||
|
|
@ -245,9 +245,7 @@ TalosPowersService.prototype = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let enumerator = Services.wm.getEnumerator(null);
|
for (let domWindow of Services.wm.getEnumerator(null)) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let domWindow = enumerator.getNext();
|
|
||||||
domWindow.close();
|
domWindow.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,9 +252,7 @@ HandlerService.prototype = {
|
||||||
if (handlerInfo.preferredApplicationHandler) {
|
if (handlerInfo.preferredApplicationHandler) {
|
||||||
handlers.push(handlerInfo.preferredApplicationHandler);
|
handlers.push(handlerInfo.preferredApplicationHandler);
|
||||||
}
|
}
|
||||||
let enumerator = handlerInfo.possibleApplicationHandlers.enumerate();
|
for (let handler of handlerInfo.possibleApplicationHandlers.enumerate(Ci.nsIHandlerApp)) {
|
||||||
while (enumerator.hasMoreElements()) {
|
|
||||||
let handler = enumerator.getNext().QueryInterface(Ci.nsIHandlerApp);
|
|
||||||
// If the caller stored duplicate handlers, we save them only once.
|
// If the caller stored duplicate handlers, we save them only once.
|
||||||
if (!handlers.some(h => h.equals(handler))) {
|
if (!handlers.some(h => h.equals(handler))) {
|
||||||
handlers.push(handler);
|
handlers.push(handler);
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,9 @@ var HandlerServiceTestUtils = {
|
||||||
* alphabetically regardless of category.
|
* alphabetically regardless of category.
|
||||||
*/
|
*/
|
||||||
getAllHandlerInfoTypes() {
|
getAllHandlerInfoTypes() {
|
||||||
let handlerInfoTypes = [];
|
return Array.from(gHandlerService.enumerate(),
|
||||||
let handlerInfoEnumerator = gHandlerService.enumerate();
|
info => info.type)
|
||||||
while (handlerInfoEnumerator.hasMoreElements()) {
|
.sort();
|
||||||
let handlerInfo = handlerInfoEnumerator.getNext()
|
|
||||||
.QueryInterface(Ci.nsIHandlerInfo);
|
|
||||||
handlerInfoTypes.push(handlerInfo.type);
|
|
||||||
}
|
|
||||||
return handlerInfoTypes.sort();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,7 @@ add_task(async function() {
|
||||||
// check the extension.
|
// check the extension.
|
||||||
var mimeType = gHandlerSvc.getTypeFromExtension("abc");
|
var mimeType = gHandlerSvc.getTypeFromExtension("abc");
|
||||||
is(mimeType, launcher.MIMEInfo.type, "Got correct mime type.");
|
is(mimeType, launcher.MIMEInfo.type, "Got correct mime type.");
|
||||||
var handlerInfos = gHandlerSvc.enumerate();
|
for (let handlerInfo of gHandlerSvc.enumerate()) {
|
||||||
while (handlerInfos.hasMoreElements()) {
|
|
||||||
let handlerInfo = handlerInfos.getNext().QueryInterface(Ci.nsIHandlerInfo);
|
|
||||||
if (handlerInfo.type == launcher.MIMEInfo.type) {
|
if (handlerInfo.type == launcher.MIMEInfo.type) {
|
||||||
// check the alwaysAskBeforeHandling
|
// check the alwaysAskBeforeHandling
|
||||||
ok(!handlerInfo.alwaysAskBeforeHandling,
|
ok(!handlerInfo.alwaysAskBeforeHandling,
|
||||||
|
|
|
||||||
|
|
@ -240,9 +240,7 @@ function run_test() {
|
||||||
handlerTypes.push("irc");
|
handlerTypes.push("irc");
|
||||||
handlerTypes.push("ircs");
|
handlerTypes.push("ircs");
|
||||||
}
|
}
|
||||||
var handlers = handlerSvc.enumerate();
|
for (let handler of handlerSvc.enumerate()) {
|
||||||
while (handlers.hasMoreElements()) {
|
|
||||||
var handler = handlers.getNext().QueryInterface(Ci.nsIHandlerInfo);
|
|
||||||
Assert.notEqual(handlerTypes.indexOf(handler.type), -1);
|
Assert.notEqual(handlerTypes.indexOf(handler.type), -1);
|
||||||
handlerTypes.splice(handlerTypes.indexOf(handler.type), 1);
|
handlerTypes.splice(handlerTypes.indexOf(handler.type), 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,10 +84,8 @@ function test_clear() {
|
||||||
function test_enumerate() {
|
function test_enumerate() {
|
||||||
var arr = create_n_element_array(5);
|
var arr = create_n_element_array(5);
|
||||||
Assert.equal(5, arr.length);
|
Assert.equal(5, arr.length);
|
||||||
var en = arr.enumerate();
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (en.hasMoreElements()) {
|
for (let str of arr.enumerate()) {
|
||||||
let str = en.getNext();
|
|
||||||
Assert.ok(str instanceof Ci.nsISupportsString);
|
Assert.ok(str instanceof Ci.nsISupportsString);
|
||||||
Assert.equal(str.data, "element " + i);
|
Assert.equal(str.data, "element " + i);
|
||||||
i++;
|
i++;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue