Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Reading moz-icon contents from extension
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Sunil Agrawal  
View profile  
 More options Oct 12 2012, 9:01 pm
Newsgroups: mozilla.dev.extensions
From: Sunil Agrawal <su...@armor5.com>
Date: Fri, 12 Oct 2012 18:01:57 -0700 (PDT)
Local: Fri, Oct 12 2012 9:01 pm
Subject: Reading moz-icon contents from extension
Hi,
I am writing a Firefox extension and have a need to read the contents of 'moz-icon' (e.g. moz-icon://.img?size=16) URI.

I have following code :

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;

var iOService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);

var mozUri = iOService.newURI('moz-icon://.img?size=16', null, null);
var channel = iOService.newChannelFromURI(mozUri);
var inputStream = channel.open(),
binaryInputStream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci["nsIBinaryInputStr eam"]);

binaryInputStream.setInputStream(inputStream);

let data = [];
try {
while ((avail = binaryInputStream.available()) > 0)
data = data.concat(binaryInputStream.readByteArray(avail));
binaryInputStream.close(); inputStream.close();

} catch(e) {
}

It works on Windows and Mac, however doesn't work on Linux (Ubuntu 12.0 32bit). If fails when trying to create a newChannelFromURI (says it's not implemented).

Is there any other way of reading the contents of the moz-icon URI besides creating a channel out of it?

Thanks, Sunil

(I have posted the same question on Mozillazine and if I get an answer there, I'll update this thread and vice versa).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »