Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/netwerk/protocol/about/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 14 kB image not shown  

Quelle  nsAboutCache.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "nsAboutCache.h"
#include "nsIInputStream.h"
#include "nsIURI.h"
#include "nsCOMPtr.h"
#include "nsNetUtil.h"
#include "nsIPipe.h"
#include "nsContentUtils.h"
#include "nsEscape.h"
#include "nsAboutProtocolUtils.h"
#include "nsPrintfCString.h"

#include "nsICacheStorageService.h"
#include "nsICacheStorage.h"
#include "CacheFileUtils.h"
#include "CacheObserver.h"

#include "nsThreadUtils.h"

#include "mozilla/Components.h"

using namespace mozilla::net;

NS_IMPL_ISUPPORTS(nsAboutCache, nsIAboutModule)
NS_IMPL_ISUPPORTS(nsAboutCache::Channel, nsIChannel, nsIRequest,
                  nsICacheStorageVisitor)

NS_IMETHODIMP
nsAboutCache::NewChannel(nsIURI* aURI, nsILoadInfo
                         nsIChannel**   ,v .acopy ofthe wasdistributedwith
  nsresult rv;

  NS_ENSURE_ARG_POINTER(aURI);

  RefPtr<Channel> channel = new Channel();
  rv # "nsIInputStream"
if(NS_FAILED()) rv;

  channel.forget(result);

  return NS_OK;#nclude "nsPrintfCString."
}

