Closed Bug 484729 Opened 17 years ago Closed 16 years ago

NPN_Write always returns zero no matter what

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
normal

Tracking

(status1.9.2 .4-fixed)

RESOLVED FIXED
Tracking Status
status1.9.2 --- .4-fixed

People

(Reporter: gomikochar, Assigned: jgriffin)

References

Details

(Whiteboard: [fixed-lorentz])

Attachments

(1 file)

User-Agent: Opera/9.63 (Windows NT 5.1; U; en) Presto/2.1.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 I am trying to stream out some HTML (text/html) data from my plugin to Firefox but seems like NPN_Write has a buggy implementation or something as it always gives 0 as the return value, the result of which is that a zero-byte file named "_blank" gets created in the TEMP folder and Firefox then tries to display that file. Reproducible: Always Steps to Reproduce: 1. NPN_NewStream(instance, "text/html", "_blank", &pStream); 2. NPN_Write(instance, pStream, streamDataLen, (void*)streamData); 3. NPN_DestroyStream(instance, pStream, NPRES_DONE); Actual Results: NPN_Write returns 0. Expected Results: * negative value in case NPN_Write fails with an error. * positive value (> 0 I guess) in case NPN_Write succeeds. OS: Windows XP Home Edition SP3 Gecko Plugin SDK Version: 1.9.0.7 moztools: http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/moztools-static.zip Microsoft Visual Studio: 2008 Professional
Component: Extension Compatibility → Plug-ins
Product: Firefox → Core
QA Contact: extension.compatibility → plugins
Version: unspecified → 1.9.0 Branch
I've noticed that the stream is closed right away ( mOutputStream->Close() ) in the constructor of nsPluginStreamToFile class ( http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginInstancePeer.cpp#194 ) which, most probably, is the reason of this bug. While debugging, if the above mentioned statement is skipped, the NPN_Write code works fine. It still returns 0 for some reason but successfully sends the stream data to Firefox, i.e. it just reports the number of bytes copied wrong.
Confirming this bug. nsPluginStreamToFile::Write() always returns NS_OK, instead of the actual number of bytes written, as the documentation states that it should.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: x86 → All
Version: 1.9.0 Branch → 1.9.2 Branch
Blocks: 517078
Attached patch patchSplinter Review
This patch fixes NPN_Write so that it works as documented. I verified this using the changes to the application/x-test plugin I've been working on as part of bug 517078.
Attachment #401506 - Flags: review?
Attachment #401506 - Flags: review? → review?(joshmoz)
Comment on attachment 401506 [details] [diff] [review] patch yikes - patch looks good to me
Attachment #401506 - Flags: superreview?(jst)
Attachment #401506 - Flags: review?(joshmoz)
Attachment #401506 - Flags: review+
Assignee: nobody → jgriffin
blocking1.9.2+ as this looks really bad, regression or not
Flags: blocking1.9.2+
Josh, I was talking to Jonathan about this on irc and it doesn't seem like this is a regression. I think I'd be happier shipping 3.6 w/o this fix, taking it on the trunk now, and letting it be part of 3.7. No plugins out there depend on this, and few, if any, have complained, so there's IMO not much reason to risk taking this as it's certainly possible that some plugins depend on our current broken behavior.
Flags: blocking1.9.2+ → blocking1.9.2-
Attachment #401506 - Flags: superreview?(jst) → superreview+
This can be marked fixed now, right?
Fixed on trunk yes.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Version: 1.9.2 Branch → Trunk
Blanket approval for Lorentz merge to mozilla-1.9.2 a=beltzner for 1.9.2.4 - please make sure to mark status1.9.2:.4-fixed
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: