Back out bug 436965

This commit is contained in:
Olli Pettay 2009-01-02 16:31:13 +02:00
parent f4bf461d7e
commit ed62696892
6 changed files with 28 additions and 62 deletions

View File

@ -5115,18 +5115,6 @@ nsDocument::FlushSkinBindings()
BindingManager()->FlushSkinBindings();
}
class nsFrameLoaderRunner : public nsRunnable
{
public:
nsFrameLoaderRunner(nsDocument* aDoc) : mDoc(aDoc) {}
NS_IMETHOD Run() {
mDoc->InitializeFinalizeFrameLoaders();
return NS_OK;
}
private:
nsRefPtr<nsDocument> mDoc;
};
nsresult
nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
{
@ -5137,12 +5125,11 @@ nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
"document is being deleted");
return NS_ERROR_FAILURE;
}
mInitializableFrameLoaders.AppendElement(aLoader);
if (!mFrameLoaderRunner) {
mFrameLoaderRunner = new nsFrameLoaderRunner(this);
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
if (mUpdateNestLevel == 0 && !mDelayFrameLoaderInitialization) {
nsRefPtr<nsFrameLoader> loader = aLoader;
return loader->ReallyStartLoading();
} else {
mInitializableFrameLoaders.AppendElement(aLoader);
}
return NS_OK;
}
@ -5154,12 +5141,11 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader)
if (mInDestructor) {
return NS_ERROR_FAILURE;
}
mFinalizableFrameLoaders.AppendElement(aLoader);
if (!mFrameLoaderRunner) {
mFrameLoaderRunner = new nsFrameLoaderRunner(this);
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
if (mUpdateNestLevel == 0) {
nsRefPtr<nsFrameLoader> loader = aLoader;
loader->Finalize();
} else {
mFinalizableFrameLoaders.AppendElement(aLoader);
}
return NS_OK;
}
@ -5167,11 +5153,8 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader)
void
nsDocument::InitializeFinalizeFrameLoaders()
{
mFrameLoaderRunner = nsnull;
if (mDelayFrameLoaderInitialization || mUpdateNestLevel != 0) {
return;
}
NS_ASSERTION(mUpdateNestLevel == 0 && !mDelayFrameLoaderInitialization,
"Wrong time to call InitializeFinalizeFrameLoaders!");
// Don't use a temporary array for mInitializableFrameLoaders, because
// loading a frame may cause some other frameloader to be removed from the
// array. But be careful to keep the loader alive when starting the load!

View File

@ -997,7 +997,6 @@ public:
nsresult CloneDocHelper(nsDocument* clone) const;
void InitializeFinalizeFrameLoaders();
protected:
void RegisterNamedItems(nsIContent *aContent);
@ -1017,6 +1016,8 @@ protected:
void DispatchContentLoadedEvents();
void InitializeFinalizeFrameLoaders();
void RetrieveRelevantHeaders(nsIChannel *aChannel);
static PRBool TryChannelCharset(nsIChannel *aChannel,
@ -1261,7 +1262,6 @@ private:
nsTArray<nsRefPtr<nsFrameLoader> > mInitializableFrameLoaders;
nsTArray<nsRefPtr<nsFrameLoader> > mFinalizableFrameLoaders;
nsCOMPtr<nsIRunnable> mFrameLoaderRunner;
nsRevocableEventPtr<nsRunnableMethod<nsDocument> > mPendingTitleChangeEvent;

View File

@ -2865,8 +2865,6 @@ nsGenericHTMLFrameElement::BindToTree(nsIDocument* aDocument,
NS_ENSURE_SUCCESS(rv, rv);
if (aDocument) {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"Missing a script blocker!");
// We're in a document now. Kick off the frame load.
LoadSrc();
}

View File

@ -849,8 +849,6 @@ nsXULElement::BindToTree(nsIDocument* aDocument,
NS_ENSURE_SUCCESS(rv, rv);
if (aDocument) {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"Missing a script blocker!");
// We're in a document now. Kick off the frame load.
LoadSrc();
}

View File

@ -13453,8 +13453,6 @@ void
nsCSSFrameConstructor::ProcessPendingRestyles()
{
NS_PRECONDITION(mDocument, "No document? Pshaw!\n");
NS_PRECONDITION(!nsContentUtils::IsSafeToRunScript(),
"Missing a script blocker!");
PRUint32 count = mPendingRestyles.Count();
@ -13598,24 +13596,21 @@ nsCSSFrameConstructor::LazyGenerateChildrenEvent::Run()
menuPopupFrame->SetGeneratedChildren();
#endif
{
nsAutoScriptBlocker scriptBlocker;
nsCSSFrameConstructor* fc = mPresShell->FrameConstructor();
fc->BeginUpdate();
nsCSSFrameConstructor* fc = mPresShell->FrameConstructor();
fc->BeginUpdate();
nsFrameItems childItems;
nsFrameConstructorState state(mPresShell, nsnull, nsnull, nsnull);
nsresult rv = fc->ProcessChildren(state, mContent, frame, PR_FALSE,
childItems, PR_FALSE);
if (NS_FAILED(rv))
return rv;
nsFrameItems childItems;
nsFrameConstructorState state(mPresShell, nsnull, nsnull, nsnull);
nsresult rv = fc->ProcessChildren(state, mContent, frame, PR_FALSE,
childItems, PR_FALSE);
if (NS_FAILED(rv))
return rv;
fc->CreateAnonymousFrames(mContent->Tag(), state, mContent, frame,
PR_FALSE, childItems);
frame->SetInitialChildList(nsnull, childItems.childList);
fc->CreateAnonymousFrames(mContent->Tag(), state, mContent, frame,
PR_FALSE, childItems);
frame->SetInitialChildList(nsnull, childItems.childList);
fc->EndUpdate();
}
fc->EndUpdate();
if (mCallback)
mCallback(mContent, frame, mArg);

View File

@ -2396,10 +2396,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
// Now flush out pending restyles before we actually reflow, in
// case XBL constructors changed styles somewhere.
{
nsAutoScriptBlocker scriptBlocker;
mFrameConstructor->ProcessPendingRestyles();
}
mFrameConstructor->ProcessPendingRestyles();
// And that might have run _more_ XBL constructors
NS_ENSURE_STATE(!mHaveShutDown);
@ -2502,10 +2499,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
// Make sure style is up to date
{
nsAutoScriptBlocker scriptBlocker;
mFrameConstructor->ProcessPendingRestyles();
}
mFrameConstructor->ProcessPendingRestyles();
if (!mIsDestroying) {
// XXX Do a full invalidate at the beginning so that invalidates along
@ -4502,7 +4496,6 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
// reflow).
mPresContext->FlushUserFontSet();
nsAutoScriptBlocker scriptBlocker;
mFrameConstructor->ProcessPendingRestyles();
}
@ -4520,7 +4513,6 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
// up the new rules and we'll end up with frames whose style doesn't match
// the frame type.
if (!mIsDestroying) {
nsAutoScriptBlocker scriptBlocker;
mFrameConstructor->ProcessPendingRestyles();
}