Merge services-central with mozilla-central. a=merge

This commit is contained in:
Philipp von Weitershausen 2011-02-26 00:31:54 -08:00
commit c478151b41
4 changed files with 31 additions and 9 deletions

View File

@ -613,7 +613,7 @@ nsFrameScriptExecutor::Shutdown()
void
nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
{
if (!mGlobal || !mCx) {
if (!mGlobal || !mCx || !sCachedScripts) {
return;
}

View File

@ -426,7 +426,7 @@ AsyncExecuteStatements::notifyComplete()
// canceling and have statements that think they have pending work, the
// rollback will fail.
for (PRUint32 i = 0; i < mStatements.Length(); i++)
mStatements[i].finalize();
mStatements[i].finalize(mCallingThread);
// Handle our transaction, if we have one
if (mTransactionManager) {

View File

@ -16,7 +16,7 @@
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
@ -44,6 +44,8 @@
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "nsIEventTarget.h"
#include "nsProxyRelease.h"
#include "mozStorageBindingParamsArray.h"
#include "mozIStorageBaseStatement.h"
@ -65,12 +67,14 @@ public:
, mParamsArray(aParamsArray)
, mStatementOwner(aStatementOwner)
{
NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
}
StatementData(const StatementData &aSource)
: mStatement(aSource.mStatement)
, mParamsArray(aSource.mParamsArray)
, mStatementOwner(aSource.mStatementOwner)
{
NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
}
StatementData()
{
@ -105,13 +109,27 @@ public:
* NULLs out our sqlite3_stmt (it is held by the owner) after reseting it and
* clear all bindings to it. This is expected to occur on the async thread.
*
* We do not clear mParamsArray out because we only want to release
* mParamsArray on the calling thread because of XPCVariant addref/release
* thread-safety issues. The same holds for mStatementOwner which can be
* holding such a reference chain as well.
* @param aReleaseThread
* The thread that we should release mParamsArray and mStatementOwner
* on. This may not be the thread we are called on.
*/
inline void finalize()
inline void finalize(nsIEventTarget *aReleaseThread)
{
NS_PRECONDITION(aReleaseThread, "Must have a non-NULL release thread!");
NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
#ifdef DEBUG
{
nsCOMPtr<nsIEventTarget> asyncThread =
mStatementOwner->getOwner()->getAsyncExecutionTarget();
// It's possible that we are shutting down the async thread, and this
// method would return NULL as a result.
if (asyncThread) {
PRBool onAsyncThread;
NS_ASSERTION(NS_SUCCEEDED(asyncThread->IsOnCurrentThread(&onAsyncThread)) && onAsyncThread,
"This should only be running on the async thread!");
}
}
#endif
// In the AsyncStatement case we may never have populated mStatement if the
// AsyncExecuteStatements got canceled or a failure occurred in constructing
// the statement.
@ -120,6 +138,10 @@ public:
(void)::sqlite3_clear_bindings(mStatement);
mStatement = NULL;
}
(void)NS_ProxyRelease(aReleaseThread, mStatementOwner, PR_TRUE);
if (mParamsArray) {
(void)NS_ProxyRelease(aReleaseThread, mParamsArray, PR_TRUE);
}
}
/**

View File

@ -357,7 +357,7 @@ Submitter.prototype = {
return;
iframe.removeEventListener("load", loadHandler, true);
if (!self.submitForm()) {
this.notifyStatus(FAILED);
self.notifyStatus(FAILED);
self.cleanup();
}
}