Merge bug 465783

This commit is contained in:
Antonio Gomes (tonikitoo) 2009-02-25 03:34:07 -04:00
commit 8d3f38b0f8
7 changed files with 110 additions and 45 deletions

View File

@ -963,6 +963,11 @@ nsContentSink::SelectDocAppCache(nsIApplicationCache *aLoadApplicationCache,
("Selection: assigning app cache %s to document %s", clientID.get(), docURISpec.get()));
#endif
{
// XXX: Debugging 471227
printf("(Bug 471227): setting application cache to %p for document >%p< from SelectDocAppCacheNoManifest\n",
aLoadApplicationCache, applicationCacheDocument.get());
}
rv = applicationCacheDocument->SetApplicationCache(aLoadApplicationCache);
NS_ENSURE_SUCCESS(rv, rv);
@ -1017,6 +1022,12 @@ nsContentSink::SelectDocAppCacheNoManifest(nsIApplicationCache *aLoadApplication
("Selection, no manifest: assigning app cache %s to document %s", clientID.get(), docURISpec.get()));
#endif
{
// XXX: Debugging 471227
printf("(Bug 471227): setting application cache to %p for document >%p< from SelectDocAppCacheNoManifest\n",
aLoadApplicationCache, applicationCacheDocument.get());
}
rv = applicationCacheDocument->SetApplicationCache(aLoadApplicationCache);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -2359,8 +2359,11 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
uri->GetSpec(spec);
}
printf("(Bug 471227): XHR failed for %s: status: %x, appcache: %p\n",
spec.get(), status, appCache.get());
nsCOMPtr<nsIApplicationCacheContainer> container;
NS_QueryNotificationCallbacks(channel, container);
printf("(Bug 471227): XHR failed for %s: status: %x, appcache: %p, doc: %p\n",
spec.get(), status, appCache.get(), container.get());
}
// By nulling out channel here we make it so that Send() can test

View File

@ -0,0 +1,34 @@
var prefetch = Cc["@mozilla.org/prefetch-service;1"].
getService(Ci.nsIPrefetchService);
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
function run_test() {
// Fill up the queue
prefs.setBoolPref("network.prefetch-next", true);
for (var i = 0; i < 5; i++) {
var uri = ios.newURI("http://localhost/" + i, null, null);
prefetch.prefetchURI(uri, uri, null, true);
}
// Make sure the queue has items in it...
var queue = prefetch.enumerateQueue(true, false);
do_check_true(queue.hasMoreElements());
// Now disable the pref to force the queue to empty...
prefs.setBoolPref("network.prefetch-next", false);
queue = prefetch.enumerateQueue(true, false);
do_check_false(queue.hasMoreElements());
// Now reenable the pref, and add more items to the queue.
prefs.setBoolPref("network.prefetch-next", true);
for (var i = 0; i < 5; i++) {
var uri = ios.newURI("http://localhost/" + i, null, null);
prefetch.prefetchURI(uri, uri, null, true);
}
queue = prefetch.enumerateQueue(true, false);
do_check_true(queue.hasMoreElements());
}

View File

@ -1168,6 +1168,10 @@ gfxFontUtils::MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength,
// matching platform/encoding/etc. and store offset/lengths
NameRecordData names[EOTFixedHeader::EOT_NUM_NAMES] = {0};
const NameRecord *nameRecord = reinterpret_cast<const NameRecord*>(aFontData + nameOffset + sizeof(NameHeader));
PRUint32 needNames = (1 << EOTFixedHeader::EOT_FAMILY_NAME_INDEX) |
(1 << EOTFixedHeader::EOT_STYLE_NAME_INDEX) |
(1 << EOTFixedHeader::EOT_FULL_NAME_INDEX) |
(1 << EOTFixedHeader::EOT_VERSION_NAME_INDEX);
for (i = 0; i < nameCount; i++, nameRecord++) {
@ -1182,38 +1186,36 @@ gfxFontUtils::MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength,
case NameRecord::NAME_ID_FAMILY:
names[EOTFixedHeader::EOT_FAMILY_NAME_INDEX].offset = nameRecord->offset;
names[EOTFixedHeader::EOT_FAMILY_NAME_INDEX].length = nameRecord->length;
needNames &= ~(1 << EOTFixedHeader::EOT_FAMILY_NAME_INDEX);
break;
case NameRecord::NAME_ID_STYLE:
names[EOTFixedHeader::EOT_STYLE_NAME_INDEX].offset = nameRecord->offset;
names[EOTFixedHeader::EOT_STYLE_NAME_INDEX].length = nameRecord->length;
needNames &= ~(1 << EOTFixedHeader::EOT_STYLE_NAME_INDEX);
break;
case NameRecord::NAME_ID_FULL:
names[EOTFixedHeader::EOT_FULL_NAME_INDEX].offset = nameRecord->offset;
names[EOTFixedHeader::EOT_FULL_NAME_INDEX].length = nameRecord->length;
needNames &= ~(1 << EOTFixedHeader::EOT_FULL_NAME_INDEX);
break;
case NameRecord::NAME_ID_VERSION:
names[EOTFixedHeader::EOT_VERSION_NAME_INDEX].offset = nameRecord->offset;
names[EOTFixedHeader::EOT_VERSION_NAME_INDEX].length = nameRecord->length;
needNames &= ~(1 << EOTFixedHeader::EOT_VERSION_NAME_INDEX);
break;
default:
break;
}
if (names[EOTFixedHeader::EOT_FAMILY_NAME_INDEX].length &&
names[EOTFixedHeader::EOT_STYLE_NAME_INDEX].length &&
names[EOTFixedHeader::EOT_FULL_NAME_INDEX].length &&
names[EOTFixedHeader::EOT_VERSION_NAME_INDEX].length)
if (needNames == 0)
break;
}
if (!(names[EOTFixedHeader::EOT_FAMILY_NAME_INDEX].length &&
names[EOTFixedHeader::EOT_STYLE_NAME_INDEX].length &&
names[EOTFixedHeader::EOT_FULL_NAME_INDEX].length &&
names[EOTFixedHeader::EOT_VERSION_NAME_INDEX].length))
if (needNames != 0)
{
return NS_ERROR_FAILURE;
}

