commit 2a7ed84c5f21d601c4ec92acce457322b822bd36 Author: Mike Perry mikeperry-git@fscked.org Date: Fri Sep 2 21:17:29 2011 -0700
Bug #3754: Fix SafeCache OCSP errors (fix for TBB only)
We added a new interface in #3666. This fix uses that string interface and falls back to the old interface if it is not available. --- src/chrome/content/stanford-safecache.js | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/chrome/content/stanford-safecache.js b/src/chrome/content/stanford-safecache.js index 4dd388d..1da6b02 100644 --- a/src/chrome/content/stanford-safecache.js +++ b/src/chrome/content/stanford-safecache.js @@ -89,11 +89,16 @@ SSC_RequestListener.prototype = },
setCacheKey: function(channel, str) { - var oldData = this.readCacheKey(channel.cacheKey); - var newKey = this.newCacheKey(this.getHash(str) + oldData); - channel.cacheKey = newKey; - SSC_dump("Set cache key to hash(" + str + ") = " + + try { + channel.cacheDomain = str; + SSC_dump("Set cacheDomain to "+str+" for "+channel.URI.spec); + } catch(e) { + var oldData = this.readCacheKey(channel); + var newKey = this.newCacheKey(this.getHash(str) + oldData); + channel.cacheKey = newKey; + SSC_dump("Set cache key to hash(" + str + ") = " + newKey.data + " for " + channel.URI.spec); + } },
onModifyRequest: function(channel) { @@ -136,7 +141,7 @@ SSC_RequestListener.prototype = // Same-origin policy var referrer; if (parent_host && parent_host != channel.URI.host) { - SSC_dump("Segmenting " + channel.URI.host + + SSC_dump("Segmenting " + channel.URI.spec + " content loaded by " + parent_host); this.setCacheKey(channel, parent_host); referrer = parent_host; @@ -154,7 +159,7 @@ SSC_RequestListener.prototype = } catch (e) {} } else { referrer = channel.URI.host; - if(!this.readCacheKey(channel.cacheKey)) { + if(!this.readCacheKey(channel)) { this.setCacheKey(channel, channel.URI.host); } else { SSC_dump("Existing cache key detected; leaving it unchanged."); @@ -300,9 +305,13 @@ SSC_RequestListener.prototype = },
// Read the integer data contained in a cache key - readCacheKey: function(key) { - key.QueryInterface(Components.interfaces.nsISupportsPRUint32); - return key.data; + readCacheKey: function(channel) { + try { + return channel.cacheDomain; + } catch(e) { + channel.cacheKey.QueryInterface(Components.interfaces.nsISupportsPRUint32); + return channel.cacheKey.data; + } },
// Construct a new cache key with some integer data
tor-commits@lists.torproject.org