bug 51671, wallet doesn't work with frames, r=jst

This commit is contained in:
morse%netscape.com 2006-07-29 05:34:41 +00:00
Родитель 5aaa36b0a4
Коммит 55cbd3ba8f
1 изменённых файлов: 75 добавлений и 29 удалений

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

@ -66,6 +66,44 @@ function goEditCardDialog(abURI, card, okCallback)
}
function okToCapture2(formsArray) {
if (!formsArray) {
return false;
}
var form;
for (form=0; form<formsArray.length; form++) {
var elementsArray = formsArray[form].elements;
var element;
for (element=0; element<elementsArray.length; element++) {
var type = elementsArray[element].type;
var value = elementsArray[element].value;
if ((type=="" || type=="text") && value!="") {
return true;
}
}
}
return false;
}
function okToPrefill2(formsArray) {
if (!formsArray) {
return false;
}
var form;
for (form=0; form<formsArray.length; form++) {
var elementsArray = formsArray[form].elements;
var element;
for (element=0; element<elementsArray.length; element++) {
var type = elementsArray[element].type;
var value = elementsArray[element].value;
if (type=="" || type=="text" || type=="select-one") {
return true;
}
}
}
return false;
}
function goPreferences(id, paneURL, paneID)
{
var prefWindowModalityPref;
@ -93,26 +131,30 @@ function okToCapture() {
capture.setAttribute("disabled", "true");
return;
}
var formsArray = window._content.document.forms;
if (!formsArray) {
capture.setAttribute("disabled", "true");
return;
}
var form;
for (form=0; form<formsArray.length; form++) {
var elementsArray = formsArray[form].elements;
var element;
for (element=0; element<elementsArray.length; element++) {
var type = elementsArray[element].type;
var value = elementsArray[element].value;
if ((type=="" || type=="text") && value!="") {
// process frames if any
var formsArray;
var framesArray = window._content.frames;
if (framesArray.length != 0) {
var frame;
for (frame=0; frame<framesArray.length; frame++) {
formsArray = framesArray[frame].document.forms;
if (okToCapture2(formsArray)) {
capture.setAttribute("disabled", "false");
return;
}
}
}
// process top-level document
formsArray = window._content.document.forms;
if (okToCapture2(formsArray)) {
capture.setAttribute("disabled", "false");
} else {
capture.setAttribute("disabled", "true");
}
return;
}
function okToPrefill() {
var prefill = document.getElementById("menu_prefill");
@ -123,26 +165,30 @@ function okToPrefill() {
prefill.setAttribute("disabled", "true");
return;
}
var formsArray = window._content.document.forms;
if (!formsArray) {
prefill.setAttribute("disabled", "true");
return;
}
var form;
for (form=0; form<formsArray.length; form++) {
var elementsArray = formsArray[form].elements;
var element;
for (element=0; element<elementsArray.length; element++) {
var type = elementsArray[element].type;
var value = elementsArray[element].value;
if (type=="" || type=="text" || type=="select-one") {
// process frames if any
var formsArray;
var framesArray = window._content.frames;
if (framesArray.length != 0) {
var frame;
for (frame=0; frame<framesArray.length; frame++) {
formsArray = framesArray[frame].document.forms;
if (okToPrefill2(formsArray)) {
prefill.setAttribute("disabled", "false");
return;
}
}
}
// process top-level document
formsArray = window._content.document.forms;
if (okToPrefill2(formsArray)) {
prefill.setAttribute("disabled", "false");
} else {
prefill.setAttribute("disabled", "true");
}
return;
}
function capture()
{