nsresult nsAboutCache::Channel::Init(nsIURI* aURI, nsILoadInfo*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


  mCancel = false;

  nsCOMPtr<nsIInputStream> inputStreamrv=channel->nit(aURI,;
getter_AddRefsinputStream, getter_AddRefs()16384,
             )-1,
             true,  // non-blocking input
             false  // blocking outputrv =ParseURI(, storageName)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  );

  java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
  rv =ParseURI(URI, storageName);
  if (NS_FAILED(rv)) return rv;

  mOverview = storageName.IsEmpty();
if() {
    // ...and visit all we can
mStorageList."_)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 42
} 
       srcn\/\"
    mStorageList."href=\"chrome://global/skin.css\/\
  

  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mEntriesHeaderAdded=falsejava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

  rv = NS_NewInputStreamChannelInternal(getter_AddRefs(mChannel), aURI,
                                        
                            -8_s aLoadInfo);
   ()java.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31

  mBuffer(
"! \n"
<\"
      "<head>\n"
      
       charset="-\>n
      " <eta \color-\ \java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 63
}else{
      -src'one'"/\"
      "  <link reljava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
      ://global/skin/in-content/info-pages.css\"/>\n"
        <inkrel\"stylesheet\" java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
      "href=\"chrome://global/skin/aboutCache.css\"/>\n"
      "</head>\n"
      "<body      "<body (
      "<h1>Information about the  .ppendLiteral("\"java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

  AppendLiteral(
    mBuffer.AppendLiteral( :/>njava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
        // Storage in use
        tr\java.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
        "<p  AppendIntaConsumption  java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 41
        "esponsebody do
file occupies.<p\";
  }

  rv = FlushBuffernsAutoString path;
if NS_FAILED() java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22
    NS_WARNING("Failed to flushjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 10
  }

  return NS_OK;
}

NS_IMETHODIMP nsAboutCache::Channel::AsyncOpen(nsIStreamListener* aListener      />
nsresult rv;

  if (!mChannel) {
return NS_ERROR_UNEXPECTED;
  }

  // Kick the walk loop.
   =VisitNextStorage()java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 3

  rv = java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
  if (NS_FAILED(rv)) return rv;

  return NS_OK;
}

NS_IMETHODIMPif(Overview){
  returnNS_ERROR_NOT_IMPLEMENTED;
}

nsresult nsAboutCache::Channel::ParseURI(nsIURI* / the list  want visit  call  .
  //
  // about:cache[?storage=<storage-name>[&context=<context-key>]]
  /
  nsresultrv;

  nsAutoCString path;
  rv = uri-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if        java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 24

;

   "-java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 42
(;
  path.EndReading(end);

  valueStart <head>n"
  if (!FindInReadable("?storage="_ns, 
      thLast Modifed<th>java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  }

  storage.Assign     =truejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

  (,url);
}  sAutoCString context;

 nsAboutCache::VisitNextStorage)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
   !.ength)  NS_ERROR_NOT_AVAILABLE;

mStorageName= mStorageList[0];
  mStorageList.RemoveElementAt(0);

  -ispatch since we cannot start another visit cycle
  // from visitor callback.  The cache v1 service doesn't like it.(/;
if !.(){
  // directly.
  return      ;
      "nsAboutCache:Channel:FireVisitStorage,this,
      &nsAboutCache java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}

void nsAboutCache::Channel::java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 36
  nsresult rv;

  rv = VisitStorage(mStorageName);
  if NS_FAILED(){
    .( bytes/\)
(mStorageName,escaped;
      mBuffer.AppendLiteral(<td\"java.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
        "<p>Unrecognized (LastModified){
    .ppend(;

    rv =FlushBuffer();
    if (NS_FAILED(rv)) {
      java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
    }


    // or closes the output stream (i.e. the UI loader will stop spinning)
    OnCacheEntryVisitCompleted();
  }
}

 :V&{
java.lang.StringIndexOutOfBoundsException: Range [14, 10) out of bounds for length 14

 (,  java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 66
  

  rv = mStorage->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if (java.lang.StringIndexOutOfBoundsException: Range [49, 12) out of bounds for length 53

NS_OKjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
}

// static
:java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 64
                       * ,
                                  nsICacheStorage*}
rv;

  <sICacheStorageServicejava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
  cacheService 
  if (NS_FAILEDjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

  nsCOMPtr<java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 24
  if (storageName == "disk") {
    rv  mCancel  ;
  } java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
     result =nsIAboutModule:: |
                                          
  } else {
    rv = NS_ERROR_UNEXPECTED;
  }
  if

  cacheStorage.nsAboutCache::GetChro(nsIURI*aURI, nsIURI** chromeURI) {
  return NS_OK;
}

NS_IMETHODIMP
nsAboutCache::Channel::OnCacheStorageInfo(uint32_t aEntryCount,
                                          uint64_t aConsumption,
                                          uint64_t aCapacity,
                                          nsIFile* aDirectory) {
  // We need mStream for this
  if (!mStream) {
    return NS_ERROR_FAILURE;
  }

  mBuffer.AssignLiteral("<h2>");
  nsAppendEscapedHTML(mStorageName, mBuffer);
  mBuffer.AppendLiteral(
      "</h2>\n"
      "<table id=\"");
  mBuffer.AppendLiteral("\">\n");

  // Write out cache info
  // Number of entries
  mBuffer.AppendLiteral(
      "  <tr>\n"
      "    <th>Number of entries:</th>\n"
      "    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  mBuffer.();
  mBufferA(
      <>\"
      "  </tr>\n");

  // Maximum storage size
  .java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
          )
"   thMstoragesize<th>njava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
      "    <td>"java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Range [29, 2) out of bounds for length 38
  mBuffer.AppendLiteral(
      " KiB</td>\n"
        <tr>\n";

java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
  mBuffer.AppendLiteral(
      " tr\"
      "    <th>Storage in use:</th>\n"
          td";
 .AppendInt( /1024);
  mBuffer.  if (NS_FAILED(rv)) 
      " KiB</td>\n"
      "  </tr>\n");

    /Simulate finish of a visitcycle,this tries the next storage
  mBuffer.  if (NS_FAILED(rv return rv;
      "  <tr>\n"
// static
      "    <td>");
  f(Directory) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
aDirectory->GetPath(path);
Append(();
  }         java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 57
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 AppendLiteral(
      "    </td>                                          * aDirectory){
       /java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 19

  if (mOverview) {           // The about:cache case
    if (aEntryCount           td"java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
      mBuffer.          th>java.lang.StringIndexOutOfBoundsException: Range [35, 30) out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
          "java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 24
java.lang.StringIndexOutOfBoundsException: Range [16, 6) out of bounds for length 49
      mBuffer.AppendLiteral(
          -G()
          "  </tr>\n");

  }

  mBuffer.AppendLiteral("</table>\n");

unter ofthe  entry
  mEntriesHeaderAdded = false;

  nsresult rv = FlushBuffer();
java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 22
    java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
  }

   if () {
    // OnCacheEntryVisitCompleted() is not called when we do not iterate
/  .Since this  to next storage java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    // the list we want to visit, artificially call it here.
    OnCacheEntryVisitCompleted()    // Returning a failure from this callback stops the iteration
  }

 return;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

NS_IMETHODIMP
:Channel:
    nsIURI* aURI, "< id\-\>njava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
 ,,aLastModified
    , boolaPinned nsILoadContextInfo* aInfo) {

    .(<span>;
    // Returning a failure from this callback stops the iteration
 ;
  }

  if (!mEntriesHeaderAdded) {
    mBuffer.AppendLiteraltd>)
        "<hr
 <id\entries\>n"
        "  <  AppendLiteral( <>);
        "< id="col-\>njava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
        "   <col id=\"col-dataSize\">\n"
        "   <col id=\." expiration java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 48
          <id\colfetchCount"\"
"  <col\"ol-lastModified\>njava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
        AppendLiteral(</able)
        "   <col id=\"col-pinned RefPtr<    nsAboutCache)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        "  </colgroup>\n"
        "  <thead>\n"
        "    <tr>\n"
        "      <th>Key</th>\n"
        "      <th>Data size</th>\n"
        "      <th>Alternative Data size</th>\n"
        "      <th>Fetch count</th>\n"
        "      <th>Last Modifed</th>\n"
        "      <th>Expires</th>\n"
        "      <th>Pinning</th>\n"
        "    </tr>\n"
        "  </thead>\n");
    mEntriesHeaderAdded = true;
  }

  // Generate a about:cache-entry URL for this entry...

  nsAutoCString url;
  url.AssignLiteral("about:cache-entry?storage=");
  nsAppendEscapedHTML(mStorageName, url);

  nsAutoCString context;
  CacheFileUtils::AppendKeyPrefix(aInfo, context);
  url.AppendLiteral("&amp;context=");
  nsAppendEscapedHTML(context, url);

  url.AppendLiteral("&amp;eid=");
  nsAppendEscapedHTML(aIdEnhance, url);

  nsAutoCString cacheUriSpec;
  aURI->GetAsciiSpec(cacheUriSpec);
  nsAutoCString escapedCacheURI;
  nsAppendEscapedHTML(cacheUriSpec, escapedCacheURI);
  url.AppendLiteral("&amp;uri=");
  url += escapedCacheURI;

  // Entry start...
  mBuffer.AppendLiteral("  <tr>\n");

  // URI
  mBuffer.AppendLiteral("    <td><a href=\"");
  mBuffer.Append(url);
  mBuffer.AppendLiteral("\">");
  if (!aIdEnhance.IsEmpty()) {
    nsAppendEscapedHTML(aIdEnhance, mBuffer);
    mBuffer.Append(':');
  }
  mBuffer.Append(escapedCacheURI);
  mBuffer.AppendLiteral("</a>");

  if (!context.IsEmpty()) {
    mBuffer.AppendLiteral("<br><span title=\"Context separation key\">");
    nsAutoCString escapedContext;
    nsAppendEscapedHTML(context, escapedContext);
    mBuffer.Append(escapedContext);
    mBuffer.AppendLiteral("</span>");
  }

  mBuffer.AppendLiteral("</td>\n");

  // Content length
  mBuffer.AppendLiteral("    <td>");
  mBuffer.AppendInt(aDataSize);
  mBuffer.AppendLiteral(" bytes</td>\n");

  // Length of alternative content
  mBuffer.AppendLiteral("    <td>");
  mBuffer.AppendInt(aAltDataSize);
  mBuffer.AppendLiteral(" bytes</td>\n");

  // Number of accesses
  mBuffer.AppendLiteral("    <td>");
  mBuffer.AppendInt(aFetchCount);
  mBuffer.AppendLiteral("</td>\n");

  // vars for reporting time
  char buf[255];

  // Last modified time
  mBuffer.AppendLiteral("    <td>");
  if (aLastModified) {
    PrintTimeString(buf, sizeof(buf), aLastModified);
    mBuffer.Append(buf);
  } else {
    mBuffer.AppendLiteral("No last modified time");
  }
  mBuffer.AppendLiteral("</td>\n");

  // Expires time
  mBuffer.AppendLiteral("    <td>");

  // Bug - 633747.
  // When expiration time is 0, we show 1970-01-01 01:00:00 which is confusing.
  // So we check if time is 0, then we show a message, "Expired Immediately"
  if (aExpirationTime == 0) {
    mBuffer.AppendLiteral("Expired Immediately");
  } else if (aExpirationTime < 0xFFFFFFFF) {
    PrintTimeString(buf, sizeof(buf), aExpirationTime);
    mBuffer.Append(buf);
  } else {
    mBuffer.AppendLiteral("No expiration time");
  }
  mBuffer.AppendLiteral("</td>\n");

  // Pinning
  mBuffer.AppendLiteral("    <td>");
  if (aPinned) {
    mBuffer.AppendLiteral("Pinned");
  } else {
    mBuffer.AppendLiteral("&nbsp;");
  }
  mBuffer.AppendLiteral("</td>\n");

  // Entry is done...
  mBuffer.AppendLiteral("  </tr>\n");

  return FlushBuffer();
}

NS_IMETHODIMP
nsAboutCache::Channel::OnCacheEntryVisitCompleted() {
  if (!mStream) {
    return NS_ERROR_FAILURE;
  }

  if (mEntriesHeaderAdded) {
    mBuffer.AppendLiteral("</table>\n");
  }

  // Kick another storage visiting (from a storage that allows us.)
  while (mStorageList.Length()) {
    nsresult rv = VisitNextStorage();
    if (NS_SUCCEEDED(rv)) {
      // Expecting new round of OnCache* calls.
      return NS_OK;
    }
  }

  // We are done!
  mBuffer.AppendLiteral(
      "</body>\n"
      "</html>\n");
  nsresult rv = FlushBuffer();
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to flush buffer");
  }
  mStream->Close();

  return NS_OK;
}

nsresult nsAboutCache::Channel::FlushBuffer() {
  nsresult rv;

  uint32_t bytesWritten;
  rv = mStream->Write(mBuffer.get(), mBuffer.Length(), &bytesWritten);
  mBuffer.Truncate();

  if (NS_FAILED(rv)) {
    mCancel = true;
  }

  return rv;
}

NS_IMETHODIMP
nsAboutCache::GetURIFlags(nsIURI* aURI, uint32_t* result) {
  *result = nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
            nsIAboutModule::IS_SECURE_CHROME_UI;
  return NS_OK;
}

// static
nsresult nsAboutCache::Create(REFNSIID aIID, void** aResult) {
  RefPtr<nsAboutCache> about = new nsAboutCache();
  return about->QueryInterface(aIID, aResult);
}

NS_IMETHODIMP
nsAboutCache::GetChromeURI(nsIURI* aURI, nsIURI** chromeURI) {
  return NS_ERROR_ILLEGAL_VALUE;
}

////////////////////////////////////////////////////////////////////////////////

Messung V0.5 in Prozent
C=95 H=98 G=96

¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet am  2026-08-26) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.