Bug 1320404 - Remove appId from origin attributes - part 4 - necko, r=valentin
☠☠ backed out by 04557fa70ce8 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 02 May 2019 17:25:05 +0000
changeset 531221 7c2f4e64d38e0405f9ff86d16f3d51d1e9f3306c
parent 531220 a7e7c02511798c661d48abedd7358f10e7efc507
child 531222 d6416b8998419c628c2383cf768bf2c5845931bf
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1320404
milestone68.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 1320404 - Remove appId from origin attributes - part 4 - necko, r=valentin Differential Revision: https://phabricator.services.mozilla.com/D29356
netwerk/cache2/CacheStorageService.cpp
netwerk/protocol/about/nsAboutCache.cpp
netwerk/protocol/http/nsHttpChannel.h
netwerk/test/unit/test_cache_jar.js
toolkit/components/aboutcache/content/aboutCache.js
--- a/netwerk/cache2/CacheStorageService.cpp
+++ b/netwerk/cache2/CacheStorageService.cpp
@@ -52,17 +52,17 @@ void AppendMemoryStorageTag(nsAutoCStrin
 // Not defining as static or class member of CacheStorageService since
 // it would otherwise need to include CacheEntry.h and that then would
 // need to be exported to make nsNetModule.cpp compilable.
 typedef nsClassHashtable<nsCStringHashKey, CacheEntryTable> GlobalEntryTables;
 
 /**
  * Keeps tables of entries.  There is one entries table for each distinct load
  * context type.  The distinction is based on following load context info
- * states: <isPrivate|isAnon|appId|inIsolatedMozBrowser> which builds a mapping
+ * states: <isPrivate|isAnon|inIsolatedMozBrowser> which builds a mapping
  * key.
  *
  * Thread-safe to access, protected by the service mutex.
  */
 static GlobalEntryTables* sGlobalEntryTables;
 
 CacheMemoryConsumer::CacheMemoryConsumer(uint32_t aFlags)
     : mReportedMemoryConsumption(0), mFlags(aFlags) {}
--- a/netwerk/protocol/about/nsAboutCache.cpp
+++ b/netwerk/protocol/about/nsAboutCache.cpp
@@ -95,22 +95,20 @@ nsresult nsAboutCache::Channel::Init(nsI
       "<body class=\"aboutPageWideContainer\">\n"
       "<h1>Information about the Network Cache Storage Service</h1>\n");
 
   // Add the context switch controls
   mBuffer.AppendLiteral(
       "<label><input id='priv' type='checkbox'/> Private</label>\n"
       "<label><input id='anon' type='checkbox'/> Anonymous</label>\n");
 
-  // Visit scoping by browser and appid is not implemented for
-  // the old cache, simply don't add these controls.
-  // The appid/inbrowser entries are already mixed in the default
-  // view anyway.
+  // Visit scoping by browseris not implemented for the old cache, simply don't
+  // add these controls.  The inbrowser entries are already mixed in the
+  // default view anyway.
   mBuffer.AppendLiteral(
-      "<label><input id='appid' type='text' size='6'/> AppID</label>\n"
       "<label><input id='inbrowser' type='checkbox'/> In Browser "
       "Element</label>\n");
 
   mBuffer.AppendLiteral(
       "<label><input id='submit' type='button' value='Update'/></label>\n");
 
   if (!mOverview) {
     mBuffer.AppendLiteral("<a href=\"about:cache?storage=&amp;context=");
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -543,17 +543,17 @@ class nsHttpChannel final : public HttpB
 
   void SetLoadGroupUserAgentOverride();
 
   void SetOriginHeader();
   void SetDoNotTrack();
 
   bool IsIsolated();
 
-  const nsCString &GetTopWindowOrigin();
+  const nsCString& GetTopWindowOrigin();
 
   already_AddRefed<nsChannelClassifier> GetOrCreateChannelClassifier();
 
   // Start an internal redirect to a new InterceptedHttpChannel which will
   // resolve in firing a ServiceWorker FetchEvent.
   MOZ_MUST_USE nsresult RedirectToInterceptedChannel();
 
   // Determines and sets content type in the cache entry. It's called when
@@ -692,17 +692,17 @@ class nsHttpChannel final : public HttpB
   // had been loaded from cache. If not, then an error has to be propagated
   // to the consumer.
   uint32_t mConcurrentCacheAccess : 1;
   // whether the request is setup be byte-range
   uint32_t mIsPartialRequest : 1;
   // true iff there is AutoRedirectVetoNotifier on the stack
   uint32_t mHasAutoRedirectVetoNotifier : 1;
   // consumers set this to true to use cache pinning, this has effect
-  // only when the channel is in an app context (load context has an appid)
+  // only when the channel is in an app context
   uint32_t mPinCacheContent : 1;
   // True if CORS preflight has been performed
   uint32_t mIsCorsPreflightDone : 1;
 
   // if the http transaction was performed (i.e. not cached) and
   // the result in OnStopRequest was known to be correctly delimited
   // by chunking, content-length, or h2 end-stream framing
   uint32_t mStronglyFramed : 1;
--- a/netwerk/test/unit/test_cache_jar.js
+++ b/netwerk/test/unit/test_cache_jar.js
@@ -25,61 +25,37 @@ function makeChan(url, inIsolatedMozBrow
   return chan;
 }
 
 // [inIsolatedMozBrowser, userContextId, expected_handlers_called]
 var firstTests = [
   [false, 0, 1], [true, 0, 1], [false, 1, 1], [true, 1, 1],
 ];
 var secondTests = [
-  [false, 0, 0], [true, 0, 0], [false, 1, 0], [true, 1, 0],
-];
-var thirdTests = [
-  [false, 0, 0], [true, 0, 0], [false, 1, 0], [true, 1, 0],
-];
-var fourthTests = [
   [false, 0, 0], [true, 0, 0], [false, 1, 1], [true, 1, 0],
 ];
 
 async function run_all_tests() {
   for (let test of firstTests) {
     handlers_called = 0;
     await test_channel(...test);
   }
 
   // We can't easily cause webapp data to be cleared from the child process, so skip
   // the rest of these tests.
   let procType = Cc["@mozilla.org/xre/runtime;1"].getService(Ci.nsIXULRuntime).processType;
   if (procType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT)
     return;
 
-  let attrs_inBrowser = { inIsolatedMozBrowser:true };
-  let attrs_notInBrowser = { };
-
-  Services.clearData.deleteDataFromOriginAttributesPattern(attrs_inBrowser);
+  Services.clearData.deleteDataFromOriginAttributesPattern({ userContextId: 1 });
 
   for (let test of secondTests) {
     handlers_called = 0;
     await test_channel(...test);
   }
-
-  Services.clearData.deleteDataFromOriginAttributesPattern(attrs_notInBrowser);
-  Services.clearData.deleteDataFromOriginAttributesPattern(attrs_inBrowser);
-
-  for (let test of thirdTests) {
-    handlers_called = 0;
-    await test_channel(...test);
-  }
-
-  Services.clearData.deleteDataFromOriginAttributesPattern({ userContextId: 1 });
-
-  for (let test of fourthTests) {
-    handlers_called = 0;
-    await test_channel(...test);
-  }
 }
 
 function run_test() {
   do_get_profile();
 
   do_test_pending();
 
   Services.prefs.setBoolPref("network.http.rcwn.enabled", false);
--- a/toolkit/components/aboutcache/content/aboutCache.js
+++ b/toolkit/components/aboutcache/content/aboutCache.js
@@ -6,41 +6,35 @@
 // Note: window.location.search doesn't work with nsSimpleURIs used for about:* addresses.
 var search = window.location.href.match(/^.*\?(.*)$/);
 var searchParams = new URLSearchParams(search ? search[1] : "");
 var storage = searchParams.get("storage") || "";
 var cacheContext = searchParams.get("context");
 
 // The context is in a format as used by the HTTP cache v2 back end
 if (cacheContext)
-  var [context, isAnon, isInBrowser, appId, isPrivate] = cacheContext.match(/(a,)?(b,)?(i\d+,)?(p,)?/);
-if (appId)
-  appId = appId.match(/i(\d+),/)[1];
-
+  var [context, isAnon, isInBrowser, isPrivate] = cacheContext.match(/(a,)?(b,)?(p,)?/);
 
 function $(id) { return document.getElementById(id) || {}; }
 
 // Initialize the context UI controls at the start according what we got in the "context=" argument
 addEventListener("DOMContentLoaded", function() {
   $("anon").checked = !!isAnon;
   $("inbrowser").checked = !!isInBrowser;
-  $("appid").value = appId || "";
   $("priv").checked = !!isPrivate;
 }, false);
 
 // When user presses the [Update] button, we build a new context key according the UI control
 // values and navigate to a new about:cache?storage=<name>&context=<key> URL.
 function navigate() {
   context = "";
   if ($("anon").checked)
     context += "a,";
   if ($("inbrowser").checked)
     context += "b,";
-  if ($("appid").value)
-    context += "i" + $("appid").value + ",";
   if ($("priv").checked)
     context += "p,";
 
   window.location.href = "about:cache?storage=" + storage + "&context=" + context;
 }
 
 let submitButton = document.getElementById("submit");
 submitButton.addEventListener("click", navigate);