Guest User

Memory leak on McAfee Site Advisor

a guest
Feb 27th, 2012
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var g_pfnCreateEngine1 = null;
  2.  
  3. // sample code which causes one container to not be released in FF 10
  4. function SampleCode1(domdoc)
  5. {
  6.     if (!g_pfnCreateEngine1)
  7.     {
  8.         var strJS = "function _SampleEvalFnc(d){return null;}"
  9.         eval (strJS);
  10.         g_pfnCreateEngine1 = _SampleEvalFnc;
  11.     }
  12.    
  13.     // Uncommenting the next line causes the last compartment to be released
  14.     // g_pfnCreateEngine1 = null;  
  15. }
  16.  
  17. var oSAPlg = {
  18.     handleEvent : function(e) {
  19.         try {
  20.             switch(e.type) {
  21.                 case "DOMContentLoaded":
  22.                     this.onDocumentComplete(e);
  23.                     break;
  24.                 case "load":
  25.                     this.onStartup();
  26.                     break;
  27.                 default:
  28.                     break;
  29.             };
  30.         } catch(e) {
  31.         }
  32.     },
  33.     // The 'load' handler. Subscribes us to 'DOMContentLoaded' events.
  34.     onStartup: function() {
  35.         var appcontent = document.getElementById("appcontent");   // browser
  36.         if(appcontent) {
  37.             appcontent.addEventListener("DOMContentLoaded", this, false);
  38.         }
  39.     },
  40.     // The 'DOMContentLoaded' handler. Demonstrates compartment leak.
  41.     onDocumentComplete : function(e) {
  42.         var doc = e.originalTarget;
  43.         if (doc instanceof HTMLDocument) {
  44.             var domdoc = doc;
  45.             try
  46.             {
  47.                 // Only run sample code on mcafee.com
  48.                 if(domdoc && domdoc.location
  49.                             && domdoc.location.href
  50.                             && domdoc.location.href.indexOf("mcafee.com", 0) != -1)
  51.                 {
  52.                     SampleCode1(domdoc);
  53.                 }
  54.                 return;
  55.             }
  56.             catch(e)
  57.             {
  58.                 alert("annotate: " + e.message);
  59.             }
  60.         }
  61.     }
  62. };
  63.  
  64. // Entry point
  65. window.addEventListener("load", oSAPlg, false);
RAW Paste Data