Bug 903714 - Provide document.baseURI when calling _makeURI() in registerProtocolHandler(); r=dao

This commit is contained in:
Tim Taubert 2013-08-10 13:33:43 +02:00
parent 489d2788bd
commit c9ed7b0daa
2 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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");