Bug 817342, delay script runners when making static clones, r=roc, a=lsblakk
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 24 Jan 2013 11:22:59 +0200
changeset 123775 0abbd04b2dc9948db8a523aab4498dbda3263ebe
parent 123774 b88a7f9585925d6912a857ca47e6dfe692e4c442
child 123776 161ff8d9538cb9f5132af3c7c18896996192a8c1
push idunknown
push userunknown
push dateunknown
reviewersroc, lsblakk
bugs817342
milestone20.0a2
Bug 817342, delay script runners when making static clones, r=roc, a=lsblakk
layout/printing/nsPrintEngine.cpp
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -508,31 +508,34 @@ nsPrintEngine::DoCommonPrint(bool       
 
   // Check to see if there is a "regular" selection
   bool isSelection = IsThereARangeSelection(mPrt->mCurrentFocusWin);
 
   // Get the docshell for this documentviewer
   nsCOMPtr<nsIDocShell> webContainer(do_QueryReferent(mContainer, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mPrt->mPrintObject = new nsPrintObject();
-  NS_ENSURE_TRUE(mPrt->mPrintObject, NS_ERROR_OUT_OF_MEMORY);
-  rv = mPrt->mPrintObject->Init(webContainer, aDoc, aIsPrintPreview);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  NS_ENSURE_TRUE(mPrt->mPrintDocList.AppendElement(mPrt->mPrintObject),
-                 NS_ERROR_OUT_OF_MEMORY);
-
-  mPrt->mIsParentAFrameSet = IsParentAFrameSet(webContainer);
-  mPrt->mPrintObject->mFrameType = mPrt->mIsParentAFrameSet ? eFrameSet : eDoc;
-
-  // Build the "tree" of PrintObjects
-  nsCOMPtr<nsIDocShellTreeNode> parentAsNode =
-    do_QueryInterface(mPrt->mPrintObject->mDocShell);
-  BuildDocTree(parentAsNode, &mPrt->mPrintDocList, mPrt->mPrintObject);
+  {
+    nsAutoScriptBlocker scriptBlocker;
+    mPrt->mPrintObject = new nsPrintObject();
+    NS_ENSURE_TRUE(mPrt->mPrintObject, NS_ERROR_OUT_OF_MEMORY);
+    rv = mPrt->mPrintObject->Init(webContainer, aDoc, aIsPrintPreview);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    NS_ENSURE_TRUE(mPrt->mPrintDocList.AppendElement(mPrt->mPrintObject),
+                   NS_ERROR_OUT_OF_MEMORY);
+
+    mPrt->mIsParentAFrameSet = IsParentAFrameSet(webContainer);
+    mPrt->mPrintObject->mFrameType = mPrt->mIsParentAFrameSet ? eFrameSet : eDoc;
+
+    // Build the "tree" of PrintObjects
+    nsCOMPtr<nsIDocShellTreeNode> parentAsNode =
+      do_QueryInterface(mPrt->mPrintObject->mDocShell);
+    BuildDocTree(parentAsNode, &mPrt->mPrintDocList, mPrt->mPrintObject);
+  }
 
   if (!aIsPrintPreview) {
     SetIsPrinting(true);
   }
 
   // XXX This isn't really correct...
   if (!mPrt->mPrintObject->mDocument ||
       !mPrt->mPrintObject->mDocument->GetRootElement())