Bug 1329182 - remove trailing newURI null parameters in toolkit/, r=jaws.

This commit is contained in:
Florian Quèze 2017-01-09 20:27:25 +01:00
parent 028a82f682
commit 34e970eb9b
82 changed files with 129 additions and 134 deletions

View File

@ -776,7 +776,7 @@ ContentPrefService2.prototype = {
if (!groupStr)
return null;
try {
var groupURI = Services.io.newURI(groupStr, null, null);
var groupURI = Services.io.newURI(groupStr);
} catch (err) {
return groupStr;
}

View File

@ -72,7 +72,7 @@ var ContentPrefTest = {
// Utilities
getURI: function ContentPrefTest_getURI(spec) {
return this._ioSvc.newURI(spec, null, null);
return this._ioSvc.newURI(spec);
},
/**

View File

@ -23,5 +23,5 @@ function createURI(aObj) {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) :
ios.newURI(aObj, null, null);
ios.newURI(aObj);
}

View File

@ -713,7 +713,7 @@ this.Extension = class extends ExtensionData {
// Checks that the given URL is a child of our baseURI.
isExtensionURL(url) {
let uri = Services.io.newURI(url, null, null);
let uri = Services.io.newURI(url);
let common = this.baseURI.getCommonBaseSpec(uri);
return common == this.baseURI.spec;

View File

@ -805,7 +805,7 @@ class BrowserExtensionContent extends EventEmitter {
this.localeData = new LocaleData(data.localeData);
this.manifest = data.manifest;
this.baseURI = Services.io.newURI(data.baseURL, null, null);
this.baseURI = Services.io.newURI(data.baseURL);
// Only used in addon processes.
this.views = new Set();
@ -813,7 +813,7 @@ class BrowserExtensionContent extends EventEmitter {
// Only used for devtools views.
this.devtoolsViews = new Set();
let uri = Services.io.newURI(data.resourceURL, null, null);
let uri = Services.io.newURI(data.resourceURL);
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
// Extension.jsm takes care of this in the parent.

View File

@ -318,7 +318,7 @@ class ExtensionTestCommon {
Services.ppmm.broadcastAsyncMessage("Extension:FlushJarCache", {path: file.path});
let fileURI = Services.io.newFileURI(file);
let jarURI = Services.io.newURI("jar:" + fileURI.spec + "!/", null, null);
let jarURI = Services.io.newURI("jar:" + fileURI.spec + "!/");
// This may be "temporary" or "permanent".
if (data.useAddonManager) {

View File

@ -22,7 +22,7 @@ function toLocalURI(code) {
let uniqueResPart = `need-a-local-uri-for-subscript-loading-${++gUniqueId}`;
Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler)
.setSubstitution(uniqueResPart, Services.io.newURI(dataUrl, null, null));
.setSubstitution(uniqueResPart, Services.io.newURI(dataUrl));
return `resource://${uniqueResPart}`;
}

View File

@ -60,7 +60,7 @@ add_task(function* test_embedded_webextension_utils() {
});
let fileURI = Services.io.newFileURI(fakeHybridAddonFile);
let resourceURI = Services.io.newURI(`jar:${fileURI.spec}!/`, null, null);
let resourceURI = Services.io.newURI(`jar:${fileURI.spec}!/`);
let embeddedExtension = LegacyExtensionsUtils.getEmbeddedExtensionFor({
id, resourceURI,
@ -122,7 +122,7 @@ function* createManifestErrorTestCase(id, xpi, expectedError) {
});
let fileURI = Services.io.newFileURI(xpi);
let resourceURI = Services.io.newURI(`jar:${fileURI.spec}!/`, null, null);
let resourceURI = Services.io.newURI(`jar:${fileURI.spec}!/`);
let embeddedExtension = LegacyExtensionsUtils.getEmbeddedExtensionFor({
id, resourceURI,

View File

@ -4,7 +4,7 @@ Cu.import("resource://gre/modules/ExtensionManagement.jsm");
Cu.import("resource://gre/modules/Services.jsm");
function createWindowWithAddonId(addonId) {
let baseURI = Services.io.newURI("about:blank", null, null);
let baseURI = Services.io.newURI("about:blank");
let originAttributes = {addonId};
let principal = Services.scriptSecurityManager
.createCodebasePrincipal(baseURI, originAttributes);

View File

@ -199,7 +199,7 @@ function selectOnOK() {
if (allowURLs) {
try {
var ios = Components.classes[NS_IOSERVICE_CONTRACTID].getService(Components.interfaces.nsIIOService);
retvals.fileURL = ios.newURI(textInput.value, null, null);
retvals.fileURL = ios.newURI(textInput.value);
let fileList = [];
if (retvals.fileURL instanceof Components.interfaces.nsIFileURL)
fileList.push(retvals.fileURL.file);

View File

@ -98,7 +98,7 @@ function run_test() {
for (let uri of uris) {
// convert URIs to paths with nsIFileURI, which fromFileURI is trying to model
let path = Services.io.newURI(uri, null, null).QueryInterface(Components.interfaces.nsIFileURL).file.path;
let path = Services.io.newURI(uri).QueryInterface(Components.interfaces.nsIFileURL).file.path;
do_check_eq(path, OS.Path.fromFileURI(uri));
}

View File

@ -50,8 +50,7 @@ this.InsecurePasswordUtils = {
_checkFormSecurity(aForm) {
let isFormSubmitHTTP = false, isFormSubmitSecure = false;
if (aForm.rootElement instanceof Ci.nsIDOMHTMLFormElement) {
let uri = Services.io.newURI(aForm.rootElement.action || aForm.rootElement.baseURI,
null, null);
let uri = Services.io.newURI(aForm.rootElement.action || aForm.rootElement.baseURI);
let principal = gScriptSecurityManager.getCodebasePrincipal(uri);
if (uri.schemeIs("http")) {

View File

@ -195,8 +195,8 @@ this.LoginHelper = {
if (aOptions.schemeUpgrades) {
try {
let loginURI = Services.io.newURI(aLoginOrigin, null, null);
let searchURI = Services.io.newURI(aSearchOrigin, null, null);
let loginURI = Services.io.newURI(aLoginOrigin);
let searchURI = Services.io.newURI(aSearchOrigin);
if (loginURI.scheme == "http" && searchURI.scheme == "https" &&
loginURI.hostPort == searchURI.hostPort) {
return true;
@ -222,14 +222,14 @@ this.LoginHelper = {
return false;
if (ignoreSchemes) {
let hostname1URI = Services.io.newURI(aLogin1.hostname, null, null);
let hostname2URI = Services.io.newURI(aLogin2.hostname, null, null);
let hostname1URI = Services.io.newURI(aLogin1.hostname);
let hostname2URI = Services.io.newURI(aLogin2.hostname);
if (hostname1URI.hostPort != hostname2URI.hostPort)
return false;
if (aLogin1.formSubmitURL != "" && aLogin2.formSubmitURL != "" &&
Services.io.newURI(aLogin1.formSubmitURL, null, null).hostPort !=
Services.io.newURI(aLogin2.formSubmitURL, null, null).hostPort)
Services.io.newURI(aLogin1.formSubmitURL).hostPort !=
Services.io.newURI(aLogin2.formSubmitURL).hostPort)
return false;
} else {
if (aLogin1.hostname != aLogin2.hostname)
@ -404,7 +404,7 @@ this.LoginHelper = {
let preferredOriginScheme;
if (preferredOrigin) {
try {
preferredOriginScheme = Services.io.newURI(preferredOrigin, null, null).scheme;
preferredOriginScheme = Services.io.newURI(preferredOrigin).scheme;
} catch (ex) {
// Handle strings that aren't valid URIs e.g. chrome://FirefoxAccounts
}
@ -445,8 +445,8 @@ this.LoginHelper = {
try {
// Only `hostname` is currently considered
let existingLoginURI = Services.io.newURI(existingLogin.hostname, null, null);
let loginURI = Services.io.newURI(login.hostname, null, null);
let existingLoginURI = Services.io.newURI(existingLogin.hostname);
let loginURI = Services.io.newURI(login.hostname);
// If the schemes of the two logins are the same or neither match the
// preferredOriginScheme then we have no preference and look at the next resolveBy.
if (loginURI.scheme == existingLoginURI.scheme ||

View File

@ -1205,7 +1205,7 @@ var LoginUtils = {
_getPasswordOrigin(uriString, allowJS) {
var realm = "";
try {
var uri = Services.io.newURI(uriString, null, null);
var uri = Services.io.newURI(uriString);
if (allowJS && uri.scheme == "javascript")
return "javascript:";

View File

@ -125,7 +125,7 @@ LoginStore.prototype._dataPostProcessor = function(data) {
LoginStore.prototype._migrateDisabledHosts = function(data) {
for (let host of data.disabledHosts) {
try {
let uri = Services.io.newURI(host, null, null);
let uri = Services.io.newURI(host);
Services.perms.add(uri, PERMISSION_SAVE_LOGINS, Services.perms.DENY_ACTION);
} catch (e) {
Cu.reportError(e);

View File

@ -446,7 +446,7 @@ LoginManager.prototype = {
return false;
}
let uri = Services.io.newURI(origin, null, null);
let uri = Services.io.newURI(origin);
return Services.perms.testPermission(uri, PERMISSION_SAVE_LOGINS) != Services.perms.DENY_ACTION;
},
@ -458,7 +458,7 @@ LoginManager.prototype = {
// Throws if there are bogus values.
LoginHelper.checkHostnameValue(origin);
let uri = Services.io.newURI(origin, null, null);
let uri = Services.io.newURI(origin);
if (enabled) {
Services.perms.remove(uri, PERMISSION_SAVE_LOGINS);
} else {

View File

@ -524,7 +524,7 @@ LoginManagerPrompter.prototype = {
if (httpRealm.test(aRealmString))
return [null, null, null];
var uri = Services.io.newURI(aRealmString, null, null);
var uri = Services.io.newURI(aRealmString);
var pathname = "";
if (uri.path != "/")
@ -1548,7 +1548,7 @@ LoginManagerPrompter.prototype = {
if (aURI instanceof Ci.nsIURI) {
uri = aURI;
} else {
uri = Services.io.newURI(aURI, null, null);
uri = Services.io.newURI(aURI);
}
return uri.scheme + "://" + uri.hostPort;
@ -1568,7 +1568,7 @@ LoginManagerPrompter.prototype = {
var idnService = Cc["@mozilla.org/network/idn-service;1"].
getService(Ci.nsIIDNService);
try {
var uri = Services.io.newURI(aURIString, null, null);
var uri = Services.io.newURI(aURIString);
var baseDomain = eTLDService.getBaseDomain(uri);
displayHost = idnService.convertToDisplayIDN(baseDomain, {});
} catch (e) {

View File

@ -465,7 +465,7 @@ LoginManagerStorage_mozStorage.prototype = {
params[field] = value;
let valueURI;
try {
if (aOptions.schemeUpgrades && (valueURI = Services.io.newURI(value, null, null)) &&
if (aOptions.schemeUpgrades && (valueURI = Services.io.newURI(value)) &&
valueURI.scheme == "https") {
condition += ` OR ${field} = :http${field}`;
params["http" + field] = "http://" + valueURI.hostPort;
@ -1136,7 +1136,7 @@ LoginManagerStorage_mozStorage.prototype = {
for (let host of disabledHosts) {
try {
let uri = Services.io.newURI(host, null, null);
let uri = Services.io.newURI(host);
Services.perms.add(uri, PERMISSION_SAVE_LOGINS, Services.perms.DENY_ACTION);
} catch (e) {
Cu.reportError(e);

View File

@ -77,7 +77,7 @@ function createLoginsFragment(url, content, elementQuery) {
ownerDocument: document
};
let URI = Services.io.newURI(url, null, null);
let URI = Services.io.newURI(url);
return {
document,
fragment: LoginManagerContextMenu.addLoginsToMenu(inputElement, browser, URI),

View File

@ -81,7 +81,7 @@ function getAllDisabledHostsFromPermissionManager() {
}
function setLoginSavingEnabled(origin, enabled) {
let uri = Services.io.newURI(origin, null, null);
let uri = Services.io.newURI(origin);
if (enabled) {
Services.perms.remove(uri, PERMISSION_SAVE_LOGINS);

View File

@ -661,7 +661,7 @@ nsPlacesExpiration.prototype = {
}
}
let uri = Services.io.newURI(row.getResultByName("url"), null, null);
let uri = Services.io.newURI(row.getResultByName("url"));
let guid = row.getResultByName("guid");
let visitDate = row.getResultByName("visit_date");
let wholeEntry = row.getResultByName("whole_entry");

View File

@ -281,7 +281,7 @@ TaggingService.prototype = {
try {
while (stmt.executeStep()) {
try {
uris.push(Services.io.newURI(stmt.row.url, null, null));
uris.push(Services.io.newURI(stmt.row.url));
} catch (ex) {}
}
} finally {

View File

@ -6,8 +6,7 @@
/* TEST_PATH=toolkit/components/places/tests/browser/browser_bug680727.js make -C $(OBJDIR) mochitest-browser-chrome */
const kUniqueURI = Services.io.newURI("http://mochi.test:8888/#bug_680727",
null, null);
const kUniqueURI = Services.io.newURI("http://mochi.test:8888/#bug_680727");
var gAsyncHistory =
Cc["@mozilla.org/browser/history;1"].getService(Ci.mozIAsyncHistory);

View File

@ -24,7 +24,7 @@ const XHTML_NS = "http://www.w3.org/1999/xhtml";
*/
function frcTest(uri, expected, message) {
return new Promise(resolve => {
CA.findRepresentativeColor(Services.io.newURI(uri, "", null),
CA.findRepresentativeColor(Services.io.newURI(uri, ""),
function(success, color) {
if (expected == null) {
ok(!success, message);

View File

@ -803,7 +803,7 @@ AboutReader.prototype = {
this._article = article;
this._domainElement.href = article.url;
let articleUri = Services.io.newURI(article.url, null, null);
let articleUri = Services.io.newURI(article.url);
this._domainElement.textContent = this._stripHost(articleUri.host);
this._creditsElement.textContent = article.byline;

View File

@ -146,7 +146,7 @@ this.ReaderMode = {
let outerHash = "";
try {
let uriObj = Services.io.newURI(url, null, null);
let uriObj = Services.io.newURI(url);
url = uriObj.specIgnoringRef;
outerHash = uriObj.ref;
} catch (ex) { /* ignore, use the raw string */ }
@ -158,7 +158,7 @@ this.ReaderMode = {
let originalUrl = searchParams.get("url");
if (outerHash) {
try {
let uriObj = Services.io.newURI(originalUrl, null, null);
let uriObj = Services.io.newURI(originalUrl);
uriObj = Services.io.newURI('#' + outerHash, null, uriObj);
originalUrl = uriObj.spec;
} catch (ex) {}
@ -178,7 +178,7 @@ this.ReaderMode = {
return false;
}
let uri = Services.io.newURI(doc.location.href, null, null);
let uri = Services.io.newURI(doc.location.href);
if (!this._shouldCheckUri(uri)) {
return false;
}
@ -208,8 +208,8 @@ this.ReaderMode = {
* @resolves JS object representing the article, or null if no article is found.
*/
parseDocument: Task.async(function* (doc) {
let documentURI = Services.io.newURI(doc.documentURI, null, null);
let baseURI = Services.io.newURI(doc.baseURI, null, null);
let documentURI = Services.io.newURI(doc.documentURI);
let baseURI = Services.io.newURI(doc.baseURI);
if (!this._shouldCheckUri(documentURI) || !this._shouldCheckUri(baseURI, true)) {
this.log("Reader mode disabled for URI");
return null;
@ -227,7 +227,7 @@ this.ReaderMode = {
*/
downloadAndParseDocument: Task.async(function* (url) {
let doc = yield this._downloadDocument(url);
let uri = Services.io.newURI(doc.baseURI, null, null);
let uri = Services.io.newURI(doc.baseURI);
if (!this._shouldCheckUri(uri, true)) {
this.log("Reader mode disabled for URI");
return null;
@ -264,7 +264,7 @@ this.ReaderMode = {
if (content) {
let urlIndex = content.toUpperCase().indexOf("URL=");
if (urlIndex > -1) {
let baseURI = Services.io.newURI(url, null, null);
let baseURI = Services.io.newURI(url);
let newURI = Services.io.newURI(content.substring(urlIndex + 4), null, baseURI);
let newURL = newURI.spec;
let ssm = Services.scriptSecurityManager;
@ -293,10 +293,10 @@ this.ReaderMode = {
// Convert these to real URIs to make sure the escaping (or lack
// thereof) is identical:
try {
responseURL = Services.io.newURI(responseURL, null, null).specIgnoringRef;
responseURL = Services.io.newURI(responseURL).specIgnoringRef;
} catch (ex) { /* Ignore errors - we'll use what we had before */ }
try {
givenURL = Services.io.newURI(givenURL, null, null).specIgnoringRef;
givenURL = Services.io.newURI(givenURL).specIgnoringRef;
} catch (ex) { /* Ignore errors - we'll use what we had before */ }
if (responseURL != givenURL) {

View File

@ -13,7 +13,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
function makeURI(url) {
return Services.io.newURI(url, null, null);
return Services.io.newURI(url);
}
function readInputStreamToString(aStream) {

View File

@ -61,7 +61,7 @@ function configureToLoadJarEngines() {
let resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("search-plugins",
Services.io.newURI(url, null, null));
Services.io.newURI(url));
// Ensure a test engine exists in the app dir anyway.
let dir = Services.dirsvc.get(NS_APP_SEARCH_DIR, Ci.nsIFile);

View File

@ -14,7 +14,7 @@ function run_test() {
let resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("search-plugins",
Services.io.newURI(url, null, null));
Services.io.newURI(url));
run_next_test();
}

View File

@ -26,7 +26,7 @@ function getDir(aKey, aIFace) {
}
function makeURI(uri) {
return Services.io.newURI(uri, null, null);
return Services.io.newURI(uri);
}
var cacheTemplate, appPluginsPath, profPlugins;

View File

@ -15,7 +15,7 @@ function run_test() {
let resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("search-plugins",
Services.io.newURI(url, null, null));
Services.io.newURI(url));
run_next_test();
}

View File

@ -18,7 +18,7 @@ function run_test() {
let resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("search-plugins",
Services.io.newURI(url, null, null));
Services.io.newURI(url));
run_next_test();
}

View File

@ -56,7 +56,7 @@ add_task(function* skip_writing_cache_without_engines() {
let resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("search-plugins",
Services.io.newURI("about:blank", null, null));
Services.io.newURI("about:blank"));
// Let the async-reInit happen.
yield reInitPromise;

View File

@ -53,7 +53,7 @@ SecurityReporter.prototype = {
// server (otherwise we'll get loops when this fails)
let endpoint =
Services.prefs.getCharPref("security.ssl.errorReporting.url");
let reportURI = Services.io.newURI(endpoint, null, null);
let reportURI = Services.io.newURI(endpoint);
if (reportURI.host == hostname) {
return;

View File

@ -1331,7 +1331,7 @@ add_task(function* test_defaultSearchEngine() {
let resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("search-plugins",
Services.io.newURI(url, null, null));
Services.io.newURI(url));
// Initialize the search service.
yield new Promise(resolve => Services.search.init(resolve));

View File

@ -18,14 +18,12 @@ function run_test() {
"moz-page-thumb handler provides substituting interface");
// then check that the file URL resolution works
let uri = Services.io.newURI("moz-page-thumb://thumbnail/?url=http%3A%2F%2Fwww.mozilla.org%2F",
null, null);
let uri = Services.io.newURI("moz-page-thumb://thumbnail/?url=http%3A%2F%2Fwww.mozilla.org%2F");
ok(uri instanceof Ci.nsIFileURL, "moz-page-thumb:// is a FileURL");
ok(uri.file, "This moz-page-thumb:// object is backed by a file");
// and check that the error case works as specified
let bad = Services.io.newURI("moz-page-thumb://wronghost/?url=http%3A%2F%2Fwww.mozilla.org%2F",
null, null);
let bad = Services.io.newURI("moz-page-thumb://wronghost/?url=http%3A%2F%2Fwww.mozilla.org%2F");
Assert.throws(() => handler.resolveURI(bad), /NS_ERROR_NOT_AVAILABLE/i,
"moz-page-thumb object with wrong host must not resolve to a file path");
}

View File

@ -94,7 +94,7 @@ UrlClassifierTableDomain.inherits(UrlClassifierTable);
*/
UrlClassifierTableDomain.prototype.exists = function(url, callback) {
var canonicalized = this.enchashDecrypter_.getCanonicalUrl(url);
var urlObj = this.ioService_.newURI(canonicalized, null, null);
var urlObj = this.ioService_.newURI(canonicalized);
var host = '';
try {
host = urlObj.host;

View File

@ -78,7 +78,7 @@ function waitForInit() {
.getService(Ci.nsIIOService);
let principal = secMan.createCodebasePrincipal(
iosvc.newURI(url, null, null), {});
iosvc.newURI(url), {});
let listener = {
QueryInterface: function(iid)

View File

@ -232,7 +232,7 @@ checkUrls: function(urls, expected, cb, useMoz = false)
if (urls.length > 0) {
var tables = useMoz ? mozTables : allTables;
var fragment = urls.shift();
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + fragment, null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + fragment), {});
dbservice.lookup(principal, tables,
function(arg) {
do_check_eq(expected, arg);
@ -247,7 +247,7 @@ checkUrls: function(urls, expected, cb, useMoz = false)
checkTables: function(url, expected, cb)
{
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + url, null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + url), {});
dbservice.lookup(principal, allTables, function(tables) {
// Rebuild tables in a predictable order.
var parts = tables.split(",");

View File

@ -110,7 +110,7 @@ function checkNoHost()
// Looking up a no-host uri such as a data: uri should throw an exception.
var exception;
try {
var principal = secMan.createCodebasePrincipal(iosvc.newURI("data:text/html,<b>test</b>", null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("data:text/html,<b>test</b>"), {});
dbservice.lookup(principal, allTables);
exception = false;
@ -223,31 +223,31 @@ function checkState()
for (var key in phishExpected) {
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key, null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key), {});
dbservice.lookup(principal, allTables, phishExists, true);
numExpecting++;
}
for (var key in phishUnexpected) {
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key, null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key), {});
dbservice.lookup(principal, allTables, phishDoesntExist, true);
numExpecting++;
}
for (var key in malwareExpected) {
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key, null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key), {});
dbservice.lookup(principal, allTables, malwareExists, true);
numExpecting++;
}
for (var key in unwantedExpected) {
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key, null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key), {});
dbservice.lookup(principal, allTables, unwantedExists, true);
numExpecting++;
}
for (var key in blockedExpected) {
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key, null, null), {});
var principal = secMan.createCodebasePrincipal(iosvc.newURI("http://" + key), {});
dbservice.lookup(principal, allTables, blockedExists, true);
numExpecting++;
}

View File

@ -91,7 +91,7 @@ function run_test() {
function createURI(s) {
let service = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
return service.newURI(s, null, null);
return service.newURI(s);
}
// Just throw if we ever get an update or download error.

View File

@ -775,7 +775,7 @@ var ViewSourceContent = {
webNav.loadURIWithOptions(uri, loadFlags,
null, referrerPolicy, // referrer
null, null, // postData, headers
Services.io.newURI(baseURI, null, null));
Services.io.newURI(baseURI));
},
/**

View File

@ -274,7 +274,7 @@ var gViewSourceUtils = {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var charset = data.doc ? data.doc.characterSet : null;
var uri = ios.newURI(data.url, charset, null);
var uri = ios.newURI(data.url, charset);
data.uri = uri;
var path;

View File

@ -20,7 +20,7 @@ function findAbouts() {
var contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
try {
var am = Cc[contract].getService(Ci.nsIAboutModule);
var uri = ios.newURI("about:" + aboutType, null, null);
var uri = ios.newURI("about:" + aboutType);
var flags = am.getURIFlags(uri);
if (!(flags & Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)) {
gProtocols.push(aboutType);

View File

@ -313,7 +313,7 @@ var WebNavigation = {
if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
let annotation = uri;
try {
let url = Services.io.newURI(uri, null, null);
let url = Services.io.newURI(uri);
// If the current URI contains a username/password, remove it.
url.userPass = "";
annotation = url.spec;
@ -322,13 +322,13 @@ var WebNavigation = {
CrashReporter.annotateCrashReport("URL", annotation);
}
if (referrer)
referrer = Services.io.newURI(referrer, null, null);
referrer = Services.io.newURI(referrer);
if (postData)
postData = makeInputStream(postData);
if (headers)
headers = makeInputStream(headers);
if (baseURI)
baseURI = Services.io.newURI(baseURI, null, null);
baseURI = Services.io.newURI(baseURI);
this._wrapURIChangeCall(() => {
return this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
postData, headers, baseURI);

View File

@ -605,7 +605,7 @@ var Printing = {
readerContent.setAttribute("id", "moz-reader-content");
contentElement.appendChild(readerContent);
let articleUri = Services.io.newURI(article.url, null, null);
let articleUri = Services.io.newURI(article.url);
let parserUtils = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
let contentFragment = parserUtils.parseFragment(article.content,
Ci.nsIParserUtils.SanitizerDropForms | Ci.nsIParserUtils.SanitizerAllowStyle,

View File

@ -29,7 +29,7 @@ function copyToTemporaryFile(f) {
function* dirIter(directory) {
var ioSvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var testsDir = ioSvc.newURI(directory, null, null)
var testsDir = ioSvc.newURI(directory)
.QueryInterface(Ci.nsIFileURL).file;
let en = testsDir.directoryEntries;
@ -77,7 +77,7 @@ function copyDirToTempProfile(path, subdirname) {
function convertChromeURI(chromeURI) {
let uri = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).newURI(chromeURI, null, null);
getService(Ci.nsIIOService).newURI(chromeURI);
return gChromeReg.convertChromeURL(uri);
}

View File

@ -104,7 +104,7 @@ function populateReportList() {
}
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var reportURI = ios.newURI(reportURL, null, null);
var reportURI = ios.newURI(reportURL);
// resolving this URI relative to /report/index
var aboutThrottling = ios.newURI("../../about/throttling", null, reportURI);

View File

@ -21,13 +21,13 @@ function run_test() {
var testspecs = ["http://example.com/submit",
"https://example.org/anothersubmit"];
for (var i = 0; i < testspecs.length; ++i) {
cr.serverURL = ios.newURI(testspecs[i], null, null);
cr.serverURL = ios.newURI(testspecs[i]);
do_check_eq(cr.serverURL.spec, testspecs[i]);
}
// should not allow setting non-http/https URLs
try {
cr.serverURL = ios.newURI("ftp://example.com/submit", null, null);
cr.serverURL = ios.newURI("ftp://example.com/submit");
do_throw("Setting serverURL to a non-http(s) URL should have thrown!");
} catch (ex) {
do_check_eq(ex.result, Components.results.NS_ERROR_INVALID_ARG);

View File

@ -123,7 +123,7 @@ IdentityProviderService.prototype = {
*/
_provisionIdentity: function _provisionIdentity(aIdentity, aIDPParams, aProvId, aCallback) {
let provPath = aIDPParams.idpParams.provisioning;
let url = Services.io.newURI("https://" + aIDPParams.domain, null, null).resolve(provPath);
let url = Services.io.newURI("https://" + aIDPParams.domain).resolve(provPath);
log("_provisionIdentity: identity:", aIdentity, "url:", url);
// If aProvId is not null, then we already have a flow
@ -315,7 +315,7 @@ IdentityProviderService.prototype = {
// extract authentication URL from idpParams
let authPath = aIDPParams.idpParams.authentication;
let authURI = Services.io.newURI("https://" + aIDPParams.domain, null, null).resolve(authPath);
let authURI = Services.io.newURI("https://" + aIDPParams.domain).resolve(authPath);
// beginAuthenticationFlow causes the "identity-auth" topic to be
// observed. Since it's sending a notification to the DOM, there's

View File

@ -216,7 +216,7 @@ IdentityRelyingParty.prototype = {
objectCopy(aOptions, options);
// Append URLs after resolving
let baseURI = Services.io.newURI(rp.origin, null, null);
let baseURI = Services.io.newURI(rp.origin);
for (let optionName of ["privacyPolicy", "termsOfService"]) {
if (aOptions[optionName]) {
options[optionName] = baseURI.resolve(aOptions[optionName]);

View File

@ -33,7 +33,7 @@ XPCOMUtils.defineLazyModuleGetter(this,
*/
this.Sandbox = function Sandbox(aURL, aCallback) {
// Normalize the URL so the comparison in _makeSandboxContentLoaded works
this._url = Services.io.newURI(aURL, null, null).spec;
this._url = Services.io.newURI(aURL).spec;
this._log("Creating sandbox for:", this._url);
this._createFrame();
this._createSandbox(aCallback);

View File

@ -138,7 +138,7 @@ this.BrowserUtils = {
},
makeURIFromCPOW(aCPOWURI) {
return Services.io.newURI(aCPOWURI.spec, aCPOWURI.originCharset, null);
return Services.io.newURI(aCPOWURI.spec, aCPOWURI.originCharset);
},
/**

View File

@ -24,7 +24,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "BinarySearch",
"resource://gre/modules/BinarySearch.jsm");
XPCOMUtils.defineLazyGetter(this, "gPrincipal", function() {
let uri = Services.io.newURI("about:newtab", null, null);
let uri = Services.io.newURI("about:newtab");
return Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
});
@ -1404,7 +1404,7 @@ this.NewTabUtils = {
try {
// Note that nsIURI.asciiHost throws NS_ERROR_FAILURE for some types of
// URIs, including jar and moz-icon URIs.
host = Services.io.newURI(url, null, null).asciiHost;
host = Services.io.newURI(url).asciiHost;
} catch (ex) {
return null;
}

View File

@ -283,8 +283,8 @@ this.PageMetadata = {
* @return {string} Result URL.
*/
_validateURL(document, url) {
let docURI = Services.io.newURI(document.documentURI, null, null);
let uri = Services.io.newURI(docURI.resolve(url), null, null);
let docURI = Services.io.newURI(document.documentURI);
let uri = Services.io.newURI(docURI.resolve(url));
if (["http", "https"].indexOf(uri.scheme) < 0) {
return null;

View File

@ -35,8 +35,8 @@ function importPrefBranch(aPrefBranch, aPermission, aAction) {
// reasons, we convert these hosts into http:// and https:// permissions
// on default ports.
try {
let httpURI = Services.io.newURI("http://" + origin, null, null);
let httpsURI = Services.io.newURI("https://" + origin, null, null);
let httpURI = Services.io.newURI("http://" + origin);
let httpsURI = Services.io.newURI("https://" + origin);
principals = [
Services.scriptSecurityManager.createCodebasePrincipal(httpURI, {}),

View File

@ -12,8 +12,8 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
function newURI(spec) {
return Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService)
.newURI(spec, null, null);
return Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService)
.newURI(spec);
}
function RemoteWebProgressRequest(spec, originalSpec, requestCPOW) {

View File

@ -177,7 +177,7 @@ this.WebChannel = function(id, originOrPermission) {
// The permission manager operates on domain names rather than true
// origins (bug 1066517). To mitigate that, we explicitly check that
// the scheme is https://.
let uri = Services.io.newURI(requestPrincipal.originNoSuffix, null, null);
let uri = Services.io.newURI(requestPrincipal.originNoSuffix);
if (uri.scheme != "https") {
return false;
}

View File

@ -144,7 +144,7 @@ function RemoteMedia(url, listener) {
this._listener = listener;
this._status = "uninitialized";
let serverURI = Services.io.newURI(this._url, null, null);
let serverURI = Services.io.newURI(this._url);
this._socket = Cc["@mozilla.org/network/socket-transport-service;1"].getService(Ci.nsISocketTransportService).createTransport(null, 0, serverURI.host, 9191, null);
this._outputStream = this._socket.openOutputStream(0, 0, 0);

View File

@ -62,7 +62,7 @@ var SimpleServiceDiscovery = {
_forceTrailingSlash(aURL) {
// Cleanup the URL to make it consistent across devices
try {
aURL = Services.io.newURI(aURL, null, null).spec;
aURL = Services.io.newURI(aURL).spec;
} catch (e) {}
return aURL;
},

View File

@ -19,7 +19,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "serializationHelper",
this.Utils = Object.freeze({
makeURI(url) {
return Services.io.newURI(url, null, null);
return Services.io.newURI(url);
},
makeInputStream(aString) {

View File

@ -650,7 +650,7 @@ xhr.prototype = {
status: null,
channel: { set notificationCallbacks(aVal) { } },
open(aMethod, aUrl) {
this.channel.originalURI = Services.io.newURI(aUrl, null, null);
this.channel.originalURI = Services.io.newURI(aUrl);
this._method = aMethod; this._url = aUrl;
},
abort() {

View File

@ -7,7 +7,7 @@ Components.utils.import("resource://gre/modules/MatchPattern.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
function test(url, pattern) {
let uri = Services.io.newURI(url, null, null);
let uri = Services.io.newURI(url);
let m = new MatchGlobs(pattern);
return m.matches(uri.spec);
}

View File

@ -7,7 +7,7 @@ Components.utils.import("resource://gre/modules/MatchPattern.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
function test(url, pattern) {
let uri = Services.io.newURI(url, null, null);
let uri = Services.io.newURI(url);
let m = new MatchPattern(pattern);
return m.matches(uri);
}

View File

@ -54,7 +54,7 @@ function test_importfromPrefs() {
"https://blacklist2-2.example.com:8080"];
let unknown = whitelisted.concat(blacklisted).concat(untouched);
for (let url of unknown) {
let uri = Services.io.newURI(url, null, null);
let uri = Services.io.newURI(url);
do_check_eq(Services.perms.testPermission(uri, TEST_PERM), Services.perms.UNKNOWN_ACTION);
}
@ -71,15 +71,15 @@ function test_importfromPrefs() {
// Check they were imported into the permissions manager
for (let url of whitelisted) {
let uri = Services.io.newURI(url, null, null);
let uri = Services.io.newURI(url);
do_check_eq(Services.perms.testPermission(uri, TEST_PERM), Services.perms.ALLOW_ACTION);
}
for (let url of blacklisted) {
let uri = Services.io.newURI(url, null, null);
let uri = Services.io.newURI(url);
do_check_eq(Services.perms.testPermission(uri, TEST_PERM), Services.perms.DENY_ACTION);
}
for (let url of untouched) {
let uri = Services.io.newURI(url, null, null);
let uri = Services.io.newURI(url);
do_check_eq(Services.perms.testPermission(uri, TEST_PERM), Services.perms.UNKNOWN_ACTION);
}
}

View File

@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/WebChannel.jsm");
const ERROR_ID_ORIGIN_REQUIRED = "WebChannel id and originOrPermission are required.";
const VALID_WEB_CHANNEL_ID = "id";
const URL_STRING = "http://example.com";
const VALID_WEB_CHANNEL_ORIGIN = Services.io.newURI(URL_STRING, null, null);
const VALID_WEB_CHANNEL_ORIGIN = Services.io.newURI(URL_STRING);
const TEST_PERMISSION_NAME = "test-webchannel-permissions";
var MockWebChannelBroker = {

View File

@ -10,7 +10,7 @@ Cu.import("resource://gre/modules/WebChannel.jsm");
const VALID_WEB_CHANNEL_ID = "id";
const URL_STRING = "http://example.com";
const VALID_WEB_CHANNEL_ORIGIN = Services.io.newURI(URL_STRING, null, null);
const VALID_WEB_CHANNEL_ORIGIN = Services.io.newURI(URL_STRING);
function run_test() {
run_next_test();

View File

@ -414,7 +414,7 @@ this.DownloadUtils = {
// Get a URI that knows about its components
let uri;
try {
uri = ioService.newURI(aURIString, null, null);
uri = ioService.newURI(aURIString);
} catch (ex) {
return ["", ""];
}

View File

@ -2995,7 +2995,7 @@ var AddonManagerInternal = {
// Throw an appropriate error if the given URL is not valid
// as an installation source. Return silently if it is okay.
function checkInstallUrl(url) {
let host = Services.io.newURI(options.url, null, null).host;
let host = Services.io.newURI(options.url).host;
if (WEBAPI_INSTALL_HOSTS.includes(host)) {
return;
}

View File

@ -196,7 +196,7 @@ InstallTrigger.prototype = {
},
startSoftwareUpdate(url, flags) {
let filename = Services.io.newURI(url, null, null)
let filename = Services.io.newURI(url)
.QueryInterface(Ci.nsIURL)
.filename;
let args = {};

View File

@ -2142,7 +2142,7 @@ var gDiscoverView = {
let setURL = (aURL) => {
try {
this.homepageURL = Services.io.newURI(aURL, null, null);
this.homepageURL = Services.io.newURI(aURL);
} catch (e) {
this.showError();
notifyInitialized();

View File

@ -60,7 +60,7 @@ var ImageCropper = {
// Generate the cropped image's file name using its
// base name and the current screen size.
let uri = Services.io.newURI(aImageURL, null, null);
let uri = Services.io.newURI(aImageURL);
let file = uri.QueryInterface(Ci.nsIFileURL).file;
// Make sure the source file exists.

View File

@ -2579,12 +2579,11 @@ this.XPIProvider = {
return this._resolveURIToFile(aURI);
case "resource":
aURI = Services.io.newURI(ResProtocolHandler.resolveURI(aURI), null,
null);
aURI = Services.io.newURI(ResProtocolHandler.resolveURI(aURI));
return this._resolveURIToFile(aURI);
case "view-source":
aURI = Services.io.newURI(aURI.path, null, null);
aURI = Services.io.newURI(aURI.path);
return this._resolveURIToFile(aURI);
case "about":

View File

@ -193,7 +193,7 @@ function getPref(func, preference, defaultValue) {
function newURI(spec) {
var ioServ = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
return ioServ.newURI(spec, null, null);
return ioServ.newURI(spec);
}
// Restarts the application checking in with observers first

View File

@ -66,7 +66,7 @@ function test() {
icon64URL: "chrome://foo/skin/icon64.png",
contributionURL: "http://foo.com",
contributionAmount: "$0.99",
sourceURI: Services.io.newURI("http://example.com/foo", null, null),
sourceURI: Services.io.newURI("http://example.com/foo"),
averageRating: 4,
reviewCount: 5,
reviewURL: "http://example.com/reviews",
@ -95,7 +95,7 @@ function test() {
description: "Short description",
creator: { name: "Mozilla", url: "http://www.mozilla.org" },
type: "extension",
sourceURI: Services.io.newURI("http://example.com/foo", null, null),
sourceURI: Services.io.newURI("http://example.com/foo"),
updateDate: gDate,
reviewCount: 1,
reviewURL: "http://example.com/reviews",
@ -981,7 +981,7 @@ add_test(function() {
type: "extension",
iconURL: "chrome://foo/skin/icon.png",
icon64URL: "chrome://foo/skin/icon264.png",
sourceURI: Services.io.newURI("http://example.com/foo", null, null),
sourceURI: Services.io.newURI("http://example.com/foo"),
averageRating: 2,
optionsURL: "chrome://foo/content/options.xul",
applyBackgroundUpdates: AddonManager.AUTOUPDATE_ENABLE,

View File

@ -73,7 +73,7 @@ add_test(function() {
name: "manually updating addon (new and improved!)",
existingAddon: gProvider.addons[1],
version: "1.1",
releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml", null, null)
releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml")
}]);
var item = get_addon_element(gManagerWindow, "addon2@tests.mozilla.org");
@ -133,7 +133,7 @@ add_test(function() {
item.removeEventListener("RelNotesToggle", arguments.callee, false);
info("Release notes now closed");
info("Setting Release notes URI to something that should load");
gProvider.installs[0].releaseNotesURI = Services.io.newURI(TESTROOT + "releaseNotes.xhtml", null, null)
gProvider.installs[0].releaseNotesURI = Services.io.newURI(TESTROOT + "releaseNotes.xhtml")
info("Re-opening release notes");
item.addEventListener("RelNotesToggle", function() {
@ -241,6 +241,6 @@ add_test(function() {
name: "manually updating addon (new and even more improved!)",
existingAddon: gProvider.addons[1],
version: "1.2",
releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml", null, null)
releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml")
}]);
});

View File

@ -21,7 +21,7 @@ var CustomChromeProtocol = {
},
newChannel2: function CCP_newChannel2(aURI, aLoadInfo) {
let url = Services.io.newURI("chrome:" + aURI.path, null, null);
let url = Services.io.newURI("chrome:" + aURI.path);
let ch = Services.io.newChannelFromURIWithLoadInfo(url, aLoadInfo);
ch.originalURI = aURI;
return ch;

View File

@ -18,7 +18,7 @@ function test() {
name: "updated 6 hours ago",
version: "1.0",
updateDate: new Date(Date.now() - (1000 * 60 * 60 * 6)),
releaseNotesURI: Services.io.newURI(TESTROOT + "releaseNotes.xhtml", null, null)
releaseNotesURI: Services.io.newURI(TESTROOT + "releaseNotes.xhtml")
}, {
id: "addon2@tests.mozilla.org",
name: "updated 5 seconds ago",

View File

@ -25,7 +25,7 @@ function TestProvider(result) {
this.result = result;
}
TestProvider.prototype = {
uri: Services.io.newURI("hellow://world", null, null),
uri: Services.io.newURI("hellow://world"),
id: "valid@id",
startup() {},
shutdown() {},

View File

@ -120,7 +120,7 @@ var dialog = {
let uri = ios.newFileURI(app.executable);
elm.setAttribute("image", "moz-icon://" + uri.spec + "?size=32");
} else if (app instanceof Ci.nsIWebHandlerApp) {
let uri = ios.newURI(app.uriTemplate, null, null);
let uri = ios.newURI(app.uriTemplate);
if (/^https?/.test(uri.scheme)) {
// Unfortunately we can't use the favicon service to get the favicon,
// because the service looks for a record with the exact URL we give

View File

@ -78,8 +78,8 @@ function load_modules_under(spec, uri) {
}
function resolveResource(spec) {
var uri = Services.io.newURI(spec, null, null);
return Services.io.newURI(rph.resolveURI(uri), null, null);
var uri = Services.io.newURI(spec);
return Services.io.newURI(rph.resolveURI(uri));
}
function precompile_startupcache(uri) {

View File

@ -3821,7 +3821,7 @@ Downloader.prototype = {
let interval = this.background ? update.getProperty("backgroundInterval")
: DOWNLOAD_FOREGROUND_INTERVAL;
var uri = Services.io.newURI(this._patch.URL, null, null);
var uri = Services.io.newURI(this._patch.URL);
LOG("Downloader:downloadUpdate - url: " + uri.spec + ", path: " +
patchFile.path + ", interval: " + interval);