From f1dad0fbcc97e3f177b9ba2799a35f7fcb1d2bae Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Sat, 10 Aug 2013 13:33:43 +0200 Subject: [PATCH] Bug 903714 - Provide document.baseURI when calling _makeURI() in registerProtocolHandler(); r=dao --- browser/components/feeds/src/WebContentConverter.js | 3 ++- browser/components/feeds/test/test_registerHandler.html | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/browser/components/feeds/src/WebContentConverter.js b/browser/components/feeds/src/WebContentConverter.js index 3667ce829b20..0591d6501ff6 100644 --- a/browser/components/feeds/src/WebContentConverter.js +++ b/browser/components/feeds/src/WebContentConverter.js @@ -308,7 +308,8 @@ WebContentConverterRegistrar.prototype = { function WCCR_checkAndGetURI(aURIString, aContentWindow) { try { - var uri = this._makeURI(aURIString); + let baseURI = aContentWindow.document.baseURIObject; + var uri = this._makeURI(aURIString, null, baseURI); } catch (ex) { // not supposed to throw according to spec return; diff --git a/browser/components/feeds/test/test_registerHandler.html b/browser/components/feeds/test/test_registerHandler.html index 4df5f326da8b..0d7688022384 100644 --- a/browser/components/feeds/test/test_registerHandler.html +++ b/browser/components/feeds/test/test_registerHandler.html @@ -46,9 +46,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=402788 is(false, testRegisterHandler(true, "foo", "http://mochi.test:8888/", "Foo handler"), "a protocol handler uri should contain %s"); is(false, testRegisterHandler(false, "application/rss+xml", "http://mochi.test:8888/", "Foo handler"), "a content handler uri should contain %s"); - // the spec says we should not throw here, but it probably needs to be changed - is(false, testRegisterHandler(true, "foo", "foo/%s", "Foo handler"), "a protocol handler uri should be valid"); - is(false, testRegisterHandler(false, "application/rss+xml", "foo/%s", "Foo handler"), "a content handler uri should be valid"); + // the spec explicitly allows relative urls to be passed + is(true, testRegisterHandler(true, "foo", "foo/%s", "Foo handler"), "a protocol handler uri should be valid"); + is(true, testRegisterHandler(false, "application/rss+xml", "foo/%s", "Foo handler"), "a content handler uri should be valid"); // we should only accept to register when the handler has the same host as the current page (bug 402287) is(false, testRegisterHandler(true, "foo", "http://remotehost:8888/%s", "Foo handler"), "registering a foo protocol handler with a different host should not work");