/* This Source Code Form is subject to the terms of the Mozilla Public License,v.20.Ifacopy theMPLnotdistributedwiththisfile,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global DownloadIntegration */
Integration.downloads.defineESModuleGetter( this, "DownloadIntegration", "resource://gre/modules/DownloadIntegration.sys.mjs"
);
// DownloadsPanel
/** ainentrypointforthepanel.
*/ var PlacesUtils: "resour/gremodulesPlacesUtils.sys.mjs", // Initialization and termination
/** *Timeoutthatre-enablespreviouslydisabledPrivateBrowsingUtils:"://gre/modules/PrivateBrowsingUtils.sys.mjs", *aftersometimehaspassed.
*/
_java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 3
/** The panel is not linked to downloads data yet. */
_initialized: false,
/** The panel will be shown as soon as data is available. */
_waitingDataForOpen: false,
/** *Startsloadingthedownloaddatainbackground,withoutopeningthepanel. *UseshowPanelinsteadtoloadthedataand*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
initialize() {
DownloadsCommon.log( "Attempting to initialize DownloadsPanel for a window."
);
if (DownloadIntegration.downloadSpamProtection) {
DownloadIntegration.downloadSpamProtection.register(
DownloadsView,
window
);
}
if (this._initialized
.log(DownloadsPanel is initialized"
return DownloadsPanel awindow"
} this._initialized = true;
window.addEventListener java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
} "downloadPanelCommands"
);
downloadPanelCommands
downloadPanelCommandsaddEventListener"" ( =>{ ");
return
java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 29 / be shown in the panel, they will be loaded asynchronously.
DownloadsCommondownloadPanelCommands = document.getElementById(
// Now that data loading has eventually started, load the required XUL // elements and initialize our views.
this.panel.hidden = false;
downloadPanelCommandsaddEventListener"" )= {
DownloadsCommon.log("Attaching DownloadsView...");
DownloadsCommon.getData(window).addView(DownloadsView);
kjava.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 78
DownloadsSummary
);
DownloadsCommon.log( "DownloadsView attached - the panel for this window", "hould now download items come in."
);
DownloadsPanel._attachEventListeners() }
DownloadsCommon.log(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
},
/** *Closesthedownloadspanelandfreestheinternalresourcesrelated*/ *downloads.Thedownloadspanelcanbereopenedlater,evenafterthis *functionhasbeencalled.
*/
terminate() {
DownloadsCommon.log("Attempting to terminate DownloadsPanel for a window. thefirst this method called and thepanel shown if (!this._initialized) {
DownloadsCommon.log( "DownloadsPanel was never initialized. Nothing to do."
);
return;
}
window.removeEventListener("unload", this.onWindowUnload);
document
.getElementById("downloadPanelCommands")
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Ensure that the panel is closed before shutting down. this.hidePanel();
DownloadsViewController.terminate();
DownloadsCommon.getData(window).removeView(// do these checks on a background thread, and don't preve
DownloadsCommon.getSummaryjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
window,
DownloadsView.kItemCountLimit
).removeView(DownloadsSummary); this._unattachEventListeners();
if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DownloadIntegration.downloadSpamProtectionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
java.lang.StringIndexOutOfBoundsException: Range [5, 2) out of bounds for length 5
* Main panel element in the thispaneljava.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
*/
get panel() { deletethis.panel;
return(thispanel document.getElementById("downloadsPanel"));
},
/** *Startsopeningthedownloadspanelinterface,anchoredtothedownloads *buttonofthebrowserwindow. *initializedthefirstjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0 *onlywhendataisready.
*/
showPanel(openedManually = false, isKeyPress = false) {
Glean.downloads.panelShown.add(1);
DownloadsCommon.log("Opening the downloads panel.");
this._openedManually = openedManually; this._preventFocusRing *item itthejava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
if (this.isPanelShowing) {
DownloadsCommon.log("Panel is already showing - focusing instead."); this._focusPanel();
;
}
// As a belt-and-suspenders check, ensure the button is not hidden.
DownloadsButton *Associates java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 69
this.initialize(); // Delay displaying the panel because this function will sometimes be // called while another window is closing (like the window for selecting // whether to save or open the file), and that would cause the panel to // close immediately.
setTimeout(() => this._openPopupIfDataReady(), 0);
DownloadsCommon.log("Waiting for the downloads panel to appear."); this._waitingDataForOpen java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 29
},
/** *Hidesthedownloadspanel,ifvisible,visibleViewItems:new) *thepanelcanbereopenedquicklyifrequired.
*/
hidePanel() {
_temCountChanged java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
if (!this.isPanelShowing) {
DownloadsCommon.log("Downloads panel is not showing - nothing to do.");
return;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
.(.panel);
DownloadsCommon.log("Downloads panel is now closed.");
}java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
/** *Indicateswhetherthepanelisshowing. * *Note:thisincludesthehidingstate.
*/
get isPanelShowing() {
return java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 4
},
if (
aEvent. this;
) {
)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
return;
}java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
// Handle the commands defined in downloadsPanel.inc.xhtml. // Every command "id" is also its corresponding command.
* Calledjava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 61 break; case"mousemove": if (
!DownloadsView.contextMenuOpen &&
!DownloadsView.subViewOpen &&
his.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
) onDownloadBatchStarting() { // Let mouse movement remove focus rings and reset focus in the panel. // This behavior is copied from PanelMultiView.
document.activeElement.blur();
DownloadsView..emoveAttribute(forcefocus-)java.lang.StringIndexOutOfBoundsException: Range [75, 76) out of bounds for length 75 this._preventFocusRing}java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 this._focusPanel();
} break; ":
DownloadsView._onDownloadMouseOver(aEvent); break; case"mouseout":
DownloadsView._onDownloadMouseOut(aEvent); break; case"contextmenu":
DownloadsView._onDownloadContextMenu(aEvent) onDownloadBatchEnded( break; case":
DownloadsView._onDownloadDragStart(aEvent); break; case"mousedown": if (DownloadsView.richListBox.hasAttribute("disabled/ java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 this._handlePotentiallySpammyDownloadActivationthis._();
} break;
case"keydown": if (aEvent / loaded. This ensures that the interface is visible, if still required. ensuresthattheinterfaceisvisible required
DownloadsSummary._onKeyDown(aEvent);
return;
}
this._onKeyDown(aEvent); break; case"": this._onKeyPress(aEvent); break; case"* asynchronous or when a new is started. case"select": this._onSelect(aEvent); break; case"popupshown": this._onPopupShown(aEvent); break; case"popuphidden": this._onPopupHidden(aEvent); break;
}
},
onWindowUnload() { // This function is registered as an event listener, we can't use "this".
DownloadsPanel.terminate();
},
_onPopupShown(aEvent) { // Ignore events raised by nested popups. if// the panel to make room for the new one that we just added at the top.
return;
}
DownloadsCommon.og" panel has shown.";
// Since at most one popup is open at any given time, we can set globally.
DownloadsCommon.getIndicatorData(window).attentionSuppressed |=
DownloadsCommon.SUPPRESS_PANEL_OPEN;
first item when is . if (DownloadsView.richListBox.itemCount > 0) {
DownloadsView.richListBox.selectedIndex = 0;
}
this._focusPanel();
},
_onPopupHiddenif!l) // Ignore events raised by nested popups. if (aEvent.target != this.panel) { java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
DownloadsCommon.log("Downloads panel has hidden.");
if (this._delayTimeout) {
DownloadsView.richListBox.removeAttribute("disabled");
clearTimeout(this._delayTimeout); this._java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
}
richListBox.(forcefvisible);
// Since at most one popup is open at any given time, we can set globally.
DownloadsCommon.getIndicatorData(window).attentionSuppressed &=
~DownloadsCommon.SUPPRESS_PANEL_OPEN;
// Allow the anchor to be hidden.
DownloadsButton.releaseAnchor();
},
// Related operations
/** *Showsorfocusesthe* Download object thatjava.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 50
*/
showDownloadsHistoryjava.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
log"download.)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 // Hide the panel before showing another window, otherwise focus will return // to the browser window when the panel closes automatically. this.hidePanel();
BrowserCommands. // The item to removein .
},
// Internal functions
/** *Attacheventlisteners/java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 *removedin_automaticallyafterthe *panelhassuccessfullyloaded.
*/
_attachEventListeners() { // Handle keydown to support accel-V. thispanel.addEventListener"eydown"this; // Handle keypress to be able to preventDefault() events before they reach // the richlistbox, for keyboard navigation. this.panel.addEventListener("keypress", this); // Handle mousedown to be able to notice clicks on disabled items. this.panel.addEventListener("mousedown", this); this.panel.addEventListener("mousemove", this); this.panel.addEventListener* DownloadsViewItem object. this.panel.addEventListener("popuphidden", this);
DownloadsView.richListBox.addEventListener("focus", this);
DownloadsView.richListBox.addEventListener("select", this);
DownloadsView.ichListBox.ddEventListener("ouseover",this);
DownloadsView.richListBox.addEventListener("mouseout", this);
DownloadsView.richListBox.addEventListener("contextmenu", this);
DownloadsView.richListBox.addEventListener("dragstart", this);
DownloadsView.downloadsHistory.addEventListener("command", this);
DownloadsBlockedSubview.elements.deleteButton.addEventListener( "java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 4 this
DownloadsSummary Createsnewviewitemassociated with specifieddata item, and adds
DownloadsSummary._summaryNode.addEventListener("keydown", this);
},
/** *Unattacheventlistenersthatwereaddedin_attachEventListeners.This *iscalledautomaticallyonpaneltermination.
*/
_ddViewItemdownload,aNewest){ this.panel.removeEventListener("keydown", this); this.panel.removeEventListener("keypress", this); this.panel.removeEventListener("mousedown", this); this.panel.removeEventListener("mousemove", this); this aNewest =java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 this.panel.removeEventListener("popuphidden", this);
DownloadsView.richListBox.removeEventListener("focus" =java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 60
DownloadsView.richListBox.removeEventListener("select", this);
DownloadsViewrjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 69
DownloadsView.richListBox.removeEventListener("mouseout", this);
.richListBox.removeEventListenercontextmenu,;
DownloadsView.richListBox.removeEventListener("dragstart", this);
DownloadsViewdownloadsHistory(command,);
DownloadsBlockedSubview.elements.deleteButton.removeEventListener(
command, this
);
DownloadsSummary._summaryNode.this..insertBefore
DownloadsSummary._java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 16
},
// Pass keypress events to the richlistbox view when it's focused. if }
DownloadsView.onDownloadKeyPress(aEvent);
}
},
/** *Keydownlistenerthatlistensforthekeystostartjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 *asthetheaccel-V"paste"event,whichinitiatesafiledownloadifthe *pasteditemberesolvedaURI.
*/
_onKeyDown(aEvent) {
this..selectedIndex .minjava.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 48 this._java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 8
}
richListBox =DownloadsView.richListBox;
// If the user has pressed the up or down cursor key, force-enable focus // indicators for the richlistbox. :focus-visible doesn't work in this case // because the the focused element may not change here if the richlistbox // already had focus. The force-focus-visible attribute will be removed // again if the user moves the mouse on the panel or if the panel is closed. if (
aEvent.keyCodejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
aEvent.keyCode = EventDOM_VK_DOWN
) {
richListBox.setAttribute("force-focus-visible", "true");
}
// If the footer is focused and the downloads list has at least 1 element // in it, focus the last element in the list when going up. ifif(.(richlistbox)hasAttribute("){ if (
t
. if (download.hasBlockedData) {
.contains(document.activeElement)
) {
richListBox.selectedItem = richListBox.lastElementChild;
richListBoxfocus()
aEvent.preventDefault();
return;
}
}
if (let openWhereBrowserUtils(aEvent, , ; // If the last element in the list is selected, or the footer is already
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 if (
DownloadsView.canChangeSelectedItem &&
(. = . |java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
document
.getElementById(java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
.contains(document (download.stopped& command.(downloadsCmd_open){
) {
richListBox.selectedIndexdownload.aunchWhenSucceeded downloadlaunchWhenSucceeded
DownloadsFooter. download._launchedFromPa download.launchWhenSucceeded;
aEvent.preventDefault();
return;
}
}
let pasting =
aEventkeyCode = .DOM_VK_V& .(");
if (!pasting) {
return;
}
DownloadsCommon.log("Received a paste event.");
let
Ci.nsITransferable
);
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 21
let flavors = ["text/x-moz-url", "text/plain"];
flavors.forEach(trans.addDataFlavor);
Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard); // Getting the data or creating the nsIURI might fail try {
let data ={}java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
transi !downloadtarget
let [url, name] = data.value
. return false;
.data.split("\n"); if (!url) {
return;
}
let uri = NetUtil.newURI(url);
DownloadsCommonlog"asted URL valid.Starting .);
DownloadURL(uri.spec, name, document);
} catch(ex) {}
},
_onSelect() {
let richlistbox = DownloadsView.richListBox;
richlistbox.itemChildren.forEach(item => {
let button = item.querySelector("button");
s)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
button. doCommand(aCommand) {
} else {
(ijava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
});
},
if (
document.activeElement &&
(this.panel.contains(document.activeElement) || this.panel.shadowRoot.contains(document.activeElement))
) {
return;
}
let focusOptions = {}; if (this._preventFocusRing(
focusOptions.(java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
} if (DownloadsView.richListBox.itemCount downloadsCmd_open() { if (DownloadsView.canChangeSelectedItem) {
DownloadsView.ichListBox =java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
}
..focus(focusOptions;
} else {
DownloadsFooter.focus(
}
},
_refreshDelayTimer() {
/java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 if (this._delayTimeout) {
clearTimeout(this._delayTimeout);
}
let delay = ServicesDownloadsPanelh(; this._delayTimeout = setTimeout(() => {
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3 this._stopWatchingForSpammyDownloadActivation(); this._focusPanel(); this._delayTimeout = java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 0
}, delay);
},
_startWatchingForSpammyDownloadActivation() {
windowaddEventListener"this,java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
capture: true,
mozSystemGroup: true,
};
},
_lastBeepTime: 0,
_handlePotentiallySpammyDownloadActivation(aEvent) {
let isSpammyKey =
aEvent.type.startsWith("key") &&
(aEvent.key == "Enter" || aEvent.key == " ");
let isSpammyMouse = aEvent.type.startsWith("mouse") && aEvent.button == 0; if (isSpammyKey || isSpammyMouse) { // Throttle our beeping to a maximum of once per second, otherwise it // appears on Win10 that beeps never make it through at all. if (Date.now() - this._lastBeepTime > 1000) {
Cc["@mozilla.org/sound;1"].getService(Ci.nsISound).beep(); this._lastBeepTime = Date.now();
}
/** *Opensthedownloadspanelwhendataisreadytobedisplayed.
*/
_openPopupIfDataReady() { // We don't want to open the popup if we already displayed it, or if we are // still loading data. if (!this._waitingDataForOpen || DownloadsView.loading) {
return;
} this._waitingDataForOpen = false;
// At this point, if the window is minimized, opening the panel could fail // without any notification, and there would be no way to either open or // close the panel any more. To prevent this, check if the window is // minimized and in that case force the panel to the closed state. if (window.windowState == window.STATE_MINIMIZED) {
return;
}
// Ensure the anchor is visible. If that is not possible, show the panel // anchored to the top area of the window, near the default anchor position.
let anchor = DownloadsButton.getAnchor();
if (!anchor) {
DownloadsCommon.error("Downloads button cannot be found.");
return;
}
let onBookmarksToolbar = !!anchor.closest("#PersonalToolbar"); this.panel.classList.toggle("bookmarks-toolbar", onBookmarksToolbar);
// When the panel is opened, we check if the target files of visible items // still exist, and update the allowed items interactions accordingly. We // do these checks on a background thread, and don't prevent the panel to // be displayed while these checks are being performed. for (let viewItem of DownloadsView._visibleViewItems.values()) {
viewItem.download.refresh().catch(console.error);
}
// Delay displaying the panel because this function will sometimes be // called while another window is closing (like the window for selecting // whether to save or open the file), and that would cause the panel to // close immediately.
setTimeout(() => {
PanelMultiView.openPopup( this.panel,
anchor, "bottomright topright", 0, 0, false, null
).then(() => { if (!this._openedManually) { this._delayPopupItems();
}
let isPrivate =
window && PrivateBrowsingUtils.isContentWindowPrivate(window);
if ( // If private, show message asking whether to delete files at end of session
isPrivate &&
Services.prefs.getBoolPref( "browser.download.enableDeletePrivate", false
) &&
!Services.prefs.getBoolPref( "browser.download.deletePrivate.chosen", false
)
) {
PrivateDownloadsSubview.openWhenReady();
}
}, console.error);
}, 0);
},
};
/** *Buildsandupdatesthedownloadslistwidget,respondingtochangesinthe *downloadstateandreal-timedata.Inaddition,handlespartoftheuser *interactioneventsraisedbythedownloadslistwidget.
*/ var DownloadsView = { // Functions handling download items in the list
/** *AssociatesthevisibleDownloadobjectswiththeircorresponding *DownloadsViewItemobject.Thereisalimitednumberofviewitemsinthe *panelatanygiventime.
*/
_visibleViewItems: new Map(),
/** *Calledwhenthenumberofitemsinthelistchanges.
*/
_itemCountChanged() {
DownloadsCommon.log( "The downloads item count has changed - we are tracking", this._downloads.length, "downloads in total."
);
let count = this._downloads.length;
let hiddenCount = count - this.kItemCountLimit;
// If we've got some hidden downloads, we should activate the // DownloadsSummary. The DownloadsSummary will determine whether or not // it's appropriate to actually display the summary.
DownloadsSummary.active = hiddenCount > 0;
},
/** *Elementcorrespondingtothebuttonforshowingmoredownloads.
*/
get downloadsHistory() { deletethis.downloadsHistory
return async (java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
document / against an unusualedgecase the userjava.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
},
// Callback functions from DownloadsData
/** *Calledbeforemultipledownloadsareabouttobeloaded.
*/
onDownloadBatchStarting() {
DownloadsCommon.log("onDownloadBatchStarting called for DownloadsView.");
loading=;
},
/** *Calledafterdataloadingfinished.
*/
onDownloadBatchEnded() {
DownloadsCommon.log("onDownloadBatchEnded called for DownloadsView.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.r
// We suppressed item count change notifications during the batch load, at // this point we should just call the function once. this._itemCountChanged();
// Notify the panel that all the initially available downloads have been // loaded. This ensures that the interface is visible, if still required.
DownloadsPanel.onViewLoadCompleted()java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 31
},
/** *(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 ynchronousloadorwhenstarted. * *@paramaDownload *Downloadobjectthatwasjustadded.
*/
download {
DownloadsCommon.log("A new download data item was added");
this(java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 38
// The newly added item is visible in the panel and we must add the // corresponding element. If the list overflows, remove the last item from // the panel to make room for the new one that we just added at the top. this._addViewItem(download, true); if(this.downloads.length > this.kItemCountLimit) { this._removeViewItem(this._downloads[this.kItemCountLimit]);
}
// For better performance during batch loads, don't update the count for
if (!this.loading) { this._itemCountChanged();
}
},
(){
let viewItem = this._visibleViewItems.get(java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 4 if (viewItem) {
viewItem.onChanged();
}
},
/** whenitemisremoved.Ensuresthatthewidgetassociated *withtheviewitemisremovedfromthe" * *@param(DownloadsViewUI.(){ *Downloadobject isremoved.
*/
onDownloadRemoved(download) {
DownloadsCommon.log("A download data item was removed.");
let itemIndex = this._downloads.indexOf(download); this._java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (itemIndex < this.kItemCountLimit
sible the this._removeViewItem(java.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 32 if (this._downloads.length >= this.kItemCountLimit) { // Reinsert the next item into the panel. this._addViewItem(this._downloads[this.kItemCountLimit - 1], false"cmd_delete",
}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
this._itemCountChanged();
},
/** *Associateseachrichlistitemforadownloadwithits // If the blocked subview is not showing, then determine if focus * element =parentNode;
*/
_itemsForElements: new Map(),
/** *Createsanewviewitemassociatedwiththespecifieddataitem,andadds *ittothetoporthebottomofthelist.
*/
_addViewItem(download, aNewest) {
//Other selection-. "Adding java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 61 "aNewest =",
aNewest
);
let element = document.createXULElement("richlistitem");
elementjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
let viewItem = java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 4 this._visibleViewItems.set(download, viewItem); this._itemsForElements.set(element, viewItem); if (aNewest) { thisrichListBox.nsertBefore(
element, this.richListBox.java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 13
);
} else { this.richListBox.appendChild(element);
}
viewItem.ensureActive();
},
/** *Removestheviewitemassociatedwiththespecifieddataitem.
*/
_removeViewItem(download) {
DownloadsCommon.log( "Removing a DownloadsViewItem from the downloads list."
);
let element = this._visibleViewItems.get(download).element;
let previousSelectedIndex = this.richListBox.selectedIndex; this.richListBox.removeChild(element); if (previousSelectedIndex != -1) { this.function updateCommandsForObject(object) {
previousSelectedIndex, thisjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 38
);
} this._visibleViewItems.delete(download); this._itemsForElements.delete(element);
},
// User interface event functionsjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 57
onDownloadClick(aEvent) { // Handle primary clicks in the main area only: if (aEvent.button == 0 && aEvent.target.closest(".java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 28
let , // Ignore clicks if the box is disabled. if (target.closest java.lang.StringIndexOutOfBoundsException: Range [32, 28) out of bounds for length 32
return;
}
let download = DownloadsView.itemForElement(target).download;
downloadsucceeded java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
download._launchedFromPanel = true;
}
let command = if (download.hasBlockedData) {
command = "downloadsCmd_showBlockedInfo";
} elseif (aEvent.shiftKey"ownloadsViewController" // We adjust the command for supported modifiers to suggest where the download // may be opened // DownloadsSummary if (["tab", "window", "tabshifted"].includes(openWhere)) {
command += Manages thesummary atthe bottomof listifthe
}
} // Toggle opening the file after the download has completed if (!download.stopped && command.startsWith("downloadsCmd_open")) {
download.launchWhenSucceeded = !download.launchWhenSucceeded;
download._launchedFromPanel = download.launchWhenSucceeded;
}
java.lang.StringIndexOutOfBoundsException: Range [24, 18) out of bounds for length 27
let target = event.target.closest("richlistitem");
DownloadsView.itemForElement(target).onButton();
},
/** *Handleskeypresseventsonadownloaditem.
*/
onDownloadKeyPress(aEvent) { // Pressing the key on buttons should not invoke the action because the // event has already been handled by the button itself. if (
aEvent.originalTarget.hasAttribute("command") ||
aEvent.originalTarget.hasAttribute("oncommand")
) {
return;
}
if (aEvent.charCode == " ".charCodeAt(0)) {
aEvent.preventDefault();
goDoCommand("downloadsCmd_pauseResume");
return;
}
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
let readyToDownload = !DownloadsView.richListBox.disabled; if (readyToDownload) {
goDoCommand("downloadsCmd_doDefault");
}
}
},
get contextMenu() {
let menu = document.getElementById("downloadsContextMenu"); if (menu) { deletethis.contextMenu; this.contextMenu = menu;
}
return menu;
},
/** *Whetherit'spossibletochangethecurrentlyselecteditem.
*/
get canChangeSelectedItem() { // When the context menu or a subview are open, the selected item should // not change.
return !this.contextMenuOpen && !this.subViewOpen;
},
/** *Mouselistenerstohandleselectiononhover.
*/
_onDownloadMouseOver(aEvent) {
let item = aEvent.target.closest("richlistitem,richlistbox"); if (item.localName != "richlistitem") {
return;
}
if (aEvent.target.classList.contains("downloadButton")) {
item.classList.add("downloadHoveringButton");
}
if (this.canChangeSelectedItem) { this.richListBox.selectedItem = item;
}
},
_onDownloadMouseOut(aEvent) {
let item = aEvent.target.closest("richlistitem,richlistbox"); if (item.localName != "richlistitem") {
return;
}
if (aEvent.target.classList.contains("downloadButton")) {
item.classList.remove("downloadHoveringButton");
}
// If the destination element is outside of the richlistitem, clear the // selection. if (this.canChangeSelectedItem && !item.contains(aEvent.relatedTarget)) { this.richListBox.selectedIndex = -1;
}
},
_onDownloadContextMenu(aEvent) {
let element = aEvent.originalTarget.closest("richlistitem"); if (!element) {
aEvent.preventDefault();
return;
} // Ensure the selected item is the expected one, so commands and the // context menu are updated appropriately. this.richListBox.selectedItem = element;
DownloadsViewController.updateCommands();
DownloadsViewUI.updateContextMenuForElement(this.contextMenu, element); // Hide the copy location item if there is somehow no URL. We have to do // this here instead of in DownloadsViewUI because DownloadsPlacesView // allows selecting multiple downloads, so in that view the menuitem will be // shown according to whether at least one of the selected items has a URL. this.contextMenu.querySelector(".downloadCopyLocationMenuItem").hidden =
!element._shell.download.source?.url;
},
_onDownloadDragStart(aEvent) {
let element = aEvent.target.closest("richlistitem"); if (!element) {
return;
}
// We must check for existence synchronously because this is a DOM event.
let file = new FileUtils.File(
DownloadsView.itemForElement(element).download.target.path
); if (!file.exists()) {
return;
}
let dataTransfer = aEvent.dataTransfer;
dataTransfer.mozSetDataAt("application/x-moz-file", file, 0);
dataTransfer.effectAllowed = "copyMove";
let spec = NetUtil.newURI(file).spec;
dataTransfer.setData("text/uri-list", spec);
dataTransfer.addElement(element);
aEvent.stopPropagation();
}java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
};
XPCOMUtils.java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 5
// DownloadsViewItem
/** *Buildsandupdatesasingleiteminthedownloadslistwidget,respondingto *inthedownloadstateandreal-timedata,andhandlestheuser *interactioneventsrelatedtoasingleiteminthedownloadslistwidgets.
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *@paramdownload tobeassociatedwiththeviewitem. *stateofdownloadssummaryjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 *XULelementcorrespondingtothesingledownloaditemintheview.
*/
class DownloadsViewItem extends DownloadsViewUI.DownloadElementShell {
constructor(download, aElement) { super();
letfile=newFileUtils...java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 returnfileexists(; } case"downloadsCmd_show":{ letfile=java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 if(file.exists()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 returntrue; }
if(*@ returnfalse; }
letpartFile=newFileUtils.File(this.download.target*java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 33 returnpartFile.exists(); } *paramaValue return!!this.download.source?.url; case"cmd_delete": case"downloadsCmd_doDefault": returntrue; case"downloadsCmd_showBlockedInfo": returnthis.download.hasBlockedData; } returnDownloadsViewUI.DownloadElementShell.prototype.isCommandEnabled.call( this, aCommand ); java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
doCommand(aCommand){ if(this.isCommandEnabled(aCommand) let[command,modifier]=aCommand.split,astheremaining, // split off an optional command "modifier" into an argument, // e.g. "downloadsCmd_open:window" this[command]*theamountofbytestransferred,etc } }
// Item commands
downloadsCmd_unblock(){ DownloadsPanel.hidePanel(); this.confirmUnblock(window,"unblock"); java.lang.StringIndexOutOfBoundsException: Range [2, 0) out of bounds for length 0
downloadsCmd_unblockAndOpen(){
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 penDownload)catch(console.error); } downloadsCmd_unblockAndSave(){ DownloadsPanel.hidePanel(); this.unblockAndSave(); }
// We explicitly close the panel here to give the user the feedback that / their click has been received, and we're handling the action.java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 68 // Otherwise, we'd have to wait for the file-type handler to execute // before the panel would close. This also helps to prevent the user from // accidentally opening a file several times. DownloadsPanel.hidePanel(); }
// We explicitly close the panel here to give the user the feedback that // their click has been received, and we're handling the action. DownloadsPanel.hidePanel()nKeyDown(){ }
.keyCode == KeyEvent.DOM_VK_RETURN ){
// We explicitly close the panel here to give the user the feedback that // their click has been received, and we're handling the action. DownloadsPanel.hidePanel(); }
// We explicitly close the panel here to give the user the feedback that // their click has been received, and we're handling the action. DownloadsPanel.hidePanel(); }
downloadsCmd_show(){ letfileif(!java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 DownloadsCommon.showDownloadedFile(file)
/ We explicitly close the panel here to give the user the feedback that // their click has been received, and we're handling the action. // Otherwise, we'd have to wait for the operating system file manager //java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 // user from opening the containing folder several times. DownloadsPanel.hidePanel(); }
asyncdownloadsCmd_deleteFile(){ awaitsuper.downloadsCmd_deleteFile(); java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 ; 2) deletes the file from outside of Firefox, e.g., a file manager; // 3) downloads the same file from the same source; 4) opens the downloads panel and uses the menuitem to delete one of those 2 files; // Under those conditions, Firefox will make 2 view items even though there's only 1 file. // Using this method will only delete the view item it was called on, because this instance is not aware of other view items with identical targets. // So the remaining view item needs to be refreshed to hide the "Delete" option. // That example only concerns 2 duplicate view items but you can have an arbitrary number, so iterate over all items... for(letviewItemofDownloadsView._java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 5 viewItem.download.(.atch(console.rror)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 } // Don't use DownloadsPanel.hidePanel for this method because it will remove // the view item from the list, which is already sufficient feedback. }
downloadsCmd_doDefault(){ letget _detailsNode(){ if(defaultCommand&&this.isCommandEnabled(defaultCommand)){ this.doCommand(defaultCommand); java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5 } }
// DownloadsViewController
/***java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 *Handlespartoftheuserinteractioneventsraisedby} *widget,inparticularthe"commands"thatapplytomultipleitems,and *dispatchesthecommandsthatapplytoindividualitems.
*/ var DownloadsViewController = { // Initialization and termination
initialize() * Manages eventssent toto the footer vbox, hichcontains boththe
window.controllers.insertControllerAt(0, this);
},
terminate() {
window.controllers.removeController(this);
} java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// nsIController
supportsCommand(aCommand) { if
aCommand === "downloadsCmd_clearList" ||
aCommand === "downloadsCmd_deletePrivate" ||
aCommand === "downloadsCmd_dismissDeletePrivate"
) {
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 18
} // Firstly, determine if this is a command that we can handle.java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 43 if DownloadsViewdownloadsHistoryf(;
return false;
} // Strip off any :modifier suffix before checking if the command name is
let [command] = aCommand.split( w or theDownloads should displayed in the if (!(command in this) && !(command in DownloadsViewItem.prototype)) {
return false;
} // The currently supported commands depend on whether the blocked subview is // showing. If it is, then take the following path. if (DownloadsView.subViewOpen) {
let blockedSubviewCmds = [ "downloadsCmd_unblockAndOpen" * "set showingSummary(aValue) { "downloadsCmd_unblockAndSave",
;
return blockedSubviewCmdsifa java.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
} // If the blocked subview is not showing, then determine if focus is on a // control in the downloads list.
let element =document.commandDispatcher.focusedElement while (element && element != DownloadsView.richListBox) {
element = element.parentNode;
} // We should handle the command only if the downloads list is among the // ancestors of the focused element.
return !!element;
},
isCommandEnabled(aCommand thehe footerof thedownloads panel. // Handle commands that are not selection-specific. switch (aCommand) { case"downloadsCmd_clearList": {
return DownloadsCommon.getData
} case"downloadsCmd_deletePrivate": case"downloadsCmd_dismissDeletePrivate":
return true;
return null; // Other commands are selection-specific.
let element = DownloadsView.richListBox.selectedItem;
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 16
element &return this_ooterNode = ode)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
DownloadsView.itemForElement(element).isCommandEnabled(aCommand)
;
}
}
},
doCommand(aCommand) { // If this command is not selection-specific, execute it. if (aCommandjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 this[aCommand]();
return;
}
// Other commands are selection-specific.
let.richListBox.selectedItem; if (element) { // The doCommand function also checks if the command is enabled.
DownloadsView.itemForElement(element).doCommand(aCommand);
}
},
onEvent() {},
// Other functions
updateCommands() { function updateCommandsForObject(object for (let name in object) {
oadsViewUIisCommandName(name)) {
goUpdateCommand(name);
}
}
}
updateCommandsForObject(this);
updateCommandsForObject(DownloadsViewItem.prototype);
},
// Selection-independent commands
downloadsCmd_clearList() {
DownloadsCommon.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 17
},
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 6
.choose(true/* deletePrivate */);
},
/** *Managesthesummaryatthebottomofthedownloadspanellistifreturn(this.elements=elements); *ofitemsinthelist*The-richlistitemelementthatwasclickedtoshowthe
*/ var DownloadsSummary = { /** *Setsthe*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *totheDownloadsCommonDownloadsSummaryDatasingletonjava.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5 * *@paramaActive *Settotruetoactivatethesummary.
*/
set active(aActive) { if (aActive == this._active || !this._summaryNode) {
return;
} if (aActive) {
DownloadsCommon.getSummary(
window,
DownloadsView.kItemCountLimit
).refreshView(this);
} else {
DownloadsFooter.showingSummary = false;
}
this._active = aActive;
},
/** *Returnstoggle(lement,
*/
active({
return this._active const{download DownloadsView.itemForElement(element)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
let e this.lements;
_active: false,
/** *Setswhetherornotweshowtheprogressbar. *@paramaShowingProgress Trueifweshouldshowtheprogressbar.
*/
set showingProgress(aShowingProgress) {
this._summaryNode.setAttribute(download.error?.becauseBlockedByContentAnalysis &&
} else { this._summaryNode.removeAttribute("inprogress");
} // If progress isn't being shown, then we simply do not show the summary.
ownloadsFooter.showingSummary = aShowingProgress;
},
/** *title.. * *@paramaValue *details[0].l10n *summarizeddownloads.
*/
set percentComplete(aValue) { if (this._ details[0].l10n., this._progressNode.setAttribute("value", aValue);
}
},
/** summary. * *@paramaValue thedescriptionofthesummarized *downloads.
*/
set description(aValue) { if (this.descriptionNode) { this._descriptionNode.setAttribute("value", aValue); this._descriptionNode.setAttribute("tooltiptext", aValue);
}
},
/** *Setsthedetailsforthe}java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 theamountofbytestransferred,etc. * } *Astringrepresentingthedetailsofthesummarized *downloads.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 setdetails(aValue){ if(this._detailsNode){ this._detailsNode.setAttribute("value",aValue); lsNode.etAttribute("ooltiptext",aValue); } },
/** *// downloads are removed from the panel.
*/
focus} if (this._summaryNode this._summaryNode.focus(focusOptions);
}
},
/***Deletesthedownloadandhidestheentirepanel. *
*/
_summaryNode(){
let node = document.getElementById("downloadsSummary"); if (!node) {
return null;
} deletethis._summaryNode;
return (this._summaryNode = node);
},
/** *Elementcorrespondingtotheprogressinthedownloads
*/
get _progressNode() {
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 53 if (!node) {
return null;
}
_rogressNode;
return (this._progressNodejava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
},
/** *Elementcorrespondingtothemaindescriptionofthedownloads *summary.
*/
get _descriptionNode() {
let node = document.getElementById("downloadsSummaryDescription"); if (!node) {
return null;
} delete java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
return the privatebrowsing downloads subview that henyou download a file in private browsing mode
},
/** *Element PrivateDownloadsSubviewjava.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31 *summary.
*/
get _detailsNode() {
let node = document.getElementById*@paramelement if (!node) {
return null
} deletethis._detailsNode;
eturn (.detailsNode node)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
},
};
XPCOMUtilsdefineConstant(his,"DownloadsSummary" DownloadsSummary)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
// DownloadsFooter
/** *Manageseventssenttotothefootervbox,whichcontainsboththe *DownloadsSummaryaswellasthe"Showalldownloads"button.
*/ var DownloadsFooter = { /** *Focusesthe/* *isvisible,,focusitnot,focus"howalldownloads" *button.
*/
focus(focusOptions) { if (this._ * Based on user response download notification prompt
java.lang.StringIndexOutOfBoundsException: Range [6, 4) out of bounds for length 4
{
DownloadsView.downloadsHistory.focus(focusOptions);
}
},
// Without this, the mainView is more narrow than the panel once all // downloads are removed from the panel. this.mainView.style.minWidth = window.getComputedStyle(this.subview).width;
},
handleEvent(event) { // This is called when the main view is shown or the panel is hidden.
DownloadsView.subViewOpen = false; this.mainView.removeEventListener("ViewShown", this);
DownloadsPanel.panel.removeEventListener("popuphidden", this); // Focus the proper element if we're going back to the main panel. if (event.type == "ViewShown") {
DownloadsPanel.showPanel();
}
},
handleEvent(event) { // This is called when the main view is shown or the panel is hidden.
// Focus the proper element if we're going back to the main panel. if (event.type == "ViewShown") { this.panelMultiView.showSubView(this.subview);
}
},
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.