Bug 669767: Add scriptblocker to EditorInitializer::Run() so our frame doesn't get killed before we finish. r=ehsan

This commit is contained in:
Randell Jesup 2011-07-13 16:57:41 -04:00
parent 00a4399c69
commit 5b082f6f56
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<html>
<head>
<title>Untitled</title>
</head>
<body>
<iframe src="data:text/html;charset=utf-8,%3Chtml%3E%3Chead%3E%3C/head%3E%3Cbody%3E%0A%3Ctextarea%3E%3C/textarea%3E%0A%0A%0A%3Cstyle%3E%0A@font-face%20%7B%0A%20%20%20%20%20%20font-family%3A%20%22cutabovetherest%22%3B%0A%20%20%20%20%20%20src%3A%20url%28%22http%3A//www.webpagepublicity.com/free-fonts/a/A%2520Cut%2520Above%2520The%2520Rest.ttf%22%29%3B%0A%7D%20%20%20%20%0A%0A%3C/style%3E%0A%0A%3Coptgroup%20contenteditable%3D%22true%22%20style%3D%22display%3A%20inline%3B%22%3E%3C/optgroup%3E%0A%0A%3C/body%3E%3C/html%3E"></iframe>
<script>
</script>
</body>
</html>

View File

@ -46,3 +46,4 @@ asserts(1) load 578604-1.html # bug 584564
asserts(3-5) load 590302-1.xhtml # bug 584564
load 626014.xhtml
load 639733.xhtml
load 669767.html

View File

@ -295,12 +295,18 @@ protected:
NS_IMETHOD Run() {
if (mFrame) {
// need to block script to avoid bug 669767
nsAutoScriptBlocker scriptBlocker;
nsCOMPtr<nsIPresShell> shell =
mFrame->PresContext()->GetPresShell();
PRBool observes = shell->ObservesNativeAnonMutationsForPrint();
shell->ObserveNativeAnonMutationsForPrint(PR_TRUE);
// This can cause the frame to be destroyed (and call Revoke()
mFrame->EnsureEditorInitialized();
shell->ObserveNativeAnonMutationsForPrint(observes);
NS_ASSERTION(mFrame,"Frame destroyed even though we had a scriptblocker");
mFrame->FinishedInitializer();
}
return NS_OK;