Closed Bug 1304152 Opened 4 years ago Closed 4 years ago

OS X Printing BorrowCGContextFromDrawTarget() ASSERT failure/crash

Categories

(Core :: Printing: Output, defect)

51 Branch
Unspecified
macOS
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox49 --- unaffected
firefox50 --- unaffected
firefox51 --- affected
firefox52 --- fixed

People

(Reporter: haik, Unassigned)

References

Details

Attachments

(1 file)

If print_via_parent=false, debug builds hit an ASSERT failure when trying to print to PDF from the OS X print dialog. 

Assertion failure: false, at gfx/2d/DrawTargetSkia.cpp:1077. That's in BorrowedCGContext::BorrowCGContextFromDrawTarget().

I was testing with print_via_parent=false, but the default is now print_via_parent=true. Bug 1228022 changed OS X to use print_via_parent=true enabling remote printing on OS X e10s.

Mozregression indicates the crash was introduced by bug 942688 "Draw Cocoa Widget without assuming DrawTargetCG".

Here's the ASSERT I see with Debug Nightly built today (changeset: 314478:62f79d676e0e).

[GFX3-]: Surface size too large (exceeds extent limit)!
[GFX2-]: Allowing surface with invalid size (Cairo) Size(48960,63360)
JavaScript error: chrome://global/content/browser-content.js, line 680: TypeError: printSettings is null
[GFX3-]: Surface size too large (exceeds extent limit)!
[GFX2-]: Allowing surface with invalid size (Cairo) Size(48960,63360)
[GFX3-]: Surface size too large (exceeds extent limit)!
[GFX2-]: Allowing surface with invalid size (Cairo) Size(48960,63360)

Assertion failure: false, at /Users/haftandilian/r/tempdir/gfx/2d/DrawTargetSkia.cpp:1077
#01: mozilla::gfx::BorrowedCGContext::BorrowCGContextFromDrawTarget(mozilla::gfx::DrawTarget*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1b3f8c2]
#02: mozilla::gfx::BorrowedCGContext::Init(mozilla::gfx::DrawTarget*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x204c959]
#03: gfxQuartzNativeDrawing::BeginNativeDrawing()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x204c7b4]
#04: nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext*, nsIFrame*, unsigned char, nsRect const&, nsRect const&)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4ba5af9]
#05: non-virtual thunk to nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext*, nsIFrame*, unsigned char, nsRect const&, nsRect const&)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4baa6c2]
#06: nsDisplayThemedBackground::PaintInternal(nsDisplayListBuilder*, nsRenderingContext*, nsRect const&, nsRect*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x50a8b18]
#07: nsDisplayThemedBackground::Paint(nsDisplayListBuilder*, nsRenderingContext*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x50a8a0c]
#08: mozilla::FrameLayerBuilder::PaintItems(nsTArray<mozilla::FrameLayerBuilder::ClippedDisplayItem>&, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&, gfxContext*, nsRenderingContext*, nsDisplayListBuilder*, nsPresContext*, mozilla::gfx::IntPoin[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4fe2e0a]
#09: mozilla::FrameLayerBuilder::DrawPaintedLayer(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::layers::DrawRegionClip, mo[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4fe41ba]
#10: mozilla::layers::BasicPaintedLayer::PaintThebes(gfxContext*, mozilla::layers::Layer*, void (*)(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::Unknown[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8def7]
#11: non-virtual thunk to mozilla::layers::BasicPaintedLayer::PaintThebes(gfxContext*, mozilla::layers::Layer*, void (*)(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8e517]
#12: mozilla::layers::BasicLayerManager::PaintSelfOrChildren(mozilla::layers::PaintLayerContext&, gfxContext*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8c454]
#13: mozilla::layers::BasicLayerManager::PaintLayer(gfxContext*, mozilla::layers::Layer*, void (*)(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownU[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8b7d7]
#14: mozilla::layers::BasicLayerManager::PaintSelfOrChildren(mozilla::layers::PaintLayerContext&, gfxContext*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8c5d3]
#15: mozilla::layers::BasicLayerManager::PaintLayer(gfxContext*, mozilla::layers::Layer*, void (*)(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownU[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8b7d7]
#16: mozilla::layers::BasicLayerManager::PaintSelfOrChildren(mozilla::layers::PaintLayerContext&, gfxContext*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8c5d3]
#17: mozilla::layers::BasicLayerManager::PaintLayer(gfxContext*, mozilla::layers::Layer*, void (*)(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownU[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8b7d7]
#18: mozilla::layers::BasicLayerManager::EndTransactionInternal(void (*)(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::lay[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e8a590]
#19: mozilla::layers::BasicLayerManager::EndTransaction(void (*)(mozilla::layers::PaintedLayer*, gfxContext*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::layers::Dra[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1e89fba]
#20: nsDisplayList::PaintRoot(nsDisplayListBuilder*, nsRenderingContext*, unsigned int)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x509efb4]
#21: nsLayoutUtils::PaintFrame(nsRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, nsDisplayListBuilderMode, nsLayoutUtils::PaintFrameFlags)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x50e3fa8]
#22: nsSimplePageSequenceFrame::PrintNextPage()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x52c2a03]
#23: non-virtual thunk to nsSimplePageSequenceFrame::PrintNextPage()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x52c2c89]
#24: nsPrintEngine::PrintPage(nsPrintObject*, bool&)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x54c3169]
#25: nsPagePrintTimer::Run()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x54c2c3c]
#26: nsThread::ProcessNextEvent(bool, bool*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1cc5a9]
#27: NS_ProcessPendingEvents(nsIThread*, unsigned int)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x25323c]
#28: nsBaseAppShell::NativeEventCallback()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4b3f9ce]
#29: nsAppShell::ProcessGeckoEvents(void*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4bd9242]
#30: __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__[/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0xaa881]
#31: __CFRunLoopDoSources0[/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x89fbc]
#32: __CFRunLoopRun[/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x894df]
#33: CFRunLoopRunSpecific[/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x88ed8]
#34: RunCurrentEventLoopInMode[/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x30935]
#35: ReceiveNextEventCommon[/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x3076f]
#36: _BlockUntilNextEventMatchingListInModeWithFilter[/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x305af]
#37: _DPSNextEvent[/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x48df6]
#38: -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:][/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x48226]
#39: -[GeckoNSApplication nextEventMatchingMask:untilDate:inMode:dequeue:][/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4bd7d94]
#40: -[NSApplication run][/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x3cd80]
#41: nsAppShell::Run()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x4bd9bec]
#42: XRE_RunAppShell[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x61021a5]
#43: mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0xbce871]
#44: MessageLoop::RunInternal()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0xad2615]
#45: MessageLoop::RunHandler()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0xad2575]
#46: MessageLoop::Run()[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0xad251d]
#47: XRE_InitChildProcess[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/XUL +0x6101898]
#48: content_process_main(int, char**)[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/plugin-container.app/Contents/MacOS/plugin-container +0x282a]
#49: main[/Users/haftandilian/r/tempdir/obj-dbg.noindex/dist/NightlyDebug.app/Contents/MacOS/plugin-container.app/Contents/MacOS/plugin-container +0x2a92]

###!!! [Parent][MessageChannel] Error: (msgtype=0x2E007E,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
See Also: → 942688, 1228022
Looks like we forgot about printing in bug 942688... the printing DrawTarget uses the cairo backend.

This bug means that printing native widgets, like unstyled buttons or check boxes, probably won't work at the moment. The controls will be invisible.
There are a couple of issues with Mac remote printing that need to be fixed before it can ship:

  Bug 1310165 - mozPrintCallback stopped producing vector output when printing via the parent
  Bug 1303051 - Printing Issue: Page Setup not being respected since upgrade to 48.01 on Mac

Until these are fixed I was planning to limit Mac remote printing to Nightly with bug 1310804. In my testing on Aurora with remote printing disabled (print_via_parent=false), I hit this ASSERT in debug mode, but release mode seems to work OK.

Markus, do you have any objections to disabling remote printing on 51 exposing this ASSERT failure?
Flags: needinfo?(mstange)
Originally I was only hitting this with print_via_parent=false, but now I hit this on Nightly debug builds without any profile changes.

This is making it tough to debug printing issues.

$ hg parent
changeset:   318198:7c8216f48c38
user:        ffxbld
date:        Mon Oct 17 06:25:26 2016 -0700
summary:     No bug, Automated blocklist update from host bld-linux64-spot-156 - a=blocklist-update
Severity: normal → major
Summary: OS X BorrowCGContextFromDrawTarget() ASSERT failure/crash when print_via_parent=false → OS X Printing BorrowCGContextFromDrawTarget() ASSERT failure/crash
Sorry, I had forgotten about this bug. Does the attached patch fix the problems you're experiencing?
Flags: needinfo?(mstange) → needinfo?(haftandilian)
Comment on attachment 8804442 [details]
Bug 1304152 - Printing uses DrawTargetCairo. Don't blindly assume we have a DrawTargetSkia.

https://reviewboard.mozilla.org/r/88404/#review87478
Attachment #8804442 - Flags: review?(mchang) → review+
(In reply to Markus Stange [:mstange] from comment #5)
> Sorry, I had forgotten about this bug. Does the attached patch fix the
> problems you're experiencing?

Yes, thanks. With the patch applied and running debug Nightly, I tried printing to PDF on a few different sites. I tested 2 combinations 1) with both print_via_parent=true and 2) (print_via_parent=false and security.sandbox.content.level=0) and didn't see any ASSERT's.
Flags: needinfo?(haftandilian)
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/b1db1c9b6f54
Printing uses DrawTargetCairo. Don't blindly assume we have a DrawTargetSkia. r=mchang
https://hg.mozilla.org/mozilla-central/rev/b1db1c9b6f54
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.