Closed
Bug 292391
Opened 20 years ago
Closed 20 years ago
[FIXr]XMLHttpRequest callbacks should forward to original ones
Categories
(Core :: DOM: Core & HTML, defect, P1)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla1.8beta2
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
Attachments
(1 file, 1 obsolete file)
|
6.34 KB,
patch
|
asa
:
approval1.8b2+
|
Details | Diff | Splinter Review |
Right now, people trying to set notification callbacks on the channel that XMLHttpRequest uses get surprised because their callbacks get clobbered by XMLHttpRequest. I think the right thing to do is to cache the callbacks they sent and: 1) Forward GetInterface to them for interfaces XMLHttpRequest doesn't implement 2) Forward interface calls to them for the interfaces it does implement Anyone see any obvious problems with the proposal?
Comment 1•20 years ago
|
||
So, how would you handle the case where an implementation of nsIChannelEventSink is already present in the notification callbacks assigned to the channel in use by the XMLHttpRequest object? Would XMLHttpRequest just trust the implementation it finds, or would it still want to impose its security restrictions for redirects?
| Assignee | ||
Comment 2•20 years ago
|
||
I should have clarified that forwarding should be in addition to whatever it normally does. So we should let the other sink know we're redirecting, but only if we're allowing the redirect to start with. For the other notifications we may also want to do something smart....
Comment 3•20 years ago
|
||
OK, I figure we'll just special case things. Maybe if the consumer specifies their own nsIAuthPrompt, then we'll just use that instead of the one we'd normally use.
| Assignee | ||
Comment 4•20 years ago
|
||
Attachment #182239 -
Flags: superreview?(darin)
Attachment #182239 -
Flags: review?(cbiesinger)
| Assignee | ||
Updated•20 years ago
|
OS: Linux → All
Priority: -- → P1
Hardware: PC → All
Summary: XMLHttpRequest callbacks should forward to original ones → [FIX]XMLHttpRequest callbacks should forward to original ones
Target Milestone: --- → mozilla1.8beta2
Comment 5•20 years ago
|
||
Comment on attachment 182239 [details] [diff] [review] Proposed patch wanna use /** */ comment style in nsXMLHttpRequest.h? that'd allow automatic documentation extracting by doxygen :-)
Attachment #182239 -
Flags: review?(cbiesinger) → review+
Comment 6•20 years ago
|
||
(and sorry about the delay, I suck at doing reviews lately)
Comment 7•20 years ago
|
||
What about code that removes the callbacks in the middle of the load, they'll now continue to get notifications after they removed the callbacks. Maybe we need to hide the actual channel that XMLHttpRequest uses from its consumers and return a wrapper instead that they can mess with, and we'll forward the appropriate data through that wrapper?
Comment 8•20 years ago
|
||
well, nsIChannel says: http://lxr.mozilla.org/seamonkey/source/netwerk/base/public/nsIChannel.idl#98 " A 100 * channel may ignore changes to the notificationCallbacks attribute after 101 * it has been opened. This rule also applies to notificationCallbacks 102 * queried from the channel's loadgroup.
Comment 9•20 years ago
|
||
Comment on attachment 182239 [details] [diff] [review] Proposed patch >Index: extensions/xmlextras/base/src/nsXMLHttpRequest.cpp >+ if (mProgressEventSink) { >+ return mProgressEventSink->OnProgress(aRequest, aContext, aProgress, >+ aProgressMax); >+ } >+ > return NS_OK; > } micro nit: the return from OnProgress means nothing, so maybe better not to propogate it. returning NS_OK in all cases is fine. > nsXMLHttpRequest::OnStatus(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatus, const PRUnichar *aStatusArg) > { >+ if (mProgressEventSink) { >+ return mProgressEventSink->OnStatus(aRequest, aContext, aStatus, same micro nit This patch looks good, but what about the notification callbacks associated with the channel's load group? Should you use NS_NewNotificationCallbacksAggregation to build an interface requestor aggregation of the notification callbacks from the channel as well as from its load group? Or is the load group never going to have notification callbacks defined on it?
Attachment #182239 -
Flags: superreview?(darin) → superreview+
| Assignee | ||
Comment 10•20 years ago
|
||
jst, the wrapper would have to implement all the channel interfaces we have, for all protocols. That's just not doable sanely. nsIChannel clearly says that changing callbacks after the channel has been opened is unsupported, and our channels already ignore such changes, so I think we're safe there. ;) darin, I'm not sure how the loadgroup is a problem here... That's already handled by the channel impl, no? What am I missing?
Comment 11•20 years ago
|
||
bz: you're right. i was confused a bit. but now that i think about it more, the concern i had was actually with the fact that we only inspect nsIProgressEventSink and nsIChannelEventSink from mNotificationCallbacks, whereas the channel would normally inspect both its notification callbacks as well as the notification callbacks of its loadgroup. so, if a consumer defined notification callbacks on the loadgroup but not on the channel, we would tell the channel that we (XMLHttpRequest) implement those interfaces thus preventing the channel from getting the interfaces from the loadgroup. does this make any sense? it's hard to explain in brief. this isn't that big of a concern to me.
| Assignee | ||
Comment 12•20 years ago
|
||
Darin, that does make sense but then the consumer is generally running the risk that someone will set notificationCallbacks on the channel and the loadgroup callbacks won't get called... I think that's just a built-in part of our design, for better or worse.
| Assignee | ||
Comment 13•20 years ago
|
||
Requesting approval. People seem to be running into this problem with nsXMLHttpRequest a good bit, and it'd be good if they didn't have to worry about it...
Attachment #182239 -
Attachment is obsolete: true
Attachment #182680 -
Flags: approval1.8b2?
| Assignee | ||
Updated•20 years ago
|
Summary: [FIX]XMLHttpRequest callbacks should forward to original ones → [FIXr]XMLHttpRequest callbacks should forward to original ones
Comment 14•20 years ago
|
||
Comment on attachment 182680 [details] [diff] [review] Updated to comments a=asa
Attachment #182680 -
Flags: approval1.8b2? → approval1.8b2+
| Assignee | ||
Comment 15•20 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•