bug 878702 remove use of no-store header when deciding sharable state of a page, r=gavin
authorShane Caraveo <scaraveo@mozilla.com>
Fri, 21 Jun 2013 15:22:30 -0700
changeset 147527 75948a6ea38dab47aafa7132ba17a099d95c09ec
parent 147526 dda6f2aa52251ff1615de2c02e51c990b510aa86
child 147528 6c236b24064bbd67c167165cd5958c2b432df7a1
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs878702
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 878702 remove use of no-store header when deciding sharable state of a page, r=gavin
browser/base/content/browser-social.js
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -666,53 +666,16 @@ SocialShare = {
 
   canSharePage: function(aURI) {
     // we do not enable sharing from private sessions
     if (PrivateBrowsingUtils.isWindowPrivate(window))
       return false;
 
     if (!aURI || !(aURI.schemeIs('http') || aURI.schemeIs('https')))
       return false;
-
-    // The share button and context menus are disabled if the current tab has
-    // defined no-store. However, a share from other content is still possible
-    // (eg. via mozSocial or future use of web activities).  If the URI is not
-    // the current tab URI, we cannot validate the no-store header on the URI.
-    if (aURI != gBrowser.currentURI)
-      return true;
-
-    // we want to ensure this is a successful load and that the page is locally
-    // cacheable since that is a common mechanism for sensitive pages to avoid
-    // storing sensitive data in cache.
-    let channel = gBrowser.docShell.currentDocumentChannel;
-    let httpChannel;
-    try {
-      httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
-    } catch (e) {
-      /* Not an HTTP channel. */
-      Cu.reportError("cannot share without httpChannel");
-      return false;
-    }
-
-    // Continue only if we have a 2xx status code.
-    try {
-      if (!httpChannel.requestSucceeded)
-        return false;
-    } catch (e) {
-      // Can't get response information from the httpChannel
-      // because mResponseHead is not available.
-      return false;
-    }
-
-    // Cache-Control: no-store.
-    if (httpChannel.isNoStoreResponse()) {
-      Cu.reportError("cannot share cache-control: no-share");
-      return false;
-    }
-
     return true;
   },
 
   update: function() {
     let shareButton = this.shareButton;
     shareButton.hidden = !SocialUI.enabled ||
                          [p for (p of Social.providers) if (p.shareURL)].length == 0;
     shareButton.disabled = shareButton.hidden || !this.canSharePage(gBrowser.currentURI);