Closed Bug 221593 Opened 21 years ago Closed 21 years ago

win nsIconChannel.cpp should not call streamlistener methods synchronously

Categories

(Core :: Graphics: ImageLib, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Biesinger, Assigned: Biesinger)

Details

Attachments

(1 file, 4 obsolete files)

416 aListener->OnDataAvailable(this, ctxt, inputStr, 0, 417 iconBuffer.Length()); 418 aListener->OnStopRequest(this, ctxt, rv); should be done via a proxy
OS: Linux → Windows 2000
Attached patch patch, unfinished (obsolete) — Splinter Review
something like this, but I want to implement nsIconChannel::Open as well
Attached patch like this (obsolete) — Splinter Review
Attachment #133537 - Attachment is obsolete: true
(bug 222694 will bitrot this patch, so not requesting review yet)
OK, 222694 is in. Should this be updated? can the OS/2 version just go in? (bug 223128)
mkaply: yes, I'm updating this right now. os/2 can go in as-is.
Attached patch merge to trunk (obsolete) — Splinter Review
Attachment #133577 - Attachment is obsolete: true
Comment on attachment 134519 [details] [diff] [review] merge to trunk >Index: modules/libpr0n/decoders/icon/win/nsIconChannel.cpp > #include "nsNetUtil.h" ... >+#include "nsNetCID.h" >+#include "nsIPipe.h" >+#include "nsIInputStream.h" >+#include "nsIOutputStream.h" nsNetUtil.h already includes all of these. >+ // Add ourself to the load group, if available >+ if (mLoadGroup) >+ mLoadGroup->AddRequest(this, nsnull); >+ >+ rv = mPump->AsyncRead(this, ctxt); >+ if (NS_FAILED(rv)) { >+ // Break possibly reference cycle >+ mListener = nsnull; >+ } >+ return rv; >+} you don't want to call AddRequest until you know AsyncOpen is going to return NS_OK. see nsFileChannel::AsyncOpen for example. >+nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval) ... >+ // Now, create a pipe and stuff our data into it >+ nsCOMPtr<nsIInputStream> inStream; >+ nsCOMPtr<nsIOutputStream> outStream; >+ rv = NS_NewPipe(getter_AddRefs(inStream), getter_AddRefs(outStream), >+ iconSize, iconSize); >+ if (NS_SUCCEEDED(rv)) { >+ PRUint32 written; >+ rv = outStream->Write(buffer, iconSize, &written); >+ if (NS_SUCCEEDED(rv)) { >+ NS_ADDREF(*_retval = inStream); >+ } you should make the input end of the pipe non-blocking, when it will be used with AsyncOpen. that way, the nsInputStreamPump will not need to read from the pipe on a background thread to make it asynchronous ;-) nsIInputStreamPump.idl explains this a bit. i would add a nonBlockingInput parameter to MakeInputStream and pass that to NS_NewPipe. otherwise, this patch looks good to me.
Attachment #134519 - Flags: review?(darin) → review-
Attached patch per darin's comments (obsolete) — Splinter Review
Attachment #134519 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Comment on attachment 135074 [details] [diff] [review] per darin's comments i think you got the sense of the nonBlocking argument backwards. nsIconChannel::Open must return a "blocking" input stream, so you want to pass PR_FALSE in ::Open and PR_TRUE in ::AsyncOpen. otherwise, the patch looks good.
Attachment #135074 - Flags: review?(darin) → review-
"oops" guess I thought of it as "blocking" rather than "nonblocking"
Attachment #135074 - Attachment is obsolete: true
Attachment #135118 - Flags: review?(darin) → review+
Attachment #135118 - Flags: superreview?(tor)
On OS/2, I had to use: aContentType = NS_LITERAL_CSTRING("image/icon"); instead of aContentType = NS_LITERAL_CSTRING("image/x-icon"); to get stuff to work. Anyone have a clue why?
mkaply: yes - neil recently changed the windows iconchannel code to generate .ico files - those have the image/x-icon content type, and are decoded by nsICODecoder.cpp. but os/2 was not changed and still creates some strange format for which the type image/icon is used (and nsIconDecoder.cpp) I don't think GetContentType was changed in this patch though...
That code didn't change - it's more that when I ported the Windows code back to OS/2, I noticed that difference and wondered why. So if I understand correctly, image/x-icon is used, Mozilla assumes a Windows icon and goes through the Windows icon format decoder. Since the OS/2 format is not at all compatible with Windows, I wonder if I should name the content type image/x-os2-icon or image/moz-os2-icon or something like that?
>So if I understand correctly, image/x-icon is used, Mozilla assumes a Windows >icon and goes through the Windows icon format decoder. correct - also see bug 222694 which changed that (before, the windows icons were converted to an intermediate format - that image/icon thing) image/icon is not os/2 specific... the macos icon decoder also creates image/icon icons.
Attachment #135118 - Flags: superreview?(tor) → superreview+
Checking in win/nsIconChannel.cpp; /cvsroot/mozilla/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp,v <-- nsIconChannel.cpp new revision: 1.28; previous revision: 1.27 done Checking in win/nsIconChannel.h; /cvsroot/mozilla/modules/libpr0n/decoders/icon/win/nsIconChannel.h,v <-- nsIconChannel.h new revision: 1.6; previous revision: 1.5 done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: