rem: if (!window._content || !window._content.document) { return hide; } var document = window._content.document; if (!("forms" in document)) {  return hide; }   if (gWalletService == -1) gWalletService = Components.classes["@mozilla.org/wallet/wallet-service;1"] .getService(Components.interfaces.nsIWalletService); if (!gWalletService) { return hide; }  var bestState = hide; var state; elementCount = 0;   var formsArray; var framesArray = window._content.frames; if (framesArray.length != 0) { var frame; for (frame=0; frame<framesArray.length; ++frame) { var frameDocument = framesArray[frame].document; if (frameDocument) { formsArray = frameDocument.forms; state = getStateFromFormsArray(formsArray, captureOrPrefill, threshhold); if (state == enable) { if (elementCount > threshhold) { gIsEncrypted = -1; return enable; } bestState = enable; } else if (state == disable && bestState == hide) { bestState = disable; } } } }  formsArray = document.forms; state = getStateFromFormsArray(formsArray, captureOrPrefill, threshhold); gIsEncrypted = -1; if (state == enable) { if (elementCount > threshhold) { return enable; } bestState = enable; } else if (state == disable && bestState == hide) { bestState = disable; }    if (elementCount > threshhold) {  return bestState; }   return hide; 
add: stateFound(window.content, captureOrPrefill, threshhold); return bestState; 
context:     function getState(captureOrPrefill, threshhold) {      if (!window._content || !window._content.document) {        return hide;      }      var document = window._content.document;      if (!("forms" in document)) {        // this will occur if document is xul document instead of html document for example        return hide;      }      // 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 hide;      }      var bestState = hide;      var state;      elementCount = 0;      // process frames if any      var formsArray;      var framesArray = window._content.frames;      if (framesArray.length != 0) {        var frame;        for (frame=0; frame<framesArray.length; ++frame) {          var frameDocument = framesArray[frame].document;          if (frameDocument) {            formsArray = frameDocument.forms;            state =              getStateFromFormsArray(formsArray, captureOrPrefill, threshhold);            if (state == enable) {              if (elementCount > threshhold) {                gIsEncrypted = -1;                return enable;              }              bestState = enable;            } else if (state == disable && bestState == hide) {              bestState = disable;            }          }        }      }      // process top-level document      formsArray = document.forms;      state =        getStateFromFormsArray(formsArray, captureOrPrefill, threshhold);      gIsEncrypted = -1;      if (state == enable) {        if (elementCount > threshhold) {          return enable;        }        bestState = enable;      } else if (state == disable && bestState == hide) {        bestState = disable;      }      // if we got here, then there was no text (or select) element with a value      // or there were too few text (or select) elements      if (elementCount > threshhold) {        // no text (or select) element with a value        return bestState;      }      // too few text (or select) elements      return hide;    }
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/cdfa3f528bf3311a30aadfe733f3d007150f8e9b/walletOverlay.js/clean/extensions/wallet/resources/content/walletOverlay.js