Closed Bug 281021 Opened 19 years ago Closed 8 years ago

Exception ``[Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: foo.js :: bar :: line 2032"

Categories

(Core :: Networking: Cache, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: timeless, Unassigned)

References

Details

I only have one or two questions for the cacheservice, they pertain to:

Exception ``[Exception... "Component returned failure code: 0xc1f30001
(NS_ERROR_NOT_INITIALIZED) [nsICacheService.evictEntries]" nsresult: "0xc1f30001
(NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: foo.js :: bar :: line 2032"
data: no]'' thrown from function bar() in <foo.js> line 2032.
Stopped for thrown exception.
#0: function bar() in <foo.js> line 2032
2030: try {
2031: var cacheService =
Components.classes['@mozilla.org/network/cache-service;1'].getService(nsICacheService);
2032: cacheService.evictEntries(nsICache.STORE_ON_DISK);
2033: cacheService.evictEntries(nsICache.STORE_IN_MEMORY);

Tested: mozilla1.8a5. The changes for bug 266051 are part of that release.

Expected results: no exception or a way to find out that cache isn't initialized
so i know not to call it.

nsDiskCacheDevice::EvictEntries(const char * clientID)
{
    if (!Initialized())  return NS_ERROR_NOT_INITIALIZED;

-	this	0x01744ad4 {mCacheDirectory={...} mBindery={ops={allocTable=0x00b7e978
PL_DHashAllocTable freeTable=0x00b7e972 PL_DHashFreeTable getKey=0x00b5cb30
GetKey(PLDHashTable *, PLDHashEntryHdr *) ...} table={ops=0x00000001
{allocTable=??? freeTable=??? getKey=??? ...} data=0x0000157c hashShift=0 ...}
initialized=0 } mCacheCapacity=0 ...}	nsDiskCacheDevice * const


>	necko.dll!nsDiskCacheDevice::EvictEntries(const char * clientID=0x00000000)
 Line 789	C++
 	necko.dll!nsCacheService::EvictEntriesForClient(const char *
clientID=0x00000000, int storagePolicy=2)  Line 579	C++
 	necko.dll!nsCacheService::EvictEntries(int storagePolicy=2)  Line 665	C++
 	xpcom_core.dll!XPTC_InvokeByIndex(nsISupports * that=0x0012eba4, unsigned int
methodIndex=11153501, unsigned int paramCount=24484336, nsXPTCVariant *
params=0x00000005)  Line 102	C++
 	xpc3250.dll!AutoJSSuspendRequest::SuspendRequest()  Line 2968 + 0x9	C++
 	xpc3250.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx={...},
XPCWrappedNative::CallMode mode=CALL_METHOD)  Line 2034 + 0x16	C++

Questions:
1. why am i getting an exception for something i can't check?
2. how should i find out that the cacheservice is not initialized so that i can
avoid getting the exception?
-> default owner
Assignee: darin → nobody
I had a similar problem but solved it by adding an epilogue to my onreadystatechange() function

if (xmlHttp.readyState==4)
{
	// Do whatever you need to do 
	// ....
	// Cleanup 
	xmlhttp.onreadystatechange = function() {};	// Reasign to avoid recalling onreadystatechange() on next line (fires ReadyState=4)
	xmlhttp.abort();							// Clear xmlhttp-session to avoid exception error NS_ERROR_NOT_INITIALIZED
}

The problem occured inside a class constructor-function: var xmlObj = new XMLHttpObj({params})

There was no error if the script was cleared from browser cache and then reloaded by a hard-reload 
but the error was trown if a secondary reload was performed without clearing the cache 

The error occured despite the fact that:
	- the code causing the error recided inside a function
	- the function was never called
	- the returned object was not reused (new operand)

Might give someone a clue?
My 'solution' removed the exception error from the situation above but caused the same error to be trown in other situationes. Besides it caused responseText/ responseXML to be cleared so I moved the code to where I call send(null)

It seems that reseting onreadystatechange-handler and call abort() just before calling send(null) solved the problem

Ps! Before moving the code I observed that the error often was triggered by activity (eg. mouseclick) in other browser-tabs (XMLHttpRequest() not thread-safe?)

I will report again if the error shows up again
... and it did

The explanation is:

1.
Referencing certain properties in a XMLHttpRequest-object while its in pending state throws the Exception NS_ERROR_NOT_INITIALIZED. Calling getAllResponseHeaders(), getResponseHeader(), setRequestHeader() or send()or referencing status or statusText throws the Exception (may be more..)

2.
Calling send() for a pending XMLHttpRequest-object may cause 2 documents to arrive. onload() fires when readystate==4 and the Exception gets thrown when the next document arrives
I've looked everywhere and can't find someone who has the same problem as myself.  I hope you can help...

Error: NS_ERROR_NOT_INITIALIZED: Component returned failure code: 0xc1f30001 [nslMsgFolder.compareSortKeys]
Source File: chrome://messenger/content/folderPane.js  Line 2426

Symptoms: My folder pane is completely empty and my address book doesn't show anything either.  But, I do see the data there in the folders.  I'm using MAC OS vs. 10.6.8 and tried uninstalling the most current version of TB and even went back to several versions older, but still having the same symptoms.
whole new cache code..
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.