View File

@ -1603,6 +1603,13 @@ nsHttpChannel::OpenCacheEntry(PRBool offline, PRBool *delayed)
if (appCacheContainer) {
appCacheContainer->GetApplicationCache(getter_AddRefs(mApplicationCache));
{
// XXX: Debugging 471227
if (mApplicationCache) {
printf("(Bug 471227): picked up application cache %p from callbacks (%p)\n",
mApplicationCache.get(), appCacheContainer.get());
}
}
}
}
@ -1617,6 +1624,14 @@ nsHttpChannel::OpenCacheEntry(PRBool offline, PRBool *delayed)
nsresult rv = appCacheService->ChooseApplicationCache
(cacheKey, getter_AddRefs(mApplicationCache));
NS_ENSURE_SUCCESS(rv, rv);
{
// XXX: Debugging 471227
if (mApplicationCache) {
printf("(Bug 471227): chose application cache %p\n",
mApplicationCache.get());
}
}
}
}

View File

@ -1179,6 +1179,9 @@ nsOfflineCacheUpdate::Init(nsIURI *aManifestURI,
rv = mApplicationCache->GetClientID(mClientID);
NS_ENSURE_SUCCESS(rv, rv);
printf("(Bug 471227) Initializing cache update %p, created %p\n",
this, mApplicationCache.get());
mState = STATE_INITIALIZED;
return NS_OK;
}
@ -1852,6 +1855,10 @@ nsOfflineCacheUpdate::AssociateDocument(nsIDOMDocument *aDocument)
if (!existingCache) {
LOG(("Update %p: associating app cache %s to document %p", this, mClientID.get(), aDocument));
{
printf("(Bug 471227): associating app cache %p with document >%p< from nsOfflineCacheUpdate %p\n",
mApplicationCache.get(), container.get(), this);
}
rv = container->SetApplicationCache(mApplicationCache);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -157,28 +157,28 @@ nsPrefetchQueueEnumerator::GetNext(nsISupports **aItem)
void
nsPrefetchQueueEnumerator::Increment()
{
do {
if (!mStarted) {
// If the service is currently serving a request, it won't be
// in the pending queue, so we return it first. If it isn't,
// we'll just start with the pending queue.
mStarted = PR_TRUE;
mCurrent = mService->GetCurrentNode();
if (!mCurrent)
mCurrent = mService->GetQueueHead();
}
else if (mCurrent) {
if (mCurrent == mService->GetCurrentNode()) {
// If we just returned the node being processed by the service,
// start with the pending queue
mCurrent = mService->GetQueueHead();
}
else {
// Otherwise just advance to the next item in the queue
mCurrent = mCurrent->mNext;
}
}
} while (mCurrent);
if (!mStarted) {
// If the service is currently serving a request, it won't be in
// the pending queue, so we return it first. If it isn't, we'll
// just start with the pending queue.
mStarted = PR_TRUE;
mCurrent = mService->GetCurrentNode();
if (!mCurrent)
mCurrent = mService->GetQueueHead();
return;
}
if (mCurrent) {
if (mCurrent == mService->GetCurrentNode()) {
// If we just returned the node being processed by the service,
// start with the pending queue
mCurrent = mService->GetQueueHead();
}
else {
// Otherwise just advance to the next item in the queue
mCurrent = mCurrent->mNext;
}
}
}
//-----------------------------------------------------------------------------
@ -586,19 +586,10 @@ nsPrefetchService::DequeueNode(nsPrefetchNode **node)
void
nsPrefetchService::EmptyQueue()
{
nsPrefetchNode *prev = 0;
nsPrefetchNode *node = mQueueHead;
while (node) {
nsPrefetchNode *next = node->mNext;
if (prev)
prev->mNext = next;
else
mQueueHead = next;
NS_RELEASE(node);
node = next;
}
do {
nsRefPtr<nsPrefetchNode> node;
DequeueNode(getter_AddRefs(node));
} while (mQueueHead);
}
void
@ -951,6 +942,7 @@ nsPrefetchService::Observe(nsISupports *aSubject,
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
StopPrefetching();
EmptyQueue();
mDisabled = PR_TRUE;
}
else if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
@ -968,6 +960,7 @@ nsPrefetchService::Observe(nsISupports *aSubject,
if (!mDisabled) {
LOG(("disabling prefetching\n"));
StopPrefetching();
EmptyQueue();
mDisabled = PR_TRUE;
RemoveProgressListener();
}