Closed
Bug 299067
Opened 19 years ago
Closed 19 years ago
Add nsIClassInfo to nsISimpleURI
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: pavlov, Assigned: pavlov)
Details
Attachments
(2 files, 2 obsolete files)
3.25 KB,
patch
|
darin.moz
:
review+
dbaron
:
superreview+
benjamin
:
approval1.8b3+
|
Details | Diff | Splinter Review |
4.38 KB,
patch
|
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
I keep hitting in my Thunderbird builds with Lightning: ###!!! ASSERTION: aObject must implement nsIClassInfo: 'Not Reached', file c:/builds/mozilla/objdir-thunderbird/xpcom/io/../../../xpcom/io/nsFastLoadFile.cpp, line 2144 Where aObject is a nsSimpleURI. I'm not sure what we're doing that is causing this, but dbaron says that anything that implements nsISerializable has to also implement nsIClassInfo. I basically just copied the code from nsStandardURL for this.
Assignee | ||
Comment 1•19 years ago
|
||
This shouldn't break anything.. it is a very minor patch, but I'd like to get it in 1.8 if possible.
Attachment #187554 -
Flags: superreview?(dbaron)
Attachment #187554 -
Flags: review?(darin)
Attachment #187554 -
Flags: superreview?(dbaron) → superreview+
Updated•19 years ago
|
OS: Windows XP → All
Hardware: PC → All
Comment on attachment 187554 [details] [diff] [review] Add nsIClassInfo to nsSimpleURI >+NS_IMETHODIMP >+nsSimpleURI::GetInterfaces(PRUint32 *count, nsIID * **array) >+{ >+ *count = 0; >+ *array = nsnull; >+ return NS_OK; >+} Err.. >+NS_IMETHODIMP >+nsSimpleURI::GetContractID(char * *aContractID) >+{ >+ *aContractID = nsnull; >+ return NS_OK; >+} It has a contractid, at http://lxr.mozilla.org/seamonkey/source/netwerk/build/nsNetCID.h#116 ?
Assignee | ||
Comment 3•19 years ago
|
||
We can certainly implement those things. nsStandardURL doesn't, which is perhaps a seperate bug, but I'm not sure that they are needed to fix this..
OS: All → Windows XP
Hardware: All → PC
Assignee | ||
Comment 4•19 years ago
|
||
just for you, vlad...
Attachment #187554 -
Attachment is obsolete: true
Attachment #187559 -
Flags: superreview?(dbaron)
Attachment #187559 -
Flags: review?(darin)
Assignee | ||
Updated•19 years ago
|
Attachment #187554 -
Flags: review?(darin)
Comment on attachment 187559 [details] [diff] [review] With GetInterfaces and GetContractID implemented >+nsSimpleURI::GetInterfaces(PRUint32 *count, nsIID * **array) If you allocate all 4 IID objects up front, you can simplify your early return code a lot. >+ const nsIID& isIID = NS_GET_IID(nsISupports); >+ iids[0] = NS_STATIC_CAST(nsIID *, nsMemory::Clone(&isIID, sizeof(nsIID))); >+ if (!iids[0]) { >+ nsMemory::Free(iids); >+ return NS_ERROR_OUT_OF_MEMORY; >+ } nsIClassInfo.idl says you can skip nsISupports.
Assignee | ||
Comment 6•19 years ago
|
||
Yeah, not sure what I was thinking there...
Attachment #187563 -
Flags: superreview?(dbaron)
Attachment #187563 -
Flags: review?(darin)
Assignee | ||
Updated•19 years ago
|
Attachment #187559 -
Attachment is obsolete: true
Attachment #187559 -
Flags: superreview?(dbaron)
Attachment #187559 -
Flags: review?(darin)
You still need to null check the three allocations, but you can do that all at the end...
(In reply to comment #4) > Created an attachment (id=187559) [edit] > With GetInterfaces and GetContractID implemented > > just for you, vlad... Yay :) Eradicating QI from JS code, one component at a time...
Assignee | ||
Comment 9•19 years ago
|
||
Attachment #187563 -
Attachment is obsolete: true
Attachment #187569 -
Flags: superreview?(dbaron)
Attachment #187569 -
Flags: review?(darin)
Assignee | ||
Updated•19 years ago
|
Attachment #187563 -
Flags: superreview?(dbaron)
Attachment #187563 -
Flags: review?(darin)
Attachment #187569 -
Flags: superreview?(dbaron) → superreview+
Comment 10•19 years ago
|
||
nsStandardURL.cpp does not implement all of nsIClassInfo. it only implements GetClassID (and GetClassIDNoAlloc) because that's all that fastload needs. why are you implementing the rest of nsIClassInfo? In fact, I'd argue that implementing GetInterfaces is a _BAD_ idea. why? because necko supports pluggable protocol handlers via a frozen contract. no where in the contract for nsIProtocolHandler::newURI does it say that the resulting nsIURI must support nsIClassInfo to automatically reflect certain interface methods to script. if you make this change (and assuming you do the same with nsStandardURL) and people start using it, then existing third-party nsIProtocolHandlers will lose. that doesn't seem like a good thing to me. if you want to make URLs easier to use from JS, then we need a new API wrapping nsIURI because the implementation of nsIURI is not entirely something we control. we do for certain protocols, but not all in general.
(In reply to comment #10) > nsStandardURL.cpp does not implement all of nsIClassInfo. it only implements > GetClassID (and GetClassIDNoAlloc) because that's all that fastload needs. why > are you implementing the rest of nsIClassInfo? > > In fact, I'd argue that implementing GetInterfaces is a _BAD_ idea. why? > because necko supports pluggable protocol handlers via a frozen contract. no > where in the contract for nsIProtocolHandler::newURI does it say that the > resulting nsIURI must support nsIClassInfo to automatically reflect certain > interface methods to script. if you make this change (and assuming you do the > same with nsStandardURL) and people start using it, then existing third-party > nsIProtocolHandlers will lose. that doesn't seem like a good thing to me. > > if you want to make URLs easier to use from JS, then we need a new API wrapping > nsIURI because the implementation of nsIURI is not entirely something we > control. we do for certain protocols, but not all in general. Fair enough, that explanation makes sense. There may be a case here for fixing fastload to not require people to implement-but-not-implement classinfo, and instead just add GetClassID to nsISerializable as needed. Not sure how frozen nsISerializable is; it doesn't seem to be according to the idl, but that hasn't always been a good guide... but that's a separate bug entirely.
Comment 12•19 years ago
|
||
Comment on attachment 187554 [details] [diff] [review] Add nsIClassInfo to nsSimpleURI Let's go with this patch instead. r=darin
Attachment #187554 -
Attachment is obsolete: false
Attachment #187554 -
Flags: review+
Assignee | ||
Comment 13•19 years ago
|
||
OK, we'll go with the first patch then. I'd like to get this in for 1.8b3 as it is causing some issues in Lightning.
Status: NEW → ASSIGNED
Flags: blocking1.8b3?
Assignee | ||
Updated•19 years ago
|
Attachment #187554 -
Flags: approval1.8b3?
Comment 14•19 years ago
|
||
Comment on attachment 187554 [details] [diff] [review] Add nsIClassInfo to nsSimpleURI Please land quickly
Attachment #187554 -
Flags: approval1.8b3? → approval1.8b3+
Comment 15•19 years ago
|
||
Wait a sec. We want to violate the contract of nsIClassInfo and give it a partial implementation, because if we add a new capability to nsStandardURL people might start to rely on unfrozen behaviour? Our environment is full of things that people can't use because they're unfrozen; we can't stop improving our platform because others might not keep up, and because people might not write perfectly general code if they don't want it. What happens when we add an nsIPropertyBag QI to nsIChannel? Can't people then write to that new API, and not work with other implementations that don't implement it, etc.? I really don't think I agree with the reasoning here.
Assignee | ||
Comment 16•19 years ago
|
||
checked in the first patch. Feel free to continue arguing about the last patch if you want. I tend to agree with shaver and vlad that we should implement the whole thing, but as the first patch fixes the problem that I'm hitting, I don't care as much anymore.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 17•19 years ago
|
||
> Wait a sec. We want to violate the contract of nsIClassInfo and give it a > partial implementation, because if we add a new capability to nsStandardURL > people might start to rely on unfrozen behaviour? Our environment is full of > things that people can't use because they're unfrozen; we can't stop improving > our platform because others might not keep up, and because people might not > write perfectly general code if they don't want it. I think you are confusing things when you talk about dipping into the unfrozen interface bucket. I'm talking about messing with frozen interface contracts. It is possible to write a protocol handler that uses only frozen interfaces. In fact, you could make this work all the way back to Mozilla 1.4 (maybe 1.0) if you so desired. It would be extremely unwise IMO to break protocol handlers that were developed by following our rules about adhering to frozen interfaces. Afterall, we have told people that they can develop to our frozen interfaces without fear of being broken by a future version of our product. Are you saying that is a bad rule? > What happens when we add an nsIPropertyBag QI to nsIChannel? Can't people > then write to that new API, and not work with other implementations that don't > implement it, etc.? I really don't think I agree with the reasoning here. nsIPropertyBag is only implemented by HTTP. It is not uniformly implemented. To the best of my knowledge the code that uses nsIPropertyBag fails gracefully when that interface is not supported. If not, then it is a bug. When we add support for nsIPropertyBag to all of our channels, we will need to take care to QI and fail gracefully if the interface is not supported. nsIClassInfo::getInterfaces is a different beast altogether because the coder has to take no action to get at the extra methods exposed by an additional interface. The onLinkIconAvailable issues with <tabbrowser> in Firefox 1.0 are not an example to be repeated! ;-)
Comment 18•19 years ago
|
||
> nsIPropertyBag is only implemented by HTTP.
(It is also implemented by file: and ftp:, fwiw)
Updated•19 years ago
|
Attachment #187569 -
Flags: review?(darin)
Updated•19 years ago
|
Flags: blocking1.8b3?
You need to log in
before you can comment on or make changes to this bug.
Description
•