зеркало из https://github.com/mozilla/pjs.git
Bug 436965, r+sr=sicking
This commit is contained in:
Родитель
c221c2b795
Коммит
30e95455e1
|
@ -5115,6 +5115,18 @@ nsDocument::FlushSkinBindings()
|
||||||
BindingManager()->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
|
nsresult
|
||||||
nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
|
nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
|
||||||
{
|
{
|
||||||
|
@ -5125,11 +5137,12 @@ nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
|
||||||
"document is being deleted");
|
"document is being deleted");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
if (mUpdateNestLevel == 0 && !mDelayFrameLoaderInitialization) {
|
|
||||||
nsRefPtr<nsFrameLoader> loader = aLoader;
|
mInitializableFrameLoaders.AppendElement(aLoader);
|
||||||
return loader->ReallyStartLoading();
|
if (!mFrameLoaderRunner) {
|
||||||
} else {
|
mFrameLoaderRunner = new nsFrameLoaderRunner(this);
|
||||||
mInitializableFrameLoaders.AppendElement(aLoader);
|
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -5141,11 +5154,12 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader)
|
||||||
if (mInDestructor) {
|
if (mInDestructor) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
if (mUpdateNestLevel == 0) {
|
|
||||||
nsRefPtr<nsFrameLoader> loader = aLoader;
|
mFinalizableFrameLoaders.AppendElement(aLoader);
|
||||||
loader->Finalize();
|
if (!mFrameLoaderRunner) {
|
||||||
} else {
|
mFrameLoaderRunner = new nsFrameLoaderRunner(this);
|
||||||
mFinalizableFrameLoaders.AppendElement(aLoader);
|
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -5153,8 +5167,11 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader)
|
||||||
void
|
void
|
||||||
nsDocument::InitializeFinalizeFrameLoaders()
|
nsDocument::InitializeFinalizeFrameLoaders()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mUpdateNestLevel == 0 && !mDelayFrameLoaderInitialization,
|
mFrameLoaderRunner = nsnull;
|
||||||
"Wrong time to call InitializeFinalizeFrameLoaders!");
|
if (mDelayFrameLoaderInitialization || mUpdateNestLevel != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't use a temporary array for mInitializableFrameLoaders, because
|
// Don't use a temporary array for mInitializableFrameLoaders, because
|
||||||
// loading a frame may cause some other frameloader to be removed from the
|
// 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!
|
// array. But be careful to keep the loader alive when starting the load!
|
||||||
|
|
|
@ -997,6 +997,7 @@ public:
|
||||||
|
|
||||||
nsresult CloneDocHelper(nsDocument* clone) const;
|
nsresult CloneDocHelper(nsDocument* clone) const;
|
||||||
|
|
||||||
|
void InitializeFinalizeFrameLoaders();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void RegisterNamedItems(nsIContent *aContent);
|
void RegisterNamedItems(nsIContent *aContent);
|
||||||
|
@ -1016,8 +1017,6 @@ protected:
|
||||||
|
|
||||||
void DispatchContentLoadedEvents();
|
void DispatchContentLoadedEvents();
|
||||||
|
|
||||||
void InitializeFinalizeFrameLoaders();
|
|
||||||
|
|
||||||
void RetrieveRelevantHeaders(nsIChannel *aChannel);
|
void RetrieveRelevantHeaders(nsIChannel *aChannel);
|
||||||
|
|
||||||
static PRBool TryChannelCharset(nsIChannel *aChannel,
|
static PRBool TryChannelCharset(nsIChannel *aChannel,
|
||||||
|
@ -1262,6 +1261,7 @@ private:
|
||||||
|
|
||||||
nsTArray<nsRefPtr<nsFrameLoader> > mInitializableFrameLoaders;
|
nsTArray<nsRefPtr<nsFrameLoader> > mInitializableFrameLoaders;
|
||||||
nsTArray<nsRefPtr<nsFrameLoader> > mFinalizableFrameLoaders;
|
nsTArray<nsRefPtr<nsFrameLoader> > mFinalizableFrameLoaders;
|
||||||
|
nsCOMPtr<nsIRunnable> mFrameLoaderRunner;
|
||||||
|
|
||||||
nsRevocableEventPtr<nsRunnableMethod<nsDocument> > mPendingTitleChangeEvent;
|
nsRevocableEventPtr<nsRunnableMethod<nsDocument> > mPendingTitleChangeEvent;
|
||||||
|
|
||||||
|
|
|
@ -2865,6 +2865,8 @@ nsGenericHTMLFrameElement::BindToTree(nsIDocument* aDocument,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aDocument) {
|
if (aDocument) {
|
||||||
|
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
|
||||||
|
"Missing a script blocker!");
|
||||||
// We're in a document now. Kick off the frame load.
|
// We're in a document now. Kick off the frame load.
|
||||||
LoadSrc();
|
LoadSrc();
|
||||||
}
|
}
|
||||||
|
|
|
@ -849,6 +849,8 @@ nsXULElement::BindToTree(nsIDocument* aDocument,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aDocument) {
|
if (aDocument) {
|
||||||
|
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
|
||||||
|
"Missing a script blocker!");
|
||||||
// We're in a document now. Kick off the frame load.
|
// We're in a document now. Kick off the frame load.
|
||||||
LoadSrc();
|
LoadSrc();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13453,6 +13453,8 @@ void
|
||||||
nsCSSFrameConstructor::ProcessPendingRestyles()
|
nsCSSFrameConstructor::ProcessPendingRestyles()
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(mDocument, "No document? Pshaw!\n");
|
NS_PRECONDITION(mDocument, "No document? Pshaw!\n");
|
||||||
|
NS_PRECONDITION(!nsContentUtils::IsSafeToRunScript(),
|
||||||
|
"Missing a script blocker!");
|
||||||
|
|
||||||
PRUint32 count = mPendingRestyles.Count();
|
PRUint32 count = mPendingRestyles.Count();
|
||||||
|
|
||||||
|
@ -13596,21 +13598,24 @@ nsCSSFrameConstructor::LazyGenerateChildrenEvent::Run()
|
||||||
menuPopupFrame->SetGeneratedChildren();
|
menuPopupFrame->SetGeneratedChildren();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCSSFrameConstructor* fc = mPresShell->FrameConstructor();
|
{
|
||||||
fc->BeginUpdate();
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
|
nsCSSFrameConstructor* fc = mPresShell->FrameConstructor();
|
||||||
|
fc->BeginUpdate();
|
||||||
|
|
||||||
nsFrameItems childItems;
|
nsFrameItems childItems;
|
||||||
nsFrameConstructorState state(mPresShell, nsnull, nsnull, nsnull);
|
nsFrameConstructorState state(mPresShell, nsnull, nsnull, nsnull);
|
||||||
nsresult rv = fc->ProcessChildren(state, mContent, frame, PR_FALSE,
|
nsresult rv = fc->ProcessChildren(state, mContent, frame, PR_FALSE,
|
||||||
childItems, PR_FALSE);
|
childItems, PR_FALSE);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
fc->CreateAnonymousFrames(mContent->Tag(), state, mContent, frame,
|
fc->CreateAnonymousFrames(mContent->Tag(), state, mContent, frame,
|
||||||
PR_FALSE, childItems);
|
PR_FALSE, childItems);
|
||||||
frame->SetInitialChildList(nsnull, childItems.childList);
|
frame->SetInitialChildList(nsnull, childItems.childList);
|
||||||
|
|
||||||
fc->EndUpdate();
|
fc->EndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
if (mCallback)
|
if (mCallback)
|
||||||
mCallback(mContent, frame, mArg);
|
mCallback(mContent, frame, mArg);
|
||||||
|
|
|
@ -2396,7 +2396,10 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||||
|
|
||||||
// Now flush out pending restyles before we actually reflow, in
|
// Now flush out pending restyles before we actually reflow, in
|
||||||
// case XBL constructors changed styles somewhere.
|
// case XBL constructors changed styles somewhere.
|
||||||
mFrameConstructor->ProcessPendingRestyles();
|
{
|
||||||
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
|
mFrameConstructor->ProcessPendingRestyles();
|
||||||
|
}
|
||||||
|
|
||||||
// And that might have run _more_ XBL constructors
|
// And that might have run _more_ XBL constructors
|
||||||
NS_ENSURE_STATE(!mHaveShutDown);
|
NS_ENSURE_STATE(!mHaveShutDown);
|
||||||
|
@ -2499,7 +2502,10 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
|
||||||
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
|
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
|
||||||
|
|
||||||
// Make sure style is up to date
|
// Make sure style is up to date
|
||||||
mFrameConstructor->ProcessPendingRestyles();
|
{
|
||||||
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
|
mFrameConstructor->ProcessPendingRestyles();
|
||||||
|
}
|
||||||
|
|
||||||
if (!mIsDestroying) {
|
if (!mIsDestroying) {
|
||||||
// XXX Do a full invalidate at the beginning so that invalidates along
|
// XXX Do a full invalidate at the beginning so that invalidates along
|
||||||
|
@ -4496,6 +4502,7 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
|
||||||
// reflow).
|
// reflow).
|
||||||
mPresContext->FlushUserFontSet();
|
mPresContext->FlushUserFontSet();
|
||||||
|
|
||||||
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
mFrameConstructor->ProcessPendingRestyles();
|
mFrameConstructor->ProcessPendingRestyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4513,6 +4520,7 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
|
||||||
// up the new rules and we'll end up with frames whose style doesn't match
|
// up the new rules and we'll end up with frames whose style doesn't match
|
||||||
// the frame type.
|
// the frame type.
|
||||||
if (!mIsDestroying) {
|
if (!mIsDestroying) {
|
||||||
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
mFrameConstructor->ProcessPendingRestyles();
|
mFrameConstructor->ProcessPendingRestyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче