e10s support for Printing [meta]

RESOLVED FIXED

Status

()

P1
normal
RESOLVED FIXED
6 years ago
3 years ago

People

(Reporter: cpeterson, Assigned: mconley)

Tracking

(Depends on: 2 bugs, {dogfood, meta})

unspecified
dogfood, meta
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(e10s-)

Details

Attachments

(1 attachment, 10 obsolete attachments)

51.05 KB, patch
Details | Diff | Splinter Review
Comment hidden (empty)
(Reporter)

Updated

6 years ago
Blocks: 516752
No longer depends on: 516752
Summary: Printing support for e10s → e10s support for Printing
(Reporter)

Comment 1

5 years ago
roc says:

"I think you probably need PuppetWidget implementations of nsIPrintSettings and nsIDeviceContextSpec. Your nsIPrintSettings would basically be a content-side proxy for the nsIPrintSettings constructed by the chrome process, and you'll pass this from chrome to content when printing is initiated.

Your nsIDeviceContextSpec implementation would likewise proxy for a chrome-process nsIDeviceContextSpec. Its GetSurfaceForPrinter implementation will probably need to return a Moz2D recording target (CreateRecordingDrawTarget) with some way to capture the DrawEventRecorder output and spool it to the chrome process where it can be replayed to the real drawing target (at every nsIDeviceContextSpec::EndPage I guess). I don't know any of the details of how the Moz2D recorder works."
Assignee: nobody → blassey.bugs
(Reporter)

Updated

5 years ago
tracking-e10s: --- → +
Taking.
Assignee: blassey.bugs → bjacob
related: bug 1034321 - Printing a remote tab hangs the browser
See Also: → bug 1034321
Priority: -- → P1
(Assignee)

Comment 4

5 years ago
Posted patch Experimentation patch (obsolete) — Splinter Review
(Assignee)

Updated

5 years ago
Assignee: bjacob → mconley
Status: NEW → ASSIGNED
(Assignee)

Comment 5

5 years ago
Silly bzexport.
Assignee: mconley → bjacob
(Assignee)

Comment 6

5 years ago
So, Ehsan / Benoit - I _think_ the problem we were experiencing with parents never getting the messages was because sendSyncMessage expects the parent to return a value that it can return to the child. When I put in explicit return values (the return values of calling the nsIWebProgressListener's functions), things seemed to go in order.

I switched to dump to avoid flushing issues with the browser console. I re-arranged a little bit of code to make it more readable.

This printing code is so nuts. Here's where I've got it:

1) We open the dialog. The dialog quickly closes, but we don't end up hearing the bullshit observer notification about it.
2) I have it entering enterPrintPreview right away. I had to disable a bunch of things (including the stuff that we'd put into the content script that we'd forgotten to get rid of in the parent), and return some bogus values for docshell-y things that the XBL bindings were expecting.
3) We get the full UI switch over to print preview now. We don't actually show the print preview in the browser, which I don't know why, but the UI is switched over.

We can't rightly exit print preview because it attempts to call webBrowserPrint.exitPrintPreview(), which the parent has no access to. So once you've entered print preview... you've gotta kill the session. You can probably fix that by messaging exit print preview to the child somehow, or just skipping it altogether since it doesn't appear that the child is doing much just yet.

So we got "somewhere". The most interesting part, in my mind, would be to get the newly opened print preview to _actually show a print preview_, but I'm not sure what stuff needs to happen in the child in order to make that happen.
An update on where we stand... as Mike explained in comment 6, his patch brings us to the point where the print preview toolbar is up, and the original web view is gone, but the print preview view that should replace it, remains blank.

In stderr, there are IPC errors about unknown PTexture actors, so for a while we worried that this might be a gfx issue i.e. the print preview wouldn't be composited correctly. But that turned out to be a red herring. Dumping all textures in the child process shows that the print preview is not even painted at all (let alone composited). So we are _not_ looking at a gfx bug at this point.

So I stepped through the nsPrintEngine code with and without e10s to compare where the two started diverging.

In nsPrintEngine, DoCommonPrint() calls InitPrintDocConstruction() calls ReflowDocList() calls ReflowPrintObject() calls SetRootView(). The code for SetRootView() around 

http://dxr.mozilla.org/mozilla-central/source/layout/printing/nsPrintEngine.cpp#2126

does:

    nscoord pageWidth, pageHeight;
    mPrt->mPrintDC->GetDeviceSurfaceDimensions(pageWidth, pageHeight);
    adjSize = nsSize(pageWidth, pageHeight);
    documentIsTopLevel = true;
    parentView = GetParentViewForRoot();

This GetParentViewForRoot() call returns null in e10s, whereas it returns non-null in non-e10s.

What's happening in GetParentViewForRoot() is it calls nsDocumentViewer::FindContainerView() which does:

http://dxr.mozilla.org/mozilla-central/source/layout/base/nsDocumentViewer.cpp#2472

  if (mContainer) {
    nsCOMPtr<nsIDocShell> docShell(mContainer);
    nsCOMPtr<nsPIDOMWindow> pwin(docShell->GetWindow());
    if (pwin) {
      nsCOMPtr<Element> containerElement = pwin->GetFrameElementInternal();
      if (!containerElement) {
        return nullptr;
      }

In e10s, GetFrameElementInternal() returns null, so we take the exit path here.

The code for that function is

http://dxr.mozilla.org/mozilla-central/source/dom/base/nsGlobalWindow.cpp#3452

Element*
nsPIDOMWindow::GetFrameElementInternal() const
{
  if (mOuterWindow) {
    return mOuterWindow->GetFrameElementInternal();
  }

  NS_ASSERTION(!IsInnerWindow(),
               "GetFrameElementInternal() called on orphan inner window");

  return mFrameElement;
}

In e10s, both mOuterWindow and mFrameElement are null, so this function returns null.

At this point, the call stack is:

#0  nsPIDOMWindow::GetFrameElementInternal (this=0x7effa788b020) at /home/bjacob/hack/mozilla-central/dom/base/nsGlobalWindow.cpp:3454
#1  0x00007effc50c3e21 in nsDocumentViewer::FindContainerView (this=0x7effa8ccb9f0)
    at /home/bjacob/hack/mozilla-central/layout/base/nsDocumentViewer.cpp:2480
#2  0x00007effc54b6beb in nsPrintEngine::GetParentViewForRoot (this=0x7effa803b9d0)
    at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:2077
#3  0x00007effc54b46d7 in nsPrintEngine::SetRootView (this=0x7effa803b9d0, aPO=0x7effa8097c20, doReturn=@0x7fff627757e7: false, 
    documentIsTopLevel=@0x7fff627757e6: true, adjSize=...) at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:2129
#4  0x00007effc54b5f56 in nsPrintEngine::ReflowPrintObject (this=0x7effa803b9d0, aPO=0x7effa8097c20)
    at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:2215
#5  0x00007effc54b5531 in nsPrintEngine::ReflowDocList (this=0x7effa803b9d0, aPO=0x7effa8097c20, aSetPixelScale=false)
    at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:1844
#6  0x00007effc54b1350 in nsPrintEngine::InitPrintDocConstruction (this=0x7effa803b9d0, aHandleError=false)
    at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:1872
#7  0x00007effc54ae1f4 in nsPrintEngine::DoCommonPrint (this=0x7effa803b9d0, aIsPrintPreview=true, aPrintSettings=0x7effb0c48ac0, 
    aWebProgressListener=0x7effa877cfa0, aDoc=0x7effa7f1d300) at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:752
#8  0x00007effc54ac3a4 in nsPrintEngine::CommonPrint (this=0x7effa803b9d0, aIsPrintPreview=true, aPrintSettings=0x7effb0c48ac0, 
    aWebProgressListener=0x7effa877cfa0, aDoc=0x7effa7f1d300) at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:422
#9  0x00007effc54b17e9 in nsPrintEngine::PrintPreview (this=0x7effa803b9d0, aPrintSettings=0x7effb0c48ac0, aChildDOMWin=0x7effa824ac20, 
    aWebProgressListener=0x7effa877cfa0) at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:812

By contrast, in non-e10s, we also arrive here in GetFrameElementInternal, with the exact same call stack, and mOuterWindow is also null, ***BUT*** now mFrameElement is non-null, so we return non-null.

Now I have no idea what mFrameElement is or should be :-)
Flags: needinfo?(bzbarsky)
FWIW, in non-e10s, mFrameElement is a nsXULElement.
In e10s frame element for the top level window in child process is expected to be null, since the 
xul:browser lives in the parent process.
Ah, so that, too, is a red herring :-( I guess I'll continue stepping through and comparing, then.
Flags: needinfo?(bzbarsky)
So before I was comparing mconley's-patch-on-e10s to mconley's-patch-on-non-e10s. Both give a blank print preview actually (not sure why I thought otherwise) the only difference being that in e10s it's completely blank while in non-e10s it has the header/footer annotation "about:blank".

It still seems that we are failing to insert the document in the print preview. "about:blank" is what the print preview is initialized with at http://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#2694. The only news here is that this happens regardless of e10s, with the patch.
So the problem was that in printUtilsContent.js, when we called printPreview passing 'content' for the document to print-preview, we were running this already in the printpreview browser, so the document that we were passing there was about:blank (the default for a new print preview browser).

Mike showed me how to hack around this by passing a CPOW for the content object, and I now get this in the content script when calling printpreview:

System JS : ERROR chrome://global/content/printUtilsContent.js:48 - NS_ERROR_FACTORY_NOT_REGISTERED: Component returned failure code: 0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED) [nsIWebBrowserPrint.printPreview]
The error in comment 12 was about the printer enumerator service, but we address that already in the patch --- was hitting it due to a bad partial rebuild.

Now I'm getting these warnings. Do you have an idea what they mean?

2498	        NS_WARNING("Subdocument container has no presshell");
(gdb) bt
#0  nsDocumentViewer::FindContainerView (this=0x7fffd283e070) at /home/bjacob/hack/mozilla-central/layout/base/nsDocumentViewer.cpp:2498
#1  0x00007ffff07849ba in nsDocumentViewer::InitInternal (this=0x7fffd283e070, aParentWidget=0x0, aState=0x0, aBounds=..., 
    aDoCreation=true, aNeedMakeCX=true, aForceSetNewDocument=true)
    at /home/bjacob/hack/mozilla-central/layout/base/nsDocumentViewer.cpp:800
#2  0x00007ffff0784874 in nsDocumentViewer::Init (this=0x7fffd283e070, aParentWidget=0x0, aBounds=...)
    at /home/bjacob/hack/mozilla-central/layout/base/nsDocumentViewer.cpp:629
#3  0x00007ffff0e65a9a in nsDocShell::SetupNewViewer (this=0x7fffce7b3000, aNewViewer=0x7fffd283e070)
    at /home/bjacob/hack/mozilla-central/docshell/base/nsDocShell.cpp:8758
#4  0x00007ffff0e6488b in nsDocShell::Embed (this=0x7fffce7b3000, aContentViewer=0x7fffd283e070, aCommand=0x7ffff2e5ea91 <.L.str98> "", 
    aExtraInfo=0x0) at /home/bjacob/hack/mozilla-central/docshell/base/nsDocShell.cpp:6738
#5  0x00007ffff0e6bfa8 in nsDocShell::CreateAboutBlankContentViewer (this=0x7fffce7b3000, aPrincipal=0x7fffc92c9c40, 
    aBaseURI=0x7fffcc89c100, aTryToSaveOldPresentation=true) at /home/bjacob/hack/mozilla-central/docshell/base/nsDocShell.cpp:7537
#6  0x00007ffff0e444e5 in nsDocShell::EnsureContentViewer (this=0x7fffce7b3000)
    at /home/bjacob/hack/mozilla-central/docshell/base/nsDocShell.cpp:7415
#7  0x00007ffff0e4ea3d in nsDocShell::GetDocument (this=0x7fffce7b3000)
    at /home/bjacob/hack/mozilla-central/docshell/base/nsDocShell.cpp:4208
#8  0x00007ffff0e582ac in non-virtual thunk to nsDocShell::GetDocument() ()
    at /home/bjacob/hack/mozilla-central/docshell/base/nsDocShell.cpp:4210
#9  0x00007fffeff7cd02 in nsFrameLoader::CreateStaticClone (this=0x7fffda8dd320, aDest=0x7fffca08b1c0)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsFrameLoader.cpp:2258
#10 0x00007ffff010c7e8 in nsGenericHTMLFrameElement::CopyInnerTo (this=0x7fffd9d54800, aDest=0x7fffdde48400)
    at /home/bjacob/hack/mozilla-central/content/html/content/src/nsGenericHTMLFrameElement.cpp:240
#11 0x00007ffff0059e6c in mozilla::dom::HTMLIFrameElement::Clone (this=0x7fffd9d54800, aNodeInfo=0x7fffc04d4180, aResult=0x7fffffff31f0)
    at /home/bjacob/hack/mozilla-central/content/html/content/src/HTMLIFrameElement.cpp:33
#12 0x00007fffeffc2186 in nsNodeUtils::CloneAndAdopt (aNode=0x7fffd9d54800, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1efbe0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffc0c97660, aResult=0x7fffffff34c0)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:447
#13 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffcc6199c0, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1efbe0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffdde48280, aResult=0x7fffffff3870)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#14 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffd9d53240, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1efbe0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffce7b2800, aResult=0x7fffffff3c20)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#15 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffd3487800, aClone=true, aDeep=true, aNewNodeInfoManager=0x0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x0, aResult=0x7fffffff3f08)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#16 0x00007fffefc88d93 in nsNodeUtils::Clone (aNode=0x7fffd3487800, aDeep=true, aNewNodeInfoManager=0x0, aNodesWithProperties=..., 
    aResult=0x7fffffff3f08) at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.h:155
#17 0x00007fffeffb7adf in nsNodeUtils::CloneNodeImpl (aNode=0x7fffd3487800, aDeep=true, aCallUserDataHandlers=false, 
    aResult=0x7fffffff3f78) at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:376
#18 0x00007fffeffb7a15 in nsINode::CloneNode (this=0x7fffd3487800, aDeep=true, aError=...)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsINode.cpp:2721
#19 0x00007ffff012c3a2 in nsHTMLDocument::CloneNode (this=0x7fffd3487800, aDeep=true, aArgc=1 '\001', aResult=0x7fffffff4198)
    at /home/bjacob/hack/mozilla-central/content/html/document/src/nsHTMLDocument.h:99
#20 0x00007fffefe30918 in nsIDocument::CreateStaticClone (this=0x7fffd3487800, aCloneContainer=0x7fffce4c29a8)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsDocument.cpp:9751
#21 0x00007fffeff7cfb5 in nsFrameLoader::CreateStaticClone (this=0x7fffca00f870, aDest=0x7fffca089110)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsFrameLoader.cpp:2270
#22 0x00007ffff010c7e8 in nsGenericHTMLFrameElement::CopyInnerTo (this=0x7fffce03af40, aDest=0x7fffdde47380)
    at /home/bjacob/hack/mozilla-central/content/html/content/src/nsGenericHTMLFrameElement.cpp:240
#23 0x00007ffff0059e6c in mozilla::dom::HTMLIFrameElement::Clone (this=0x7fffce03af40, aNodeInfo=0x7fffd9826300, aResult=0x7fffffff4660)
    at /home/bjacob/hack/mozilla-central/content/html/content/src/HTMLIFrameElement.cpp:33
#24 0x00007fffeffc2186 in nsNodeUtils::CloneAndAdopt (aNode=0x7fffce03af40, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffda8d9e90, aResult=0x7fffffff4930)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:447
#25 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffd32232c0, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffda8d9e00, aResult=0x7fffffff4ce0)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#26 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffd3223230, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffc0315ec0, aResult=0x7fffffff5090)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#27 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffcc618ca0, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffc0315e20, aResult=0x7fffffff5440)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#28 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffcc618b60, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffc0315d80, aResult=0x7fffffff57f0)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#29 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffcc618ac0, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffc0315ce0, aResult=0x7fffffff5ba0)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#30 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffca4226a0, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffca089060, aResult=0x7fffffff5f50)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#31 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffca00ed70, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffc0315c40, aResult=0x7fffffff6300)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
---Type <return> to continue, or q <return> to quit---
#32 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffcc618840, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffdde47140, aResult=0x7fffffff66b0)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#33 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffccdba600, aClone=true, aDeep=true, aNewNodeInfoManager=0x7fffcd1ef0a0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x7fffce4c1000, aResult=0x7fffffff6a60)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#34 0x00007fffeffc2b5d in nsNodeUtils::CloneAndAdopt (aNode=0x7fffce505800, aClone=true, aDeep=true, aNewNodeInfoManager=0x0, 
    aReparentScope=..., aNodesWithProperties=..., aParent=0x0, aResult=0x7fffffff6d48)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:562
#35 0x00007fffefc88d93 in nsNodeUtils::Clone (aNode=0x7fffce505800, aDeep=true, aNewNodeInfoManager=0x0, aNodesWithProperties=..., 
    aResult=0x7fffffff6d48) at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.h:155
#36 0x00007fffeffb7adf in nsNodeUtils::CloneNodeImpl (aNode=0x7fffce505800, aDeep=true, aCallUserDataHandlers=false, 
    aResult=0x7fffffff6db8) at /home/bjacob/hack/mozilla-central/content/base/src/nsNodeUtils.cpp:376
#37 0x00007fffeffb7a15 in nsINode::CloneNode (this=0x7fffce505800, aDeep=true, aError=...)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsINode.cpp:2721
#38 0x00007ffff012c3a2 in nsHTMLDocument::CloneNode (this=0x7fffce505800, aDeep=true, aArgc=1 '\001', aResult=0x7fffffff6fd8)
    at /home/bjacob/hack/mozilla-central/content/html/document/src/nsHTMLDocument.h:99
#39 0x00007fffefe30918 in nsIDocument::CreateStaticClone (this=0x7fffce505800, aCloneContainer=0x7fffcf1a21a8)
    at /home/bjacob/hack/mozilla-central/content/base/src/nsDocument.cpp:9751
#40 0x00007ffff0b868a8 in nsPrintObject::Init (this=0x7fffcd1ef040, aDocShell=0x7fffcf1a21a8, aDoc=0x7fffce505b00, aPrintPreview=true)
    at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintObject.cpp:87
#41 0x00007ffff0b77145 in nsPrintEngine::DoCommonPrint (this=0x7fffd9d6ad30, aIsPrintPreview=true, aPrintSettings=0x7fffc5dc1760, 
    aWebProgressListener=0x7fffc0361040, aDoc=0x7fffce505b00) at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:547
#42 0x00007ffff0b763a4 in nsPrintEngine::CommonPrint (this=0x7fffd9d6ad30, aIsPrintPreview=true, aPrintSettings=0x7fffc5dc1760, 
    aWebProgressListener=0x7fffc0361040, aDoc=0x7fffce505b00) at /home/bjacob/hack/mozilla-central/layout/printing/nsPrintEngine.cpp:422
#43 0x00007ffff0b7b7e9 in nsPrintEngine::PrintPreview (this=0x7fffd9d6ad30, aPrintSettings=0x7fffc5dc1760, aChildDOMWin=0x7fffcca38020,

Comment 15

5 years ago
(In reply to Benoit Jacob [:bjacob] from comment #14)
> The error in comment 12 was about the printer enumerator service, but we
> address that already in the patch --- was hitting it due to a bad partial
> rebuild.
> 
> Now I'm getting these warnings. Do you have an idea what they mean?
> 
> 2498	        NS_WARNING("Subdocument container has no presshell");

Don't take me as an expert here, but maybe an iframe (I think that's what subdocuments might mean here) is not setup correctly?
I have no idea what's going on. That was meant to be a simple 2-line patch to fix the above warning; it results in various download dialogs to open while the page is loading, and once you dismiss them and click the print icon, the print preview shows.... about:newtab!!
Attachment #8480046 - Attachment is obsolete: true
Assignee: bjacob → nobody
(Reporter)

Updated

5 years ago
No longer blocks: 997462
Whiteboard: [e10s-m3]
(Reporter)

Comment 17

5 years ago
Moving to M3 milestone. These bugs affect e10s dogfooding but Brad and Gavin did not think they were M2 blockers.
tracking-e10s: + → m3+
This hackypatch does the trick of getting print preview to paint for me.
Comment on attachment 8489499 [details] [diff] [review]
Hacky widget hookup to make print preview actually paint

I spun this bit out into bug 1067504.  We'll probably want to make this into a tracking bug, effectively.
Attachment #8489499 - Attachment is obsolete: true
Posted patch Make printing limp on Mac (obsolete) — Splinter Review
This is a total hack in all sorts of ways (e.g. it tries to print multiple times if you do Cmd-P a second time), but it does let me print on Mac, including opening in preview, printing to file, sending to an actual printer, etc
Assignee: nobody → bzbarsky
(Reporter)

Comment 22

5 years ago
Adding "dogfood" keyword so this bug shows up on the e10s wiki's list of known issues:

https://wiki.mozilla.org/Electrolysis#Known_Issues
Keywords: dogfood
(Assignee)

Comment 23

5 years ago
My turn to take the ball and run.
Assignee: bzbarsky → mconley
(Assignee)

Updated

5 years ago
Attachment #8477103 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Attachment #8479391 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Attachment #8488793 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Attachment #8491596 - Attachment is obsolete: true
(Assignee)

Comment 25

5 years ago
I've folded all of the experiment patches together and rebased on top of a recent tip.
(Assignee)

Updated

5 years ago
Attachment #8501315 - Attachment is obsolete: true
The code seems to load printUtilsContent.js. It looks like maybe that code was moved to browser-content.js?
(Assignee)

Comment 28

5 years ago
Yep, that's exactly what happened, and I forgot to remove references to it here - thanks for the heads up. :)
(Assignee)

Updated

5 years ago
Attachment #8501396 - Attachment is obsolete: true
(Assignee)

Comment 30

5 years ago
This patch gives me iframe printing powers on OS X.

Tomorrow, I'm going to port this to Windows and see where we are. The content process for Linux crashes when I make those same components in nsWidgetFactory.cpp available as we did for OS X, so there's that to look into. There's also lots and lots of clean-up required in printUtis.js, but I think I'm starting to get the hang of this.
(Assignee)

Comment 31

5 years ago
So I've run into a snag on Windows. The content process attempts to open printing dialogs, but it is unable to get a proper "window handle" from the nsIDOMWindow being passed to it - the best it can do is the TabChild, which is no good, and doesn't translate to a valid window handle. So when we try to open a print dialog with the TabChild address casted to an hWnd, ::PrintDlgW rightly errors out, giving back a CDERR_DIALOGFAILURE.

I think that, in order to avoid much redesign and rearchitecture of our printing backend, we're going to have to go with roc's advice in comment 1 - but for some of the printing UI interfaces as well. We'll have to proxy those over IPC to the parent.
(Assignee)

Comment 32

5 years ago
Ok, I just successfully printed from Windows - but I had to enable silent printing and disable showing print progress (you'd think that'd be the same thing, but it's not).

Those prefs are:

print.always_print_silent -> true
print.show_print_progress -> false

I'll have the updated WIP up in a second.
(Assignee)

Updated

5 years ago
Attachment #8501482 - Attachment is obsolete: true
(Assignee)

Comment 34

5 years ago
Ok, my current plan of attack is to start implementing proxy components for various things that printing requires, define a PPrinting IPDL that they use, and communicate from the proxies to the parent through it.

I'm going to start with nsIPrintingPromptService - starting with the "showProgress" method. The end goal being that I can print from Windows with show_print_progress in the default state of "true".

nsIPrintingPromptService::ShowProgress has a number of in-params that I'm not too worried about serializing or finding equivalents for on the parent side - however, there are some out-params (a nsIWebProgressListener and an nsIPrintProgressParams) that the child will be expected to hand back to nsPrintEngine on the child side that I'm going to have to somehow wire up to things in the parent process.

The design seems to be that ShowProgress returns these listeners, which we then pass to some printing functions, which will update the progress dialog through these objects.

So what I plan to do is to have ShowProgress return implementations of nsIWebProgressListener and nsIPrintProgressParams, and have corresponding nsIWebProgressListener and nsIPrintProgressParams on the parent side. The implementations of those interfaces I will write on the child side will use PPrinting to update the ones on the parent side, and… well, I think we'll be able to show progress there.

Then I'll try to do something similar for the native printing setup dialog so we can get rid of the print.always_print_silent workaround. But we'll cross that bridge when we get there.
(Assignee)

Comment 35

5 years ago
(Assignee)

Updated

5 years ago
Attachment #8501995 - Attachment is obsolete: true
(Assignee)

Comment 37

5 years ago
I think I've come to the conclusion that this work is going to need to be broken down and landed in separate chunks. I'll come up with a landing plan and file some bugs.
(Assignee)

Updated

5 years ago
Depends on: 1082575
(Assignee)

Updated

5 years ago
Depends on: 1082579
(Assignee)

Updated

5 years ago
Depends on: 1087122
(Assignee)

Updated

5 years ago
Depends on: 1089815
(Assignee)

Updated

5 years ago
Depends on: 1090439
(Assignee)

Updated

5 years ago
Depends on: 1090444
(Assignee)

Updated

5 years ago
Depends on: 1090448
(Assignee)

Updated

5 years ago
Depends on: 1090449
(Assignee)

Updated

5 years ago
Depends on: 1090454
(Assignee)

Updated

5 years ago
Depends on: 1090995

Updated

5 years ago
Depends on: 1091103

Updated

5 years ago
Depends on: 1091112
tracking-e10s: m3+ → ---
(Assignee)

Updated

5 years ago
tracking-e10s: --- → -
(Assignee)

Updated

4 years ago
Depends on: 1093774

Updated

4 years ago
Depends on: 1106321
(Reporter)

Updated

4 years ago
Blocks: 1081467
(Assignee)

Updated

4 years ago
Depends on: 1117016
(Reporter)

Comment 38

4 years ago
meta, not m3+
Keywords: meta
Whiteboard: [e10s-m3]
(Assignee)

Updated

4 years ago
Depends on: 1130416
(Assignee)

Updated

4 years ago
Depends on: 1131079

Updated

4 years ago
Depends on: 1160058

Updated

4 years ago
Depends on: 1165560

Updated

4 years ago
No longer depends on: 1165560

Updated

4 years ago
Depends on: 1167600

Updated

4 years ago
Depends on: 1156742
(Assignee)

Updated

4 years ago
Depends on: 1185580

Updated

4 years ago
Depends on: 1189846

Updated

4 years ago
Depends on: 1193182

Updated

4 years ago
Depends on: 1199434

Updated

3 years ago
Depends on: 1142013

Updated

3 years ago
No longer depends on: 1093774

Updated

3 years ago
Summary: e10s support for Printing → e10s support for Printing [meta]
No longer depends on: 1090454
Closing this bug because e10s has shipped and printing is supported.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
See Also: → bug 1090454
You need to log in before you can comment on or make changes to this bug.