home *** CD-ROM | disk | FTP | other *** search
/ Minami 83 / MINAMI83.iso / Extra / DivXInstaller.exe / $PLUGINSDIR / GoogleToolbarFirefox.msi / xpi / amulet-jslib / multi-table-querier.js < prev    next >
Text File  |  2006-08-07  |  1KB  |  49 lines

  1. function PROT_MultiTableQuerier(url, whiteTables, blackTables, listManager,
  2. callback) {
  3. this.debugZone = "multitablequerier";
  4. this.url_ = url;
  5. this.whiteTables_ = whiteTables;
  6. this.blackTables_ = blackTables;
  7. this.listManager_ = listManager;
  8. this.whiteIdx_ = 0;
  9. this.blackIdx_ = 0;
  10. this.callback_ = callback;
  11. }
  12. PROT_MultiTableQuerier.prototype.run = function() {
  13. var whiteTable = this.whiteTables_[this.whiteIdx_];
  14. var blackTable = this.blackTables_[this.blackIdx_];
  15. if (whiteTable) {
  16. ++this.whiteIdx_;
  17. this.listManager_.safeExists(whiteTable, this.url_,
  18. BindToObject(this.whiteTableCallback_,
  19. this));
  20. } else if (blackTable) {
  21. ++this.blackIdx_;
  22. this.listManager_.safeExists(blackTable, this.url_,
  23. BindToObject(this.blackTableCallback_,
  24. this));
  25. } else {
  26. G_Debug(this, "Not found in any tables: " + this.url_);
  27. this.callback_(PROT_ListWarden.NOT_FOUND);
  28. this.callback_ = null;
  29. }
  30. }
  31. PROT_MultiTableQuerier.prototype.whiteTableCallback_ = function(isFound) {
  32. if (!isFound)
  33. this.run();
  34. else {
  35. G_Debug(this, "Found in whitelist: " + this.url_)
  36. this.callback_(PROT_ListWarden.IN_WHITELIST);
  37. this.callback_ = null;
  38. }
  39. }
  40. PROT_MultiTableQuerier.prototype.blackTableCallback_ = function(isFound) {
  41. if (!isFound) {
  42. this.run();
  43. } else {
  44. G_Debug(this, "Found in blacklist: " + this.url_)
  45. this.callback_(PROT_ListWarden.IN_BLACKLIST);
  46. this.callback_ = null;
  47. }
  48. }
  49.