Closed Bug 693270 Opened 13 years ago Closed 7 years ago

registerContentHandler of a relative URI gets uncaught exception in WebContentConverter.js

Categories

(Firefox Graveyard :: RSS Discovery and Preview, defect)

10 Branch
x86_64
Linux
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: info, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

I tried the Example in https://developer.mozilla.org/en/DOM/window.navigator.registerContentHandler in SeaMonkey, but used a relative URI to avoid getting 'Permission denied to add http://www.example.tld/?foo=%s as a content or protocol handler.' I.e. just the three lines <script> navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "local.html?foo=%s", "My Feed Reader"); </script> It's at http://www.skierpage.com/moz_bugs/my_register_bug.html Actual results: Error console has the error: [03:30:28.902] uncaught exception: [Exception... "'[JavaScript Error: "aURI is undefined" {file: "resource:///components/WebContentConverter.js" line: 550}]' when calling method: [nsIWebContentHandlerRegistrar::registerContentHandler]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: http://www.skierpage.com/moz_bugs/my_register_bug.html :: <TOP_LEVEL> :: line 4" data: yes] Expected results: I'm not sure why this shouldn't work, the relative URI is implicitly using the http protocol and the same host, so the checks in WCCR_checkAndGetURI() in http://hg.mozilla.org/mozilla-central/file/aee2bf4eb5f8/browser/components/feeds/src/WebContentConverter.js#l341 should pass. I think the problem is WCCR_checkAndGetURI() doesn't pass a baseURI parameter to _makeURI, so if you give a relative URI, ioService.newURI() throws an exception NS_ERROR_MALFORMED_URI, WCCR_checkAndGetURI catches this and returns nothing as the URI, and then _appendFeedReaderNotification() blows up. Clients invoking registerContentHandler() must specify a full URI starting with scheme (only http and https for now), not a relative URI. This seems very low-priority until/unless registerContentHandler() is enhanced so people can do Boot2Gecko-ish things like pass PDF and ODF URLs to an HTML page that renders them (bug 391286).
opensuse 12.1, 32 bit system, Mozilla/5.0 (X11; Linux i686; rv:13.0a1) Gecko/20120215 Firefox/13.0a1, this problem is still present using http://www.skierpage.com/moz_bugs/my_register_bug.html as way to reproduce this. Console output: Timestamp: 02/15/2012 04:26:10 PM Error: uncaught exception: [Exception... "'[JavaScript Error: "aURI is undefined" {file: "resource:///components/WebContentConverter.js" line: 550}]' when calling method: [nsIWebContentHandlerRegistrar::registerContentHandler]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: http://www.skierpage.com/moz_bugs/my_register_bug.html :: <TOP_LEVEL> :: line 4" data: yes]
Attached file skierpage's testcase
See also bug 732692.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
Depends on: 1398169
As of Bug 1460481 we should WONTFIX this.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: