[tor-commits] [torbutton/master] Bug #3665: Use loadGroup to get window if callbacks are absent

mikeperry at torproject.org mikeperry at torproject.org
Tue Aug 9 00:53:38 UTC 2011


commit cc51fe06551be998f70d1653433f8332b2895f98
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Mon Aug 8 17:00:01 2011 -0700

    Bug #3665: Use loadGroup to get window if callbacks are absent
    
    Thanks to Georg Koppen for catching this oversight.
---
 src/chrome/content/stanford-safecache.js |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/chrome/content/stanford-safecache.js b/src/chrome/content/stanford-safecache.js
index 3daed58..31cdf45 100644
--- a/src/chrome/content/stanford-safecache.js
+++ b/src/chrome/content/stanford-safecache.js
@@ -97,19 +97,29 @@ SSC_RequestListener.prototype =
 
   onModifyRequest: function(channel) {
     var parent = null;
-    if (channel.notificationCallbacks) {
-        try {
-            var wind = channel.notificationCallbacks.QueryInterface(
-                    Components.interfaces.nsIInterfaceRequestor).getInterface(
-                        Components.interfaces.nsIDOMWindow);
-            parent = wind.window.top.location;
-        } catch(e) {
-        }
-        SSC_dump("Parent "+parent+" for "+ channel.URI.spec);
+    if (channel.notificationCallbacks ||
+           channel.loadGroup && channel.loadGroup.notificationCallbacks) {
+      var callbacks = null;
+      if (channel.notificationCallbacks) {
+        callbacks = channel.notificationCallbacks;
+      } else {
+        callbacks = channel.loadGroup.notificationCallbacks;
+      }
+      try {
+          var wind = callbacks.QueryInterface(
+                  Components.interfaces.nsIInterfaceRequestor).getInterface(
+                      Components.interfaces.nsIDOMWindow);
+          parent = wind.window.top.location;
+      } catch(e) {
+      }
+      SSC_dump("Parent "+parent+" for "+ channel.URI.spec);
     }
 
     if (channel.documentURI && channel.documentURI == channel.URI) {
       parent = null;  // first party interaction
+    } else if(!parent) {
+      // Questionable first party interaction..
+      SSC_dump("No parent parent for "+ channel.URI.spec);
     }
 
     // Same-origin policy





More information about the tor-commits mailing list