--- 0.6.20061221/slogger.js	2006-05-08 22:57:20.000000000 +0200
+++ patched/slogger.js	2007-05-05 01:14:25.593750000 +0200
@@ -1,19 +1,19 @@
 
 
 // File constants copied from file-utils.js
-const MODE_RDONLY   = 0x01;
-const MODE_WRONLY   = 0x02;
-const MODE_RDWR     = 0x04;
-const MODE_CREATE   = 0x08;
-const MODE_APPEND   = 0x10;
-const MODE_TRUNCATE = 0x20;
-const MODE_SYNC     = 0x40;
-const MODE_EXCL     = 0x80;
+const SLOGGER_MODE_RDONLY   = 0x01;
+const SLOGGER_MODE_WRONLY   = 0x02;
+const SLOGGER_MODE_RDWR     = 0x04;
+const SLOGGER_MODE_CREATE   = 0x08;
+const SLOGGER_MODE_APPEND   = 0x10;
+const SLOGGER_MODE_TRUNCATE = 0x20;
+const SLOGGER_MODE_SYNC     = 0x40;
+const SLOGGER_MODE_EXCL     = 0x80;
 
 // how to save each page:
-const SAVEAS_COMPLETE = 0;
-const SAVEAS_URL = 1;
-const SAVEAS_TEXT = 2;
+const SLOGGER_SAVEAS_COMPLETE = 0;
+const SLOGGER_SAVEAS_URL = 1;
+const SLOGGER_SAVEAS_TEXT = 2;
 
 
 window.addEventListener('load',  onWindowLoad, true);
@@ -41,7 +41,7 @@
      var scriptableStream = Components.classes['@mozilla.org/scriptableinputstream;1']
 	 .createInstance(Components.interfaces.nsIScriptableInputStream);
 
-     inputStream.init(aFile, MODE_RDONLY, 0, false);
+     inputStream.init(aFile, SLOGGER_MODE_RDONLY, 0, false);
      scriptableStream.init(inputStream);
 
      str = scriptableStream.read(-1);
@@ -50,11 +50,11 @@
 
 
      isNewFile = 0;
-     outputMode = MODE_WRONLY;
+     outputMode = SLOGGER_MODE_WRONLY;
    }
    else {
        isNewFile = 1;
-       outputMode = MODE_RDWR | MODE_CREATE | MODE_APPEND;
+       outputMode = SLOGGER_MODE_RDWR | SLOGGER_MODE_CREATE | SLOGGER_MODE_APPEND;
    }
 
 
@@ -119,7 +119,7 @@
    
    if (!aFile.exists()) {
        
-       var outputMode = MODE_RDWR | MODE_CREATE | MODE_APPEND;
+       var outputMode = SLOGGER_MODE_RDWR | SLOGGER_MODE_CREATE | SLOGGER_MODE_APPEND;
        
        var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
 	   createInstance(Components.interfaces.nsIFileOutputStream);
@@ -169,7 +169,7 @@
     //    sloggerexecAction("execAction"+n);
     var proflist = new Array();
     proflist = proflist.concat(sloggerGetVar("execAction"+n).split("|"));
-    sloggerExecProfiles(proflist);
+    sloggerExecProfiles(proflist, null);
 }
 
 
@@ -184,7 +184,15 @@
 //}
 
 
-function onWindowLoad() {
+function onWindowLoad(event) {
+    
+    var doc = event.originalTarget;
+    if (!doc)
+        return;
+    if (doc.defaultView.frameElement) {
+        // skip logging of frames and iframes
+        return;        
+    }
 
     var proflist = new Array();
 
@@ -208,7 +216,7 @@
     }
 
     //    msg('px ' + proflist.length);
-    sloggerExecProfiles(proflist);
+    sloggerExecProfiles(proflist, doc);
 
 //     if (document.getElementById("slogger-button-push1").checked)
 // 	sloggerexecAction("execAction1");
@@ -249,7 +257,7 @@
 	var proflist = new Array(pref_filename);
 	//proflist.push(pref_filename);
 
-	sloggerExecProfiles(proflist);
+	sloggerExecProfiles(proflist, null);
 
     }
     else if (id.substring(0,15) == 'profileEditList') {
@@ -399,12 +407,13 @@
 //   - a button click
 //   - a page load
 //
-function sloggerExecProfiles(proflist) {
+function sloggerExecProfiles(proflist, doc) {
 
     //    msg('pp ' + proflist.length);
 
     var numran = 0;
-    var doc = window._content.document;
+    if (doc == null)
+        doc = window._content.document;
     var t = setVars(doc);
     var tdiff = t.getTime() - Date.parse(sloggerGetVar("lastTime"));
 


