Merge inbound to mozilla-central. a=merge

This commit is contained in:
Tiberius Oros 2018-08-24 12:43:45 +03:00
Родитель 5bf1468b39 33cef824d2
Коммит 2ee9341d01
399 изменённых файлов: 3476 добавлений и 2142 удалений

Просмотреть файл

@ -2448,6 +2448,9 @@ void
DocAccessible::DispatchScrollingEvent(uint32_t aEventType)
{
nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollable();
if (!sf) {
return;
}
int32_t appUnitsPerDevPixel = mPresShell->GetPresContext()->AppUnitsPerDevPixel();
LayoutDevicePoint scrollPoint = LayoutDevicePoint::FromAppUnits(

Просмотреть файл

@ -67,9 +67,8 @@ var AccessFu = {
Services.obs.addObserver(this, "inprocess-browser-shown");
Services.ww.registerNotification(this);
let windows = Services.wm.getEnumerator(null);
while (windows.hasMoreElements()) {
this._attachWindow(windows.getNext());
for (let win of Services.wm.getEnumerator(null)) {
this._attachWindow(win);
}
Logger.info("AccessFu:Enabled");
@ -89,9 +88,8 @@ var AccessFu = {
Services.obs.removeObserver(this, "inprocess-browser-shown");
Services.ww.unregisterNotification(this);
let windows = Services.wm.getEnumerator(null);
while (windows.hasMoreElements()) {
this._detachWindow(windows.getNext());
for (let win of Services.wm.getEnumerator(null)) {
this._detachWindow(win);
}
delete this._notifyOutputPref;

Просмотреть файл

@ -160,13 +160,9 @@ var Utils = { // jshint ignore:line
let attributes = {};
if (aAccessible && aAccessible.attributes) {
let attributesEnum = aAccessible.attributes.enumerate();
// Populate |attributes| object with |aAccessible|'s attribute key-value
// pairs.
while (attributesEnum.hasMoreElements()) {
let attribute = attributesEnum.getNext().QueryInterface(
Ci.nsIPropertyElement);
for (let attribute of aAccessible.attributes.enumerate()) {
attributes[attribute.key] = attribute.value;
}
}
@ -757,9 +753,8 @@ PivotContext.prototype = {
}
};
let getHeaders = function* getHeaders(aHeaderCells) {
let enumerator = aHeaderCells.enumerate();
while (enumerator.hasMoreElements()) {
yield enumerator.getNext().QueryInterface(Ci.nsIAccessible).name;
for (let {name} of aHeaderCells.enumerate(Ci.nsIAccessible)) {
yield name;
}
};

Просмотреть файл

@ -246,11 +246,8 @@ function addAccessibleTask(doc, task) {
}
registerCleanupFunction(() => {
let observers = Services.obs.enumerateObservers("accessible-event");
while (observers.hasMoreElements()) {
Services.obs.removeObserver(
observers.getNext().QueryInterface(Ci.nsIObserver),
"accessible-event");
for (let observer of Services.obs.enumerateObservers("accessible-event")) {
Services.obs.removeObserver(observer, "accessible-event");
}
});

Просмотреть файл

@ -0,0 +1,26 @@
<style>
#a { border-left: solid -moz-hyperlinktext 93em }
</style>
<script>
/*
I dont't know why but this seems to be required to trigger the crash...
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
*/
function go() {
var b = document.elementFromPoint(0,0);
window.scroll({left: 97, top: -1});
document.adoptNode(b);
}
</script>
<body onload=go()>
<ins id="a">

Просмотреть файл

@ -6,6 +6,7 @@ load 893515.html
load 1072792.xhtml
load 1380199.html
load 1402999.html
load 1484778.html
# last_test_to_unload_testsuite.xul MUST be the last test in the list because it
# is responsible for shutting down accessibility service affecting later tests.

Просмотреть файл

@ -319,10 +319,7 @@ function testAttrsInternal(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs,
function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
aAbsentAttrs) {
// Check if all obtained attributes are expected and have expected value.
var enumerate = aAttrs.enumerate();
while (enumerate.hasMoreElements()) {
let prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
for (let prop of aAttrs.enumerate()) {
if (!(prop.key in aExpectedAttrs)) {
if (!aSkipUnexpectedAttrs)
ok(false, "Unexpected attribute '" + prop.key + "' having '" +
@ -355,9 +352,7 @@ function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
for (var name in aAbsentAttrs) {
var wasFound = false;
enumerate = aAttrs.enumerate();
while (enumerate.hasMoreElements()) {
let prop = enumerate.getNext().QueryInterface(nsIPropertyElement);
for (let prop of aAttrs.enumerate()) {
if (prop.key == name)
wasFound = true;
}

Просмотреть файл

@ -76,9 +76,7 @@ function testRelation(aIdentifier, aRelType, aRelatedIdentifiers) {
// Check if all given related accessibles are targets of obtained relation.
for (let idx = 0; idx < targets.length; idx++) {
var isFound = false;
let enumerate = actualTargets.enumerate();
while (enumerate.hasMoreElements()) {
let relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
for (let relatedAcc of actualTargets.enumerate(Ci.nsIAccessible)) {
if (targets[idx] == relatedAcc) {
isFound = true;
break;
@ -89,9 +87,7 @@ function testRelation(aIdentifier, aRelType, aRelatedIdentifiers) {
}
// Check if all obtained targets are given related accessibles.
let enumerate = actualTargets.enumerate();
while (enumerate.hasMoreElements()) {
let relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
for (let relatedAcc of actualTargets.enumerate(Ci.nsIAccessible)) {
let 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.
for (let idx = 0; idx < targets.length; idx++) {
var notFound = true;
var enumerate = actualTargets.enumerate();
while (enumerate.hasMoreElements()) {
var relatedAcc = enumerate.getNext().QueryInterface(nsIAccessible);
for (let relatedAcc of actualTargets.enumerate(Ci.nsIAccessible)) {
if (targets[idx] == relatedAcc) {
notFound = false;
break;

Просмотреть файл

@ -83,12 +83,9 @@ class NetErrorChild extends ActorChild {
_getCertValidityRange(docShell) {
let {securityInfo} = docShell.failedChannel;
securityInfo.QueryInterface(Ci.nsITransportSecurityInfo);
let certs = securityInfo.failedCertChain.getEnumerator();
let notBefore = 0;
let notAfter = Number.MAX_SAFE_INTEGER;
while (certs.hasMoreElements()) {
let cert = certs.getNext();
cert.QueryInterface(Ci.nsIX509Cert);
for (let cert of securityInfo.failedCertChain.getEnumerator()) {
notBefore = Math.max(notBefore, cert.validity.notBefore);
notAfter = Math.min(notAfter, cert.validity.notAfter);
}

Просмотреть файл

@ -336,10 +336,8 @@ function isInitialPage(url) {
return gInitialPages.includes(url) || url == BROWSER_NEW_TAB_URL;
}
function* browserWindows() {
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements())
yield windows.getNext();
function browserWindows() {
return Services.wm.getEnumerator("navigator:browser");
}
function UpdateBackForwardCommands(aWebNavigation) {
@ -2636,13 +2634,11 @@ function BrowserPageInfo(documentURL, initialTab, imageElement, frameOuterWindow
}
let args = { initialTab, imageElement, frameOuterWindowID, browser };
var windows = Services.wm.getEnumerator("Browser:page-info");
documentURL = documentURL || window.gBrowser.selectedBrowser.currentURI.spec;
// Check for windows matching the url
while (windows.hasMoreElements()) {
var currentWindow = windows.getNext();
for (let currentWindow of Services.wm.getEnumerator("Browser:page-info")) {
if (currentWindow.closed) {
continue;
}
@ -3309,10 +3305,7 @@ function getDetailedCertErrorInfo(location, securityInfo) {
let certChain = "";
if (securityInfo.failedCertChain) {
let certs = securityInfo.failedCertChain.getEnumerator();
while (certs.hasMoreElements()) {
let cert = certs.getNext();
cert.QueryInterface(Ci.nsIX509Cert);
for (let cert of securityInfo.failedCertChain.getEnumerator()) {
certChain += getPEMString(cert);
}
}

Просмотреть файл

@ -496,10 +496,7 @@ function getCertChain(securityInfoAsString) {
.getService(Ci.nsISerializationHelper);
let securityInfo = serhelper.deserializeObject(securityInfoAsString);
securityInfo.QueryInterface(Ci.nsITransportSecurityInfo);
let certs = securityInfo.failedCertChain.getEnumerator();
while (certs.hasMoreElements()) {
let cert = certs.getNext();
cert.QueryInterface(Ci.nsIX509Cert);
for (let cert of securityInfo.failedCertChain.getEnumerator()) {
certChain += getPEMString(cert);
}
return certChain;

Просмотреть файл

@ -1,9 +1,6 @@
function test() {
var contentWin = window.open("about:blank", "", "width=100,height=100");
var enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (win.content == contentWin) {
Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
win.gBrowser.removeCurrentTab();

Просмотреть файл

@ -65,9 +65,7 @@ function triggerSave(aWindow, aCallback) {
}
function continueDownloading() {
let windows = Services.wm.getEnumerator("");
while (windows.hasMoreElements()) {
let win = windows.getNext();
for (let win of Services.wm.getEnumerator("")) {
if (win.location && win.location.href == UCT_URI) {
win.document.documentElement._fireButtonEvent("accept");
win.close();

Просмотреть файл

@ -533,24 +533,13 @@ async function loadBadCertPage(url) {
// Utility function to get a handle on the certificate exception dialog.
// Modified from toolkit/components/passwordmgr/test/prompt_common.js
function getCertExceptionDialog(aLocation) {
let enumerator = Services.wm.getXULWindowEnumerator(null);
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
let windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
let containedDocShells = windowDocShell.getDocShellEnumerator(
Ci.nsIDocShellTreeItem.typeChrome,
Ci.nsIDocShell.ENUMERATE_FORWARDS);
while (containedDocShells.hasMoreElements()) {
// Get the corresponding document for this docshell
let childDocShell = containedDocShells.getNext();
let childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
.contentViewer
.DOMDocument;
if (childDoc.location.href == aLocation) {
return childDoc;
for (let {docShell} of Services.wm.getXULWindowEnumerator(null)) {
let containedDocShells = docShell.getDocShellEnumerator(
docShell.typeChrome,
docShell.ENUMERATE_FORWARDS);
for (let {domWindow} of containedDocShells) {
if (domWindow.location.href == aLocation) {
return domWindow.document;
}
}
}

Просмотреть файл

@ -17,9 +17,7 @@ const PLUGIN_SMALL_PAGE = gTestRoot + "plugin_small.html";
*/
function convertPropertyBag(aBag) {
let result = {};
let enumerator = aBag.enumerator;
while (enumerator.hasMoreElements()) {
let { name, value } = enumerator.getNext().QueryInterface(Ci.nsIProperty);
for (let { name, value } of aBag.enumerator) {
if (value instanceof Ci.nsIPropertyBag) {
value = convertPropertyBag(value);
}

Просмотреть файл

@ -294,24 +294,15 @@ async function loadBadCertPage(url) {
// Utility function to get a handle on the certificate exception dialog.
// Modified from toolkit/components/passwordmgr/test/prompt_common.js
function getCertExceptionDialog(aLocation) {
let enumerator = Services.wm.getXULWindowEnumerator(null);
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
let windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
for (let win of Services.wm.getXULWindowEnumerator(null)) {
let windowDocShell = win.docShell;
let containedDocShells = windowDocShell.getDocShellEnumerator(
Ci.nsIDocShellTreeItem.typeChrome,
Ci.nsIDocShell.ENUMERATE_FORWARDS);
while (containedDocShells.hasMoreElements()) {
// Get the corresponding document for this docshell
let childDocShell = containedDocShells.getNext();
let childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
.contentViewer
.DOMDocument;
if (childDoc.location.href == aLocation) {
return childDoc;
for (let {domWindow} of containedDocShells) {
if (domWindow.location.href == aLocation) {
return domWindow.document;
}
}
}

Просмотреть файл

@ -219,10 +219,8 @@ add_task(async function checkAllTheProperties() {
for (let uri of uris) {
let bundle = Services.strings.createBundle(uri.spec);
let enumerator = bundle.getSimpleEnumeration();
while (enumerator.hasMoreElements()) {
let entity = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
for (let entity of bundle.getSimpleEnumeration()) {
testForErrors(uri.spec, entity.key, entity.value);
}
}

Просмотреть файл

@ -54,9 +54,7 @@ function promiseCrashReport(expectedExtra = {}) {
}
info("Iterating crash report extra keys");
let enumerator = extra.enumerator;
while (enumerator.hasMoreElements()) {
let key = enumerator.getNext().QueryInterface(Ci.nsIProperty).name;
for (let {name: key} of extra.enumerator) {
let value = extra.getPropertyAsAString(key);
if (key in expectedExtra) {
if (expectedExtra[key] == null) {

Просмотреть файл

@ -139,9 +139,7 @@ function loadTab(tab, url) {
function ensure_opentabs_match_db() {
var tabs = {};
var winEnum = Services.wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
let browserWin = winEnum.getNext();
for (let browserWin of Services.wm.getEnumerator("navigator:browser")) {
// skip closed-but-not-destroyed windows
if (browserWin.closed)
continue;

Просмотреть файл

@ -110,9 +110,7 @@ async function assertWebRTCIndicatorStatus(expected) {
is(ui.showMicrophoneIndicator, expectAudio, "microphone global indicator as expected");
is(ui.showScreenSharingIndicator, expectScreen, "screen global indicator as expected");
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
let win = windows.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
let menu = win.document.getElementById("tabSharingMenu");
is(!!menu && !menu.hidden, !!expected, "WebRTC menu should be " + expectedState);
}

Просмотреть файл

@ -790,10 +790,8 @@ function isBidiEnabled() {
}
function openAboutDialog() {
var enumerator = Services.wm.getEnumerator("Browser:About");
while (enumerator.hasMoreElements()) {
for (let win of Services.wm.getEnumerator("Browser:About")) {
// Only open one about window (Bug 599573)
let win = enumerator.getNext();
if (win.closed) {
continue;
}

Просмотреть файл

@ -72,9 +72,7 @@ add_task(async function test_cookie_getCookiesWithOriginAttributes() {
// Using getCookiesWithOriginAttributes() to get all cookies for a certain
// domain by using the originAttributes pattern, and clear all these cookies.
let enumerator = Services.cookies.getCookiesWithOriginAttributes(JSON.stringify({}), TEST_HOST);
while (enumerator.hasMoreElements()) {
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
for (let cookie of Services.cookies.getCookiesWithOriginAttributes(JSON.stringify({}), TEST_HOST)) {
Services.cookies.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
}

Просмотреть файл

@ -65,9 +65,7 @@ function checkCookies(ignoreContext = null) {
function deleteCookies(onlyContext = null) {
// Using getCookiesWithOriginAttributes() to get all cookies for a certain
// domain by using the originAttributes pattern, and clear all these cookies.
let enumerator = Services.cookies.getCookiesWithOriginAttributes(JSON.stringify({}), TEST_HOST);
while (enumerator.hasMoreElements()) {
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
for (let cookie of Services.cookies.getCookiesWithOriginAttributes(JSON.stringify({}), TEST_HOST)) {
if (!onlyContext || cookie.originAttributes.userContextId == onlyContext) {
Services.cookies.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
}

Просмотреть файл

@ -516,6 +516,15 @@ var PanelMultiView = class extends AssociatedToNode {
try {
canCancel = false;
this._panel.openPopup(...args);
// On Windows, if another popup is hiding while we call openPopup, the
// call won't fail but the popup won't open. In this case, we have to
// dispatch an artificial "popuphidden" event to reset our state.
if (this._panel.state == "closed" && this.openViews.length) {
this.dispatchCustomEvent("popuphidden");
return false;
}
return true;
} catch (ex) {
this.dispatchCustomEvent("popuphidden");
@ -1056,8 +1065,10 @@ var PanelMultiView = class extends AssociatedToNode {
}
handleEvent(aEvent) {
if (aEvent.type.startsWith("popup") && aEvent.target != this._panel) {
// Shouldn't act on e.g. context menus being shown from within the panel.
// Only process actual popup events from the panel or events we generate
// ourselves, but not from menus being shown from within the panel.
if (aEvent.type.startsWith("popup") && aEvent.target != this._panel &&
aEvent.target != this.node) {
return;
}
switch (aEvent.type) {

Просмотреть файл

@ -144,6 +144,7 @@ skip-if = os == "mac"
[browser_1096763_seen_widgets_post_reset.js]
[browser_1161838_inserted_new_default_buttons.js]
skip-if = verify
[browser_1484275_PanelMultiView_toggle_with_other_popup.js]
[browser_allow_dragging_removable_false.js]
[browser_bootstrapped_custom_toolbar.js]
[browser_currentset_post_reset.js]

Просмотреть файл

@ -0,0 +1,87 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URL = "data:text/html,<html><body></body></html>";
// This code can be consolidated in the EventUtils module (bug 1126772).
const isWindows = AppConstants.platform == "win";
const isMac = AppConstants.platform == "macosx";
const mouseDown = isWindows ? 2 : isMac ? 1 : 4; // eslint-disable-line no-nested-ternary
const mouseUp = isWindows ? 4 : isMac ? 2 : 7; // eslint-disable-line no-nested-ternary
const utils = window.windowUtils;
const scale = utils.screenPixelsPerCSSPixel;
function synthesizeNativeMouseClick(aElement) {
let rect = aElement.getBoundingClientRect();
let win = aElement.ownerGlobal;
let x = win.mozInnerScreenX + (rect.left + rect.right) / 2;
let y = win.mozInnerScreenY + (rect.top + rect.bottom) / 2;
// Wait for the mouseup event to occur before continuing.
return new Promise((resolve, reject) => {
function eventOccurred(e) {
aElement.removeEventListener("mouseup", eventOccurred, true);
resolve();
}
aElement.addEventListener("mouseup", eventOccurred, true);
utils.sendNativeMouseEvent(x * scale, y * scale, mouseDown, 0, null);
utils.sendNativeMouseEvent(x * scale, y * scale, mouseUp, 0, null);
});
}
/**
* Test steps that may lead to the panel being stuck on Windows (bug 1484275).
*/
add_task(async function test_PanelMultiView_toggle_with_other_popup() {
// For proper cleanup, create a bookmark that we will remove later.
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: TEST_URL,
});
registerCleanupFunction(() => PlacesUtils.bookmarks.remove(bookmark));
await BrowserTestUtils.withNewTab({
gBrowser,
url: TEST_URL,
}, async function(browser) {
// 1. Open the main menu.
await gCUITestUtils.openMainMenu();
// 2. Open another popup not managed by PanelMultiView.
let bookmarkPanel = document.getElementById("editBookmarkPanel");
let shown = BrowserTestUtils.waitForEvent(bookmarkPanel, "popupshown");
let hidden = BrowserTestUtils.waitForEvent(bookmarkPanel, "popuphidden");
EventUtils.synthesizeKey("D", { accelKey: true });
await shown;
// 3. Click the button to which the main menu is anchored. We need a native
// mouse event to simulate the exact platform behavior with popups.
let clickFn = () => synthesizeNativeMouseClick(
document.getElementById("PanelUI-button"));
if (AppConstants.platform == "win") {
// On Windows, the operation will close both popups.
await gCUITestUtils.hidePanelMultiView(PanelUI.panel, clickFn);
await new Promise(resolve => executeSoon(resolve));
// 4. Test that the popup can be opened again after it's been closed.
await gCUITestUtils.openMainMenu();
Assert.equal(PanelUI.panel.state, "open");
} else {
// On other platforms, the operation will close both popups and reopen the
// main menu immediately, so we wait for the reopen to occur.
shown = BrowserTestUtils.waitForEvent(PanelUI.mainView, "ViewShown");
clickFn();
await shown;
}
await gCUITestUtils.hideMainMenu();
// Make sure the events for the bookmarks panel have also been processed
// before closing the tab and removing the bookmark.
await hidden;
});
});

Просмотреть файл

@ -406,6 +406,7 @@ add_task(async function test_cancel_mainview_event_sequence() {
Assert.deepEqual(recordArray, [
"panelview-0: ViewShowing",
"panelview-0: ViewHiding",
"panelmultiview-0: PanelMultiViewHidden",
"panelmultiview-0: popuphidden",
]);
});
@ -475,8 +476,9 @@ add_task(async function test_close_while_showing_mainview_event_sequence() {
Assert.deepEqual(recordArray, [
"panelview-0: ViewShowing",
"panelview-0: ViewShowing > panelmultiview-0: popuphidden",
"panelview-0: ViewShowing > panelview-0: ViewHiding",
"panelview-0: ViewShowing > panelmultiview-0: PanelMultiViewHidden",
"panelview-0: ViewShowing > panelmultiview-0: popuphidden",
]);
});

Просмотреть файл

@ -140,14 +140,12 @@ DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult)
nsCOMArray<nsIFile> distroFiles;
AppendDistroSearchDirs(dirSvc, distroFiles);
return NS_NewArrayEnumerator(aResult, distroFiles);
return NS_NewArrayEnumerator(aResult, distroFiles, NS_GET_IID(nsIFile));
}
return NS_ERROR_FAILURE;
}
NS_IMPL_ISUPPORTS(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
NS_IMETHODIMP
DirectoryProvider::AppendingEnumerator::HasMoreElements(bool *aResult)
{

Просмотреть файл

@ -7,8 +7,8 @@
#include "nsIDirectoryService.h"
#include "nsComponentManagerUtils.h"
#include "nsISimpleEnumerator.h"
#include "nsIFile.h"
#include "nsSimpleEnumerator.h"
#include "mozilla/Attributes.h"
#define NS_BROWSERDIRECTORYPROVIDER_CONTRACTID \
@ -27,17 +27,16 @@ public:
private:
~DirectoryProvider() {}
class AppendingEnumerator final : public nsISimpleEnumerator
class AppendingEnumerator final : public nsSimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
AppendingEnumerator(nsISimpleEnumerator* aBase,
char const *const *aAppendList);
private:
~AppendingEnumerator() {}
~AppendingEnumerator() override = default;
nsCOMPtr<nsISimpleEnumerator> mBase;
char const *const *const mAppendList;

Просмотреть файл

@ -142,9 +142,7 @@ var DownloadsCommon = {
get strings() {
let strings = {};
let sb = Services.strings.createBundle(kDownloadsStringBundleUrl);
let enumerator = sb.getSimpleEnumeration();
while (enumerator.hasMoreElements()) {
let string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
for (let string of sb.getSimpleEnumeration()) {
let stringName = string.key;
if (stringName in kDownloadsStringsRequiringFormatting) {
strings[stringName] = function() {

Просмотреть файл

@ -26,9 +26,7 @@ add_task(async function setup() {
function retrieve_all_cookies(host) {
const values = [];
const cookies = Services.cookies.getCookiesFromHost(host, {});
while (cookies.hasMoreElements()) {
const cookie = cookies.getNext().QueryInterface(Ci.nsICookie);
for (let cookie of Services.cookies.getCookiesFromHost(host, {})) {
values.push({
host: cookie.host,
name: cookie.name,

Просмотреть файл

@ -44,7 +44,7 @@ const clearCookies = async function(options) {
if (options.since || options.hostnames) {
// Iterate through the cookies and delete any created after our cutoff.
for (const cookie of XPCOMUtils.IterSimpleEnumerator(cookieMgr.enumerator, Ci.nsICookie2)) {
for (const cookie of cookieMgr.enumerator) {
if ((!options.since || cookie.creationTime >= PlacesUtils.toPRTime(options.since)) &&
(!options.hostnames || options.hostnames.includes(cookie.host.replace(/^\./, "")))) {
// This cookie was created after our cutoff, clear it.

Просмотреть файл

@ -13,8 +13,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "pkcs11db",
var {DefaultMap} = ExtensionUtils;
const findModuleByPath = function(path) {
let modules = pkcs11db.listModules();
for (let module of XPCOMUtils.IterSimpleEnumerator(modules, Ci.nsIPKCS11Module)) {
for (let module of pkcs11db.listModules()) {
if (module && module.libName === path) {
return module;
}
@ -118,7 +117,7 @@ this.pkcs11 = class extends ExtensionAPI {
return Promise.reject({message: `The module ${name} is not installed`});
}
let rv = [];
for (let slot of XPCOMUtils.IterSimpleEnumerator(module.listSlots(), Ci.nsIPKCS11Slot)) {
for (let slot of module.listSlots()) {
let token = slot.getToken();
let slotobj = {
name: slot.name,

Просмотреть файл

@ -50,9 +50,7 @@ XPCOMUtils.defineLazyGetter(this, "tabHidePopup", () => {
});
function showHiddenTabs(id) {
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let win = windowsEnum.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (win.closed || !win.gBrowser) {
continue;
}

Просмотреть файл

@ -28,6 +28,8 @@ support-files =
file_inspectedwindow_reload_target.sjs
file_indexedDB.html
file_serviceWorker.html
install_other-1.0-fx.xpi
install_theme-1.0-fx.xpi
webNav_createdTarget.html
webNav_createdTargetSource.html
webNav_createdTargetSource_subframe.html
@ -105,6 +107,7 @@ skip-if = (verify && (os == 'linux' || os == 'mac'))
[browser_ext_incognito_views.js]
[browser_ext_incognito_popup.js]
[browser_ext_lastError.js]
[browser_ext_management.js]
[browser_ext_menus.js]
[browser_ext_menus_accesskey.js]
[browser_ext_menus_activeTab.js]

Просмотреть файл

@ -0,0 +1,80 @@
"use strict";
const BASE = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/";
function waitForTransition(element, propertyName) {
return BrowserTestUtils.waitForEvent(element, "transitionend", false, event => {
return event.target == element && event.propertyName == propertyName;
});
}
add_task(async function test_management_install() {
await SpecialPowers.pushPrefEnv({set: [
["xpinstall.signatures.required", false],
]});
registerCleanupFunction(async () => {
await SpecialPowers.popPrefEnv();
});
let extension = ExtensionTestUtils.loadExtension({
manifest: {
browser_action: {
"browser_style": false,
},
permissions: ["management"],
},
background() {
let addons;
browser.test.onMessage.addListener((msg, init) => {
addons = init;
browser.test.sendMessage("ready");
});
browser.browserAction.onClicked.addListener(async () => {
try {
let {url, hash} = addons.shift();
browser.test.log(`Installing XPI from ${url} with hash ${hash || "missing"}`);
let {id} = await browser.management.install({url, hash});
let {type} = await browser.management.get(id);
browser.test.sendMessage("installed", {id, type});
} catch (e) {
browser.test.log(`management.install() throws ${e}`);
browser.test.sendMessage("failed", e.message);
}
});
},
});
let addons = [{
url: BASE + "install_theme-1.0-fx.xpi",
hash: "sha256:aa232d8391d82a9c1014364efbe1657ff6d8dfc88b3c71e99881b1f3843fdad3",
}, {
url: BASE + "install_other-1.0-fx.xpi",
}];
await extension.startup();
extension.sendMessage("addons", addons);
await extension.awaitMessage("ready");
// Test installing a static WE theme.
let transitionDone = waitForTransition(document.documentElement, "background-color");
clickBrowserAction(extension);
let {id, type} = await extension.awaitMessage("installed");
is(id, "tiger@persona.beard", "Static web extension theme installed");
is(type, "theme", "Extension type is correct");
await transitionDone;
let style = window.getComputedStyle(document.documentElement);
is(style.backgroundColor, "rgb(255, 165, 0)", "Background is the new black");
let addon = await AddonManager.getAddonByID("tiger@persona.beard");
await addon.uninstall();
// Test installing a standard WE.
clickBrowserAction(extension);
let error = await extension.awaitMessage("failed");
is(error, "Incompatible addon", "Standard web extension rejected");
await extension.unload();
});

Просмотреть файл

@ -508,9 +508,7 @@ function awaitEvent(eventName, id) {
}
function* BrowserWindowIterator() {
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let currentWindow = windowsEnum.getNext();
for (let currentWindow of Services.wm.getEnumerator("navigator:browser")) {
if (!currentWindow.closed) {
yield currentWindow;
}

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -276,9 +276,7 @@ const AutoMigrate = {
},
_removeNotificationBars() {
let browserWindows = Services.wm.getEnumerator("navigator:browser");
while (browserWindows.hasMoreElements()) {
let win = browserWindows.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (!win.closed) {
for (let browser of win.gBrowser.browsers) {
let nb = win.gBrowser.getNotificationBox(browser);

Просмотреть файл

@ -37,12 +37,9 @@ FirefoxProfileMigrator.prototype = Object.create(MigratorPrototype);
FirefoxProfileMigrator.prototype._getAllProfiles = function() {
let allProfiles = new Map();
let profiles =
Cc["@mozilla.org/toolkit/profile-service;1"]
.getService(Ci.nsIToolkitProfileService)
.profiles;
while (profiles.hasMoreElements()) {
let profile = profiles.getNext().QueryInterface(Ci.nsIToolkitProfile);
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
.getService(Ci.nsIToolkitProfileService);
for (let profile of profileService.profiles) {
let rootDir = profile.rootDir;
if (rootDir.exists() && rootDir.isReadable() &&

Просмотреть файл

@ -38,10 +38,8 @@ History.prototype = {
migrate: function H_migrate(aCallback) {
let pageInfos = [];
let typedURLs = MSMigrationUtils.getTypedURLs("Software\\Microsoft\\Internet Explorer");
let historyEnumerator = Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"].
createInstance(Ci.nsISimpleEnumerator);
while (historyEnumerator.hasMoreElements()) {
let entry = historyEnumerator.getNext().QueryInterface(Ci.nsIPropertyBag2);
for (let entry of Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"]
.createInstance(Ci.nsISimpleEnumerator)) {
let url = entry.get("uri").QueryInterface(Ci.nsIURI);
// MSIE stores some types of URLs in its history that we don't handle,
// like HTMLHelp and others. Since we don't properly map handling for
@ -115,11 +113,9 @@ IE7FormPasswords.prototype = {
},
async migrate(aCallback) {
let historyEnumerator = Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"].
createInstance(Ci.nsISimpleEnumerator);
let uris = []; // the uris of the websites that are going to be migrated
while (historyEnumerator.hasMoreElements()) {
let entry = historyEnumerator.getNext().QueryInterface(Ci.nsIPropertyBag2);
for (let entry of Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"]
.createInstance(Ci.nsISimpleEnumerator)) {
let uri = entry.get("uri").QueryInterface(Ci.nsIURI);
// MSIE stores some types of URLs in its history that we don't handle, like HTMLHelp
// and others. Since we are not going to import the logins that are performed in these URLs

Просмотреть файл

@ -19,8 +19,6 @@
////////////////////////////////////////////////////////////////////////////////
//// nsIEHistoryEnumerator
NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator)
nsIEHistoryEnumerator::nsIEHistoryEnumerator()
{
::CoInitialize(nullptr);

Просмотреть файл

@ -9,19 +9,23 @@
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsISimpleEnumerator.h"
#include "nsIWritablePropertyBag2.h"
#include "nsSimpleEnumerator.h"
class nsIEHistoryEnumerator final : public nsISimpleEnumerator
class nsIEHistoryEnumerator final : public nsSimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
nsIEHistoryEnumerator();
const nsID& DefaultInterface() override
{
return NS_GET_IID(nsIWritablePropertyBag2);
}
private:
~nsIEHistoryEnumerator();
~nsIEHistoryEnumerator() override;
/**
* Initializes the history reader, if needed.

Просмотреть файл

@ -19,9 +19,7 @@ function readFile(file) {
function checkDirectoryContains(dir, files) {
print("checking " + dir.path + " - should contain " + Object.keys(files));
let seen = new Set();
let enumerator = dir.directoryEntries;
while (enumerator.hasMoreElements()) {
let file = enumerator.getNext().QueryInterface(Ci.nsIFile);
for (let file of dir.directoryEntries) {
print("found file: " + file.path);
Assert.ok(file.leafName in files, file.leafName + " exists, but shouldn't");

Просмотреть файл

@ -36,9 +36,7 @@ this.ASRouterTriggerListeners = new Map([
Services.ww.registerNotification(this);
// Add listeners to all existing browser windows
const winEnum = Services.wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
let win = winEnum.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (win.closed || PrivateBrowsingUtils.isWindowPrivate(win)) {
continue;
}
@ -59,9 +57,7 @@ this.ASRouterTriggerListeners = new Map([
if (this._initialized) {
Services.ww.unregisterNotification(this);
const winEnum = Services.wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
let win = winEnum.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (win.closed || PrivateBrowsingUtils.isWindowPrivate(win)) {
continue;
}

Просмотреть файл

@ -66,9 +66,8 @@ this.Screenshots = {
* we are ok to collect screenshots.
*/
_shouldGetScreenshots() {
const windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
if (!PrivateBrowsingUtils.isWindowPrivate(windows.getNext())) {
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (!PrivateBrowsingUtils.isWindowPrivate(win)) {
// As soon as we encounter 1 non-private window, screenshots are fair game.
return true;
}

Просмотреть файл

@ -642,9 +642,8 @@ BrowserGlue.prototype = {
// delays are in seconds
const MAX_DELAY = 300;
let delay = 3;
let browserEnum = Services.wm.getEnumerator("navigator:browser");
while (browserEnum.hasMoreElements()) {
delay += browserEnum.getNext().gBrowser.tabs.length;
for (let win of Services.wm.getEnumerator("navigator:browser")) {
delay += win.gBrowser.tabs.length;
}
delay = delay <= MAX_DELAY ? delay : MAX_DELAY;

Просмотреть файл

@ -47,11 +47,9 @@ add_task(async function cookie_test() {
let tab = BrowserTestUtils.addTab(gBrowser, BASE_URL + "test_firstParty_cookie.html");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, true);
let iter = Services.cookies.enumerator;
let count = 0;
while (iter.hasMoreElements()) {
for (let cookie of Services.cookies.enumerator) {
count++;
let cookie = iter.getNext().QueryInterface(Ci.nsICookie2);
Assert.equal(cookie.value, "foo", "Cookie value should be foo");
Assert.equal(cookie.originAttributes.firstPartyDomain, BASE_DOMAIN, "Cookie's origin attributes should be " + BASE_DOMAIN);
}

Просмотреть файл

@ -154,9 +154,7 @@ PaymentUIService.prototype = {
},
findDialog(requestId) {
let enu = Services.wm.getEnumerator(null);
let win;
while ((win = enu.getNext())) {
for (let win of Services.wm.getEnumerator(null)) {
if (win.name == `${this.REQUEST_ID_PREFIX}${requestId}`) {
return win;
}

Просмотреть файл

@ -24,12 +24,7 @@ const {PaymentTestUtils: PTU} = ChromeUtils.import(
"resource://testing-common/PaymentTestUtils.jsm", {});
function getPaymentRequests() {
let requestsEnum = paymentSrv.enumerate();
let requests = [];
while (requestsEnum.hasMoreElements()) {
requests.push(requestsEnum.getNext().QueryInterface(Ci.nsIPaymentRequest));
}
return requests;
return Array.from(paymentSrv.enumerate());
}
/**

Просмотреть файл

@ -30,14 +30,10 @@ var gAppManagerDialog = {
}
var list = document.getElementById("appList");
var apps = this.handlerInfo.possibleApplicationHandlers.enumerate();
while (apps.hasMoreElements()) {
let app = apps.getNext();
for (let app of this.handlerInfo.possibleApplicationHandlers.enumerate()) {
if (!gMainPane.isValidHandlerApp(app))
continue;
app.QueryInterface(Ci.nsIHandlerApp);
// Ensure the XBL binding is created eagerly.
// eslint-disable-next-line no-undef
list.appendChild(MozXULElement.parseXULToFragment("<richlistitem/>"));

Просмотреть файл

@ -1397,10 +1397,7 @@ var gMainPane = {
* Load the set of handlers defined by the application datastore.
*/
_loadApplicationHandlers() {
var wrappedHandlerInfos = gHandlerService.enumerate();
while (wrappedHandlerInfos.hasMoreElements()) {
let wrappedHandlerInfo =
wrappedHandlerInfos.getNext().QueryInterface(Ci.nsIHandlerInfo);
for (let wrappedHandlerInfo of gHandlerService.enumerate()) {
let type = wrappedHandlerInfo.type;
let handlerInfoWrapper;
@ -1661,10 +1658,8 @@ var gMainPane = {
// Create menu items for possible handlers.
let preferredApp = handlerInfo.preferredApplicationHandler;
let possibleApps = handlerInfo.possibleApplicationHandlers.enumerate();
var possibleAppMenuItems = [];
while (possibleApps.hasMoreElements()) {
let possibleApp = possibleApps.getNext();
for (let possibleApp of handlerInfo.possibleApplicationHandlers.enumerate()) {
if (!this.isValidHandlerApp(possibleApp))
continue;
@ -1692,10 +1687,8 @@ var gMainPane = {
let gIOSvc = Cc["@mozilla.org/gio-service;1"].
getService(Ci.nsIGIOService);
var gioApps = gIOSvc.getAppsForURIScheme(handlerInfo.type);
let enumerator = gioApps.enumerate();
let possibleHandlers = handlerInfo.possibleApplicationHandlers;
while (enumerator.hasMoreElements()) {
let handler = enumerator.getNext().QueryInterface(Ci.nsIHandlerApp);
for (let handler of gioApps.enumerate()) {
// OS handler share the same name, it's most likely the same app, skipping...
if (handler.name == handlerInfo.defaultDescription) {
continue;
@ -2400,6 +2393,10 @@ function ArrayEnumerator(aItems) {
ArrayEnumerator.prototype = {
_index: 0,
[Symbol.iterator]() {
return this._contents.values();
},
hasMoreElements() {
return this._index < this._contents.length;
},
@ -2710,9 +2707,8 @@ class HandlerInfoWrapper {
}
addPossibleApplicationHandler(aNewHandler) {
var possibleApps = this.possibleApplicationHandlers.enumerate();
while (possibleApps.hasMoreElements()) {
if (possibleApps.getNext().equals(aNewHandler))
for (let app of this.possibleApplicationHandlers.enumerate()) {
if (app.equals(aNewHandler))
return;
}
this.possibleApplicationHandlers.appendElement(aNewHandler);

Просмотреть файл

@ -54,15 +54,10 @@ var gLanguagesDialog = {
}
// 1) Read the available languages out of language.properties
var strings = bundleAccepted.strings;
let localeCodes = [];
let localeValues = [];
while (strings.hasMoreElements()) {
var currString = strings.getNext();
if (!(currString instanceof Ci.nsIPropertyElement))
break;
for (let currString of bundleAccepted.strings) {
var property = currString.key.split("."); // ab[-cd].accept
if (property[1] == "accept") {
localeCodes.push(property[0]);

Просмотреть файл

@ -260,9 +260,7 @@ var gPermissionManager = {
_loadPermissions() {
// load permissions into a table.
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let nextPermission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
for (let nextPermission of Services.perms.enumerator) {
this._addPermissionToList(nextPermission);
}
},

Просмотреть файл

@ -192,9 +192,7 @@ var gSitePermissionsManager = {
_loadPermissions() {
// load permissions into a table.
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let nextPermission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
for (let nextPermission of Services.perms.enumerator) {
this._addPermissionToList(nextPermission);
}
},

Просмотреть файл

@ -93,10 +93,7 @@ var gTranslationExceptions = {
// Load site permissions into an array.
this._sites = [];
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let perm = enumerator.getNext().QueryInterface(Ci.nsIPermission);
for (let perm of Services.perms.enumerator) {
if (perm.type == kPermissionType &&
perm.capability == Services.perms.DENY_ACTION) {
this._sites.push(perm.principal.origin);

Просмотреть файл

@ -176,9 +176,8 @@ var SessionCookiesInternal = {
return;
}
let iter = Services.cookies.sessionEnumerator;
while (iter.hasMoreElements()) {
this._addCookie(iter.getNext());
for (let cookie of Services.cookies.sessionEnumerator) {
this._addCookie(cookie);
}
}
};

Просмотреть файл

@ -597,9 +597,7 @@ var SessionStoreInternal = {
// in one of the currently open windows that was closed after the
// last-closed window.
let tabTimestamps = [];
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let window = windowsEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
let windowState = this._windows[window.__SSi];
if (windowState && windowState._closedTabs[0]) {
tabTimestamps.push(windowState._closedTabs[0].closedAt);
@ -2722,9 +2720,7 @@ var SessionStoreInternal = {
}
// Check for a tab.
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let window = windowsEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
let windowState = this._windows[window.__SSi];
if (windowState) {
for (let j = 0, l = windowState._closedTabs.length; j < l; j++) {
@ -2785,9 +2781,7 @@ var SessionStoreInternal = {
// This method deletes all the closedTabs matching userContextId.
_forgetTabsWithUserContextId(userContextId) {
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let window = windowsEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
let windowState = this._windows[window.__SSi];
if (windowState) {
// In order to remove the tabs in the correct order, we store the
@ -2972,9 +2966,7 @@ var SessionStoreInternal = {
* Revive all crashed tabs and reset the crashed tabs count to 0.
*/
reviveAllCrashedTabs() {
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let window = windowsEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
for (let tab of window.gBrowser.tabs) {
this.reviveCrashedTab(tab);
}
@ -4329,11 +4321,8 @@ var SessionStoreInternal = {
* setBrowserState to treat them as open windows.
*/
_handleClosedWindows: function ssi_handleClosedWindows() {
var windowsEnum = Services.wm.getEnumerator("navigator:browser");
let promises = [];
while (windowsEnum.hasMoreElements()) {
var window = windowsEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
if (window.closed) {
promises.push(this.onClose(window));
}

Просмотреть файл

@ -59,9 +59,8 @@ const IS_MAC = navigator.platform.match(/Mac/);
*/
function getBrowserWindowsCount() {
let open = 0;
let e = Services.wm.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (!win.closed)
++open;
}

Просмотреть файл

@ -23,11 +23,8 @@ add_task(async function() {
let state = ss.getBrowserState();
// verify our cookie got set during pageload
let enumerator = Services.cookies.enumerator;
let cookie;
let i = 0;
while (enumerator.hasMoreElements()) {
cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
for (var cookie of Services.cookies.enumerator) {
i++;
}
Assert.equal(i, 1, "expected one cookie");
@ -39,10 +36,7 @@ add_task(async function() {
await setBrowserState(state);
// at this point, the cookie should be restored...
enumerator = Services.cookies.enumerator;
let cookie2;
while (enumerator.hasMoreElements()) {
cookie2 = enumerator.getNext().QueryInterface(Ci.nsICookie);
for (var cookie2 of Services.cookies.enumerator) {
if (cookie.name == cookie2.name)
break;
}

Просмотреть файл

@ -10,9 +10,8 @@ function test() {
function browserWindowsCount(expected) {
let count = 0;
let e = Services.wm.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (!win.closed)
++count;
}
is(count, expected,

Просмотреть файл

@ -1,8 +1,7 @@
function browserWindowsCount(expected) {
var count = 0;
var e = Services.wm.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (!win.closed)
++count;
}
is(count, expected,

Просмотреть файл

@ -67,10 +67,8 @@ function testBug600545() {
function done() {
// Enumerate windows and close everything but our primary window. We can't
// use waitForFocus() because apparently it's buggy. See bug 599253.
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
let closeWinPromises = [];
while (windowsEnum.hasMoreElements()) {
let currentWindow = windowsEnum.getNext();
for (let currentWindow of Services.wm.getEnumerator("navigator:browser")) {
if (currentWindow != window)
closeWinPromises.push(BrowserTestUtils.closeWindow(currentWindow));
}

Просмотреть файл

@ -26,10 +26,8 @@ function runNextTest() {
if (tests.length) {
// Enumerate windows and close everything but our primary window. We can't
// use waitForFocus() because apparently it's buggy. See bug 599253.
var windowsEnum = Services.wm.getEnumerator("navigator:browser");
let closeWinPromises = [];
while (windowsEnum.hasMoreElements()) {
var currentWindow = windowsEnum.getNext();
for (let currentWindow of Services.wm.getEnumerator("navigator:browser")) {
if (currentWindow != window) {
closeWinPromises.push(BrowserTestUtils.closeWindow(currentWindow));
}

Просмотреть файл

@ -50,10 +50,7 @@ function test() {
function countTabs() {
let needsRestore = 0, isRestoring = 0;
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let window = windowsEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
if (window.closed)
continue;

Просмотреть файл

@ -136,11 +136,8 @@ add_task(async function run_test() {
// Restore window with session cookies that have no originAttributes.
await setWindowState(win, SESSION_DATA, true);
let enumerator = Services.cookies.getCookiesFromHost(TEST_HOST, {});
let cookie;
let cookieCount = 0;
while (enumerator.hasMoreElements()) {
cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
for (var cookie of Services.cookies.getCookiesFromHost(TEST_HOST, {})) {
cookieCount++;
}
@ -156,10 +153,8 @@ add_task(async function run_test() {
// Restore window with session cookies that have originAttributes within.
await setWindowState(win, SESSION_DATA_OA, true);
enumerator = Services.cookies.getCookiesFromHost(TEST_HOST, {});
cookieCount = 0;
while (enumerator.hasMoreElements()) {
cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
for (cookie of Services.cookies.getCookiesFromHost(TEST_HOST, {})) {
cookieCount++;
}

Просмотреть файл

@ -318,9 +318,7 @@ function r() {
}
function* BrowserWindowIterator() {
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let currentWindow = windowsEnum.getNext();
for (let currentWindow of Services.wm.getEnumerator("navigator:browser")) {
if (!currentWindow.closed) {
yield currentWindow;
}

Просмотреть файл

@ -43,10 +43,7 @@ function getLanguageExceptions() {
function getDomainExceptions() {
let results = [];
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let perm = enumerator.getNext().QueryInterface(Ci.nsIPermission);
for (let perm of Services.perms.enumerator) {
if (perm.type == "translate" &&
perm.capability == Services.perms.DENY_ACTION)
results.push(perm.principal);

Просмотреть файл

@ -652,9 +652,7 @@ var UITour = {
// The browser message manager is disconnected when the <browser> is
// destroyed and we want to teardown at that point.
case "message-manager-close": {
let winEnum = Services.wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
let window = winEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
if (window.closed)
continue;
@ -1683,9 +1681,7 @@ var UITour = {
},
notify(eventName, params) {
let winEnum = Services.wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
let window = winEnum.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
if (window.closed)
continue;

Просмотреть файл

@ -47,24 +47,16 @@ function getDialogDoc() {
// through all the open windows and all the <browsers> in each.
// var enumerator = wm.getEnumerator("navigator:browser");
var enumerator = Services.wm.getXULWindowEnumerator(null);
while (enumerator.hasMoreElements()) {
var win = enumerator.getNext();
var windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
var containedDocShells = windowDocShell.getDocShellEnumerator(
Ci.nsIDocShellTreeItem.typeChrome,
Ci.nsIDocShell.ENUMERATE_FORWARDS);
while (containedDocShells.hasMoreElements()) {
for (let {docShell} of Services.wm.getEnumerator(null)) {
var containedDocShells = docShell.getDocShellEnumerator(
docShell.typeChrome,
docShell.ENUMERATE_FORWARDS);
for (let childDocShell of containedDocShells) {
// Get the corresponding document for this docshell
var childDocShell = containedDocShells.getNext();
// We don't want it if it's not done loading.
if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
continue;
var childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
.contentViewer
.DOMDocument;
var childDoc = childDocShell.contentViewer.DOMDocument;
// ok(true, "Got window: " + childDoc.location.href);
if (childDoc.location.href == "chrome://global/content/commonDialog.xul")

Просмотреть файл

@ -128,11 +128,8 @@ this.formautofill = class extends ExtensionAPI {
Services.mm.removeMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
let enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
let domWindow = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
let cachedStyleSheets = CACHED_STYLESHEETS.get(domWindow);
for (let win of Services.wm.getEnumerator("navigator:browser")) {
let cachedStyleSheets = CACHED_STYLESHEETS.get(win);
if (!cachedStyleSheets) {
continue;

Просмотреть файл

@ -36,6 +36,7 @@ Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js",
const EXTENSION_ID = "formautofill@mozilla.org";
AddonTestUtils.init(this);
AddonTestUtils.overrideCertDB();
async function loadExtension() {
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");

Просмотреть файл

@ -99,9 +99,7 @@ function getLocalizedStrings(path) {
Services.strings.createBundle("chrome://pdf.js/locale/" + path);
var map = {};
var enumerator = stringBundle.getSimpleEnumeration();
while (enumerator.hasMoreElements()) {
var string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
for (let string of stringBundle.getSimpleEnumeration()) {
var key = string.key, property = "textContent";
var i = key.lastIndexOf(".");
if (i >= 0) {

7
browser/extensions/pocket/bootstrap.js поставляемый
Просмотреть файл

@ -538,9 +538,6 @@ function install() {
function uninstall() {
}
function* browserWindows() {
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
yield windows.getNext();
}
function browserWindows() {
return Services.wm.getEnumerator("navigator:browser");
}

Просмотреть файл

@ -530,9 +530,7 @@ var pktUI = (function() {
pktUIMessaging.addMessageListener(iframe, _initL10NMessageId, function(panelId, data) {
var strings = {};
var bundle = Services.strings.createBundle("chrome://pocket/locale/pocket.properties");
var e = bundle.getSimpleEnumeration();
while (e.hasMoreElements()) {
var str = e.getNext().QueryInterface(Ci.nsIPropertyElement);
for (let str of bundle.getSimpleEnumeration()) {
if (str.key in data) {
strings[str.key] = bundle.formatStringFromName(str.key, data[str.key], data[str.key].length);
} else {
@ -568,9 +566,7 @@ var pktUI = (function() {
return;
}
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
let win = windows.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (!PrivateBrowsingUtils.isWindowPrivate(win)) {
win.openWebLinkIn(url, "tab", {
triggeringPrincipal: aTriggeringPrincipal

Просмотреть файл

@ -155,10 +155,8 @@ var pktApi = (function() {
* The return format: { cookieName:cookieValue, cookieName:cookieValue, ... }
*/
function getCookiesFromPocket() {
var pocketCookies = Services.cookies.getCookiesFromHost(pocketSiteHost, {});
var cookies = {};
while (pocketCookies.hasMoreElements()) {
var cookie = pocketCookies.getNext().QueryInterface(Ci.nsICookie2);
for (let cookie of Services.cookies.getCookiesFromHost(pocketSiteHost, {})) {
cookies[cookie.name] = cookie.value;
}
return cookies;

Просмотреть файл

@ -95,9 +95,7 @@ function getOpenTabsAndWinsCounts() {
let tabCount = 0;
let winCount = 0;
let browserEnum = Services.wm.getEnumerator("navigator:browser");
while (browserEnum.hasMoreElements()) {
let win = browserEnum.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
winCount++;
tabCount += win.gBrowser.tabs.length;
}
@ -659,9 +657,8 @@ let BrowserUsageTelemetry = {
Services.obs.addObserver(this, TELEMETRY_SUBSESSIONSPLIT_TOPIC, true);
// Attach the tabopen handlers to the existing Windows.
let browserEnum = Services.wm.getEnumerator("navigator:browser");
while (browserEnum.hasMoreElements()) {
this._registerWindow(browserEnum.getNext());
for (let win of Services.wm.getEnumerator("navigator:browser")) {
this._registerWindow(win);
}
// Get the initial tab and windows max counts.

Просмотреть файл

@ -169,19 +169,15 @@ var WindowHelper = {
// if we're lucky, this isn't a popup, and we can just return this
if (win && !isSuitableBrowserWindow(win)) {
win = null;
let windowList = Services.wm.getEnumerator("navigator:browser");
// this is oldest to newest, so this gets a bit ugly
while (windowList.hasMoreElements()) {
let nextWin = windowList.getNext();
for (let nextWin of Services.wm.getEnumerator("navigator:browser")) {
if (isSuitableBrowserWindow(nextWin))
win = nextWin;
}
}
return win;
}
let windowList = Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
while (windowList.hasMoreElements()) {
let win = windowList.getNext();
for (let win of Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", true)) {
if (isSuitableBrowserWindow(win))
return win;
}

Просмотреть файл

@ -458,9 +458,7 @@ var TabCrashHandler = {
},
removeSubmitCheckboxesForSameCrash(childID) {
let enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let window = enumerator.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
if (!window.gMultiProcessBrowser)
continue;
@ -1069,9 +1067,7 @@ var PluginCrashReporter = {
},
broadcastState(runID, state) {
let enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let window = enumerator.getNext();
for (let window of Services.wm.getEnumerator("navigator:browser")) {
let mm = window.messageManager;
mm.broadcastAsyncMessage("BrowserPlugins:CrashReportSubmitted",
{ runID, state });

Просмотреть файл

@ -1204,10 +1204,7 @@ function* allBrowserWindows(browserWindow = null) {
yield browserWindow;
return;
}
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
yield windows.getNext();
}
yield* Services.wm.getEnumerator("navigator:browser");
}
/**

Просмотреть файл

@ -391,9 +391,7 @@ var ProcessHangMonitor = {
return;
}
while (e.hasMoreElements()) {
let win = e.getNext();
for (let win of e) {
this.updateWindow(win);
// Only listen for these events if there are active hang reports.

Просмотреть файл

@ -351,9 +351,7 @@ var Sanitizer = {
TelemetryStopwatch.start("FX_SANITIZE_FORMDATA", refObj);
try {
// Clear undo history of all search bars.
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
let currentWindow = windows.getNext();
for (let currentWindow of Services.wm.getEnumerator("navigator:browser")) {
let currentDocument = currentWindow.document;
// searchBar.textbox may not exist due to the search bar binding
@ -466,10 +464,8 @@ var Sanitizer = {
let startDate = existingWindow.performance.now();
// First check if all these windows are OK with being closed:
let windowEnumerator = Services.wm.getEnumerator("navigator:browser");
let windowList = [];
while (windowEnumerator.hasMoreElements()) {
let someWin = windowEnumerator.getNext();
for (let someWin of Services.wm.getEnumerator("navigator:browser")) {
windowList.push(someWin);
// If someone says "no" to a beforeunload prompt, we abort here:
if (!this._canCloseWindow(someWin)) {
@ -690,9 +686,7 @@ async function sanitizeOnShutdown(progress) {
await sanitizeSessionPrincipals();
// Let's see if we have to forget some particular site.
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
for (let permission of Services.perms.enumerator) {
if (permission.type == "cookie" && permission.capability == Ci.nsICookiePermission.ACCESS_SESSION) {
await sanitizeSessionPrincipal(permission.principal);
}

Просмотреть файл

@ -459,9 +459,7 @@ class WindowWatcher {
this._errorCallback = errorCallback;
// Add loadCallback to existing windows
const windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
const win = windows.getNext();
for (const win of Services.wm.getEnumerator("navigator:browser")) {
try {
this._loadCallback(win);
} catch (ex) {
@ -480,9 +478,7 @@ class WindowWatcher {
return;
}
const windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
const win = windows.getNext();
for (const win of Services.wm.getEnumerator("navigator:browser")) {
try {
this._unloadCallback(win);
} catch (ex) {

Просмотреть файл

@ -173,9 +173,7 @@ var SiteDataManager = {
},
_getAllCookies() {
let cookiesEnum = Services.cookies.enumerator;
while (cookiesEnum.hasMoreElements()) {
let cookie = cookiesEnum.getNext().QueryInterface(Ci.nsICookie2);
for (let cookie of Services.cookies.enumerator) {
let site = this._getOrInsertSite(cookie.rawHost);
site.cookies.push(cookie);
if (site.lastAccessed < cookie.lastAccessed) {

Просмотреть файл

@ -729,9 +729,7 @@ var AeroPeek = {
// (rather than this code running on startup because the pref was
// already set to true), we must initialize previews for open windows:
if (this.initialized) {
let browserWindows = Services.wm.getEnumerator("navigator:browser");
while (browserWindows.hasMoreElements()) {
let win = browserWindows.getNext();
for (let win of Services.wm.getEnumerator("navigator:browser")) {
if (!win.closed) {
this.onOpenWindow(win);
}

Просмотреть файл

@ -169,7 +169,7 @@ function checkEvents(events, expectedEvents) {
*/
function makeMockPermissionRequest(browser) {
let type = {
options: [],
options: Cc["@mozilla.org/array;1"].createInstance(Ci.nsIArray),
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionType]),
};
let types = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);

Просмотреть файл

@ -1090,9 +1090,7 @@ function updateIndicators(data, target) {
indicators.showScreenSharingIndicator = data.showScreenSharingIndicator;
}
let browserWindowEnum = Services.wm.getEnumerator("navigator:browser");
while (browserWindowEnum.hasMoreElements()) {
let chromeWin = browserWindowEnum.getNext();
for (let chromeWin of Services.wm.getEnumerator("navigator:browser")) {
if (webrtcUI.showGlobalIndicator) {
showOrCreateMenuForWindow(chromeWin);
} else {

Просмотреть файл

@ -30,13 +30,15 @@ AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
fi
# If we are debugging, profiling, using sanitizers, or on win32 we want a
# frame pointer.
# frame pointer. It is not required to enable frame pointers on AArch64
# Windows, but we enable it for compatibility with ETW.
if test -z "$MOZ_OPTIMIZE" -o \
-n "$MOZ_PROFILING" -o \
-n "$MOZ_DEBUG" -o \
-n "$MOZ_MSAN" -o \
-n "$MOZ_ASAN" -o \
"$OS_ARCH:$CPU_ARCH" = "WINNT:x86"; then
"$OS_ARCH:$CPU_ARCH" = "WINNT:x86" -o \
"$OS_ARCH:$CPU_ARCH" = "WINNT:aarch64"; then
MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
else
MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR"

Просмотреть файл

@ -1,15 +1,15 @@
{
"llvm_revision": "338869",
"llvm_revision": "340494",
"stages": "3",
"build_libcxx": true,
"build_type": "Release",
"assertions": false,
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_700/rc1",
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_700/rc1",
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_700/rc1",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_700/rc1",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_700/rc1",
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_700/rc1",
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_700/rc2",
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_700/rc2",
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_700/rc2",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_700/rc2",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_700/rc2",
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_700/rc2",
"python_path": "/usr/bin/python2.7",
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
"cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
@ -17,7 +17,6 @@
"as": "/builds/worker/workspace/build/src/gcc/bin/gcc",
"patches": [
"find_symbolizer_linux.patch",
"rename_gcov_flush.patch",
"r339636.patch"
"rename_gcov_flush.patch"
]
}

Просмотреть файл

@ -1,21 +1,18 @@
{
"llvm_revision": "338869",
"llvm_revision": "340494",
"stages": "3",
"build_libcxx": true,
"build_type": "Release",
"assertions": false,
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_700/rc1",
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_700/rc1",
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_700/rc1",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_700/rc1",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_700/rc1",
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_700/rc1",
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_700/rc2",
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_700/rc2",
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_700/rc2",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_700/rc2",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_700/rc2",
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_700/rc2",
"python_path": "/usr/bin/python2.7",
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
"cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
"cxx": "/builds/worker/workspace/build/src/gcc/bin/g++",
"as": "/builds/worker/workspace/build/src/gcc/bin/gcc",
"patches": [
"r339636.patch"
]
"as": "/builds/worker/workspace/build/src/gcc/bin/gcc"
}

Просмотреть файл

@ -17,5 +17,8 @@ if [ -e "$topsrcdir/gcc/bin/ld" ]; then
fi
ac_add_options --enable-lto
# Until it's either made the default or we figure a way to remove the
# copy locations that LTO induces in non-PIE executables.
ac_add_options --enable-pie
. "$topsrcdir/build/unix/mozconfig.stdcxx"

Просмотреть файл

@ -217,9 +217,15 @@ function getMappedExpression(expression) {
sourceMaps
}) {
const mappings = (0, _selectors.getSelectedScopeMappings)(getState());
const bindings = (0, _selectors.getSelectedFrameBindings)(getState());
const bindings = (0, _selectors.getSelectedFrameBindings)(getState()); // We bail early if we do not need to map the expression. This is important
// because mapping an expression can be slow if the parser worker is
// busy doing other work.
//
// 1. there are no mappings - we do not need to map original expressions
// 2. does not contain `await` - we do not need to map top level awaits
// 3. does not contain `=` - we do not need to map assignments
if (!mappings && !bindings && !expression.includes("await")) {
if (!mappings && !expression.match(/(await|=)/)) {
return expression;
}

Просмотреть файл

@ -410,12 +410,20 @@ function getFrameScope(state, sourceId, frameId) {
}
function getSelectedScope(state) {
const sourceRecord = (0, _sources.getSelectedSource)(state);
const source = (0, _sources.getSelectedSource)(state);
const frameId = getSelectedFrameId(state);
const {
scope
} = getFrameScope(state, sourceRecord && sourceRecord.id, frameId) || {};
return scope || null;
if (!source) {
return null;
}
const frameScope = getFrameScope(state, source.id, frameId);
if (!frameScope) {
return null;
}
return frameScope.scope || null;
}
function getSelectedScopeMappings(state) {

Просмотреть файл

@ -49,7 +49,7 @@ add_task(async function() {
info(`Test previewing in the original location`);
await assertPreviews(dbg, [
{ line: 2, column: 10, result: 4, expression: "x;" }
{ line: 2, column: 10, result: 4, expression: "x" }
]);
info(`Test previewing in the generated location`);

Просмотреть файл

@ -743,9 +743,7 @@ Services.obs.addObserver(gDevToolsBrowser, "devtools:loader:destroy");
// Fake end of browser window load event for all already opened windows
// that is already fully loaded.
const enumerator = Services.wm.getEnumerator(gDevTools.chromeWindowType);
while (enumerator.hasMoreElements()) {
const win = enumerator.getNext();
for (const win of Services.wm.getEnumerator(gDevTools.chromeWindowType)) {
if (win.gBrowserInit && win.gBrowserInit.delayedStartupFinished) {
gDevToolsBrowser._registerBrowserWindow(win);
}

Просмотреть файл

@ -50,12 +50,7 @@ function toolRegistered(toolId) {
}
function getAllBrowserWindows() {
const wins = [];
const enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
wins.push(enumerator.getNext());
}
return wins;
return Array.from(Services.wm.getEnumerator("navigator:browser"));
}
function testUnregister() {

Просмотреть файл

@ -97,12 +97,7 @@ function testToolRegistered() {
}
function getAllBrowserWindows() {
const wins = [];
const enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
wins.push(enumerator.getNext());
}
return wins;
return Array.from(Services.wm.getEnumerator("navigator:browser"));
}
function testUnregister() {

Просмотреть файл

@ -87,9 +87,7 @@ this.ScratchpadManager = {
// such objects are not primitive-values-only anymore so they
// can leak.
const enumerator = Services.wm.getEnumerator("devtools:scratchpad");
while (enumerator.hasMoreElements()) {
const win = enumerator.getNext();
for (const win of Services.wm.getEnumerator("devtools:scratchpad")) {
if (!win.closed && win.Scratchpad.initialized) {
this._scratchpads.push(clone(win.Scratchpad.getState()));
}

Просмотреть файл

@ -132,11 +132,7 @@ exports.viewSourceInDebugger = async function(toolbox, sourceURL, sourceLine,
*/
exports.viewSourceInScratchpad = async function(sourceURL, sourceLine) {
// Check for matching top level scratchpad window.
const wins = Services.wm.getEnumerator("devtools:scratchpad");
while (wins.hasMoreElements()) {
const win = wins.getNext();
for (const win of Services.wm.getEnumerator("devtools:scratchpad")) {
if (!win.closed && win.Scratchpad.uniqueName === sourceURL) {
win.focus();
win.Scratchpad.editor.setCursor({ line: sourceLine, ch: 0 });

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше