Closed Bug 345716 Opened 19 years ago Closed 14 years ago

addMicrosummaryGenerator with data: URL not working

Categories

(Firefox Graveyard :: Microsummaries, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jsixpack, Unassigned)

Details

(Whiteboard: [microsummaries-feature-removal])

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1 Adding a microsummary with window.sidebar.addMicrosummaryGenerator(URI) fails if the URI is a data:xxxxxxx pseudo URL. See test case for details. Reproducible: Always Steps to Reproduce: 1. Load the attached test case 2. click "add a microsummary generator..." 3. the "Add Microsummary.." Dialog appears, click OK (or Return) 4. look at output in Javascript console 5. The same error message is shown 3 times (see actual results) 6. The rest of the script is aborted (alert 'done' does not show - see source) Actual Results: JS Console shows the following line three times: uncaught exception: [Exception... "'<error>' when calling method: [nsIMicrosummaryService::addGenerator]" nsresult: "0x805303f4 (<unknown>)" location: "JS frame :: file:///Users/joe/Desktop/Firefox-2.0b1.app/Contents/MacOS/components/nsSidebar.js :: anonymous :: line 301" data: no] Expected Results: Contents of data:xxxxxx URI should be decoded and processed; ultimately a file should show up in ..../Moz-Profile/microsummary-generators/generator-title.xml window.sidebar.addMicrosummaryGenerator() works fine for http:// and file:// URI's
A few more debugging observations. In nsSidebar.js, just before line 301, there's a call to newURI. This results in an object with the following properties for a data: URI: -*- sidebar component: spec: data:application/x.microsummary+xml;charset=UTF-8,[...]enerator%3E%0A -*- sidebar component: prePath: data: -*- sidebar component: scheme: data For a HTTP uri the URI object looks much more complete: -*- sidebar component: spec: http://www.xs4all.nl/~jlpoutre/BoT/Firefox/Microsummaries/generators/slashdot.org.xml -*- sidebar component: prePath: http://www.xs4all.nl -*- sidebar component: scheme: http -*- sidebar component: userPass: -*- sidebar component: username: -*- sidebar component: password: -*- sidebar component: hostPort: www.xs4all.nl -*- sidebar component: host: www.xs4all.nl -*- sidebar component: port: -1 -*- sidebar component: path: /~jlpoutre/BoT/Firefox/Microsummaries/generators/slashdot.org.xml -*- sidebar component: equals: function equals() { [native code] } -*- sidebar component: schemeIs: function schemeIs() { [native code] } -*- sidebar component: clone: function clone() { [native code] } -*- sidebar component: resolve: function resolve() { [native code] } -*- sidebar component: asciiSpec: http://www.xs4all.nl/~jlpoutre/BoT/Firefox/Microsummaries/generators/slashdot.org.xml -*- sidebar component: asciiHost: www.xs4all.nl -*- sidebar component: originCharset: UTF-8 -*- sidebar component: QueryInterface: function QueryInterface() { [native code] }
I can reproduce in "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061003 BonEcho/2.0". It's a little late in the game, but blocking-firefox2?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking-firefox2?
Firefox 2 is finished. Viva Grandpa Radiso! (Plus, we'd ever block on anything this minor anyway.)
Flags: blocking-firefox2?
data: URIs are potentially unsafe to use as microsummaries, as are javascript: URIs, and are likely filtered out somewhere along the line. we are way past nominations for anything but absolute showstoppers (regression topcrashes, major UI bustage, and broken web compat, etc)
Flags: blocking-firefox2-
Note that while you can't install a generator using a data: URL, you *can* install a generator programmatically from an extension or other code with chrome privileges. To do so, just call nsIMicrosummaryService::installGenerator(), passing it an XML document containing the generator. The service will install the generator, saving it as a file in the user's profile and caching it in its local generators cache. See the interface definition here: http://lxr.mozilla.org/mozilla/source/browser/components/microsummaries/public/nsIMicrosummaryService.idl#191 When programmatically installing generators, you should specify a unique identifier for the generator by adding a "uri" attribute to the "generator" element. The attribute must contain a valid URI, but you can specify an arbitrary identifier using a URN, i.e. urn:<any sequence of characters which are valid in a URI>. To guarantee uniqueness, I recommend using URNs containing UUIDs generated by nsIUUIDGenerator::generateUUID(), although you are free to use another scheme appropriate to your extension. Note that generators installed by nsISidebar::addMicrosummaryGenerator() use unique identifiers of the form urn:source:<source URI>, where <source URI> is the URI from which the generator was downloaded. Unless you are installing generators which are also available remotely from the address embedded in the URI, you should not use this form.
(In reply to comment #6) > Note that while you can't install a generator using a data: URL, you *can* > install a generator programmatically from an extension or other code with > chrome privileges. I put up a document on devmo with more documentation, including code snippets, for how to do this: http://developer.mozilla.org/en/docs/Microsummary_topics#Programmatically_installing_a_microsummary_generator
- BUGSPAM - Wontfixing all Microsummaries bugs, since the feature has been removed from the core product and previous versions won't get further fixes for it. If interested in supporting Microsummaries in your add-on, you're free to use our old microsummaries code and to search all previously open bugs by looking for [microsummaries-feature-removal] in the status whiteboard field.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
Whiteboard: [microsummaries-feature-removal]
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: