Bug 793844. DocHasPrintCallbackCanvas should skip documents that don't have a root element. r=smaug
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 26 Sep 2012 21:26:49 +1200
changeset 108121 4927e7e7477e77a4c41e48234d6cbd4512a09873
parent 108120 bc0b95817e55b7a06881c41ae5aa5f4ae9f4453b
child 108122 e0d69219dd2b3b2826d186dc99c673b879409ea6
push id23539
push userryanvm@gmail.com
push dateWed, 26 Sep 2012 22:55:55 +0000
treeherderautoland@ec079fd92224 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs793844
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 793844. DocHasPrintCallbackCanvas should skip documents that don't have a root element. r=smaug
layout/printing/nsPrintEngine.cpp
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -2661,16 +2661,19 @@ nsPrintEngine::ElipseLongString(PRUnicha
 
 static bool
 DocHasPrintCallbackCanvas(nsIDocument* aDoc, void* aData)
 {
   if (!aDoc) {
     return true;
   }
   Element* root = aDoc->GetRootElement();
+  if (!root) {
+    return true;
+  }
   nsRefPtr<nsContentList> canvases = NS_GetContentList(root,
                                                        kNameSpaceID_XHTML,
                                                        NS_LITERAL_STRING("canvas"));
   uint32_t canvasCount = canvases->Length(true);
   for (uint32_t i = 0; i < canvasCount; ++i) {
     nsCOMPtr<nsIDOMHTMLCanvasElement> canvas = do_QueryInterface(canvases->Item(i, false));
     nsCOMPtr<nsIPrintCallback> printCallback;
     if (canvas && NS_SUCCEEDED(canvas->GetMozPrintCallback(getter_AddRefs(printCallback))) &&