Bug 1558079. Add a comment to the mozPrintCallback invoking code warning about its non-obvious behavior. r=bobowen

Differential Revision: https://phabricator.services.mozilla.com/D34298

--HG--
extra : rebase_source : 523c19cc0b63d08a5701f9a2d4148b146529827c
extra : amend_source : c3b5b7e85a1b9bc64e76524f974a96ad93201886
This commit is contained in:
Jonathan Watt 2019-05-31 16:18:51 +01:00
parent 640faff91f
commit cdbcb71463

View File

@ -558,6 +558,14 @@ nsresult nsPageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback,
ctx->InitializeWithDrawTarget(nullptr, WrapNotNull(canvasTarget));
// Start the rendering process.
// Note: Other than drawing to our CanvasRenderingContext2D, the
// callback cannot access or mutate our static clone document. It is
// evaluated in its original context (the window of the original
// document) of course, and our canvas has a strong ref to the
// original HTMLCanvasElement (in mOriginalCanvas) so that if the
// callback calls GetCanvas() on our CanvasRenderingContext2D (passed
// to it via a MozCanvasPrintState argument) it will be given the
// original 'canvas' element.
AutoWeakFrame weakFrame = this;
canvas->DispatchPrintCallback(aCallback);
NS_ENSURE_STATE(weakFrame.IsAlive());