Closed Bug 388082 Opened 17 years ago Closed 17 years ago

Printing plugin on OS X on trunk causes crash

Categories

(Core Graveyard :: Plug-ins, defect)

PowerPC
macOS
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: smichaud, Assigned: smichaud)

References

()

Details

Attachments

(3 files)

As best I can tell, you always crash when you try to print a page with at least one plugin in trunk versions of all Mozilla.org browsers on OS X. Well almost always: You don't crash when you try to print a page containing a Java plugin ... but that's only because the JEP doesn't yet support printing :-) Aside from Java, I always crash trying to print either Flash plugins (e.g. http://rogerdean.com/) or QuickTime plugins (e.g. any of the QuickTime movie trailers at http://www.apple.com/trailers/). I've tested in Minefield and Camino (though not yet in SeaMonkey). Crashes don't happen on the 1.8 branch, but no plugins print (you see blank spots where they should have printed). This was also the behavior on the trunk until the 2005-08-23-07-trunk nightly. On that date changes were made to layout/generic/nsObjectFrame.cpp to "move native theme stuff to widget (bug 305291) and land the remaining thebes gfx changes (bug 305538)": http://bonsai.mozilla.org/cvsview2.cgi?diff_mode=context&whitespace_mode=show&subdir=mozilla/layout/generic& command=DIFF_FRAMESET&file=nsObjectFrame.cpp&rev1=1.513&rev2=1.514&root=/cvsroot One of these dropped a NULL check on the call to get "native graphic data" from the current rendering context. But this call (both its old and new variations) _always_ returns NULL on OS X. So the print.embedPrint.platformPrint field of the NPPrint structure passed to the plugin's implementation of NPP_Print() (in ns4xPluginInstance::Print()) is always NULL. And neither the Flash nor the QuickTime plugins like this at all -- they always crash. As best I can tell the print.embedPrint.platformPrint field should always be set to a QuickDraw port. This is what nsRenderingContextMac::GetNativeGraphicData() returns (if it's called with the appropriate GraphicDataType). But the rendering context for all OS X trunk browsers is now an nsThebesRenderingContext object. I have no idea how to get an nsThebesRenderingContext object to do the right thing (to create and return a QuickDraw port on OS X). So my "fix" for these crashes is just to restore the NULL check that was dropped by revision 1.514 to nsObjectFrame.cpp. (I'll post a patch that does this.) My "fix" gets rid of the crashes, but doesn't make plugin printing work on OS X. I'll leave it to others (who know more about this stuff than I do) to decide how (or whether) to get plugin printing to actually work.
Severity: normal → critical
Flags: blocking1.9?
Attached file Crash in Flash plugin
Made with today's Minefield nightly (2007-07-13-04-trunk).
Also made with today's Minefield nightly (2007-07-13-04-trunk).
Steven: What's the status here? Do you need reviews?
Assignee: nobody → smichaud
Flags: blocking1.9? → blocking1.9+
> What's the status here? My patch gets rid of the crash (which as far as I know only happens on OS X), but doesn't make plugin printing work. And it needs to be tested on Windows (which I'm not able to do myself). (Since my change is on the "other side" of a "#if defined(XP_UNIX) && !defined(XP_MACOSX)", it doesn't effect other OSes.) Plugin printing doesn't work in Wiudows either (on the trunk), though it does work in Windows on the branch (at least for the Flash object I just tested with). Plugin printing doesn't even work on the branch in Mac OS X. So (aside from the need to test on Windows) the question is -- is my patch "good enough", or does someone need to take the trouble to make plugin printing work on OS X (and on Windows)? If no-one cares about plugin printing even on Windows, I suppose the answer should be "yes" (my patch can be used as it stands). > Do you need reviews? I suppose I do.
Stuart/vlad: Is printing plugins a known issue? Do we have any other bugs on it?
It's possible that plugin printing hasn't worked on Mac OS X for years. See bug 191046. NPP_Print _is_ now being called on the trunk (on OS X) ... with the results that I've reported here. As I said above, plugin printing does work on the branch in Windows. But just now I tested on Linux (with Firefox 2.0.0.5) and a blank space showed up where a Flash plugin should have appeared (one that prints fine with Windows Firefox 2.0.0.5). And, as I also said, plugin printing (with the same Flash object) doesn't work on the trunk even on Windows. There are a few bugs that touch on these problems. But in general it seems that very few people try to print plugins ... or say anything about their problems when it doesn't work. Notice that printing a plugin has triggered a crash on the trunk on OS X since 2005-08-23, and I'm the first one to report it (as specifically happening on the trunk).
Comment on attachment 272232 [details] [diff] [review] Simple fix (landed on trunk) I hate this code so, so much. Whether plugin printing should work or not is a separate issue; we shouldn't crash, so we should take this patch. This, I think, should be safe on windows. That said, I'm pretty sure we can make plugin printing work across the board, but that's a separate patch.
Attachment #272232 - Flags: review+
Attachment #272232 - Flags: superreview?(pavlov)
Comment on attachment 272232 [details] [diff] [review] Simple fix (landed on trunk) this patch looks fine, but this is a windows patch not a mac one.. Is this the right bug?
Attachment #272232 - Flags: superreview?(pavlov) → superreview+
> but this is a windows patch not a mac one Not so. My change is on the "other side" of a "#if defined(XP_UNIX) && !defined(XP_MACOSX)" block. And in any case I did test it on OS X :-) It's pretty clear, though, that whoever wrote this code wasn't thinking of OS X -- hence the NATIVE_WINDOWS_DC parameter to the GetNativeGraphicData() call (which makes it return NULL on OS X).
Yeah, we hit this code in the Mac case, and that returns nsnull on the mac (always), as comment #1 says. We need to do some extra work on XP_MAC here to get the CGContextRef, start QuickDraw rendering, and then send QD Port down to the plugin. But this fix should avoid the crash at least.
Since this bug was designated a blocker (just) before the tree closed for the A7 release, I assume it's alright for me to land my patch (attachment 272232 [details] [diff] [review]) once the tree reopens. (If it reopens tonight, as planned, I'll land the patch tomorrow morning ... assuming that I do in fact have permission.)
You can land your patch before the tree reopens if you get approval from one of the Firefox 3 M7 drivers (schrep, mconnor; direct email or IRC probably work best).
Landed on trunk.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Attachment #272232 - Attachment description: Simple fix → Simple fix (landed on trunk)
Flags: in-litmus?
Flags: in-litmus? → in-litmus+
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: