|
|
|
Lines 534-552
GenericProtocolHandler.prototype = {
|
Link Here
|
|---|
|
| 534 |
|
534 |
|
| 535 |
spec = spec.replace(/^\s+|[\r\n\t]+|\s+$/g, ""); |
535 |
spec = spec.replace(/^\s+|[\r\n\t]+|\s+$/g, ""); |
| 536 |
if (!/^feed:/.test(spec)) |
536 |
if (!/^feed:/.test(spec)) |
| 537 |
throw Components.results.NS_ERROR_MALFORMED_URI; |
537 |
throw Components.results.NS_ERROR_MALFORMED_URI; |
| 538 |
|
538 |
|
| 539 |
var prefix = /^feed:\/\//.test(spec) ? "http:" : ""; |
539 |
var prefix = /^feed:\/\//.test(spec) ? "http:" : ""; |
| 540 |
var inner = this._ioSvc.newURI(spec.replace("feed:", prefix), |
540 |
var inner = this._ioSvc.newURI(spec.replace("feed:", prefix), |
| 541 |
originalCharset, baseURI); |
541 |
originalCharset, baseURI); |
| 542 |
var uri = Components.classes["@mozilla.org/network/util;1"] |
542 |
var netutil = Components.classes["@mozilla.org/network/util;1"] |
| 543 |
.getService(Components.interfaces.nsINetUtil) |
543 |
.getService(Components.interfaces.nsINetUtil); |
| 544 |
.newSimpleNestedURI(inner); |
544 |
if (netutil.URIChainHasFlags(inner, |
|
|
545 |
Components.interfaces.nsIProtocolHandler.URI_INHERITS_SECURITY_CONTEXT)) |
| 546 |
throw Components.results.NS_ERROR_MALFORMED_URI; |
| 547 |
|
| 548 |
var uri = netutil.newSimpleNestedURI(inner); |
| 545 |
uri.spec = inner.spec.replace(prefix, "feed:"); |
549 |
uri.spec = inner.spec.replace(prefix, "feed:"); |
| 546 |
return uri; |
550 |
return uri; |
| 547 |
}, |
551 |
}, |
| 548 |
|
552 |
|
| 549 |
newChannel: function newChannel(aUri) { |
553 |
newChannel: function newChannel(aUri) { |
| 550 |
var uri = aUri.QueryInterface(Components.interfaces.nsINestedURI).innerURI; |
554 |
var uri = aUri.QueryInterface(Components.interfaces.nsINestedURI).innerURI; |
| 551 |
var channel = this._ioSvc.newChannelFromURI(uri); |
555 |
var channel = this._ioSvc.newChannelFromURI(uri); |
| 552 |
if (channel instanceof Components.interfaces.nsIHttpChannel) |
556 |
if (channel instanceof Components.interfaces.nsIHttpChannel) |