Re: problem getting image size(in bytes)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: problem getting image size(in bytes)

Anatoly Kaverin
Hello Daniel and everyone

> Anatoly Kaverin wrote:
>
>> We need to get an image physical size (not dimentions) from Web page
>> loaded into Firefox browser.
>>
>> Is it possible to get it via XPCOM without additional reloading???
>>
> From
> chrome\browser\content\browser\metaData.js
> function getSize(url) {
> try
> {
> var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url,
> Components.interfaces.nsICache.ACCESS_READ, false);
> if(cacheEntryDescriptor)
> return cacheEntryDescriptor.dataSize;
> }
> catch(ex) {}
> try
> {
> cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url,
> Components.interfaces.nsICache.ACCESS_READ, false);
> if (cacheEntryDescriptor)
> return cacheEntryDescriptor.dataSize;
> }
> catch(ex) {}
> return -1;
> }
> Daniel
>
> F'up set to netscape.public.mozilla.xpcom
>

This sample works great in our C++ XPCOM component in FF 1.0.x, but in Firefox
1.5 beta2 this code ins't working.
When we try to get service nsICacheService we always got error - NO_INTERFACE...

So, is there any mechanism to get physical size of images from cache???
maybe, new service or interface??
It's a pity, but XULPlanet don't include Gecko 1.8 interfaces...

With Best Regards,
Anatoly Kaverin,
Firefox VEngine team
Comodo CA Limited
http://www.vengine.com http://www.comodo.com
[hidden email]
MSN: [hidden email]


_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom
Reply | Threaded
Open this post in threaded view
|

Re: problem getting image size(in bytes)

Christian Biesinger
[replying to sender + mailing list due to late reply]

Anatoly Kaverin wrote:
> This sample works great in our C++ XPCOM component in FF 1.0.x, but in
> Firefox 1.5 beta2 this code ins't working.
> When we try to get service nsICacheService we always got error -
> NO_INTERFACE...

The (unfrozen) nsICacheService interface changed between 1.0.x and 1.5.
If you want to be compatible with both versions, you need to get both
header files, rename the interface in one of them, and QI to both of
them, and use whichever one succeeds.

nsICacheService is available still.

-biesi
_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom
Reply | Threaded
Open this post in threaded view
|

Re: problem getting image size(in bytes)

Anatoly Kaverin-2
In reply to this post by Anatoly Kaverin
Hello Christian,

> [replying to sender + mailing list due to late reply]
>
> Anatoly Kaverin wrote:
>
>> This sample works great in our C++ XPCOM component in FF 1.0.x, but
>> in
>> Firefox 1.5 beta2 this code ins't working.
>> When we try to get service nsICacheService we always got error -
>> NO_INTERFACE...
> The (unfrozen) nsICacheService interface changed between 1.0.x and
> 1.5. If you want to be compatible with both versions, you need to get
> both header files, rename the interface in one of them, and QI to both
> of them, and use whichever one succeeds.
>
> nsICacheService is available still.
>
> -biesi
>

Christian,

hi again, and THANK YOU VERY MUCH AGAIN for your help.
Our team really appreciate Your help.

We're downloading FF 1.5 beta2 src-s and going to use your advice.

P.S. if You'll be in Odessa (Ukraine) we'd like to drink some beer with You....:)

With Best Regards,
Anatoly Kaverin,
Firefox VEngine team
Comodo CA Limited
http://www.vengine.com http://www.comodo.com
[hidden email]
MSN: [hidden email]


_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom