PK
]x6b~*\ *\ # content/xbl-marquee/xbl-marquee.xml
6
this.setAttribute("scrollamount", val);
85
this.setAttribute("scrolldelay", val);
return this.getAttribute("direction");
this.setAttribute("direction", val);
"left"
return this._behavior;
this.setAttribute("behavior", val);
"scroll"
this.setAttribute("loop", val);
-1
return this.getAttribute("onstart");
this._setEventListener("start", val, true);
this.setAttribute("onstart", val);
return this.getAttribute("onfinish");
this._setEventListener("finish", val, true);
this.setAttribute("onfinish", val);
return this.getAttribute("onbounce");
this._setEventListener("bounce", val, true);
this.setAttribute("onbounce", val);
100000true"0.9.7"
this.outerDiv.offsetHeight)
corrvalue = this.originalHeight - this.outerDiv.offsetHeight;
this.innerDiv.style.padding = height + " 0";
this.dirsign = 1;
this.startAt = (this._behavior == 'alternate') ? (this.originalHeight - corrvalue) : 0;
this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ?
(parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height));
break;
case "down":
var height = document.defaultView.getComputedStyle(this, "").height;
this.outerDiv.style.height = height;
if (this.originalHeight > this.outerDiv.offsetHeight)
corrvalue = this.originalHeight - this.outerDiv.offsetHeight;
this.innerDiv.style.padding = height + " 0";
this.dirsign = -1;
this.startAt = (this._behavior == 'alternate') ?
(parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height));
this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ?
(this.originalHeight - corrvalue) : 0;
break;
case "right":
if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth)
corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth;
this.dirsign = -1;
this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ?
(this.innerDiv.offsetWidth - corrvalue) : 0;
this.startAt = this.outerDiv.offsetWidth + ((this._behavior == 'alternate') ?
corrvalue : (this.innerDiv.offsetWidth + this.stopAt));
break;
case "left":
default:
if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth)
corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth;
this.dirsign = 1;
this.startAt = (this._behavior == 'alternate') ? (this.innerDiv.offsetWidth - corrvalue) : 0;
this.stopAt = this.outerDiv.offsetWidth +
((this._behavior == 'alternate' || this._behavior == 'slide') ?
corrvalue : (this.innerDiv.offsetWidth + this.startAt));
}
// RTL Support. If text direction is right-to-left and marquee
// axis is horizontal, then negate and swap stopAt and startAt.
var dir = document.defaultView.getComputedStyle(this, "").direction;
if (dir == "rtl") {
if (this._direction == "right" || this._direction == "left") {
var tmp = this.startAt;
this.startAt = -this.stopAt;
this.stopAt = -tmp;
}
}
if (aResetPosition) {
this.newPosition = this.startAt;
this._fireEvent("start", false, false);
}
} //end if
this.newPosition = this.newPosition + (this.dirsign * this._scrollAmount);
if ((this.dirsign == 1 && this.newPosition > this.stopAt) ||
(this.dirsign == -1 && this.newPosition < this.stopAt))
{
switch (this._behavior)
{
case 'alternate':
// lets start afresh
this.startNewDirection = true;
// swap direction
const swap = {left: "right", down: "up", up: "down", right: "left"};
this._direction = swap[this._direction];
this.newPosition = this.stopAt;
if ((this._direction == "up") || (this._direction == "down"))
this.outerDiv.scrollTop = this.newPosition;
else
this.outerDiv.scrollLeft = this.newPosition;
if (this._loop != 1)
this._fireEvent("bounce", false, true);
break;
case 'slide':
if (this._loop > 1)
this.newPosition = this.startAt;
break;
default:
this.newPosition = this.startAt;
if ((this._direction == "up") || (this._direction == "down"))
this.outerDiv.scrollTop = this.newPosition;
else
this.outerDiv.scrollLeft = this.newPosition;
//dispatch start event, even when this._loop == 1, comp. with IE6
this._fireEvent("start", false, false);
}
if (this._loop > 1)
this._loop--;
else if (this._loop == 1) {
if ((this._direction == "up") || (this._direction == "down"))
this.outerDiv.scrollTop = this.stopAt;
else
this.outerDiv.scrollLeft = this.stopAt;
this.stop();
this._fireEvent("finish", false, true);
return;
}
}
else {
if ((this._direction == "up") || (this._direction == "down"))
this.outerDiv.scrollTop = this.newPosition;
else
this.outerDiv.scrollLeft = this.newPosition;
}
var myThis = this;
var lambda = function myTimeOutFunction(){myThis._doMove(false);}
this.runId = window.setTimeout(lambda, this._scrollDelay);
]]>
PK
TQ6 # content/xbl-marquee/xbl-marquee.css/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* PRINT ONLY rules */
@media print {
marquee > * > * {
margin: 0 !important;
padding: 0 !important;
} /* This hack is needed until bug 119078 gets fixed */
}
PK
[0eOM 1 content/communicator/downloadmanager/contents.rdf
chrome://communicator/content/tasksOverlay.xulchrome://communicator/content/utilityOverlay.xul
PK
}'7C0 0 8 content/communicator/downloadmanager/downloadmanager.xul
%downloadManagerDTD;
%downloadProgressDTD;
]>
&confirmCancel;
&progressMsgNoRate;
&rateMsg;
&completeMsg;
&percentMsg;
&shortTimeFormat;
&longTimeFormat;
&unknownTime;
&pausedMsg;
PK
f4]'> > 7 content/communicator/downloadmanager/downloadmanager.js/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Goodger (Original Author)
* Blake Ross
* Jan Varga
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const NC_NS = "http://home.netscape.com/NC-rdf#";
var gDownloadView = null;
var gDownloadManager = null;
var gRDFService = null;
var gNC_File = null;
var gFileHandler = null;
var gStatusBar = null;
var gCannotLaunch = ((navigator.platform.indexOf("Win") == -1) &&
(navigator.platform.indexOf("OS/2") == -1) &&
(navigator.platform.indexOf("Mac") == -1) &&
(navigator.platform.indexOf("BeOS") == -1));
const dlObserver = {
observe: function(subject, topic, state) {
if (topic != "download-starting") return;
selectDownload(subject.QueryInterface(Components.interfaces.nsIDownload));
}
};
function selectDownload(aDownload)
{
var dlElt = document.getElementById(aDownload.targetFile.path);
var dlIndex = gDownloadView.contentView.getIndexOfItem(dlElt);
gDownloadView.view.selection.select(dlIndex);
gDownloadView.treeBoxObject.ensureRowIsVisible(dlIndex);
}
function DLManagerStartup()
{
if (!window.arguments.length)
return;
try {
var observerService = Components.classes[kObserverServiceProgID]
.getService(Components.interfaces.nsIObserverService);
observerService.addObserver(dlObserver, "download-starting", false);
}
catch (ex) {
}
const rdfSvcContractID = "@mozilla.org/rdf/rdf-service;1";
const rdfSvcIID = Components.interfaces.nsIRDFService;
gRDFService = Components.classes[rdfSvcContractID].getService(rdfSvcIID);
gNC_File = gRDFService.GetResource(NC_NS + "File");
gDownloadView = document.getElementById("downloadView");
setSortVariables(gDownloadView);
const dlmgrContractID = "@mozilla.org/download-manager;1";
const dlmgrIID = Components.interfaces.nsIDownloadManager;
gDownloadManager = Components.classes[dlmgrContractID].getService(dlmgrIID);
const ioSvcContractID = "@mozilla.org/network/io-service;1";
const ioSvcIID = Components.interfaces.nsIIOService;
var ioService = Components.classes[ioSvcContractID].getService(ioSvcIID);
const fileHandlerIID = Components.interfaces.nsIFileProtocolHandler;
gFileHandler = ioService.getProtocolHandler("file")
.QueryInterface(fileHandlerIID);
var ds = window.arguments[0];
gDownloadView.database.AddDataSource(ds);
gDownloadView.builder.rebuild();
window.setTimeout(onRebuild, 0);
// correct keybinding command attributes which don't do our business yet
var key = document.getElementById("key_delete");
if (key.getAttribute("command"))
key.setAttribute("command", "cmd_remove");
key = document.getElementById("key_delete2");
if (key.getAttribute("command"))
key.setAttribute("command", "cmd_remove");
document.getElementById("btn_openfile").hidden = gCannotLaunch;
document.getElementById("downloadPaneContext-openfile").hidden = gCannotLaunch;
}
function onRebuild() {
gDownloadView.controllers.appendController(downloadViewController);
gDownloadView.focus();
// If the window was opened automatically because
// a download started, select the new download
if (window.arguments.length > 1 && window.arguments[1]) {
var dl = window.arguments[1];
selectDownload(dl.QueryInterface(Components.interfaces.nsIDownload));
}
else if (gDownloadView.view && gDownloadView.view.rowCount > 0) {
// Select the first item in the view, if any.
gDownloadView.view.selection.select(0);
}
}
function onSelect(aEvent) {
if (!gStatusBar)
gStatusBar = document.getElementById("statusbar-text");
var selectionCount = gDownloadView.view.selection.count;
if (selectionCount == 1)
gStatusBar.label = createLocalFile(getSelectedItem().id).path;
else
gStatusBar.label = "";
window.updateCommands("tree-select");
}
function onTrigger() {
if (downloadViewController.isCommandEnabled('cmd_properties'))
goDoCommand('cmd_properties');
else if (downloadViewController.isCommandEnabled('cmd_openfile'))
goDoCommand('cmd_openfile');
else if (downloadViewController.isCommandEnabled('cmd_showinshell'))
goDoCommand('cmd_showinshell');
}
var downloadViewController = {
supportsCommand: function dVC_supportsCommand (aCommand)
{
switch (aCommand) {
case "cmd_properties":
case "cmd_pause":
case "cmd_cancel":
case "cmd_remove":
case "cmd_copyurl":
case "cmd_openfile":
case "cmd_showinshell":
case "cmd_selectAll":
return true;
}
return false;
},
isCommandEnabled: function dVC_isCommandEnabled (aCommand)
{
if (!gDownloadView.view || !gDownloadView.view.selection) return false;
var selectionCount = gDownloadView.view.selection.count;
if (!selectionCount) return false;
var selectedItem = getSelectedItem();
var isDownloading = selectedItem && gDownloadManager.getDownload(selectedItem.id);
switch (aCommand) {
case "cmd_openfile":
if (gCannotLaunch)
return false;
case "cmd_showinshell":
// we can't reveal until the download is complete, because we have not given
// the file its final name until them.
return selectionCount == 1 && !isDownloading && selectedItem &&
createLocalFile(selectedItem.id).exists();
case "cmd_properties":
return selectionCount == 1 && isDownloading;
case "cmd_pause":
return false;
case "cmd_cancel":
// XXX check if selection is still in progress
// how to handle multiple selection?
return isDownloading;
case "cmd_remove":
// XXX ensure selection isn't still in progress
// and how to handle multiple selection?
return selectionCount > 0 && !isDownloading;
case "cmd_copyurl":
return selectionCount > 0;
case "cmd_selectAll":
return gDownloadView.view.rowCount != selectionCount;
default:
return false;
}
},
doCommand: function dVC_doCommand (aCommand)
{
var selectedItem, selectedItems;
var file, i;
switch (aCommand) {
case "cmd_properties":
selectedItem = getSelectedItem();
var dl;
if (selectedItem)
dl = gDownloadManager.getDownload(selectedItem.id);
if (dl)
gDownloadManager.openProgressDialogFor(dl, window, false);
break;
case "cmd_openfile":
selectedItem = getSelectedItem();
if (selectedItem) {
file = createLocalFile(selectedItem.id);
const kDontAskAgainPref = "browser.download.progressDnlgDialog.dontAskForLaunch";
try {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var dontAskAgain = pref.getBoolPref(kDontAskAgainPref);
} catch (e) {
// dontAskAgain not set - then we need to ask user
dontAskAgain = false;
}
if (!dontAskAgain && file.isExecutable()) {
try {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
} catch (ex) {
break;
}
var strBundle = document.getElementById("dlProgressDlgBundle");
var title = strBundle.getFormattedString("openingAlertTitle", [file.leafName]);
var msg = strBundle.getFormattedString("securityAlertMsg", [file.leafName]);
var dontaskmsg = strBundle.getString("dontAskAgain");
var checkbox = {value:0};
var okToProceed = promptService.confirmCheck(window, title, msg, dontaskmsg, checkbox);
try {
if (checkbox.value != dontAskAgain)
pref.setBoolPref(kDontAskAgainPref, checkbox.value);
} catch (ex) {}
if (!okToProceed)
return;
}
file.launch();
}
break;
case "cmd_showinshell":
selectedItem = getSelectedItem();
if (selectedItem) {
file = createLocalFile(selectedItem.id);
// on unix, open a browser window rooted at the parent
if ((navigator.platform.indexOf("Win") == -1) &&
(navigator.platform.indexOf("Mac") == -1) &&
(navigator.platform.indexOf("OS/2") == -1) &&
(navigator.platform.indexOf("BeOS") == -1)) {
var parent = file.parent;
if (parent) {
const browserURL = "chrome://navigator/content/navigator.xul";
window.openDialog(browserURL, "_blank", "chrome,all,dialog=no", parent.path);
}
}
else {
file.reveal();
}
}
break;
case "cmd_pause":
break;
case "cmd_cancel":
// XXX we should probably prompt the user
selectedItems = getSelectedItems();
for (i = 0; i < selectedItems.length; i++)
gDownloadManager.cancelDownload(selectedItems[i].id);
window.updateCommands("tree-select");
break;
case "cmd_remove":
selectedItems = getSelectedItems();
// Figure out where to place the selection after deletion
var newSelectionPos = gDownloadView.contentView.getIndexOfItem(selectedItems[0]);
gDownloadManager.startBatchUpdate();
// Notify the datasource that we're about to begin a batch operation
var ds = window.arguments[0]
.QueryInterface(Components.interfaces.nsIRDFDataSource);
ds.beginUpdateBatch();
for (i = 0; i <= selectedItems.length - 1; ++i) {
gDownloadManager.removeDownload(selectedItems[i].id);
}
ds.endUpdateBatch();
gDownloadManager.endBatchUpdate();
// If there's nothing on the panel now, skip setting the selection
if (gDownloadView.treeBoxObject.view && gDownloadView.treeBoxObject.view.rowCount > 0) {
// Select the item that replaced the first deleted one
if (newSelectionPos >= gDownloadView.treeBoxObject.view.rowCount)
newSelectionPos = gDownloadView.treeBoxObject.view.rowCount - 1;
gDownloadView.view.selection.select(newSelectionPos);
gDownloadView.treeBoxObject.ensureRowIsVisible(newSelectionPos);
gStatusBar.label = createLocalFile(getSelectedItem().id).path;
}
else {
// Nothing on the panel, so clear the Status Bar
gStatusBar.label = "";
}
window.updateCommands("tree-select");
break;
case "cmd_selectAll":
gDownloadView.view.selection.selectAll();
break;
case "cmd_copyurl":
selectedItems = getSelectedItems();
if (selectedItems.length > 0) {
gStatusBar.label = copyToClipboard(selectedItems);
}
break;
default:
}
},
onEvent: function dVC_onEvent (aEvent)
{
switch (aEvent) {
case "tree-select":
this.onCommandUpdate();
}
},
onCommandUpdate: function dVC_onCommandUpdate ()
{
var cmds = ["cmd_properties", "cmd_pause", "cmd_cancel", "cmd_remove",
"cmd_copyurl", "cmd_openfile", "cmd_showinshell"];
for (var command in cmds)
goUpdateCommand(cmds[command]);
}
};
function getSelectedItem()
{
if (gDownloadView.currentIndex != -1)
return gDownloadView.contentView.getItemAtIndex(gDownloadView.currentIndex);
return null;
}
function getSelectedItems()
{
var items = [];
var k = 0;
var selection = gDownloadView.view.selection;
var rangeCount = selection.getRangeCount();
for (var i = 0; i < rangeCount; i++) {
var startIndex = {};
var endIndex = {};
selection.getRangeAt(i, startIndex, endIndex);
for (var j = startIndex.value; j <= endIndex.value; j++)
items[k++] = gDownloadView.contentView.getItemAtIndex(j);
}
return items;
}
function createLocalFile(aFilePath)
{
const lfIID = Components.interfaces.nsILocalFile;
// XXXvarga We should fix the download manager to be consistent, that is,
// use urls instead of local paths when adding new items to the list.
// Once it's fixed, the code below can be removed.
// See bug 208113 for more details.
var file;
if (aFilePath.substring(0,5) == 'file:') {
file = gFileHandler.getFileFromURLSpec(aFilePath)
.QueryInterface(lfIID);
}
else {
const lfContractID = "@mozilla.org/file/local;1";
file = Components.classes[lfContractID].createInstance(lfIID);
file.initWithPath(aFilePath);
}
return file;
}
function DLManagerShutdown()
{
try {
var observerService = Components.classes[kObserverServiceProgID]
.getService(Components.interfaces.nsIObserverService);
observerService.removeObserver(dlObserver, "download-starting");
}
catch (ex) {
}
}
function setSortVariables(tree)
{
var node;
for (node = document.getElementById("Name"); node; node = node.nextSibling) {
if (node.getAttribute("sortActive") == "true")
break;
}
if (!node) {
node = document.getElementById("Progress");
node.setAttribute("sortActive", "true");
node.setAttribute("sortDirection", "descending");
}
tree.setAttribute("sortActive", "true");
tree.setAttribute("sortDirection", node.getAttribute("sortDirection"));
tree.setAttribute("sortResource", node.getAttribute("resource"));
}
function doSort(node)
{
if (node.localName != "treecol")
return;
var sortResource = node.getAttribute("resource");
var sortDirection = node.getAttribute("sortDirection");
sortDirection = sortDirection == "ascending" ? "descending" : "ascending";
try {
var sortService = Components.classes["@mozilla.org/xul/xul-sort-service;1"]
.getService(Components.interfaces.nsIXULSortService);
sortService.sort(node, sortResource, sortDirection);
}
catch(ex) {
}
}
function copyToClipboard(selectedItems)
{
var urlArray = new Array(selectedItems.length);
for (var i = 0; i < selectedItems.length; ++i) {
urlArray[i] = selectedItems[i].firstChild.lastChild.getAttribute("label");
}
var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper);
clipboardHelper.copyString(urlArray.join("\n"));
return urlArray.join(" "); // for status text
}
PK
C"7x % content/cookie/cookieAcceptDialog.xul
PK
j6 $ content/cookie/cookieAcceptDialog.js//@line 36 "/builds/tinderbox/SeaMonkey-Trunk/Linux_2.6.18-8.el5_Depend/mozilla/toolkit/components/cookie/content/cookieAcceptDialog.js"
const nsICookieAcceptDialog = Components.interfaces.nsICookieAcceptDialog;
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
const nsICookie = Components.interfaces.nsICookie;
const nsICookiePromptService = Components.interfaces.nsICookiePromptService;
var params;
var cookieBundle;
var gDateService = null;
var showDetails = "";
var hideDetails = "";
var detailsAccessKey = "";
function onload()
{
doSetOKCancel(cookieAcceptNormal, cookieDeny, cookieAcceptSession);
var dialog = document.documentElement;
document.getElementById("Button2").collapsed = false;
document.getElementById("ok").label = dialog.getAttribute("acceptLabel");
document.getElementById("ok").accessKey = dialog.getAttribute("acceptKey");
document.getElementById("Button2").label = dialog.getAttribute("extra1Label");
document.getElementById("Button2").accessKey = dialog.getAttribute("extra1Key");
document.getElementById("cancel").label = dialog.getAttribute("cancelLabel");
document.getElementById("cancel").accessKey = dialog.getAttribute("cancelKey");
// hook up button icons where implemented
document.getElementById("ok").setAttribute("icon","accept");
document.getElementById("cancel").setAttribute("icon","cancel");
document.getElementById("disclosureButton").setAttribute("icon","properties");
if (!gDateService) {
const nsScriptableDateFormat_CONTRACTID = "@mozilla.org/intl/scriptabledateformat;1";
const nsIScriptableDateFormat = Components.interfaces.nsIScriptableDateFormat;
gDateService = Components.classes[nsScriptableDateFormat_CONTRACTID]
.getService(nsIScriptableDateFormat);
}
cookieBundle = document.getElementById("cookieBundle");
//cache strings
if (!showDetails) {
showDetails = cookieBundle.getString('showDetails');
}
if (!hideDetails) {
hideDetails = cookieBundle.getString('hideDetails');
}
detailsAccessKey = cookieBundle.getString('detailsAccessKey');
if (document.getElementById('infobox').hidden) {
document.getElementById('disclosureButton').setAttribute("label",showDetails);
} else {
document.getElementById('disclosureButton').setAttribute("label",hideDetails);
}
document.getElementById('disclosureButton').setAttribute("accesskey",detailsAccessKey);
if ("arguments" in window && window.arguments.length >= 1 && window.arguments[0]) {
try {
params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
var objects = params.objects;
var cookie = params.objects.queryElementAt(0,nsICookie);
var cookiesFromHost = params.GetInt(nsICookieAcceptDialog.COOKIESFROMHOST);
var messageFormat;
if (params.GetInt(nsICookieAcceptDialog.CHANGINGCOOKIE))
messageFormat = 'permissionToModifyCookie';
else if (cookiesFromHost > 1)
messageFormat = 'permissionToSetAnotherCookie';
else if (cookiesFromHost == 1)
messageFormat = 'permissionToSetSecondCookie';
else
messageFormat = 'permissionToSetACookie';
var hostname = params.GetString(nsICookieAcceptDialog.HOSTNAME);
var messageText;
if (cookie)
messageText = cookieBundle.getFormattedString(messageFormat,[hostname, cookiesFromHost]);
else
// No cookies means something went wrong. Bring up the dialog anyway
// to not make the mess worse.
messageText = cookieBundle.getFormattedString(messageFormat,["",cookiesFromHost]);
var messageParent = document.getElementById("dialogtextbox");
var messageParagraphs = messageText.split("\n");
// use value for the header, so it doesn't wrap.
var headerNode = document.getElementById("dialog-header");
headerNode.setAttribute("value",messageParagraphs[0]);
// use childnodes here, the text can wrap
for (var i = 1; i < messageParagraphs.length; i++) {
var descriptionNode = document.createElement("description");
text = document.createTextNode(messageParagraphs[i]);
descriptionNode.appendChild(text);
messageParent.appendChild(descriptionNode);
}
if (cookie) {
document.getElementById('ifl_name').setAttribute("value",cookie.name);
document.getElementById('ifl_value').setAttribute("value",cookie.value);
document.getElementById('ifl_host').setAttribute("value",cookie.host);
document.getElementById('ifl_path').setAttribute("value",cookie.path);
document.getElementById('ifl_isSecure').setAttribute("value",
cookie.isSecure ?
cookieBundle.getString("forSecureOnly") : cookieBundle.getString("forAnyConnection")
);
document.getElementById('ifl_expires').setAttribute("value",GetExpiresString(cookie.expires));
document.getElementById('ifl_isDomain').setAttribute("value",
cookie.isDomain ?
cookieBundle.getString("domainColon") : cookieBundle.getString("hostColon")
);
}
// set default result to not accept the cookie
params.SetInt(nsICookieAcceptDialog.ACCEPT_COOKIE, 0);
// and to not persist
params.SetInt(nsICookieAcceptDialog.REMEMBER_DECISION, 0);
} catch (e) {
}
}
}
function showhideinfo()
{
var infobox=document.getElementById('infobox');
if (infobox.hidden) {
infobox.setAttribute("hidden","false");
document.getElementById('disclosureButton').setAttribute("label",hideDetails);
} else {
infobox.setAttribute("hidden","true");
document.getElementById('disclosureButton').setAttribute("label",showDetails);
}
sizeToContent();
}
function cookieAcceptNormal()
{
// accept the cookie normally
params.SetInt(nsICookieAcceptDialog.ACCEPT_COOKIE, nsICookiePromptService.ACCEPT_COOKIE);
// And remember that when needed
params.SetInt(nsICookieAcceptDialog.REMEMBER_DECISION, document.getElementById('persistDomainAcceptance').checked);
window.close();
}
function cookieAcceptSession()
{
// accept for the session only
params.SetInt(nsICookieAcceptDialog.ACCEPT_COOKIE, nsICookiePromptService.ACCEPT_SESSION_COOKIE);
// And remember that when needed
params.SetInt(nsICookieAcceptDialog.REMEMBER_DECISION, document.getElementById('persistDomainAcceptance').checked);
window.close();
}
function cookieDeny()
{
// say that the cookie was rejected
params.SetInt(nsICookieAcceptDialog.ACCEPT_COOKIE, nsICookiePromptService.DENY_COOKIE);
// And remember that when needed
params.SetInt(nsICookieAcceptDialog.REMEMBER_DECISION, document.getElementById('persistDomainAcceptance').checked);
window.close();
}
function GetExpiresString(secondsUntilExpires) {
if (secondsUntilExpires) {
var date = new Date(1000*secondsUntilExpires);
// if a server manages to set a really long-lived cookie, the dateservice
// can't cope with it properly, so we'll just return a blank string
// see bug 238045 for details
var expiry = "";
try {
expiry = gDateService.FormatDateTime("", gDateService.dateFormatLong,
gDateService.timeFormatSeconds,
date.getFullYear(), date.getMonth()+1,
date.getDate(), date.getHours(),
date.getMinutes(), date.getSeconds());
} catch(ex) {
// do nothing
}
return expiry;
}
return cookieBundle.getString("atEndOfSession");
}
PK
}'7`y ) content/wallet/walletNavigatorOverlay.xul
PK
nI51uE{ { % content/wallet/walletTasksOverlay.xul
PK
,F ' content/wallet/walletContextOverlay.xul
PK
I6\[ % content/wallet/walletPrefsOverlay.xul
PK
&I*3=p
content/wallet/pref-wallet.xul
%brandDTD;
%prefWalletDTD;
]>
&encryptDescription.label;
PK
U06>9 >9 content/wallet/walletOverlay.js/* -*- Mode: Java; tab-width: 4; c-basic-offset: 4; -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org Code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gIsEncrypted = -1;
var gWalletService = -1;
// states that the capture and prefill menu items can be in
const hide = -1; // don't show menu item
const disable = 0; // show menu item but gray it out
const enable = 1; // show menu item normally
// Set the disabled attribute of specified item.
// If the value is false, then it removes the attribute
function setDisabledAttr(id, val) {
var elem = document.getElementById(id);
if (elem) {
if (val) {
elem.setAttribute("disabled", val);
} else {
elem.removeAttribute("disabled");
}
}
}
// Show/hide one item (specified via name or the item element itself).
function showItem(itemOrId, show) {
var item = null;
if (itemOrId.constructor == String) {
// Argument specifies item id.
item = document.getElementById(itemOrId);
} else {
// Argument is the item itself.
item = itemOrId;
}
if (item) {
var styleIn = item.getAttribute("style");
var styleOut = styleIn;
if (show) {
// Remove style="display:none;".
styleOut = styleOut.replace("display:none;", "");
} else {
// Set style="display:none;".
if (styleOut.indexOf("display:none;") == -1) {
// Add style the first time we need to.
styleOut += "display:none;";
}
}
// Only set style if it's different.
if (styleIn != styleOut) {
item.setAttribute("style", styleOut);
}
}
}
/* form toolbar is out
var firstTime = true;
function initToolbarItems() {
// This routine determines whether or not to display the form-manager toolbar and,
// if so, which buttons on the toolbar are to be enabled. We need to reexecute
// this routine whenever the form-manager dialog finishes because saved values might
// have been added/removed which could affect the enable/disable state of the buttons.
if (firstTime) {
// Force initToolbarItems to be executed upon return from viewing prefs.
// This is necessary in case the form-manager dialog was invoked from the
// pref panel. See next block of code for more details.
var pref = document.getElementById("menu_preferences");
if (pref) {
oncommand = pref.getAttribute("oncommand");
pref.setAttribute("oncommand", oncommand+";initToolbarItems()");
firstTime = false;
}
}
// get the form-manager toolbar
var cmd_viewformToolbar = document.getElementById("cmd_viewformtoolbar");
if (!cmd_viewformToolbar) {
// This happens when you access the form-manager dialog from the prefs panel
// Not sure yet how to get access to items in navigator in that case
// So instead we will execute initToolbarItems when edit->prefs returns (that's
// what above block of code involving firstTime accomplished.
return;
}
// keep form toolbar hidden if checkbox in view menu so indicates
var checkValue = cmd_viewformToolbar.getAttribute("checked");
if (checkValue == "false") {
showItem("formToolbar", false);
return;
}
// hide form toolbar if three or less text elements in form
var state = getState(3);
showItem("formToolbar", (state.prefill != hide));
// enable prefill button if there is at least one saved value for the form
setDisabledAttr("formPrefill", (state.prefill == disable));
}
*/
function formShow() {
window.openDialog(
"chrome://communicator/content/wallet/WalletViewer.xul",
"_blank",
"chrome,titlebar,resizable=yes");
/* form toolbar is out
initToolbarItems(); // need to redetermine which buttons in form toolbar to enable
*/
}
// Capture the values that are filled in on the form being displayed.
function formCapture() {
var walletService = Components.classes["@mozilla.org/wallet/wallet-service;1"].getService(Components.interfaces.nsIWalletService);
walletService.WALLET_RequestToCapture(window.content);
}
// Prefill the form being displayed.
function formPrefill() {
var walletService = Components.classes["@mozilla.org/wallet/wallet-service;1"].getService(Components.interfaces.nsIWalletService);
try {
walletService.WALLET_Prefill(false, window.content);
window.openDialog("chrome://communicator/content/wallet/WalletPreview.xul",
"_blank", "chrome,modal=yes,dialog=yes,all, width=504, height=436");
} catch(e) {
}
}
/*
// Prefill the form being displayed without bringing up the preview window.
function formQuickPrefill() {
gWalletService.WALLET_Prefill(true, window.content);
}
*/
var elementCount;
// Walk through the DOM to determine how a capture or prefill item is to appear.
// returned value:
// hide, disable, enable for .capture and .prefill
function getStateFromFormsArray(content, threshhold) {
var formsArray = content.document.forms;
if (!formsArray) {
return {capture: hide, prefill: hide};
}
var form;
var bestState = {capture: hide, prefill: hide};
for (form=0; form threshhold)) {
return bestState;
}
}
}
}
// if we got here, then there was no element with a value or too few elements
return bestState;
}
var bestState;
function stateFoundInFormsArray(content, threshhold) {
var rv = {capture: false, prefill: false};
var state = getStateFromFormsArray(content, threshhold);
for (var i in state) {
if (state[i] == enable) {
bestState[i] = enable;
if (elementCount > threshhold) {
rv[i] = true;
}
} else if (state[i] == disable && bestState[i] == hide) {
bestState[i] = disable;
}
}
return rv;
}
// Walk through the DOM to determine how capture or prefill item is to appear.
// returned value:
// hide, disable, enable for .capture and .prefill
function getState(threshhold) {
bestState = {capture: hide, prefill: hide};
elementCount = 0;
stateFound(window.content, threshhold);
return bestState;
}
function stateFound(content, threshhold) {
var captureStateFound = false;
var prefillStateFound = false;
if (!content || !content.document) {
return {capture: false, prefill: false};
}
var document = content.document;
if (!("forms" in document)) {
// this will occur if document is xul document instead of html document for example
return {capture: false, prefill: false};
}
// test for wallet service being available
if (gWalletService == -1)
gWalletService = Components.classes["@mozilla.org/wallet/wallet-service;1"]
.getService(Components.interfaces.nsIWalletService);
if (!gWalletService) {
return {capture: true, prefill: true};
}
// process frames if any
var framesArray = content.frames;
var rv;
if (framesArray.length != 0) {
var frame;
for (frame=0; frame threshhold) {
// no text (or select) element with a value
return rv;
}
// too few text (or select) elements
bestState = {capture: hide, prefill: hide};
return rv;
}
// display a Wallet Dialog
function WalletDialog(which) {
switch( which ) {
case "walletsites":
window.openDialog("chrome://communicator/content/wallet/SignonViewer.xul",
"_blank","chrome,resizable","W");
break;
case "wallet":
default:
formShow();
break;
}
}
PK
c)6T^ ^ + content/communicator/wallet/SignonViewer.js/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben "Count XULula" Goodger
* Mike Calmus
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*** =================== INITIALISATION CODE =================== ***/
var kObserverService;
var kSignonBundle;
var gSelectUserInUse = false;
// interface variables
var signonviewer = null;
var passwordmanager = null;
// password-manager lists
var signons = [];
var rejects = [];
var deletedSignons = [];
var deletedRejects = [];
// form-manager lists
var nopreviews = [];
var nocaptures = [];
var deletedNopreviews = [];
var deletedNocaptures = [];
// delete the following lines !!!!!
var goneNP = ""; // nopreview
var goneNC = ""; // nocapture
// differentiate between password manager and form manager
var isPasswordManager = (window.arguments[0] == "S");
// variables for encryption
var encrypted = "";
var showingPasswords = false;
function Startup() {
// xpconnect to password manager interfaces
signonviewer = Components.classes["@mozilla.org/signonviewer/signonviewer-world;1"].createInstance();
signonviewer = signonviewer.QueryInterface(Components.interfaces.nsISignonViewer);
passwordmanager = Components.classes["@mozilla.org/passwordmanager;1"].getService();
passwordmanager = passwordmanager.QueryInterface(Components.interfaces.nsIPasswordManager);
// determine if database is encrypted
try {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
try {
encrypted = pref.getBoolPref("wallet.crypto");
} catch(e) {
dump("wallet.crypto pref is missing from all.js");
}
} catch (ex) {
dump("failed to get prefs service!\n");
pref = null;
}
// determine whether to run in password-manager mode or form-manager mode
var tabBox = document.getElementById("tabbox");
kSignonBundle = document.getElementById("signonBundle");
var element;
if (isPasswordManager) {
// be prepared to reload the display if anything changes
kObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
kObserverService.addObserver(signonReloadDisplay, "signonChanged", false);
// be prepared to disable the buttons when selectuser dialog is in use
kObserverService.addObserver(signonReloadDisplay, "signonSelectUser", false);
signonsTree = document.getElementById("signonsTree");
rejectsTree = document.getElementById("rejectsTree");
// set initial password-manager tab
element = document.getElementById("signonsTab");
tabBox.selectedTab = element;
// hide form-manager tabs
element = document.getElementById("nopreviewsTab");
element.hidden = "true";
element = document.getElementById("nocapturesTab");
element.hidden = "true"
// load password manager items
if (!LoadSignons()) {
return; /* user failed to unlock the database */
}
LoadRejects();
// label the show/hide password button
document.getElementById("togglePasswords").label = kSignonBundle.getString(showingPasswords ? "hidePasswords" : "showPasswords");
} else {
nopreviewsTree = document.getElementById("nopreviewsTree");
nocapturesTree = document.getElementById("nocapturesTree");
// change title on window
var wind = document.getElementById("signonviewer");
document.title = wind.getAttribute("alttitle");
// set initial form-manager tab
element = document.getElementById("nopreviewsTab");
tabBox.selectedTab = element;
// hide password-manager tabs
element = document.getElementById("signonsTab");
element.hidden = "true";
element = document.getElementById("signonsitesTab");
element.hidden = "true";
// load form manager items
LoadNopreview();
LoadNocapture();
}
// label the close button
document.documentElement.getButton("accept").label = kSignonBundle.getString("close");
}
function Shutdown() {
if (isPasswordManager) {
kObserverService.removeObserver(signonReloadDisplay, "signonChanged");
kObserverService.removeObserver(signonReloadDisplay, "signonSelectUser");
}
}
var signonReloadDisplay = {
observe: function(subject, topic, state) {
if (topic == "signonChanged") {
if (state == "signons") {
signons.length = 0;
if (lastSignonSortColumn == "host") {
lastSignonSortAscending = !lastSignonSortAscending; // prevents sort from being reversed
}
LoadSignons();
} else if (state == "rejects") {
rejects.length = 0;
if (lastRejectSortColumn == "host") {
lastRejectSortAscending = !lastRejectSortAscending; // prevents sort from being reversed
}
LoadRejects();
} else if (state == "nocaptures") {
nocaptures.length = 0;
if (lastNocaptureSortColumn == "host") {
lastNocaptureSortAscending = !lastNocaptureSortAscending; // prevents sort from being reversed
}
LoadNocapture();
} else if (state == "nopreviews") {
nopreviews.length = 0;
if (lastNopreviewSortColumn == "host") {
lastNopreviewSortAscending = !lastNopreviewSortAscending; // prevents sort from being reversed
}
LoadNopreview();
}
} else if (topic == "signonSelectUser") {
if (state == "suspend") {
gSelectUserInUse = true;
document.getElementById("removeSignon").disabled = true;
document.getElementById("removeAllSignons").disabled = true;
document.getElementById("togglePasswords").disabled = true;
} else if (state == "resume") {
gSelectUserInUse = false;
var selections = GetTreeSelections(signonsTree);
if (selections.length > 0) {
document.getElementById("removeSignon").disabled = false;
}
if (signons.length > 0) {
document.getElementById("removeAllSignons").disabled = false;
document.getElementById("togglePasswords").disabled = false;
}
} else if (state == "inUse") {
gSelectUserInUse = true;
}
}
}
}
/*** =================== SAVED SIGNONS CODE =================== ***/
var signonsTreeView = {
rowCount : 0,
setTree : function(tree) {},
getImageSrc : function(row,column) {},
getProgressMode : function(row,column) {},
getCellValue : function(row,column) {},
getCellText : function(row,column) {
var rv="";
if (column.id=="siteCol") {
rv = signons[row].host;
} else if (column.id=="userCol") {
rv = signons[row].user;
} else if (column.id=="passwordCol") {
rv = signons[row].password;
}
return rv;
},
isSeparator : function(index) { return false; },
isSorted : function() { return false; },
isContainer : function(index) { return false; },
cycleHeader : function(column) {},
getRowProperties : function(row,prop) {},
getColumnProperties : function(column,prop) {},
getCellProperties : function(row,column,prop) {}
};
var signonsTree;
function Signon(id, host, user, rawuser, password) {
this.id = id;
this.host = host;
this.user = user;
this.rawuser = rawuser;
this.password = password;
}
function LoadSignons() {
// loads signons into table
var enumerator = passwordmanager.enumerator;
var count = 0;
while (enumerator.hasMoreElements()) {
var nextPassword;
try {
nextPassword = enumerator.getNext();
nextPassword = nextPassword.QueryInterface(Components.interfaces.nsIPassword);
var host = nextPassword.host;
var user = nextPassword.user;
var password = nextPassword.password;
var rawuser = user;
// if no username supplied, try to parse it out of the url
if (user == "") {
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
try {
user = ioService.newURI(host, null, null).username;
if (user == "") {
user = "<>";
}
} catch(e) {
user = "<>";
}
}
if (encrypted) {
user = kSignonBundle.getFormattedString("encrypted", [user], 1);
}
signons[count] = new Signon(count++, host, user, rawuser, password);
} catch(e) {
/* The user cancelled the master password dialog */
if (e.result==Components.results.NS_ERROR_NOT_AVAILABLE) {
window.close();
return false;
}
/* Otherwise an entry is corrupt. Go to next element. */
}
}
signonsTreeView.rowCount = signons.length;
// sort and display the table
signonsTree.treeBoxObject.view = signonsTreeView;
SignonColumnSort('host');
// disable "remove all signons" button if there are no signons
var element = document.getElementById("removeAllSignons");
var toggle = document.getElementById("togglePasswords")
if (signons.length == 0 || gSelectUserInUse) {
element.setAttribute("disabled","true");
toggle.setAttribute("disabled","true");
} else {
element.removeAttribute("disabled");
toggle.removeAttribute("disabled");
}
return true;
}
function SignonSelected() {
var selections = GetTreeSelections(signonsTree);
if (selections.length && !gSelectUserInUse) {
document.getElementById("removeSignon").removeAttribute("disabled");
}
}
function DeleteSignon() {
DeleteSelectedItemFromTree(signonsTree, signonsTreeView,
signons, deletedSignons,
"removeSignon", "removeAllSignons");
FinalizeSignonDeletions();
}
function DeleteAllSignons() {
var prompter = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
// Confirm the user wants to remove all passwords
var dummy = { value: false };
if (prompter.confirmEx(window,
kSignonBundle.getString("removeAllPasswordsTitle"),
kSignonBundle.getString("removeAllPasswordsPrompt"),
prompter.STD_YES_NO_BUTTONS + prompter.BUTTON_POS_1_DEFAULT,
null, null, null, null, dummy) == 1) // 1 == "No" button
return;
DeleteAllFromTree(signonsTree, signonsTreeView,
signons, deletedSignons,
"removeSignon", "removeAllSignons");
FinalizeSignonDeletions();
}
function TogglePasswordVisible() {
if (!showingPasswords && !ConfirmShowPasswords())
return;
showingPasswords = !showingPasswords;
document.getElementById("togglePasswords").label = kSignonBundle.getString(showingPasswords ? "hidePasswords" : "showPasswords");
document.getElementById("passwordCol").hidden = !showingPasswords;
}
function AskUserShowPasswords() {
var prompter = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
var dummy = { value: false };
// Confirm the user wants to display passwords
return prompter.confirmEx(window,
null,
kSignonBundle.getString("noMasterPasswordPrompt"),
prompter.STD_YES_NO_BUTTONS,
null, null, null, null, dummy) == 0; // 0=="Yes" button
}
function ConfirmShowPasswords() {
if (encrypted) {
// If signons are encrypted, force prompted login into Software Security Device
var tokendb = Components.classes["@mozilla.org/security/pk11tokendb;1"]
.createInstance(Components.interfaces.nsIPK11TokenDB);
var token = tokendb.getInternalKeyToken();
try {
// If signons are encrypted but there is no master password (it could have been changed to an empty string),
// still give the user a chance to opt-out of displaying passwords (like in the non-encrypted case).
// Regardless of whether the check succeeds or not, we still login to make sure we're properly authenticated.
// This is all right since login() will succeed without prompting the user for the (empty) master password.
if (token.checkPassword("") && !AskUserShowPasswords())
return false;
token.login(true); // 'true' means always prompt for token password. User will be prompted until
// clicking 'Cancel' or entering the correct password.
} catch (e) {
// An exception will be thrown if the user cancels the login prompt dialog.
// User is also logged out of Software Security Device.
;
}
return token.isLoggedIn();
} else {
// signons not encrypted, confirm the user wants to display passwords
return AskUserShowPasswords();
}
}
function FinalizeSignonDeletions() {
for (var s=0; s 0) {
var delim = list[0];
list = list.split(delim);
}
for (var i = 1; i < list.length; i++) {
var host = TrimString(list[i]);
nopreviews[count] = new Nopreview(count++, host);
}
nopreviewsTreeView.rowCount = nopreviews.length;
// sort and display the table
nopreviewsTree.treeBoxObject.view = nopreviewsTreeView;
NopreviewColumnSort('host');
var element = document.getElementById("removeAllNopreviews");
if (nopreviews.length == 0) {
element.setAttribute("disabled","true");
} else {
element.removeAttribute("disabled");
}
}
function NopreviewSelected() {
var selections = GetTreeSelections(nopreviewsTree);
if (selections.length) {
document.getElementById("removeNopreview").removeAttribute("disabled");
}
}
function DeleteNopreview() {
DeleteSelectedItemFromTree(nopreviewsTree, nopreviewsTreeView,
nopreviews, deletedNopreviews,
"removeNopreview", "removeAllNopreviews");
FinalizeNopreviewDeletions();
}
function DeleteAllNopreviews() {
DeleteAllFromTree(nopreviewsTree, nopreviewsTreeView,
nopreviews, deletedNopreviews,
"removeNopreview", "removeAllNopreviews");
FinalizeNopreviewDeletions();
}
function FinalizeNopreviewDeletions() {
var i;
var result = "|goneP|";
for (i=0; i 0) {
var delim = list[0];
list = list.split(delim);
}
for (var i = 1; i < list.length; i++) {
var host = TrimString(list[i]);
nocaptures[count] = new Nocapture(count++, host);
}
nocapturesTreeView.rowCount = nocaptures.length;
// sort and display the table
nocapturesTree.treeBoxObject.view = nocapturesTreeView;
NocaptureColumnSort('host');
var element = document.getElementById("removeAllNocaptures");
if (nocaptures.length == 0) {
element.setAttribute("disabled","true");
} else {
element.removeAttribute("disabled");
}
}
function NocaptureSelected() {
var selections = GetTreeSelections(nocapturesTree);
if (selections.length) {
document.getElementById("removeNocapture").removeAttribute("disabled");
}
}
function DeleteNocapture() {
DeleteSelectedItemFromTree(nocapturesTree, nocapturesTreeView,
nocaptures, deletedNocaptures,
"removeNocapture", "removeAllNocaptures");
FinalizeNocaptureDeletions();
}
function DeleteAllNocaptures() {
DeleteAllFromTree(nocapturesTree, nocapturesTreeView,
nocaptures, deletedNocaptures,
"removeNocapture", "removeAllNocaptures");
FinalizeNocaptureDeletions();
}
function FinalizeNocaptureDeletions() {
var i;
var result = "|goneC|";
for (i=0; i