Bug 1365887 - Access resource:// urls r?mak
MozReview-Commit-ID: GfXVvxLEZpK
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -1594,17 +1594,17 @@ Search.prototype = {
if (!fixupInfo.fixedURI || fixupInfo.keywordAsSent)
return false;
let uri = fixupInfo.fixedURI;
// Check the host, as "http:///" is a valid nsIURI, but not useful to us.
// But, some schemes are expected to have no host. So we check just against
// schemes we know should have a host. This allows new schemes to be
// implemented without us accidentally blocking access to them.
- let hostExpected = new Set(["http", "https", "ftp", "chrome", "resource"]);
+ let hostExpected = new Set(["http", "https", "ftp", "chrome"]);
if (hostExpected.has(uri.scheme) && !uri.host)
return false;
// getFixupURIInfo() escaped the URI, so it may not be pretty. Embed the
// escaped URL in the action URI since that URL should be "canonical". But
// pass the pretty, unescaped URL as the match comment, since it's likely
// to be displayed to the user, and in any case the front-end should not
// rely on it being canonical.
--- a/toolkit/components/places/tests/unifiedcomplete/test_visit_url.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_visit_url.js
@@ -178,9 +178,23 @@ add_task(async function() {
});
do_print("numerical operations that look like urls should search");
await check_autocomplete({
search: "123.12/12.1",
searchParam: "enable-actions",
matches: [ makeSearchMatch("123.12/12.1", { heuristic: true }) ]
});
+
+ do_print("access resource:///modules");
+ await check_autocomplete({
+ search: "resource:///modules",
+ searchParam: "enable-actions",
+ matches: [ makeVisitMatch("resource:///modules", "resource:///modules", { heuristic: true }) ]
+ });
+
+ do_print("access resource://app/modules");
+ await check_autocomplete({
+ search: "resource://app/modules",
+ searchParam: "enable-actions",
+ matches: [ makeVisitMatch("resource://app/modules", "resource://app/modules", { heuristic: true }) ]
+ });
});