--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -439,17 +439,17 @@ nsCoreUtils::IsErrorPage(nsIDocument *aD
{
nsIURI *uri = aDocument->GetDocumentURI();
bool isAboutScheme = false;
uri->SchemeIs("about", &isAboutScheme);
if (!isAboutScheme)
return false;
nsAutoCString path;
- uri->GetPath(path);
+ uri->GetPathQueryRef(path);
NS_NAMED_LITERAL_CSTRING(neterror, "neterror");
NS_NAMED_LITERAL_CSTRING(certerror, "certerror");
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
}
bool
--- a/addon-sdk/source/lib/sdk/url.js
+++ b/addon-sdk/source/lib/sdk/url.js
@@ -130,34 +130,34 @@ function URL(url, base) {
try {
fileName = uri.QueryInterface(Ci.nsIURL).fileName;
} catch (e) {
if (e.result != Cr.NS_NOINTERFACE) {
throw e;
}
}
- let uriData = [uri.path, uri.path.length, {}, {}, {}, {}, {}, {}];
+ let uriData = [uri.pathQueryRef, uri.pathQueryRef.length, {}, {}, {}, {}, {}, {}];
URLParser.parsePath.apply(URLParser, uriData);
let [{ value: filepathPos }, { value: filepathLen },
{ value: queryPos }, { value: queryLen },
{ value: refPos }, { value: refLen }] = uriData.slice(2);
let hash = uri.ref ? "#" + uri.ref : "";
- let pathname = uri.path.substr(filepathPos, filepathLen);
- let search = uri.path.substr(queryPos, queryLen);
+ let pathname = uri.pathQueryRef.substr(filepathPos, filepathLen);
+ let search = uri.pathQueryRef.substr(queryPos, queryLen);
search = search ? "?" + search : "";
this.__defineGetter__("fileName", () => fileName);
this.__defineGetter__("scheme", () => uri.scheme);
this.__defineGetter__("userPass", () => userPass);
this.__defineGetter__("host", () => host);
this.__defineGetter__("hostname", () => host);
this.__defineGetter__("port", () => port);
- this.__defineGetter__("path", () => uri.path);
+ this.__defineGetter__("path", () => uri.pathQueryRef);
this.__defineGetter__("pathname", () => pathname);
this.__defineGetter__("hash", () => hash);
this.__defineGetter__("href", () => uri.spec);
this.__defineGetter__("origin", () => uri.prePath);
this.__defineGetter__("protocol", () => uri.scheme + ":");
this.__defineGetter__("search", () => search);
Object.defineProperties(this, {
--- a/addon-sdk/source/test/addons/content-permissions/httpd.js
+++ b/addon-sdk/source/test/addons/content-permissions/httpd.js
@@ -1641,17 +1641,17 @@ RequestReader.prototype =
if (!metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1))
throw HTTP_400;
try
{
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(fullPath);
- fullPath = uri.path;
+ fullPath = uri.pathQueryRef;
scheme = uri.scheme;
host = metadata._host = uri.asciiHost;
port = uri.port;
if (port === -1)
{
if (scheme === "http")
port = 80;
else if (scheme === "https")
--- a/addon-sdk/source/test/addons/content-script-messages-latency/httpd.js
+++ b/addon-sdk/source/test/addons/content-script-messages-latency/httpd.js
@@ -1641,17 +1641,17 @@ RequestReader.prototype =
if (!metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1))
throw HTTP_400;
try
{
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(fullPath);
- fullPath = uri.path;
+ fullPath = uri.pathQueryRef;
scheme = uri.scheme;
host = metadata._host = uri.asciiHost;
port = uri.port;
if (port === -1)
{
if (scheme === "http")
port = 80;
else if (scheme === "https")
--- a/addon-sdk/source/test/addons/e10s-content/lib/httpd.js
+++ b/addon-sdk/source/test/addons/e10s-content/lib/httpd.js
@@ -1642,17 +1642,17 @@ RequestReader.prototype =
if (!metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1))
throw HTTP_400;
try
{
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(fullPath);
- fullPath = uri.path;
+ fullPath = uri.pathQueryRef;
scheme = uri.scheme;
host = metadata._host = uri.asciiHost;
port = uri.port;
if (port === -1)
{
if (scheme === "http")
port = 80;
else if (scheme === "https")
--- a/addon-sdk/source/test/addons/places/lib/httpd.js
+++ b/addon-sdk/source/test/addons/places/lib/httpd.js
@@ -1641,17 +1641,17 @@ RequestReader.prototype =
if (!metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1))
throw HTTP_400;
try
{
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(fullPath);
- fullPath = uri.path;
+ fullPath = uri.pathQueryRef;
scheme = uri.scheme;
host = metadata._host = uri.asciiHost;
port = uri.port;
if (port === -1)
{
if (scheme === "http")
port = 80;
else if (scheme === "https")
--- a/addon-sdk/source/test/lib/httpd.js
+++ b/addon-sdk/source/test/lib/httpd.js
@@ -1642,17 +1642,17 @@ RequestReader.prototype =
if (!metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1))
throw HTTP_400;
try
{
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(fullPath);
- fullPath = uri.path;
+ fullPath = uri.pathQueryRef;
scheme = uri.scheme;
host = metadata._host = uri.asciiHost;
port = uri.port;
if (port === -1)
{
if (scheme === "http")
port = 80;
else if (scheme === "https")
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6569,17 +6569,17 @@ var IndexedDBPromptHelper = {
var browser = requestor.getInterface(Ci.nsIDOMNode);
if (browser.ownerGlobal != window) {
// Only listen for notifications for browsers in our chrome window.
return;
}
// Get the host name if available or the file path otherwise.
- var host = browser.currentURI.asciiHost || browser.currentURI.path;
+ var host = browser.currentURI.asciiHost || browser.currentURI.pathQueryRef;
var message;
var responseTopic;
if (topic == this._permissionsPrompt) {
message = gNavigatorBundle.getFormattedString("offlineApps.available2",
[ host ]);
responseTopic = this._permissionsResponse;
}
@@ -7690,31 +7690,31 @@ var gIdentityHandler = {
try {
this._uri.host;
this._uriHasHost = true;
} catch (ex) {
this._uriHasHost = false;
}
let whitelist = /^(?:accounts|addons|cache|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|searchreset|sessionrestore|support|welcomeback)(?:[?#]|$)/i;
- this._isSecureInternalUI = uri.schemeIs("about") && whitelist.test(uri.path);
+ this._isSecureInternalUI = uri.schemeIs("about") && whitelist.test(uri.pathQueryRef);
this._isExtensionPage = uri.schemeIs("moz-extension");
// Create a channel for the sole purpose of getting the resolved URI
// of the request to determine if it's loaded from the file system.
this._isURILoadedFromFile = false;
let chanOptions = {uri: this._uri, loadUsingSystemPrincipal: true};
let resolvedURI;
try {
resolvedURI = NetUtil.newChannel(chanOptions).URI;
if (resolvedURI.schemeIs("jar")) {
// Given a URI "jar:<jar-file-uri>!/<jar-entry>"
// create a new URI using <jar-file-uri>!/<jar-entry>
- resolvedURI = NetUtil.newURI(resolvedURI.path);
+ resolvedURI = NetUtil.newURI(resolvedURI.pathQueryRef);
}
// Check the URI again after resolving.
this._isURILoadedFromFile = resolvedURI.schemeIs("file");
} catch (ex) {
// NetUtil's methods will throw for malformed URIs and the like
}
},
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -521,17 +521,17 @@
<parameter name="aURI"/>
<parameter name="aResolvedURI"/>
<body><![CDATA[
if (!aURI.schemeIs("about")) {
return false;
}
// Specially handle about:blank as local
- if (aURI.path === "blank") {
+ if (aURI.pathQueryRef === "blank") {
return true;
}
try {
// Use the passed in resolvedURI if we have one
const resolvedURI = aResolvedURI || Services.io.newChannelFromURI2(
aURI,
null, // loadingNode
--- a/browser/base/content/test/general/browser_e10s_about_process.js
+++ b/browser/base/content/test/general/browser_e10s_about_process.js
@@ -28,17 +28,17 @@ function AboutModule() {
AboutModule.prototype = {
newChannel(aURI, aLoadInfo) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
getURIFlags(aURI) {
for (let module of TEST_MODULES) {
- if (aURI.path.startsWith(module.path)) {
+ if (aURI.pathQueryRef.startsWith(module.path)) {
return module.flags;
}
}
ok(false, "Called getURIFlags for an unknown page " + aURI.spec);
return 0;
},
--- a/browser/base/content/test/static/browser_all_files_referenced.js
+++ b/browser/base/content/test/static/browser_all_files_referenced.js
@@ -517,34 +517,34 @@ add_task(async function checkAllTheFiles
// our zipreader APIs are all sync)
let uris = await generateURIsFromDirTree(appDir, [".css", ".manifest", ".json", ".jpg", ".png", ".gif", ".svg", ".dtd", ".properties"].concat(kCodeExtensions));
// Parse and remove all manifests from the list.
// NOTE that this must be done before filtering out devtools paths
// so that all chrome paths can be recorded.
let manifestPromises = [];
uris = uris.filter(uri => {
- let path = uri.path;
+ let path = uri.pathQueryRef;
if (path.endsWith(".manifest")) {
manifestPromises.push(parseManifest(uri));
return false;
}
return true;
});
// Wait for all manifest to be parsed
await Promise.all(manifestPromises);
// We build a list of promises that get resolved when their respective
// files have loaded and produced no errors.
let allPromises = [];
for (let uri of uris) {
- let path = uri.path;
+ let path = uri.pathQueryRef;
if (path.endsWith(".css"))
allPromises.push(parseCSSFile(uri));
else if (kCodeExtensions.some(ext => path.endsWith(ext)))
allPromises.push(parseCodeFile(uri));
}
// Wait for all the files to have actually loaded:
await Promise.all(allPromises);
--- a/browser/base/content/test/static/browser_parsable_css.js
+++ b/browser/base/content/test/static/browser_parsable_css.js
@@ -274,17 +274,17 @@ add_task(async function checkAllTheCSS()
await iframeLoaded;
let doc = iframe.contentWindow.document;
// Parse and remove all manifests from the list.
// NOTE that this must be done before filtering out devtools paths
// so that all chrome paths can be recorded.
let manifestPromises = [];
uris = uris.filter(uri => {
- if (uri.path.endsWith(".manifest")) {
+ if (uri.pathQueryRef.endsWith(".manifest")) {
manifestPromises.push(parseManifest(uri));
return false;
}
return true;
});
// Wait for all manifest to be parsed
await Promise.all(manifestPromises);
--- a/browser/base/content/test/webextensions/browser_permissions_addons_search.js
+++ b/browser/base/content/test/webextensions/browser_permissions_addons_search.js
@@ -19,17 +19,17 @@ async function installSearch(filename) {
await searchResultsPromise;
ok(win.gViewController.currentViewId.startsWith("addons://search"),
"about:addons is displaying search results");
let list = win.document.getElementById("search-list");
let item = null;
for (let child of list.childNodes) {
if (child.nodeName == "richlistitem" &&
- child.mAddon.install.sourceURI.path.endsWith(filename)) {
+ child.mAddon.install.sourceURI.pathQueryRef.endsWith(filename)) {
item = child;
break;
}
}
ok(item, `Found ${filename} in search results`);
// abracadabara XBL
item.clientTop;
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -107,17 +107,17 @@ static const RedirEntry kRedirMap[] = {
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
};
static nsAutoCString
GetAboutModuleName(nsIURI *aURI)
{
nsAutoCString path;
- aURI->GetPath(path);
+ aURI->GetPathQueryRef(path);
int32_t f = path.FindChar('#');
if (f >= 0)
path.SetLength(f);
f = path.FindChar('?');
if (f >= 0)
path.SetLength(f);
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -1084,21 +1084,21 @@ this.PlacesUIUtils = {
// if node title is empty, try to set the label using host and filename
// PlacesUtils._uri() will throw if aNode.uri is not a valid URI
try {
var uri = PlacesUtils._uri(aNode.uri);
var host = uri.host;
var fileName = uri.QueryInterface(Ci.nsIURL).fileName;
// if fileName is empty, use path to distinguish labels
if (aDoNotCutTitle) {
- title = host + uri.path;
+ title = host + uri.pathQueryRef;
} else {
title = host + (fileName ?
(host ? "/" + this.ellipsis + "/" : "") + fileName :
- uri.path);
+ uri.pathQueryRef);
}
} catch (e) {
// Use (no title) for non-standard URIs (data:, javascript:, ...)
title = "";
}
} else
title = aNode.title;
--- a/browser/components/preferences/in-content-new/tests/browser_cookies_dialog.js
+++ b/browser/components/preferences/in-content-new/tests/browser_cookies_dialog.js
@@ -20,17 +20,17 @@ add_task(async function openCookiesSubDi
cookiesDialog = await dialogOpened;
});
add_task(async function testDeleteCookie() {
let doc = cookiesDialog.document;
// Add a cookie.
- Services.cookies.add(URI.host, URI.path, "", "", false, false, true, Date.now());
+ Services.cookies.add(URI.host, URI.pathQueryRef, "", "", false, false, true, Date.now());
let tree = doc.getElementById("cookiesList");
Assert.equal(tree.view.rowCount, 1, "Row count should initially be 1");
tree.focus();
tree.view.selection.select(0);
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
--- a/browser/components/preferences/in-content/tests/browser_cookies_dialog.js
+++ b/browser/components/preferences/in-content/tests/browser_cookies_dialog.js
@@ -20,17 +20,17 @@ add_task(async function openCookiesSubDi
cookiesDialog = await dialogOpened;
});
add_task(async function testDeleteCookie() {
let doc = cookiesDialog.document;
// Add a cookie.
- Services.cookies.add(URI.host, URI.path, "", "", false, false, true, Date.now());
+ Services.cookies.add(URI.host, URI.pathQueryRef, "", "", false, false, true, Date.now());
let tree = doc.getElementById("cookiesList");
Assert.equal(tree.view.rowCount, 1, "Row count should initially be 1");
tree.focus();
tree.view.selection.select(0);
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
--- a/browser/extensions/presentation/content/PresentationDevicePrompt.jsm
+++ b/browser/extensions/presentation/content/PresentationDevicePrompt.jsm
@@ -162,17 +162,17 @@ PresentationPermissionPrompt.prototype =
this.request.cancel(Cr.NS_ERROR_NOT_AVAILABLE);
},
dismiss: true,
}];
},
// PRIVATE APIs
get _domainName() {
if (this.principal.URI instanceof Ci.nsIFileURL) {
- return this.principal.URI.path.split("/")[1];
+ return this.principal.URI.pathQueryRef.split("/")[1];
}
return this.principal.URI.hostPort;
},
_createPopupContent() {
log("_createPopupContent");
if (!this._devices.length) {
log("No available devices can be listed!");
--- a/browser/modules/E10SUtils.jsm
+++ b/browser/modules/E10SUtils.jsm
@@ -19,17 +19,17 @@ XPCOMUtils.defineLazyPreferenceGetter(th
"browser.tabs.remote.allowLinkedWebInFileUriProcess", false);
XPCOMUtils.defineLazyModuleGetter(this, "Utils",
"resource://gre/modules/sessionstore/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/Console.jsm");
function getAboutModule(aURL) {
// Needs to match NS_GetAboutModuleName
- let moduleName = aURL.path.replace(/[#?].*/, "").toLowerCase();
+ let moduleName = aURL.pathQueryRef.replace(/[#?].*/, "").toLowerCase();
let contract = "@mozilla.org/network/protocol/about;1?what=" + moduleName;
try {
return Cc[contract].getService(Ci.nsIAboutModule);
} catch (e) {
// Either the about module isn't defined or it is broken. In either case
// ignore it.
return null;
}
--- a/caps/DomainPolicy.cpp
+++ b/caps/DomainPolicy.cpp
@@ -150,17 +150,17 @@ DomainPolicy::ApplyClone(const DomainPol
static already_AddRefed<nsIURI>
GetCanonicalClone(nsIURI* aURI)
{
nsCOMPtr<nsIURI> clone;
nsresult rv = aURI->Clone(getter_AddRefs(clone));
NS_ENSURE_SUCCESS(rv, nullptr);
rv = clone->SetUserPass(EmptyCString());
NS_ENSURE_SUCCESS(rv, nullptr);
- rv = clone->SetPath(EmptyCString());
+ rv = clone->SetPathQueryRef(EmptyCString());
NS_ENSURE_SUCCESS(rv, nullptr);
return clone.forget();
}
NS_IMPL_ISUPPORTS(DomainSet, nsIDomainSet)
NS_IMETHODIMP
DomainSet::Add(nsIURI* aDomain)
--- a/caps/NullPrincipal.cpp
+++ b/caps/NullPrincipal.cpp
@@ -98,17 +98,17 @@ NullPrincipal::Init(const OriginAttribut
mURI = NullPrincipalURI::Create();
NS_ENSURE_TRUE(mURI, NS_ERROR_NOT_AVAILABLE);
nsAutoCString originNoSuffix;
DebugOnly<nsresult> rv = mURI->GetSpec(originNoSuffix);
MOZ_ASSERT(NS_SUCCEEDED(rv));
nsAutoCString path;
- rv = mURI->GetPath(path);
+ rv = mURI->GetPathQueryRef(path);
MOZ_ASSERT(NS_SUCCEEDED(rv));
OriginAttributes attrs(aOriginAttributes);
if (aIsFirstParty) {
// remove the '{}' characters from both ends.
path.Mid(path, 1, path.Length() - 2);
path.AppendLiteral(".mozilla");
attrs.SetFirstPartyDomain(true, path);
@@ -187,17 +187,17 @@ NullPrincipal::MayLoadInternal(nsIURI* a
return false;
}
NS_IMETHODIMP
NullPrincipal::GetBaseDomain(nsACString& aBaseDomain)
{
// For a null principal, we use our unique uuid as the base domain.
- return mURI->GetPath(aBaseDomain);
+ return mURI->GetPathQueryRef(aBaseDomain);
}
NS_IMETHODIMP
NullPrincipal::GetAddonId(nsAString& aAddonId)
{
aAddonId.Truncate();
return NS_OK;
};
--- a/caps/NullPrincipalURI.cpp
+++ b/caps/NullPrincipalURI.cpp
@@ -150,24 +150,24 @@ NullPrincipalURI::GetPassword(nsACString
NS_IMETHODIMP
NullPrincipalURI::SetPassword(const nsACString& aPassword)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-NullPrincipalURI::GetPath(nsACString& _path)
+NullPrincipalURI::GetPathQueryRef(nsACString& _path)
{
_path = mPath;
return NS_OK;
}
NS_IMETHODIMP
-NullPrincipalURI::SetPath(const nsACString& aPath)
+NullPrincipalURI::SetPathQueryRef(const nsACString& aPath)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NullPrincipalURI::GetFilePath(nsACString& aFilePath)
{
aFilePath.Truncate();
--- a/chrome/nsChromeProtocolHandler.cpp
+++ b/chrome/nsChromeProtocolHandler.cpp
@@ -181,17 +181,17 @@ nsChromeProtocolHandler::NewChannel2(nsI
NS_ENSURE_SUCCESS(rv, rv);
rv = result->SetOriginalURI(aURI);
if (NS_FAILED(rv)) return rv;
// Get a system principal for content files and set the owner
// property of the result
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
nsAutoCString path;
- rv = url->GetPath(path);
+ rv = url->GetPathQueryRef(path);
if (StringBeginsWith(path, NS_LITERAL_CSTRING("/content/"))) {
result->SetOwner(nsContentUtils::GetSystemPrincipal());
}
// XXX Removed dependency-tracking code from here, because we're not
// tracking them anyways (with fastload we checked only in DEBUG
// and with startupcache not at all), but this is where we would start
// if we need to re-add.
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -161,17 +161,17 @@ nsChromeRegistry::GetProviderAndPath(nsI
#ifdef DEBUG
bool isChrome;
aChromeURL->SchemeIs("chrome", &isChrome);
NS_ASSERTION(isChrome, "Non-chrome URI?");
#endif
nsAutoCString path;
- rv = aChromeURL->GetPath(path);
+ rv = aChromeURL->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
if (path.Length() < 3) {
LogMessage("Invalid chrome URI: %s", path.get());
return NS_ERROR_FAILURE;
}
path.SetLength(nsUnescapeCount(path.BeginWriting()));
@@ -225,17 +225,17 @@ nsChromeRegistry::Canonify(nsIURL* aChro
path.AppendLiteral(".dtd");
}
else if (provider.EqualsLiteral("skin")) {
path.AppendLiteral(".css");
}
else {
return NS_ERROR_INVALID_ARG;
}
- aChromeURL->SetPath(path);
+ aChromeURL->SetPathQueryRef(path);
}
else {
// prevent directory traversals ("..")
// path is already unescaped once, but uris can get unescaped twice
const char* pos = path.BeginReading();
const char* end = path.EndReading();
while (pos < end) {
switch (*pos) {
--- a/chrome/nsChromeRegistryChrome.cpp
+++ b/chrome/nsChromeRegistryChrome.cpp
@@ -853,18 +853,18 @@ nsChromeRegistryChrome::ManifestOverride
nsresult rv = chromeuri->SchemeIs("chrome", &chromeSkinOnly);
chromeSkinOnly = chromeSkinOnly && NS_SUCCEEDED(rv);
if (chromeSkinOnly) {
rv = resolveduri->SchemeIs("chrome", &chromeSkinOnly);
chromeSkinOnly = chromeSkinOnly && NS_SUCCEEDED(rv);
}
if (chromeSkinOnly) {
nsAutoCString chromePath, resolvedPath;
- chromeuri->GetPath(chromePath);
- resolveduri->GetPath(resolvedPath);
+ chromeuri->GetPathQueryRef(chromePath);
+ resolveduri->GetPathQueryRef(resolvedPath);
chromeSkinOnly = StringBeginsWith(chromePath, NS_LITERAL_CSTRING("/skin/")) &&
StringBeginsWith(resolvedPath, NS_LITERAL_CSTRING("/skin/"));
}
if (!chromeSkinOnly) {
LogMessageWithContext(cx.GetManifestURI(), lineno, nsIScriptError::warningFlag,
"Cannot register non-chrome://.../skin/ URIs '%s' and '%s' as overrides and/or to be overridden from a skin manifest.",
chrome, resolved);
return;
--- a/devtools/client/styleeditor/StyleSheetEditor.jsm
+++ b/devtools/client/styleeditor/StyleSheetEditor.jsm
@@ -852,18 +852,18 @@ function findProjectPath(file, branch) {
* @param {nsIURI} origUri
* uri to find unshared branch of. Usually is uri for original source.
* @param {nsIURI} uri
* uri to compare against to get a shared root
* @return {object}
* object with 'branch' and 'origBranch' array of path parts for branch
*/
function findUnsharedBranches(origUri, uri) {
- origUri = OS.Path.split(origUri.path).components;
- uri = OS.Path.split(uri.path).components;
+ origUri = OS.Path.split(origUri.pathQueryRef).components;
+ uri = OS.Path.split(uri.pathQueryRef).components;
for (let i = 0; i < uri.length - 1; i++) {
if (uri[i] != origUri[i]) {
return {
branch: uri.slice(i),
origBranch: origUri.slice(i)
};
}
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -66,17 +66,17 @@ nsDefaultURIFixup::CreateExposableURI(ns
NS_ADDREF(*aReturn);
return NS_OK;
}
// Rats, we have to massage the URI
nsCOMPtr<nsIURI> uri;
if (isWyciwyg) {
nsAutoCString path;
- nsresult rv = aURI->GetPath(path);
+ nsresult rv = aURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t pathLength = path.Length();
if (pathLength <= 2) {
return NS_ERROR_FAILURE;
}
// Path is of the form "//123/http://foo/bar", with a variable number of
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5267,17 +5267,17 @@ nsDocShell::DisplayLoadError(nsresult aE
nsAutoCString spec;
rv = NS_ERROR_NOT_AVAILABLE;
if (aURI) {
// displaying "file://" is aesthetically unpleasing and could even be
// confusing to the user
bool isFileURI = false;
rv = aURI->SchemeIs("file", &isFileURI);
if (NS_SUCCEEDED(rv) && isFileURI) {
- aURI->GetPath(spec);
+ aURI->GetPathQueryRef(spec);
} else {
aURI->GetSpec(spec);
}
nsAutoCString charset;
// unescape and convert from origin charset
aURI->GetOriginCharset(charset);
nsCOMPtr<nsITextToSubURI> textToSubURI(
@@ -12360,17 +12360,17 @@ nsDocShell::ShouldAddToSessionHistory(ns
nsAutoCString buf;
rv = aURI->GetScheme(buf);
if (NS_FAILED(rv)) {
return false;
}
if (buf.EqualsLiteral("about")) {
- rv = aURI->GetPath(buf);
+ rv = aURI->GetPathQueryRef(buf);
if (NS_FAILED(rv)) {
return false;
}
if (buf.EqualsLiteral("blank") || buf.EqualsLiteral("newtab")) {
return false;
}
}
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -6506,17 +6506,17 @@ nsContentUtils::GetUTFOrigin(nsIURI* aUR
} else {
// We are probably dealing with an unknown blob URL.
bool isBlobURL = false;
nsresult rv = aURI->SchemeIs(BLOBURI_SCHEME, &isBlobURL);
NS_ENSURE_SUCCESS(rv, rv);
if (isBlobURL) {
nsAutoCString path;
- rv = aURI->GetPath(path);
+ rv = aURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), path);
if (NS_FAILED(rv)) {
aOrigin.AssignLiteral("null");
return NS_OK;
}
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -9633,19 +9633,19 @@ nsDocument::MaybePreconnect(nsIURI* aOri
// The URI created here is used in 2 contexts. One is nsISpeculativeConnect
// which ignores the path and uses only the origin. The other is for the
// document mPreloadedPreconnects de-duplication hash. Anonymous vs
// non-Anonymous preconnects create different connections on the wire and
// therefore should not be considred duplicates of each other and we
// normalize the path before putting it in the hash to accomplish that.
if (aCORSMode == CORS_ANONYMOUS) {
- uri->SetPath(NS_LITERAL_CSTRING("/anonymous"));
+ uri->SetPathQueryRef(NS_LITERAL_CSTRING("/anonymous"));
} else {
- uri->SetPath(NS_LITERAL_CSTRING("/"));
+ uri->SetPathQueryRef(NS_LITERAL_CSTRING("/"));
}
auto entry = mPreloadedPreconnects.LookupForAdd(uri);
if (entry) {
return; // we found an existing entry
}
entry.OrInsert([] () { return true; });
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -2656,17 +2656,17 @@ nsFrameLoader::CheckForRecursiveLoad(nsI
// Bug 136580: Check for recursive frame loading excluding about:srcdoc URIs.
// srcdoc URIs require their contents to be specified inline, so it isn't
// possible for undesirable recursion to occur without the aid of a
// non-srcdoc URI, which this method will block normally.
// Besides, URI is not enough to guarantee uniqueness of srcdoc documents.
nsAutoCString buffer;
rv = aURI->GetScheme(buffer);
if (NS_SUCCEEDED(rv) && buffer.EqualsLiteral("about")) {
- rv = aURI->GetPath(buffer);
+ rv = aURI->GetPathQueryRef(buffer);
if (NS_SUCCEEDED(rv) && buffer.EqualsLiteral("srcdoc")) {
// Duplicates allowed up to depth limits
return NS_OK;
}
}
int32_t matchCount = 0;
mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem));
while (parentAsItem) {
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -9185,17 +9185,17 @@ nsGlobalWindow::PostMessageMozOuter(JSCo
else if (!aTargetOrigin.EqualsASCII("*")) {
nsCOMPtr<nsIURI> originURI;
if (NS_FAILED(NS_NewURI(getter_AddRefs(originURI), aTargetOrigin))) {
aError.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
}
if (NS_FAILED(originURI->SetUserPass(EmptyCString())) ||
- NS_FAILED(originURI->SetPath(EmptyCString()))) {
+ NS_FAILED(originURI->SetPathQueryRef(EmptyCString()))) {
return;
}
OriginAttributes attrs = aSubjectPrincipal.OriginAttributesRef();
if (aSubjectPrincipal.GetIsSystemPrincipal()) {
auto principal = BasePrincipal::Cast(GetPrincipal());
if (attrs != principal->OriginAttributesRef()) {
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -1458,17 +1458,17 @@ nsObjectLoadingContent::MaybeRewriteYout
// See if URL is referencing youtube
if (!currentBaseDomain.EqualsLiteral("youtube.com")) {
return;
}
// We should only rewrite URLs with paths starting with "/v/", as we shouldn't
// touch object nodes with "/embed/" urls that already do that right thing.
nsAutoCString path;
- aURI->GetPath(path);
+ aURI->GetPathQueryRef(path);
if (!StringBeginsWith(path, NS_LITERAL_CSTRING("/v/"))) {
return;
}
// See if requester is planning on using the JS API.
nsAutoCString uri;
nsresult rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) {
--- a/dom/browser-element/BrowserElementPromptService.jsm
+++ b/dom/browser-element/BrowserElementPromptService.jsm
@@ -376,17 +376,17 @@ BrowserElementAuthPrompt.prototype = {
let loadContext = channel.notificationCallbacks.getInterface(Ci.nsILoadContext);
return loadContext.topFrameElement;
},
_createAuthDetail: function(channel, authInfo) {
let [hostname, httpRealm] = this._getAuthTarget(channel, authInfo);
return {
host: hostname,
- path: channel.URI.path,
+ path: channel.URI.pathQueryRef,
realm: httpRealm,
username: authInfo.username,
isProxy: !!(authInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY),
isOnlyPassword: !!(authInfo.flags & Ci.nsIAuthInformation.ONLY_PASSWORD)
};
},
// The code is taken from nsLoginManagerPrompter.js, with slight
--- a/dom/html/HTMLFormSubmission.cpp
+++ b/dom/html/HTMLFormSubmission.cpp
@@ -275,30 +275,30 @@ FSURLEncoded::GetEncodedSubmission(nsIUR
if (mMethod == NS_FORM_METHOD_POST) {
bool isMailto = false;
aURI->SchemeIs("mailto", &isMailto);
if (isMailto) {
nsAutoCString path;
- rv = aURI->GetPath(path);
+ rv = aURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
HandleMailtoSubject(path);
// Append the body to and force-plain-text args to the mailto line
nsAutoCString escapedBody;
if (NS_WARN_IF(!NS_Escape(mQueryString, escapedBody, url_XAlphas))) {
return NS_ERROR_OUT_OF_MEMORY;
}
path += NS_LITERAL_CSTRING("&force-plain-text=Y&body=") + escapedBody;
- rv = aURI->SetPath(path);
+ rv = aURI->SetPathQueryRef(path);
} else {
nsCOMPtr<nsIInputStream> dataStream;
// XXX We *really* need to either get the string to disown its data (and
// not destroy it), or make a string input stream that owns the CString
// that is passed to it. Right now this operation does a copy.
rv = NS_NewCStringInputStream(getter_AddRefs(dataStream), mQueryString);
@@ -327,17 +327,17 @@ FSURLEncoded::GetEncodedSubmission(nsIUR
}
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
if (url) {
url->SetQuery(mQueryString);
}
else {
nsAutoCString path;
- rv = aURI->GetPath(path);
+ rv = aURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
// Bug 42616: Trim off named anchor and save it to add later
int32_t namedAnchorPos = path.FindChar('#');
nsAutoCString namedAnchor;
if (kNotFound != namedAnchorPos) {
path.Right(namedAnchor, (path.Length() - namedAnchorPos));
path.Truncate(namedAnchorPos);
}
@@ -348,17 +348,17 @@ FSURLEncoded::GetEncodedSubmission(nsIUR
if (kNotFound != queryStart) {
path.Truncate(queryStart);
}
path.Append('?');
// Bug 42616: Add named anchor to end after query string
path.Append(mQueryString + namedAnchor);
- aURI->SetPath(path);
+ aURI->SetPathQueryRef(path);
}
}
return rv;
}
// i18n helper routines
nsresult
@@ -720,31 +720,31 @@ FSTextPlain::GetEncodedSubmission(nsIURI
// XXX HACK We are using the standard URL mechanism to give the body to the
// mailer instead of passing the post data stream to it, since that sounds
// hard.
bool isMailto = false;
aURI->SchemeIs("mailto", &isMailto);
if (isMailto) {
nsAutoCString path;
- rv = aURI->GetPath(path);
+ rv = aURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
HandleMailtoSubject(path);
// Append the body to and force-plain-text args to the mailto line
nsAutoCString escapedBody;
if (NS_WARN_IF(!NS_Escape(NS_ConvertUTF16toUTF8(mBody), escapedBody,
url_XAlphas))) {
return NS_ERROR_OUT_OF_MEMORY;
}
path += NS_LITERAL_CSTRING("&force-plain-text=Y&body=") + escapedBody;
- rv = aURI->SetPath(path);
+ rv = aURI->SetPathQueryRef(path);
} else {
// Create data stream.
// We do want to send the data through the charset encoder and we want to
// normalize linebreaks to use the "standard net" format (\r\n), but we
// don't want to perform any other encoding. This means that names and
// values which contains '=' or newlines are potentially ambigiously
// encoded, but that how text/plain is specced.
--- a/dom/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/jsurl/nsJSProtocolHandler.cpp
@@ -91,17 +91,17 @@ nsJSThunk::~nsJSThunk()
{
}
nsresult nsJSThunk::Init(nsIURI* uri)
{
NS_ENSURE_ARG_POINTER(uri);
// Get the script string to evaluate...
- nsresult rv = uri->GetPath(mScript);
+ nsresult rv = uri->GetPathQueryRef(mScript);
if (NS_FAILED(rv)) return rv;
// Get the url.
rv = uri->GetSpec(mURL);
if (NS_FAILED(rv)) return rv;
return NS_OK;
}
--- a/dom/media/IdpSandbox.jsm
+++ b/dom/media/IdpSandbox.jsm
@@ -93,18 +93,18 @@ ResourceLoader.prototype = {
function createLocationFromURI(uri) {
return {
href: uri.spec,
protocol: uri.scheme + ":",
host: uri.host + ((uri.port >= 0) ?
(":" + uri.port) : ""),
port: uri.port,
hostname: uri.host,
- pathname: uri.path.replace(/[#\?].*/, ""),
- search: uri.path.replace(/^[^\?]*/, "").replace(/#.*/, ""),
+ pathname: uri.pathQueryRef.replace(/[#\?].*/, ""),
+ search: uri.pathQueryRef.replace(/^[^\?]*/, "").replace(/#.*/, ""),
hash: uri.hasRef ? ("#" + uri.ref) : "",
origin: uri.prePath,
toString() {
return uri.spec;
}
};
}
@@ -158,17 +158,17 @@ IdpSandbox.createIdpUri = function(domai
let wkIdp = "https://" + domain + "/.well-known/idp-proxy/" + protocol;
let ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
let uri = ioService.newURI(wkIdp);
if (uri.hostPort !== domain) {
throw new Error(message + "domain is invalid");
}
- if (uri.path.indexOf("/.well-known/idp-proxy/") !== 0) {
+ if (uri.pathQueryRef.indexOf("/.well-known/idp-proxy/") !== 0) {
throw new Error(message + "must produce a /.well-known/idp-proxy/ URI");
}
return uri;
} catch (e) {
if (typeof e.result !== "undefined" &&
e.result === Cr.NS_ERROR_MALFORMED_URI) {
throw new Error(message + "must produce a valid URI");
--- a/dom/push/test/xpcshell/test_drop_expired.js
+++ b/dom/push/test/xpcshell/test_drop_expired.js
@@ -27,18 +27,18 @@ var putRecord = async function({scope, p
Ci.nsIPermissionManager[perm]);
do_register_cleanup(() => {
Services.perms.remove(uri, 'desktop-notification');
});
await visitURI(uri, lastVisit);
await db.put({
- channelID: uri.path,
- pushEndpoint: 'https://example.org/push' + uri.path,
+ channelID: uri.pathQueryRef,
+ pushEndpoint: 'https://example.org/push' + uri.pathQueryRef,
scope: uri.spec,
pushCount: 0,
lastPush: lastPush,
version: null,
originAttributes: '',
quota: quota,
});
--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -1281,29 +1281,29 @@ nsWebBrowserPersist::GetLocalFileFromURI
}
/* static */ nsresult
nsWebBrowserPersist::AppendPathToURI(nsIURI *aURI, const nsAString & aPath)
{
NS_ENSURE_ARG_POINTER(aURI);
nsAutoCString newPath;
- nsresult rv = aURI->GetPath(newPath);
+ nsresult rv = aURI->GetPathQueryRef(newPath);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
// Append a forward slash if necessary
int32_t len = newPath.Length();
if (len > 0 && newPath.CharAt(len - 1) != '/')
{
newPath.Append('/');
}
// Store the path back on the URI
AppendUTF16toUTF8(aPath, newPath);
- aURI->SetPath(newPath);
+ aURI->SetPathQueryRef(newPath);
return NS_OK;
}
nsresult nsWebBrowserPersist::SaveURIInternal(
nsIURI *aURI, nsISupports *aCacheKey, nsIURI *aReferrer,
uint32_t aReferrerPolicy, nsIInputStream *aPostData,
const char *aExtraHeaders, nsIURI *aFile,
--- a/dom/workers/ServiceWorkerUpdateJob.cpp
+++ b/dom/workers/ServiceWorkerUpdateJob.cpp
@@ -60,17 +60,17 @@ GetRequiredScopeStringPrefix(nsIURI* aSc
rv = scriptURL->GetDirectory(dir);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
aPrefix.Append(dir);
} else if (aPrefixMode == eUsePath) {
nsAutoCString path;
- rv = aScriptURI->GetPath(path);
+ rv = aScriptURI->GetPathQueryRef(path);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
aPrefix.Append(path);
} else {
MOZ_ASSERT_UNREACHABLE("Invalid value for aPrefixMode");
}
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -543,17 +543,17 @@ nsBindingManager::FlushSkinBindings()
for (auto iter = mBoundContentSet->Iter(); !iter.Done(); iter.Next()) {
nsXBLBinding* binding = iter.Get()->GetKey()->GetXBLBinding();
if (binding->MarkedForDeath()) {
continue;
}
nsAutoCString path;
- binding->PrototypeBinding()->DocURI()->GetPath(path);
+ binding->PrototypeBinding()->DocURI()->GetPathQueryRef(path);
if (!strncmp(path.get(), "/skin", 5)) {
binding->MarkForDeath();
}
}
}
// Used below to protect from recurring in QI calls through XPConnect.
--- a/dom/xul/nsXULPrototypeCache.cpp
+++ b/dom/xul/nsXULPrototypeCache.cpp
@@ -267,27 +267,27 @@ nsXULPrototypeCache::FlushSkinFiles()
StyleBackendType tableTypes[] = { StyleBackendType::Gecko,
StyleBackendType::Servo };
for (auto tableType : tableTypes) {
// Flush out skin XBL files from the cache.
XBLDocTable& xblDocTable = XBLDocTableFor(tableType);
for (auto iter = xblDocTable.Iter(); !iter.Done(); iter.Next()) {
nsAutoCString str;
- iter.Key()->GetPath(str);
+ iter.Key()->GetPathQueryRef(str);
if (strncmp(str.get(), "/skin", 5) == 0) {
iter.Remove();
}
}
// Now flush out our skin stylesheets from the cache.
StyleSheetTable& table = StyleSheetTableFor(tableType);
for (auto iter = table.Iter(); !iter.Done(); iter.Next()) {
nsAutoCString str;
- iter.Data()->GetSheetURI()->GetPath(str);
+ iter.Data()->GetSheetURI()->GetPathQueryRef(str);
if (strncmp(str.get(), "/skin", 5) == 0) {
iter.Remove();
}
}
// Iterate over all the remaining XBL and make sure cached
// scoped skin stylesheets are flushed and refetched by the
// prototype bindings.
@@ -480,17 +480,17 @@ nsXULPrototypeCache::HasData(nsIURI* uri
}
nsresult
nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
{
nsresult rv, tmp;
nsAutoCString path;
- aURI->GetPath(path);
+ aURI->GetPathQueryRef(path);
if (!StringEndsWith(path, NS_LITERAL_CSTRING(".xul")))
return NS_ERROR_NOT_AVAILABLE;
StartupCache* startupCache = StartupCache::GetSingleton();
if (!startupCache)
return NS_ERROR_FAILURE;
if (gDisableXULCache)
--- a/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp
+++ b/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp
@@ -188,17 +188,17 @@ nsXULTemplateQueryProcessorStorage::GetD
nsCOMPtr<nsIFile> databaseFile;
nsAutoCString scheme;
rv = uri->GetScheme(scheme);
NS_ENSURE_SUCCESS(rv, rv);
if (scheme.EqualsLiteral("profile")) {
nsAutoCString path;
- rv = uri->GetPath(path);
+ rv = uri->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
if (path.IsEmpty()) {
return NS_ERROR_FAILURE;
}
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
getter_AddRefs(databaseFile));
--- a/image/decoders/icon/nsIconURI.cpp
+++ b/image/decoders/icon/nsIconURI.cpp
@@ -372,24 +372,24 @@ nsMozIconURI::GetPort(int32_t* aPort)
NS_IMETHODIMP
nsMozIconURI::SetPort(int32_t aPort)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsMozIconURI::GetPath(nsACString& aPath)
+nsMozIconURI::GetPathQueryRef(nsACString& aPath)
{
aPath.Truncate();
return NS_OK;
}
NS_IMETHODIMP
-nsMozIconURI::SetPath(const nsACString& aPath)
+nsMozIconURI::SetPathQueryRef(const nsACString& aPath)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsMozIconURI::GetFilePath(nsACString& aFilePath)
{
aFilePath.Truncate();
--- a/intl/hyphenation/glue/nsHyphenationManager.cpp
+++ b/intl/hyphenation/glue/nsHyphenationManager.cpp
@@ -205,17 +205,17 @@ nsHyphenationManager::LoadPatternListFro
nsCString uriString(base);
uriString.Append(result, len);
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), uriString);
if (NS_FAILED(rv)) {
continue;
}
nsCString locale;
- rv = uri->GetPath(locale);
+ rv = uri->GetPathQueryRef(locale);
if (NS_FAILED(rv)) {
continue;
}
ToLowerCase(locale);
locale.SetLength(locale.Length() - 4); // strip ".dic"
locale.Cut(0, locale.RFindChar('/') + 1); // strip directory
if (StringBeginsWith(locale, NS_LITERAL_CSTRING("hyph_"))) {
locale.Cut(0, 5);
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -10272,17 +10272,17 @@ PresShell::VerifyStyleTree()
void
PresShell::DumpReflows()
{
if (mReflowCountMgr) {
nsAutoCString uriStr;
if (mDocument) {
nsIURI *uri = mDocument->GetDocumentURI();
if (uri) {
- uri->GetPath(uriStr);
+ uri->GetPathQueryRef(uriStr);
}
}
mReflowCountMgr->DisplayTotals(uriStr.get());
mReflowCountMgr->DisplayHTMLTotals(uriStr.get());
mReflowCountMgr->DisplayDiffsInTotals();
}
}
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -494,17 +494,17 @@ PeerConnectionConfiguration::AddIceServe
// TODO(jib@mozilla.com): Revisit once nsURI supports STUN/TURN (Bug 833509)
int32_t port;
nsAutoCString host;
nsAutoCString transport;
{
uint32_t hostPos;
int32_t hostLen;
nsAutoCString path;
- rv = url->GetPath(path);
+ rv = url->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
// Tolerate query-string + parse 'transport=[udp|tcp]' by hand.
int32_t questionmark = path.FindChar('?');
if (questionmark >= 0) {
const nsCString match = NS_LITERAL_CSTRING("transport=");
for (int32_t i = questionmark, endPos; i >= 0; i = endPos) {
--- a/mobile/android/components/AboutRedirector.js
+++ b/mobile/android/components/AboutRedirector.js
@@ -86,17 +86,17 @@ if (AppConstants.MOZ_SERVICES_HEALTHREPO
}
function AboutRedirector() {}
AboutRedirector.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
classID: Components.ID("{322ba47e-7047-4f71-aebf-cb7d69325cd9}"),
_getModuleInfo: function (aURI) {
- let moduleName = aURI.path.replace(/[?#].*/, "").toLowerCase();
+ let moduleName = aURI.pathQueryRef.replace(/[?#].*/, "").toLowerCase();
return modules[moduleName];
},
// nsIAboutModule
getURIFlags: function(aURI) {
let flags;
let moduleInfo = this._getModuleInfo(aURI);
if (moduleInfo.hide)
--- a/mobile/android/components/PromptService.js
+++ b/mobile/android/components/PromptService.js
@@ -620,18 +620,18 @@ var PromptUtils = {
getHostnameAndRealm: function pu_getHostnameAndRealm(aRealmString) {
let httpRealm = /^.+ \(.+\)$/;
if (httpRealm.test(aRealmString))
return [null, null, null];
let uri = Services.io.newURI(aRealmString);
let pathname = "";
- if (uri.path != "/")
- pathname = uri.path;
+ if (uri.pathQueryRef != "/")
+ pathname = uri.pathQueryRef;
let formattedHostname = this._getFormattedHostname(uri);
return [formattedHostname, formattedHostname + pathname, uri.username];
},
canSaveLogin: function pu_canSaveLogin(aHostname, aSavePassword) {
let canSave = !this._inPrivateBrowsing && this.pwmgr.getLoginSavingEnabled(aHostname)
if (aSavePassword)
--- a/mobile/android/components/build/nsAndroidHistory.cpp
+++ b/mobile/android/components/build/nsAndroidHistory.cpp
@@ -367,17 +367,17 @@ nsAndroidHistory::CanAddURI(nsIURI* aURI
return NS_OK;
}
if (scheme.EqualsLiteral("https")) {
*canAdd = true;
return NS_OK;
}
if (scheme.EqualsLiteral("about")) {
nsAutoCString path;
- rv = aURI->GetPath(path);
+ rv = aURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
if (StringBeginsWith(path, NS_LITERAL_CSTRING("reader"))) {
*canAdd = true;
return NS_OK;
}
}
--- a/mobile/android/modules/HelperApps.jsm
+++ b/mobile/android/modules/HelperApps.jsm
@@ -131,17 +131,17 @@ var HelperApps = {
});
}
// Some apps will register for html files (the Samsung Video player) but should be shown
// for non-HTML files (like videos). This filters them only if the page has an htm of html
// file extension.
if (flags.filterHtml) {
// Matches from the first '.' to the end of the string, '?', or '#'
- let ext = /\.([^\?#]*)/.exec(uri.path);
+ let ext = /\.([^\?#]*)/.exec(uri.pathQueryRef);
if (ext && (ext[1] === "html" || ext[1] === "htm")) {
apps = apps.filter(function(app) {
return app.name && !this.defaultHtmlHandlers[app.name];
}, this);
}
}
return apps;
--- a/modules/libjar/nsJARURI.cpp
+++ b/modules/libjar/nsJARURI.cpp
@@ -438,25 +438,25 @@ nsJARURI::GetPort(int32_t *aPort)
NS_IMETHODIMP
nsJARURI::SetPort(int32_t aPort)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsJARURI::GetPath(nsACString &aPath)
+nsJARURI::GetPathQueryRef(nsACString &aPath)
{
nsAutoCString entrySpec;
mJAREntry->GetSpec(entrySpec);
return FormatSpec(entrySpec, aPath, false);
}
NS_IMETHODIMP
-nsJARURI::SetPath(const nsACString &aPath)
+nsJARURI::SetPathQueryRef(const nsACString &aPath)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsJARURI::GetAsciiSpec(nsACString &aSpec)
{
// XXX Shouldn't this like... make sure it returns ASCII or something?
--- a/netwerk/base/RustURL.cpp
+++ b/netwerk/base/RustURL.cpp
@@ -259,23 +259,23 @@ RustURL::GetPort(int32_t *aPort)
NS_IMETHODIMP
RustURL::SetPort(int32_t aPort)
{
ENSURE_MUTABLE();
return rusturl_set_port_no(mURL.get(), aPort);
}
NS_IMETHODIMP
-RustURL::GetPath(nsACString & aPath)
+RustURL::GetPathQueryRef(nsACString & aPath)
{
return rusturl_get_path(mURL.get(), &aPath);
}
NS_IMETHODIMP
-RustURL::SetPath(const nsACString & aPath)
+RustURL::SetPathQueryRef(const nsACString & aPath)
{
ENSURE_MUTABLE();
nsAutoCString path;
nsresult rv = GetPrePath(path);
if (NS_FAILED(rv)) {
return rv;
}
--- a/netwerk/base/nsIURI.idl
+++ b/netwerk/base/nsIURI.idl
@@ -165,17 +165,17 @@ interface nsIURI : nsISupports
* The path, typically including at least a leading '/' (but may also be
* empty, depending on the protocol).
*
* Some characters may be escaped.
*
* This attribute contains query and ref parts for historical reasons.
* Use the 'filePath' attribute if you do not want those parts included.
*/
- attribute AUTF8String path;
+ attribute AUTF8String pathQueryRef;
/************************************************************************
* An URI supports the following methods:
*/
/**
* URI equivalence test (not a strict string comparison).
--- a/netwerk/base/nsSimpleURI.cpp
+++ b/netwerk/base/nsSimpleURI.cpp
@@ -301,17 +301,17 @@ nsSimpleURI::SetSpec(const nsACString &a
return NS_ERROR_MALFORMED_URI;
mScheme.Truncate();
DebugOnly<int32_t> n = spec.Left(mScheme, colonPos);
NS_ASSERTION(n == colonPos, "Left failed");
ToLowerCase(mScheme);
// This sets mPath, mQuery and mRef.
- return SetPath(Substring(spec, colonPos + 1));
+ return SetPathQueryRef(Substring(spec, colonPos + 1));
}
NS_IMETHODIMP
nsSimpleURI::GetScheme(nsACString &result)
{
result = mScheme;
return NS_OK;
}
@@ -432,31 +432,31 @@ NS_IMETHODIMP
nsSimpleURI::SetPort(int32_t port)
{
NS_ENSURE_STATE(mMutable);
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsSimpleURI::GetPath(nsACString &result)
+nsSimpleURI::GetPathQueryRef(nsACString &result)
{
result = mPath;
if (mIsQueryValid) {
result += NS_LITERAL_CSTRING("?") + mQuery;
}
if (mIsRefValid) {
result += NS_LITERAL_CSTRING("#") + mRef;
}
return NS_OK;
}
NS_IMETHODIMP
-nsSimpleURI::SetPath(const nsACString &aPath)
+nsSimpleURI::SetPathQueryRef(const nsACString &aPath)
{
NS_ENSURE_STATE(mMutable);
nsAutoCString path;
if (!path.Assign(aPath, fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
int32_t queryPos = path.FindChar('?');
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -1566,20 +1566,20 @@ nsStandardURL::GetPort(int32_t *result)
MOZ_ASSERT(mPort <= std::numeric_limits<uint16_t>::max());
*result = mPort;
CALL_RUST_GETTER_INT(result, GetPort, result);
return NS_OK;
}
// result may contain unescaped UTF-8 characters
NS_IMETHODIMP
-nsStandardURL::GetPath(nsACString &result)
+nsStandardURL::GetPathQueryRef(nsACString &result)
{
result = Path();
- CALL_RUST_GETTER_STR(result, GetPath, result);
+ CALL_RUST_GETTER_STR(result, GetPathQueryRef, result);
return NS_OK;
}
// result is ASCII
NS_IMETHODIMP
nsStandardURL::GetAsciiSpec(nsACString &result)
{
if (mSpecEncoding == eEncoding_Unknown) {
@@ -2305,22 +2305,22 @@ nsStandardURL::ReplacePortInSpec(int32_t
// Bookkeeping to reflect the new length:
int32_t shift = buf.Length() - replacedLen;
mAuthority.mLen += shift;
ShiftFromPath(shift);
}
NS_IMETHODIMP
-nsStandardURL::SetPath(const nsACString &input)
+nsStandardURL::SetPathQueryRef(const nsACString &input)
{
ENSURE_MUTABLE();
const nsPromiseFlatCString &path = PromiseFlatCString(input);
- LOG(("nsStandardURL::SetPath [path=%s]\n", path.get()));
+ LOG(("nsStandardURL::SetPathQueryRef [path=%s]\n", path.get()));
InvalidateCache();
if (!path.IsEmpty()) {
nsAutoCString spec;
spec.Assign(mSpec.get(), mPath.mPos);
if (path.First() != '/')
@@ -2336,17 +2336,17 @@ nsStandardURL::SetPath(const nsACString
mDirectory.mLen = 1;
mFilepath.mLen = 1;
// these are no longer defined
mBasename.mLen = -1;
mExtension.mLen = -1;
mQuery.mLen = -1;
mRef.mLen = -1;
}
- CALL_RUST_SETTER(SetPath, input);
+ CALL_RUST_SETTER(SetPathQueryRef, input);
return NS_OK;
}
NS_IMETHODIMP
nsStandardURL::Equals(nsIURI *unknownOther, bool *result)
{
return EqualsInternal(unknownOther, eHonorRef, result);
}
@@ -2948,17 +2948,17 @@ nsStandardURL::SetFilePath(const nsACStr
const nsPromiseFlatCString &flat = PromiseFlatCString(input);
const char *filepath = flat.get();
LOG(("nsStandardURL::SetFilePath [filepath=%s]\n", filepath));
// if there isn't a filepath, then there can't be anything
// after the path either. this url is likely uninitialized.
if (mFilepath.mLen < 0)
- return SetPath(flat);
+ return SetPathQueryRef(flat);
if (filepath && *filepath) {
nsAutoCString spec;
uint32_t dirPos, basePos, extPos;
int32_t dirLen, baseLen, extLen;
nsresult rv;
rv = mParser->ParseFilePath(filepath, flat.Length(),
@@ -3024,17 +3024,17 @@ nsStandardURL::SetQuery(const nsACString
ENSURE_MUTABLE();
const nsPromiseFlatCString &flat = PromiseFlatCString(input);
const char *query = flat.get();
LOG(("nsStandardURL::SetQuery [query=%s]\n", query));
if (mPath.mLen < 0)
- return SetPath(flat);
+ return SetPathQueryRef(flat);
if (mSpec.Length() + input.Length() - Query().Length() > (uint32_t) net_GetURLMaxLength()) {
return NS_ERROR_MALFORMED_URI;
}
InvalidateCache();
if (!query || !*query) {
@@ -3098,17 +3098,17 @@ nsStandardURL::SetRef(const nsACString &
ENSURE_MUTABLE();
const nsPromiseFlatCString &flat = PromiseFlatCString(input);
const char *ref = flat.get();
LOG(("nsStandardURL::SetRef [ref=%s]\n", ref));
if (mPath.mLen < 0)
- return SetPath(flat);
+ return SetPathQueryRef(flat);
if (mSpec.Length() + input.Length() - Ref().Length() > (uint32_t) net_GetURLMaxLength()) {
return NS_ERROR_MALFORMED_URI;
}
InvalidateCache();
if (!ref || !*ref) {
@@ -3170,17 +3170,17 @@ nsStandardURL::SetFileName(const nsACStr
ENSURE_MUTABLE();
const nsPromiseFlatCString &flat = PromiseFlatCString(input);
const char *filename = flat.get();
LOG(("nsStandardURL::SetFileName [filename=%s]\n", filename));
if (mPath.mLen < 0)
- return SetPath(flat);
+ return SetPathQueryRef(flat);
if (mSpec.Length() + input.Length() - Filename().Length() > (uint32_t) net_GetURLMaxLength()) {
return NS_ERROR_MALFORMED_URI;
}
int32_t shift = 0;
if (!(filename && *filename)) {
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -3286,17 +3286,17 @@ nsCookieService::GetCookieStringInternal
// scheme must have a non-empty host. A trailing dot in the host
// is acceptable.
bool requireHostMatch;
nsAutoCString baseDomain, hostFromURI, pathFromURI;
nsresult rv = GetBaseDomain(aHostURI, baseDomain, requireHostMatch);
if (NS_SUCCEEDED(rv))
rv = aHostURI->GetAsciiHost(hostFromURI);
if (NS_SUCCEEDED(rv))
- rv = aHostURI->GetPath(pathFromURI);
+ rv = aHostURI->GetPathQueryRef(pathFromURI);
if (NS_FAILED(rv)) {
COOKIE_LOGFAILURE(GET_COOKIE, aHostURI, nullptr, "invalid host/path from URI");
return;
}
// check default prefs
CookieStatus cookieStatus = CheckPrefs(aHostURI, aIsForeign, nullptr);
@@ -4297,17 +4297,17 @@ GetPathFromURI(nsIURI* aHostURI)
// ignoring slashes in the query string part.
// if we can QI to nsIURL, that'll take care of the query string portion.
// otherwise, it's not an nsIURL and can't have a query string, so just find the last slash.
nsAutoCString path;
nsCOMPtr<nsIURL> hostURL = do_QueryInterface(aHostURI);
if (hostURL) {
hostURL->GetDirectory(path);
} else {
- aHostURI->GetPath(path);
+ aHostURI->GetPathQueryRef(path);
int32_t slash = path.RFindChar('/');
if (slash != kNotFound) {
path.Truncate(slash + 1);
}
}
return path;
}
@@ -4324,17 +4324,17 @@ nsCookieService::CheckPath(nsCookieAttri
/**
* The following test is part of the RFC2109 spec. Loosely speaking, it says that a site
* cannot set a cookie for a path that it is not on. See bug 155083. However this patch
* broke several sites -- nordea (bug 155768) and citibank (bug 156725). So this test has
* been disabled, unless we can evangelize these sites.
*/
// get path from aHostURI
nsAutoCString pathFromURI;
- if (NS_FAILED(aHostURI->GetPath(pathFromURI)) ||
+ if (NS_FAILED(aHostURI->GetPathQueryRef(pathFromURI)) ||
!StringBeginsWith(pathFromURI, aCookieAttributes.path)) {
return false;
}
#endif
}
if (aCookieAttributes.path.Length() > kMaxBytesPerPath ||
aCookieAttributes.path.Contains('\t'))
--- a/netwerk/protocol/about/nsAboutCache.cpp
+++ b/netwerk/protocol/about/nsAboutCache.cpp
@@ -174,17 +174,17 @@ nsresult
nsAboutCache::Channel::ParseURI(nsIURI * uri, nsACString & storage)
{
//
// about:cache[?storage=<storage-name>[&context=<context-key>]]
//
nsresult rv;
nsAutoCString path;
- rv = uri->GetPath(path);
+ rv = uri->GetPathQueryRef(path);
if (NS_FAILED(rv)) return rv;
mContextString.Truncate();
mLoadInfo = CacheFileUtils::ParseKey(NS_LITERAL_CSTRING(""));
storage.Truncate();
nsACString::const_iterator start, valueStart, end;
path.BeginReading(start);
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -226,17 +226,17 @@ nsAboutCacheEntry::Channel::ParseURI(nsI
nsIURI **cacheUri)
{
//
// about:cache-entry?storage=[string]&contenxt=[string]&eid=[string]&uri=[string]
//
nsresult rv;
nsAutoCString path;
- rv = uri->GetPath(path);
+ rv = uri->GetPathQueryRef(path);
if (NS_FAILED(rv))
return rv;
nsACString::const_iterator keyBegin, keyEnd, valBegin, begin, end;
path.BeginReading(begin);
path.EndReading(end);
keyBegin = begin; keyEnd = end;
--- a/netwerk/protocol/about/nsAboutProtocolHandler.cpp
+++ b/netwerk/protocol/about/nsAboutProtocolHandler.cpp
@@ -134,17 +134,17 @@ nsAboutProtocolHandler::NewURI(const nsA
}
if (isSafe) {
// We need to indicate that this baby is safe. Use an inner URI that
// no one but the security manager will see. Make sure to preserve our
// path, in case someone decides to hardcode checks for particular
// about: URIs somewhere.
nsAutoCString spec;
- rv = url->GetPath(spec);
+ rv = url->GetPathQueryRef(spec);
NS_ENSURE_SUCCESS(rv, rv);
spec.Insert("moz-safe-about:", 0);
nsCOMPtr<nsIURI> inner;
rv = NS_NewURI(getter_AddRefs(inner), spec);
NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/protocol/about/nsAboutProtocolUtils.h
+++ b/netwerk/protocol/about/nsAboutProtocolUtils.h
@@ -19,17 +19,17 @@ NS_GetAboutModuleName(nsIURI *aAboutURI,
{
bool isAbout;
NS_ASSERTION(NS_SUCCEEDED(aAboutURI->SchemeIs("about", &isAbout)) &&
isAbout,
"should be used only on about: URIs");
}
#endif
- nsresult rv = aAboutURI->GetPath(aModule);
+ nsresult rv = aAboutURI->GetPathQueryRef(aModule);
NS_ENSURE_SUCCESS(rv, rv);
int32_t f = aModule.FindCharInSet(NS_LITERAL_CSTRING("#?"));
if (f != kNotFound) {
aModule.Truncate(f);
}
// convert to lowercase, as all about: modules are lowercase
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -1631,28 +1631,28 @@ nsFtpState::Init(nsFtpChannel *channel)
if (NS_FAILED(rv) || host.IsEmpty()) {
return NS_ERROR_MALFORMED_URI;
}
nsAutoCString path;
if (url) {
rv = url->GetFilePath(path);
} else {
- rv = mChannel->URI()->GetPath(path);
+ rv = mChannel->URI()->GetPathQueryRef(path);
}
if (NS_FAILED(rv))
return rv;
removeParamsFromPath(path);
// FTP parameters such as type=i are ignored
if (url) {
url->SetFilePath(path);
} else {
- mChannel->URI()->SetPath(path);
+ mChannel->URI()->SetPathQueryRef(path);
}
// Skip leading slash
char *fwdPtr = path.BeginWriting();
if (!fwdPtr)
return NS_ERROR_OUT_OF_MEMORY;
if (*fwdPtr == '/')
fwdPtr++;
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1577,17 +1577,17 @@ HttpBaseChannel::SetReferrerWithPolicy(n
// perhaps some sort of generic nsINestedURI could be used. then, if an URI
// fails the whitelist test, then we could check for an inner URI and try
// that instead. though, that might be too automatic.
//
rv = referrer->SchemeIs("wyciwyg", &match);
if (NS_FAILED(rv)) return rv;
if (match) {
nsAutoCString path;
- rv = referrer->GetPath(path);
+ rv = referrer->GetPathQueryRef(path);
if (NS_FAILED(rv)) return rv;
uint32_t pathLength = path.Length();
if (pathLength <= 2) return NS_ERROR_FAILURE;
// Path is of the form "//123/http://foo/bar", with a variable number of
// digits. To figure out where the "real" URL starts, search path for a
// '/', starting at the third character.
@@ -1824,17 +1824,17 @@ HttpBaseChannel::SetReferrerWithPolicy(n
// No URL, so fall through to truncating the path and any query/ref off
// as well.
}
MOZ_FALLTHROUGH;
default: // (Pref limited to [0,2] enforced by clamp, MOZ_CRASH overkill.)
case 2: // scheme+host+port+/
spec.AppendLiteral("/");
// This nukes any query/ref present as well in the case of nsStandardURL
- rv = clone->SetPath(EmptyCString());
+ rv = clone->SetPathQueryRef(EmptyCString());
if (NS_FAILED(rv)) return rv;
break;
}
} else {
// use the full URI
rv = clone->GetAsciiSpec(spec);
if (NS_FAILED(rv)) return rv;
}
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1052,17 +1052,17 @@ nsHttpChannel::SetupTransaction()
}
// Use the URI path if not proxying (transparent proxying such as proxy
// CONNECT does not count here). Also figure out what HTTP version to use.
nsAutoCString buf, path;
nsCString* requestURI;
// This is the normal e2e H1 path syntax "/index.html"
- rv = mURI->GetPath(path);
+ rv = mURI->GetPathQueryRef(path);
if (NS_FAILED(rv)) {
return rv;
}
// path may contain UTF-8 characters, so ensure that they're escaped.
if (NS_EscapeURL(path.get(), path.Length(), esc_OnlyNonASCII, buf)) {
requestURI = &buf;
} else {
--- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
+++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
@@ -1743,17 +1743,17 @@ nsHttpChannelAuthProvider::SetAuthorizat
nsresult
nsHttpChannelAuthProvider::GetCurrentPath(nsACString &path)
{
nsresult rv;
nsCOMPtr<nsIURL> url = do_QueryInterface(mURI);
if (url)
rv = url->GetDirectory(path);
else
- rv = mURI->GetPath(path);
+ rv = mURI->GetPathQueryRef(path);
return rv;
}
NS_IMPL_ISUPPORTS(nsHttpChannelAuthProvider, nsICancelable,
nsIHttpChannelAuthProvider, nsIAuthPromptCallback, nsIHttpAuthenticatorCallback)
} // namespace net
} // namespace mozilla
--- a/netwerk/protocol/http/nsHttpDigestAuth.cpp
+++ b/netwerk/protocol/http/nsHttpDigestAuth.cpp
@@ -101,17 +101,17 @@ nsHttpDigestAuth::GetMethodAndPath(nsIHt
rv2 = uri->GetPort(&port);
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2)) {
path.Append(':');
path.AppendInt(port < 0 ? NS_HTTPS_DEFAULT_PORT : port);
}
}
else {
rv = authChannel->GetRequestMethod(httpMethod);
- rv2 = uri->GetPath(path);
+ rv2 = uri->GetPathQueryRef(path);
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2)) {
//
// strip any fragment identifier from the URL path.
//
int32_t ref = path.RFindChar('#');
if (ref != kNotFound)
path.Truncate(ref);
//
--- a/netwerk/protocol/res/SubstitutingProtocolHandler.cpp
+++ b/netwerk/protocol/res/SubstitutingProtocolHandler.cpp
@@ -362,17 +362,17 @@ SubstitutingProtocolHandler::ResolveURI(
nsCOMPtr<nsIURL> url = do_QueryInterface(uri);
if (!url) {
return NS_ERROR_MALFORMED_URI;
}
rv = uri->GetAsciiHost(host);
if (NS_FAILED(rv)) return rv;
- rv = uri->GetPath(path);
+ rv = uri->GetPathQueryRef(path);
if (NS_FAILED(rv)) return rv;
rv = url->GetFilePath(pathname);
if (NS_FAILED(rv)) return rv;
if (ResolveSpecialCases(host, path, pathname, result)) {
return NS_OK;
}
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -39,17 +39,17 @@ NS_INTERFACE_MAP_BEGIN(nsViewSourceChann
NS_INTERFACE_MAP_END
nsresult
nsViewSourceChannel::Init(nsIURI* uri)
{
mOriginalURI = uri;
nsAutoCString path;
- nsresult rv = uri->GetPath(path);
+ nsresult rv = uri->GetPathQueryRef(path);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIIOService> pService(do_GetIOService(&rv));
if (NS_FAILED(rv)) return rv;
nsAutoCString scheme;
rv = pService->ExtractScheme(path, scheme);
--- a/netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.cpp
@@ -110,17 +110,17 @@ nsWyciwygProtocolHandler::NewChannel2(ns
rv = wcc->Init(url);
if (NS_FAILED(rv))
PWyciwygChannelChild::Send__delete__(wcc);
} else
{
// If original channel used https, make sure PSM is initialized
// (this may be first channel to load during a session restore)
nsAutoCString path;
- rv = url->GetPath(path);
+ rv = url->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
int32_t slashIndex = path.FindChar('/', 2);
if (slashIndex == kNotFound)
return NS_ERROR_FAILURE;
if (path.Length() < (uint32_t)slashIndex + 1 + 5)
return NS_ERROR_FAILURE;
if (!PL_strncasecmp(path.get() + slashIndex + 1, "https", 5))
net_EnsurePSMInit();
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -188,17 +188,17 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
if (NS_FAILED(rv)) return rv;
rv = newUri->SetPassword(EmptyCString());
if (NS_FAILED(rv)) return rv;
rv = newUri->GetAsciiSpec(titleUri);
if (NS_FAILED(rv)) return rv;
}
nsAutoCString path;
- rv = uri->GetPath(path);
+ rv = uri->GetPathQueryRef(path);
if (NS_FAILED(rv)) return rv;
if (!path.EqualsLiteral("//") && !path.LowerCaseEqualsLiteral("/%2f")) {
rv = uri->Resolve(NS_LITERAL_CSTRING(".."),parentStr);
if (NS_FAILED(rv)) return rv;
}
} else if (NS_SUCCEEDED(uri->SchemeIs("file", &isSchemeFile)) && isSchemeFile) {
nsCOMPtr<nsIFileURL> fileUrl = do_QueryInterface(uri);
@@ -221,17 +221,17 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
parentStr.Assign(url);
}
// Directory index will be always encoded in UTF-8 if this is file url
buffer.AppendLiteral("<meta charset=\"UTF-8\">\n");
} else if (NS_SUCCEEDED(uri->SchemeIs("jar", &isScheme)) && isScheme) {
nsAutoCString path;
- rv = uri->GetPath(path);
+ rv = uri->GetPathQueryRef(path);
if (NS_FAILED(rv)) return rv;
// a top-level jar directory URL is of the form jar:foo.zip!/
// path will be of the form foo.zip!/, and its last two characters
// will be "!/"
//XXX this won't work correctly when the name of the directory being
//XXX displayed ends with "!", but then again, jar: URIs don't deal
//XXX particularly well with such directories anyway
@@ -239,22 +239,22 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
rv = uri->Resolve(NS_LITERAL_CSTRING(".."), parentStr);
if (NS_FAILED(rv)) return rv;
}
}
else {
// default behavior for other protocols is to assume the channel's
// URL references a directory ending in '/' -- fixup if necessary.
nsAutoCString path;
- rv = uri->GetPath(path);
+ rv = uri->GetPathQueryRef(path);
if (NS_FAILED(rv)) return rv;
if (baseUri.Last() != '/') {
baseUri.Append('/');
path.Append('/');
- uri->SetPath(path);
+ uri->SetPathQueryRef(path);
}
if (!path.EqualsLiteral("/")) {
rv = uri->Resolve(NS_LITERAL_CSTRING(".."), parentStr);
if (NS_FAILED(rv)) return rv;
}
}
buffer.AppendLiteral("<style type=\"text/css\">\n"
--- a/netwerk/test/gtest/TestStandardURL.cpp
+++ b/netwerk/test/gtest/TestStandardURL.cpp
@@ -32,18 +32,18 @@ TEST(TestStandardURL, Simple) {
ASSERT_TRUE(out == NS_LITERAL_CSTRING("foo"));
ASSERT_EQ(url->GetHost(out), NS_OK);
ASSERT_TRUE(out == NS_LITERAL_CSTRING("example.com"));
ASSERT_EQ(url->SetHost(NS_LITERAL_CSTRING("www.yahoo.com")), NS_OK);
ASSERT_EQ(url->GetHost(out), NS_OK);
ASSERT_TRUE(out == NS_LITERAL_CSTRING("www.yahoo.com"));
- ASSERT_EQ(url->SetPath(NS_LITERAL_CSTRING("/some-path/one-the-net/about.html?with-a-query#for-you")), NS_OK);
- ASSERT_EQ(url->GetPath(out), NS_OK);
+ ASSERT_EQ(url->SetPathQueryRef(NS_LITERAL_CSTRING("/some-path/one-the-net/about.html?with-a-query#for-you")), NS_OK);
+ ASSERT_EQ(url->GetPathQueryRef(out), NS_OK);
ASSERT_TRUE(out == NS_LITERAL_CSTRING("/some-path/one-the-net/about.html?with-a-query#for-you"));
ASSERT_EQ(url->SetQuery(NS_LITERAL_CSTRING("a=b&d=c&what-ever-you-want-to-be-called=45")), NS_OK);
ASSERT_EQ(url->GetQuery(out), NS_OK);
ASSERT_TRUE(out == NS_LITERAL_CSTRING("a=b&d=c&what-ever-you-want-to-be-called=45"));
ASSERT_EQ(url->SetRef(NS_LITERAL_CSTRING("#some-book-mark")), NS_OK);
ASSERT_EQ(url->GetRef(out), NS_OK);
@@ -185,18 +185,18 @@ MOZ_GTEST_BENCH(TestStandardURL, Perf, [
for (int i = COUNT; i; --i) {
ASSERT_EQ(url->SetSpec(NS_LITERAL_CSTRING("http://example.com")), NS_OK);
ASSERT_EQ(url->GetSpec(out), NS_OK);
url->Resolve(NS_LITERAL_CSTRING("foo.html?q=45"), out);
url->SetScheme(NS_LITERAL_CSTRING("foo"));
url->GetScheme(out);
url->SetHost(NS_LITERAL_CSTRING("www.yahoo.com"));
url->GetHost(out);
- url->SetPath(NS_LITERAL_CSTRING("/some-path/one-the-net/about.html?with-a-query#for-you"));
- url->GetPath(out);
+ url->SetPathQueryRef(NS_LITERAL_CSTRING("/some-path/one-the-net/about.html?with-a-query#for-you"));
+ url->GetPathQueryRef(out);
url->SetQuery(NS_LITERAL_CSTRING("a=b&d=c&what-ever-you-want-to-be-called=45"));
url->GetQuery(out);
url->SetRef(NS_LITERAL_CSTRING("#some-book-mark"));
url->GetRef(out);
}
});
// Note the five calls in the loop, so divide by 100k
--- a/netwerk/test/httpserver/httpd.js
+++ b/netwerk/test/httpserver/httpd.js
@@ -1753,17 +1753,17 @@ RequestReader.prototype =
throw HTTP_400;
}
try
{
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(fullPath);
- fullPath = uri.path;
+ fullPath = uri.pathQueryRef;
scheme = uri.scheme;
host = metadata._host = uri.asciiHost;
port = uri.port;
if (port === -1)
{
if (scheme === "http")
{
port = 80;
--- a/netwerk/test/httpserver/test/test_default_index_handler.js
+++ b/netwerk/test/httpserver/test/test_default_index_handler.js
@@ -147,17 +147,17 @@ function hiddenDataCheck(bytes, uri, pat
.QueryInterface(Ci.nsIDOMElement);
var f = dirEntries[i];
var sep = f.isDirectory ? "/" : "";
do_check_eq(link.textContent, f.name + sep);
uri = ios.newURI(link.getAttribute("href"), null, top);
- do_check_eq(decodeURIComponent(uri.path), path + f.name + sep);
+ do_check_eq(decodeURIComponent(uri.pathQueryRef), path + f.name + sep);
}
}
/**
* Verifies data in bytes (an array of bytes) represents an index page for the
* given URI and path, which should be a page listing the given directory
* entries, in order.
*
@@ -227,17 +227,17 @@ function dataCheck(bytes, uri, path, dir
.QueryInterface(Ci.nsIDOMElement);
var f = dirEntries[i];
var sep = f.isDirectory ? "/" : "";
do_check_eq(link.textContent, f.name + sep);
uri = ios.newURI(link.getAttribute("href"), null, top);
- do_check_eq(decodeURIComponent(uri.path), path + f.name + sep);
+ do_check_eq(decodeURIComponent(uri.pathQueryRef), path + f.name + sep);
}
}
/**
* Create a file/directory with the given name underneath parentDir, and
* append an object with name/isDirectory properties to lst corresponding
* to it if the file/directory could be created.
*/
--- a/netwerk/test/unit/test_URIs.js
+++ b/netwerk/test/unit/test_URIs.js
@@ -21,209 +21,209 @@ var gIoService = Components.classes["@mo
// http://greenbytes.de/tech/tc/uris/
// TEST DATA
// ---------
var gTests = [
{ spec: "about:blank",
scheme: "about",
prePath: "about:",
- path: "blank",
+ pathQueryRef: "blank",
ref: "",
nsIURL: false, nsINestedURI: true, immutable: true },
{ spec: "about:foobar",
scheme: "about",
prePath: "about:",
- path: "foobar",
+ pathQueryRef: "foobar",
ref: "",
nsIURL: false, nsINestedURI: false, immutable: true },
{ spec: "chrome://foobar/somedir/somefile.xml",
scheme: "chrome",
prePath: "chrome://foobar",
- path: "/somedir/somefile.xml",
+ pathQueryRef: "/somedir/somefile.xml",
ref: "",
nsIURL: true, nsINestedURI: false, immutable: true },
{ spec: "data:text/html;charset=utf-8,<html></html>",
scheme: "data",
prePath: "data:",
- path: "text/html;charset=utf-8,<html></html>",
+ pathQueryRef: "text/html;charset=utf-8,<html></html>",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "data:text/html;charset=utf-8,<html>\r\n\t</html>",
scheme: "data",
prePath: "data:",
- path: "text/html;charset=utf-8,<html></html>",
+ pathQueryRef: "text/html;charset=utf-8,<html></html>",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "data:text/plain,hello world",
scheme: "data",
prePath: "data:",
- path: "text/plain,hello%20world",
+ pathQueryRef: "text/plain,hello%20world",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "file:///dir/afile",
scheme: "data",
prePath: "data:",
- path: "text/plain,2",
+ pathQueryRef: "text/plain,2",
ref: "",
relativeURI: "data:te\nxt/plain,2",
nsIURL: false, nsINestedURI: false },
{ spec: "file://",
scheme: "file",
prePath: "file://",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "file:///",
scheme: "file",
prePath: "file://",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "file:///myFile.html",
scheme: "file",
prePath: "file://",
- path: "/myFile.html",
+ pathQueryRef: "/myFile.html",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "file:///dir/afile",
scheme: "file",
prePath: "file://",
- path: "/dir/data/text/plain,2",
+ pathQueryRef: "/dir/data/text/plain,2",
ref: "",
relativeURI: "data/text/plain,2",
nsIURL: true, nsINestedURI: false },
{ spec: "file:///dir/dir2/",
scheme: "file",
prePath: "file://",
- path: "/dir/dir2/data/text/plain,2",
+ pathQueryRef: "/dir/dir2/data/text/plain,2",
ref: "",
relativeURI: "data/text/plain,2",
nsIURL: true, nsINestedURI: false },
{ spec: "ftp://ftp.mozilla.org/pub/mozilla.org/README",
scheme: "ftp",
prePath: "ftp://ftp.mozilla.org",
- path: "/pub/mozilla.org/README",
+ pathQueryRef: "/pub/mozilla.org/README",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "ftp://foo:bar@ftp.mozilla.org:100/pub/mozilla.org/README",
scheme: "ftp",
prePath: "ftp://foo:bar@ftp.mozilla.org:100",
port: 100,
username: "foo",
password: "bar",
- path: "/pub/mozilla.org/README",
+ pathQueryRef: "/pub/mozilla.org/README",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "ftp://foo:@ftp.mozilla.org:100/pub/mozilla.org/README",
scheme: "ftp",
prePath: "ftp://foo@ftp.mozilla.org:100",
port: 100,
username: "foo",
password: "",
- path: "/pub/mozilla.org/README",
+ pathQueryRef: "/pub/mozilla.org/README",
ref: "",
nsIURL: true, nsINestedURI: false },
//Bug 706249
{ spec: "gopher://mozilla.org/",
scheme: "gopher",
prePath: "gopher:",
- path: "//mozilla.org/",
+ pathQueryRef: "//mozilla.org/",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "http://www.example.com/",
scheme: "http",
prePath: "http://www.example.com",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://www.exa\nmple.com/",
scheme: "http",
prePath: "http://www.example.com",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://10.32.4.239/",
scheme: "http",
prePath: "http://10.32.4.239",
host: "10.32.4.239",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://[::192.9.5.5]/ipng",
scheme: "http",
prePath: "http://[::c009:505]",
host: "::c009:505",
- path: "/ipng",
+ pathQueryRef: "/ipng",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:8888/index.html",
scheme: "http",
prePath: "http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]:8888",
host: "fedc:ba98:7654:3210:fedc:ba98:7654:3210",
port: 8888,
- path: "/index.html",
+ pathQueryRef: "/index.html",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://bar:foo@www.mozilla.org:8080/pub/mozilla.org/README.html",
scheme: "http",
prePath: "http://bar:foo@www.mozilla.org:8080",
port: 8080,
username: "bar",
password: "foo",
host: "www.mozilla.org",
- path: "/pub/mozilla.org/README.html",
+ pathQueryRef: "/pub/mozilla.org/README.html",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "jar:resource://!/",
scheme: "jar",
prePath: "jar:",
- path: "resource:///!/",
+ pathQueryRef: "resource:///!/",
ref: "",
nsIURL: true, nsINestedURI: true },
{ spec: "jar:resource://gre/chrome.toolkit.jar!/",
scheme: "jar",
prePath: "jar:",
- path: "resource://gre/chrome.toolkit.jar!/",
+ pathQueryRef: "resource://gre/chrome.toolkit.jar!/",
ref: "",
nsIURL: true, nsINestedURI: true },
{ spec: "mailto:webmaster@mozilla.com",
scheme: "mailto",
prePath: "mailto:",
- path: "webmaster@mozilla.com",
+ pathQueryRef: "webmaster@mozilla.com",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "javascript:new Date()",
scheme: "javascript",
prePath: "javascript:",
- path: "new%20Date()",
+ pathQueryRef: "new%20Date()",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "blob:123456",
scheme: "blob",
prePath: "blob:",
- path: "123456",
+ pathQueryRef: "123456",
ref: "",
nsIURL: false, nsINestedURI: false, immutable: true },
{ spec: "place:sort=8&maxResults=10",
scheme: "place",
prePath: "place:",
- path: "sort=8&maxResults=10",
+ pathQueryRef: "sort=8&maxResults=10",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "resource://gre/",
scheme: "resource",
prePath: "resource://gre",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "resource://gre/components/",
scheme: "resource",
prePath: "resource://gre",
- path: "/components/",
+ pathQueryRef: "/components/",
ref: "",
nsIURL: true, nsINestedURI: false },
// Adding more? Consider adding to test_URIs2.js instead, so that neither
// test runs for *too* long, risking timeouts on slow platforms.
];
var gHashSuffixes = [
@@ -328,19 +328,19 @@ function do_test_uri_basic(aTest) {
} catch (e) {
do_info("Caught error on Relative parse of " + aTest.spec + " + " + aTest.relativeURI +" Error: " + e.result);
if (aTest.relativeFail) {
do_check_eq(e.result, aTest.relativeFail);
return;
}
do_throw(e.result);
}
- do_info("relURI.path = " + relURI.path + ", was " + URI.path);
+ do_info("relURI.pathQueryRef = " + relURI.pathQueryRef + ", was " + URI.pathQueryRef);
URI = relURI;
- do_info("URI.path now = " + URI.path);
+ do_info("URI.pathQueryRef now = " + URI.pathQueryRef);
}
// Sanity-check
do_info("testing " + aTest.spec + " equals a clone of itself");
do_check_uri_eq(URI, URI.clone());
do_check_uri_eqExceptRef(URI, URI.cloneIgnoringRef());
do_info("testing " + aTest.spec + " instanceof nsIURL");
do_check_eq(URI instanceof Ci.nsIURL, aTest.nsIURL);
@@ -360,17 +360,18 @@ function do_test_uri_basic(aTest) {
threw = true;
}
do_check_true(threw || !isEqualToNull);
// Check the various components
do_check_property(aTest, URI, "scheme");
do_check_property(aTest, URI, "prePath");
- do_check_property(aTest, URI, "path");
+ do_check_property(aTest, URI, "pathQueryRef");
+ do_check_property(aTest, URI, "query");
do_check_property(aTest, URI, "ref");
do_check_property(aTest, URI, "port");
do_check_property(aTest, URI, "username");
do_check_property(aTest, URI, "password");
do_check_property(aTest, URI, "host");
do_check_property(aTest, URI, "specIgnoringRef");
if ("hasRef" in aTest) {
do_info("testing hasref: " + aTest.hasRef + " vs " + URI.hasRef);
@@ -439,17 +440,17 @@ function do_test_uri_with_hash_suffix(aT
do_check_uri_eq(cloneNewRef, testURI);
do_check_true(cloneNewRef.equals(testURI));
}
do_check_property(aTest, testURI, "scheme");
do_check_property(aTest, testURI, "prePath");
if (!origURI.ref) {
// These don't work if it's a ref already because '+' doesn't give the right result
- do_check_property(aTest, testURI, "path",
+ do_check_property(aTest, testURI, "pathQueryRef",
function(aStr) { return aStr + aSuffix; });
do_check_property(aTest, testURI, "ref",
function(aStr) { return aSuffix.substr(1); });
}
}
// Tests various ways of setting & clearing a ref on a URI.
function do_test_mutate_ref(aTest, aSuffix) {
@@ -494,47 +495,47 @@ function do_test_mutate_ref(aTest, aSuff
specWithSuffix + " and then clearing ref does what we expect");
testURI.spec = specWithSuffix;
testURI.ref = "";
do_check_uri_eq(testURI, refURIWithoutSuffix);
do_check_uri_eqExceptRef(testURI, refURIWithSuffix);
// XXX nsIJARURI throws an exception in SetPath(), so skip it for next part.
if (!(testURI instanceof Ci.nsIJARURI)) {
- // Now try setting .path directly (including suffix) and then clearing .ref
- // (same as above, but with now with .path instead of .spec)
+ // Now try setting .pathQueryRef directly (including suffix) and then clearing .ref
+ // (same as above, but with now with .pathQueryRef instead of .spec)
testURI = NetUtil.newURI(aTest.spec);
- var pathWithSuffix = aTest.path + aSuffix;
+ var pathWithSuffix = aTest.pathQueryRef + aSuffix;
do_info("testing that setting path to " +
pathWithSuffix + " and then clearing ref does what we expect");
- testURI.path = pathWithSuffix;
+ testURI.pathQueryRef = pathWithSuffix;
testURI.ref = "";
do_check_uri_eq(testURI, refURIWithoutSuffix);
do_check_uri_eqExceptRef(testURI, refURIWithSuffix);
- // Also: make sure that clearing .path also clears .ref
- testURI.path = pathWithSuffix;
+ // Also: make sure that clearing .pathQueryRef also clears .ref
+ testURI.pathQueryRef = pathWithSuffix;
do_info("testing that clearing path from " +
pathWithSuffix + " also clears .ref");
- testURI.path = "";
+ testURI.pathQueryRef = "";
do_check_eq(testURI.ref, "");
}
}
}
// Tests that normally-mutable properties can't be modified on
// special URIs that are known to be immutable.
function do_test_immutable(aTest) {
do_check_true(aTest.immutable);
var URI = NetUtil.newURI(aTest.spec);
// All the non-readonly attributes on nsIURI.idl:
var propertiesToCheck = ["spec", "scheme", "userPass", "username", "password",
- "hostPort", "host", "port", "path", "ref"];
+ "hostPort", "host", "port", "pathQueryRef", "query", "ref"];
propertiesToCheck.forEach(function(aProperty) {
var threw = false;
try {
URI[aProperty] = "anothervalue";
} catch(e) {
threw = true;
}
--- a/netwerk/test/unit/test_URIs2.js
+++ b/netwerk/test/unit/test_URIs2.js
@@ -18,331 +18,331 @@ var gIoService = Components.classes["@mo
// http://greenbytes.de/tech/tc/uris/
// TEST DATA
// ---------
var gTests = [
{ spec: "view-source:about:blank",
scheme: "view-source",
prePath: "view-source:",
- path: "about:blank",
+ pathQueryRef: "about:blank",
ref: "",
nsIURL: false, nsINestedURI: true, immutable: true },
{ spec: "view-source:http://www.mozilla.org/",
scheme: "view-source",
prePath: "view-source:",
- path: "http://www.mozilla.org/",
+ pathQueryRef: "http://www.mozilla.org/",
ref: "",
nsIURL: false, nsINestedURI: true, immutable: true },
{ spec: "x-external:",
scheme: "x-external",
prePath: "x-external:",
- path: "",
+ pathQueryRef: "",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "x-external:abc",
scheme: "x-external",
prePath: "x-external:",
- path: "abc",
+ pathQueryRef: "abc",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "http://www2.example.com/",
relativeURI: "a/b/c/d",
scheme: "http",
prePath: "http://www2.example.com",
- path: "/a/b/c/d",
+ pathQueryRef: "/a/b/c/d",
ref: "",
nsIURL: true, nsINestedURI: false },
// relative URL testcases from http://greenbytes.de/tech/webdav/rfc3986.html#rfc.section.5.4
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g:h",
scheme: "g",
prePath: "g:",
- path: "h",
+ pathQueryRef: "h",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g",
+ pathQueryRef: "/b/c/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "./g",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g",
+ pathQueryRef: "/b/c/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g/",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g/",
+ pathQueryRef: "/b/c/g/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "/g",
scheme: "http",
prePath: "http://a",
- path: "/g",
+ pathQueryRef: "/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "?y",
scheme: "http",
prePath: "http://a",
- path: "/b/c/d;p?y",
+ pathQueryRef: "/b/c/d;p?y",
ref: "",// fix
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g?y",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g?y",
+ pathQueryRef: "/b/c/g?y",
ref: "",// fix
specIgnoringRef: "http://a/b/c/g?y",
hasRef: false,
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "#s",
scheme: "http",
prePath: "http://a",
- path: "/b/c/d;p?q#s",
+ pathQueryRef: "/b/c/d;p?q#s",
ref: "s",// fix
specIgnoringRef: "http://a/b/c/d;p?q",
hasRef: true,
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g#s",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g#s",
+ pathQueryRef: "/b/c/g#s",
ref: "s",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g?y#s",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g?y#s",
+ pathQueryRef: "/b/c/g?y#s",
ref: "s",
nsIURL: true, nsINestedURI: false },
/*
Bug xxxxxx - we return a path of b/c/;x
{ spec: "http://a/b/c/d;p?q",
relativeURI: ";x",
scheme: "http",
prePath: "http://a",
- path: "/b/c/d;x",
+ pathQueryRef: "/b/c/d;x",
ref: "",
nsIURL: true, nsINestedURI: false },
*/
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g;x",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g;x",
+ pathQueryRef: "/b/c/g;x",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g;x?y#s",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g;x?y#s",
+ pathQueryRef: "/b/c/g;x?y#s",
ref: "s",
nsIURL: true, nsINestedURI: false },
/*
Can't easily specify a relative URI of "" to the test code
{ spec: "http://a/b/c/d;p?q",
relativeURI: "",
scheme: "http",
prePath: "http://a",
- path: "/b/c/d",
+ pathQueryRef: "/b/c/d",
ref: "",
nsIURL: true, nsINestedURI: false },
*/
{ spec: "http://a/b/c/d;p?q",
relativeURI: ".",
scheme: "http",
prePath: "http://a",
- path: "/b/c/",
+ pathQueryRef: "/b/c/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "./",
scheme: "http",
prePath: "http://a",
- path: "/b/c/",
+ pathQueryRef: "/b/c/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "..",
scheme: "http",
prePath: "http://a",
- path: "/b/",
+ pathQueryRef: "/b/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "../",
scheme: "http",
prePath: "http://a",
- path: "/b/",
+ pathQueryRef: "/b/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "../g",
scheme: "http",
prePath: "http://a",
- path: "/b/g",
+ pathQueryRef: "/b/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "../..",
scheme: "http",
prePath: "http://a",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "../../",
scheme: "http",
prePath: "http://a",
- path: "/",
+ pathQueryRef: "/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "../../g",
scheme: "http",
prePath: "http://a",
- path: "/g",
+ pathQueryRef: "/g",
ref: "",
nsIURL: true, nsINestedURI: false },
// abnormal examples
{ spec: "http://a/b/c/d;p?q",
relativeURI: "../../../g",
scheme: "http",
prePath: "http://a",
- path: "/g",
+ pathQueryRef: "/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "../../../../g",
scheme: "http",
prePath: "http://a",
- path: "/g",
+ pathQueryRef: "/g",
ref: "",
nsIURL: true, nsINestedURI: false },
// coalesce
{ spec: "http://a/b/c/d;p?q",
relativeURI: "/./g",
scheme: "http",
prePath: "http://a",
- path: "/g",
+ pathQueryRef: "/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "/../g",
scheme: "http",
prePath: "http://a",
- path: "/g",
+ pathQueryRef: "/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g.",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g.",
+ pathQueryRef: "/b/c/g.",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: ".g",
scheme: "http",
prePath: "http://a",
- path: "/b/c/.g",
+ pathQueryRef: "/b/c/.g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g..",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g..",
+ pathQueryRef: "/b/c/g..",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "..g",
scheme: "http",
prePath: "http://a",
- path: "/b/c/..g",
+ pathQueryRef: "/b/c/..g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: ".",
scheme: "http",
prePath: "http://a",
- path: "/b/c/",
+ pathQueryRef: "/b/c/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "./../g",
scheme: "http",
prePath: "http://a",
- path: "/b/g",
+ pathQueryRef: "/b/g",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "./g/.",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g/",
+ pathQueryRef: "/b/c/g/",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g/./h",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g/h",
+ pathQueryRef: "/b/c/g/h",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g/../h",
scheme: "http",
prePath: "http://a",
- path: "/b/c/h",
+ pathQueryRef: "/b/c/h",
ref: "",// fix
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g;x=1/./y",
scheme: "http",
prePath: "http://a",
- path: "/b/c/g;x=1/y",
+ pathQueryRef: "/b/c/g;x=1/y",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g;x=1/../y",
scheme: "http",
prePath: "http://a",
- path: "/b/c/y",
+ pathQueryRef: "/b/c/y",
ref: "",
nsIURL: true, nsINestedURI: false },
// protocol-relative http://tools.ietf.org/html/rfc3986#section-4.2
{ spec: "http://www2.example.com/",
relativeURI: "//www3.example2.com/bar",
scheme: "http",
prePath: "http://www3.example2.com",
- path: "/bar",
+ pathQueryRef: "/bar",
ref: "",
nsIURL: true, nsINestedURI: false },
{ spec: "https://www2.example.com/",
relativeURI: "//www3.example2.com/bar",
scheme: "https",
prePath: "https://www3.example2.com",
- path: "/bar",
+ pathQueryRef: "/bar",
ref: "",
nsIURL: true, nsINestedURI: false },
];
var gHashSuffixes = [
"#",
"#myRef",
"#myRef?a=b",
@@ -443,19 +443,19 @@ function do_test_uri_basic(aTest) {
} catch (e) {
do_info("Caught error on Relative parse of " + aTest.spec + " + " + aTest.relativeURI +" Error: " + e.result);
if (aTest.relativeFail) {
do_check_eq(e.result, aTest.relativeFail);
return;
}
do_throw(e.result);
}
- do_info("relURI.path = " + relURI.path + ", was " + URI.path);
+ do_info("relURI.pathQueryRef = " + relURI.pathQueryRef + ", was " + URI.pathQueryRef);
URI = relURI;
- do_info("URI.path now = " + URI.path);
+ do_info("URI.pathQueryRef now = " + URI.pathQueryRef);
}
// Sanity-check
do_info("testing " + aTest.spec + " equals a clone of itself");
do_check_uri_eq(URI, URI.clone());
do_check_uri_eqExceptRef(URI, URI.cloneIgnoringRef());
do_info("testing " + aTest.spec + " instanceof nsIURL");
do_check_eq(URI instanceof Ci.nsIURL, aTest.nsIURL);
@@ -475,17 +475,18 @@ function do_test_uri_basic(aTest) {
threw = true;
}
do_check_true(threw || !isEqualToNull);
// Check the various components
do_check_property(aTest, URI, "scheme");
do_check_property(aTest, URI, "prePath");
- do_check_property(aTest, URI, "path");
+ do_check_property(aTest, URI, "pathQueryRef");
+ do_check_property(aTest, URI, "query");
do_check_property(aTest, URI, "ref");
do_check_property(aTest, URI, "port");
do_check_property(aTest, URI, "username");
do_check_property(aTest, URI, "password");
do_check_property(aTest, URI, "host");
do_check_property(aTest, URI, "specIgnoringRef");
if ("hasRef" in aTest) {
do_info("testing hasref: " + aTest.hasRef + " vs " + URI.hasRef);
@@ -541,17 +542,17 @@ function do_test_uri_with_hash_suffix(aT
do_check_uri_eq(cloneNoRef, origURI);
do_check_false(cloneNoRef.equals(testURI));
}
do_check_property(aTest, testURI, "scheme");
do_check_property(aTest, testURI, "prePath");
if (!origURI.ref) {
// These don't work if it's a ref already because '+' doesn't give the right result
- do_check_property(aTest, testURI, "path",
+ do_check_property(aTest, testURI, "pathQueryRef",
function(aStr) { return aStr + aSuffix; });
do_check_property(aTest, testURI, "ref",
function(aStr) { return aSuffix.substr(1); });
}
}
// Tests various ways of setting & clearing a ref on a URI.
function do_test_mutate_ref(aTest, aSuffix) {
@@ -596,47 +597,47 @@ function do_test_mutate_ref(aTest, aSuff
specWithSuffix + " and then clearing ref does what we expect");
testURI.spec = specWithSuffix;
testURI.ref = "";
do_check_uri_eq(testURI, refURIWithoutSuffix);
do_check_uri_eqExceptRef(testURI, refURIWithSuffix);
// XXX nsIJARURI throws an exception in SetPath(), so skip it for next part.
if (!(testURI instanceof Ci.nsIJARURI)) {
- // Now try setting .path directly (including suffix) and then clearing .ref
- // (same as above, but with now with .path instead of .spec)
+ // Now try setting .pathQueryRef directly (including suffix) and then clearing .ref
+ // (same as above, but with now with .pathQueryRef instead of .spec)
testURI = NetUtil.newURI(aTest.spec);
- var pathWithSuffix = aTest.path + aSuffix;
+ var pathWithSuffix = aTest.pathQueryRef + aSuffix;
do_info("testing that setting path to " +
pathWithSuffix + " and then clearing ref does what we expect");
- testURI.path = pathWithSuffix;
+ testURI.pathQueryRef = pathWithSuffix;
testURI.ref = "";
do_check_uri_eq(testURI, refURIWithoutSuffix);
do_check_uri_eqExceptRef(testURI, refURIWithSuffix);
- // Also: make sure that clearing .path also clears .ref
- testURI.path = pathWithSuffix;
+ // Also: make sure that clearing .pathQueryRef also clears .ref
+ testURI.pathQueryRef = pathWithSuffix;
do_info("testing that clearing path from " +
pathWithSuffix + " also clears .ref");
- testURI.path = "";
+ testURI.pathQueryRef = "";
do_check_eq(testURI.ref, "");
}
}
}
// Tests that normally-mutable properties can't be modified on
// special URIs that are known to be immutable.
function do_test_immutable(aTest) {
do_check_true(aTest.immutable);
var URI = NetUtil.newURI(aTest.spec);
// All the non-readonly attributes on nsIURI.idl:
var propertiesToCheck = ["spec", "scheme", "userPass", "username", "password",
- "hostPort", "host", "port", "path", "ref"];
+ "hostPort", "host", "port", "pathQueryRef", "query", "ref"];
propertiesToCheck.forEach(function(aProperty) {
var threw = false;
try {
URI[aProperty] = "anothervalue";
} catch(e) {
threw = true;
}
--- a/netwerk/test/unit/test_authentication.js
+++ b/netwerk/test/unit/test_authentication.js
@@ -110,18 +110,18 @@ AuthPrompt2.prototype = {
iid.equals(Components.interfaces.nsIAuthPrompt2))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
},
promptAuth:
function ap2_promptAuth(channel, level, authInfo)
{
- var isNTLM = channel.URI.path.indexOf("ntlm") != -1;
- var isDigest = channel.URI.path.indexOf("digest") != -1;
+ var isNTLM = channel.URI.pathQueryRef.indexOf("ntlm") != -1;
+ var isDigest = channel.URI.pathQueryRef.indexOf("digest") != -1;
if (isNTLM || (this.flags & FLAG_NO_REALM)) {
this.expectedRealm = ""; // NTLM knows no realms
}
do_check_eq(this.expectedRealm, authInfo.realm);
var expectedLevel = (isNTLM || isDigest) ?
--- a/netwerk/test/unit/test_bug321706.js
+++ b/netwerk/test/unit/test_bug321706.js
@@ -1,11 +1,11 @@
const url = "http://foo.com/folder/file?/.";
function run_test() {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var newURI = ios.newURI(url);
do_check_eq(newURI.spec, url);
- do_check_eq(newURI.path, "/folder/file?/.");
+ do_check_eq(newURI.pathQueryRef, "/folder/file?/.");
do_check_eq(newURI.resolve("./file?/."), url);
}
--- a/netwerk/test/unit/test_file_protocol.js
+++ b/netwerk/test/unit/test_file_protocol.js
@@ -228,21 +228,21 @@ function test_upload_file() {
function test_load_replace() {
// lnk files should resolve to their targets
if (mozinfo.os == "win") {
dump("*** test_load_replace\n");
file = do_get_file("data/system_root.lnk", false);
var chan = new_file_channel(file);
// The original URI path should differ from the URI path
- do_check_neq(chan.URI.path, chan.originalURI.path);
+ do_check_neq(chan.URI.pathQueryRef, chan.originalURI.pathQueryRef);
// The original URI path should be the same as the lnk file path
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
- do_check_eq(chan.originalURI.path, ios.newFileURI(file).path);
+ do_check_eq(chan.originalURI.pathQueryRef, ios.newFileURI(file).pathQueryRef);
}
run_next_test();
}
function run_test() {
run_next_test();
}
--- a/netwerk/test/unit/test_rusturl.js
+++ b/netwerk/test/unit/test_rusturl.js
@@ -16,17 +16,17 @@ function symmetricEquality(expect, a, b)
that we get the specs output on the console if the check fails.
*/
if (expect) {
/* Check all the sub-pieces too, since that can help with
debugging cases when equals() returns something unexpected */
/* We don't check port in the loop, because it can be defaulted in
some cases. */
["spec", "prePath", "scheme", "userPass", "username", "password",
- "hostPort", "host", "path", "filePath", "param", "query",
+ "hostPort", "host", "pathQueryRef", "filePath", "param", "query",
"ref",
// TODO: implement these
//"directory", "fileName", "fileBaseName", "fileExtension"
]
.map(function(prop) {
dump("Testing '"+ prop + "'\n");
do_check_eq(a[prop], b[prop]);
});
@@ -65,18 +65,18 @@ add_test({ skip_if: () => rustIsMissing
symmetricEquality(false, target, provided);
dump(provided.scheme);
dump(provided.host);
dump(provided.port);
dump(provided.userPass);
dump(provided.hostPort);
- provided.path = "";
- target.path = "";
+ provided.pathQueryRef = "";
+ target.pathQueryRef = "";
do_check_eq(provided.spec, target.spec);
symmetricEquality(true, target, provided);
}
run_next_test();
});
add_test({ skip_if: () => rustIsMissing }, function test_setQuery()
@@ -317,17 +317,17 @@ add_test({ skip_if: () => true }, functi
{
let prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService);
let maxLen = prefs.getIntPref("network.standard-url.max-length");
let url = stringToURL("http://test:test@example.com");
let hugeString = new Array(maxLen + 1).fill("a").join("");
let properties = ["spec", "scheme", "userPass", "username",
- "password", "hostPort", "host", "path", "ref",
+ "password", "hostPort", "host", "pathQueryRef", "ref",
"query", "fileName", "filePath", "fileBaseName", "fileExtension"];
for (let prop of properties) {
Assert.throws(() => url[prop] = hugeString,
/NS_ERROR_MALFORMED_URI/,
`Passing a huge string to "${prop}" should throw`);
}
run_next_test();
@@ -355,17 +355,17 @@ add_test({ skip_if: () => rustIsMissing
add_test({ skip_if: () => rustIsMissing }, function test_backslashReplacement()
{
var url = stringToURL("http:\\\\test.com\\path/to\\file?query\\backslash#hash\\");
do_check_eq(url.spec, "http://test.com/path/to/file?query\\backslash#hash\\");
url = stringToURL("http:\\\\test.com\\example.org/path\\to/file");
do_check_eq(url.spec, "http://test.com/example.org/path/to/file");
do_check_eq(url.host, "test.com");
- do_check_eq(url.path, "/example.org/path/to/file");
+ do_check_eq(url.pathQueryRef, "/example.org/path/to/file");
run_next_test();
});
add_test({ skip_if: () => rustIsMissing }, function test_trim_C0_and_space()
{
var url = stringToURL("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f http://example.com/ \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ");
do_check_eq(url.spec, "http://example.com/");
--- a/netwerk/test/unit/test_standardurl.js
+++ b/netwerk/test/unit/test_standardurl.js
@@ -12,17 +12,17 @@ function symmetricEquality(expect, a, b)
that we get the specs output on the console if the check fails.
*/
if (expect) {
/* Check all the sub-pieces too, since that can help with
debugging cases when equals() returns something unexpected */
/* We don't check port in the loop, because it can be defaulted in
some cases. */
["spec", "prePath", "scheme", "userPass", "username", "password",
- "hostPort", "host", "path", "filePath", "query",
+ "hostPort", "host", "pathQueryRef", "filePath", "query",
"ref", "directory", "fileName", "fileBaseName", "fileExtension"]
.map(function(prop) {
dump("Testing '"+ prop + "'\n");
do_check_eq(a[prop], b[prop]);
});
} else {
do_check_neq(a.spec, b.spec);
}
@@ -52,18 +52,18 @@ add_test(function test_setEmptyPath()
["http://example.com/a", "http://example.com/tests/dom/tests"],
["http://example.com:80/a", "http://example.com/tests/dom/tests"],
].map(pairToURLs);
for (var [provided, target] of pairs)
{
symmetricEquality(false, target, provided);
- provided.path = "";
- target.path = "";
+ provided.pathQueryRef = "";
+ target.pathQueryRef = "";
do_check_eq(provided.spec, target.spec);
symmetricEquality(true, target, provided);
}
run_next_test();
});
add_test(function test_setQuery()
@@ -288,17 +288,17 @@ add_test(function test_hugeStringThrows(
{
let prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService);
let maxLen = prefs.getIntPref("network.standard-url.max-length");
let url = stringToURL("http://test:test@example.com");
let hugeString = new Array(maxLen + 1).fill("a").join("");
let properties = ["spec", "scheme", "userPass", "username",
- "password", "hostPort", "host", "path", "ref",
+ "password", "hostPort", "host", "pathQueryRef", "ref",
"query", "fileName", "filePath", "fileBaseName", "fileExtension"];
for (let prop of properties) {
Assert.throws(() => url[prop] = hugeString,
/NS_ERROR_MALFORMED_URI/,
`Passing a huge string to "${prop}" should throw`);
}
run_next_test();
@@ -326,17 +326,17 @@ add_test(function test_filterWhitespace(
add_test(function test_backslashReplacement()
{
var url = stringToURL("http:\\\\test.com\\path/to\\file?query\\backslash#hash\\");
do_check_eq(url.spec, "http://test.com/path/to/file?query\\backslash#hash\\");
url = stringToURL("http:\\\\test.com\\example.org/path\\to/file");
do_check_eq(url.spec, "http://test.com/example.org/path/to/file");
do_check_eq(url.host, "test.com");
- do_check_eq(url.path, "/example.org/path/to/file");
+ do_check_eq(url.pathQueryRef, "/example.org/path/to/file");
run_next_test();
});
add_test(function test_authority_host()
{
Assert.throws(() => { stringToURL("http:"); }, "TYPE_AUTHORITY should have host");
Assert.throws(() => { stringToURL("http:///"); }, "TYPE_AUTHORITY should have host");
--- a/services/crypto/modules/utils.js
+++ b/services/crypto/modules/utils.js
@@ -314,17 +314,17 @@ this.CryptoUtils = {
throw new Error("Unsupported URI scheme: " + uri.scheme);
}
let ext = (extra && extra.ext) ? extra.ext : "";
let requestString = ts.toString(10) + "\n" +
nonce + "\n" +
usedMethod + "\n" +
- uri.path + "\n" +
+ uri.pathQueryRef + "\n" +
host + "\n" +
port + "\n" +
ext + "\n";
let hasher = CryptoUtils.makeHMACHasher(Ci.nsICryptoHMAC.SHA1,
CryptoUtils.makeHMACKey(key));
let mac = CryptoUtils.digestBytes(requestString, hasher);
@@ -468,17 +468,17 @@ this.CryptoUtils = {
} else {
throw new Error("Unsupported URI scheme: " + uri.scheme);
}
let artifacts = {
ts,
nonce: options.nonce || btoa(CryptoUtils.generateRandomBytes(8)),
method: method.toUpperCase(),
- resource: uri.path, // This includes both path and search/queryarg.
+ resource: uri.pathQueryRef, // This includes both path and search/queryarg.
host: uri.asciiHost.toLowerCase(), // This includes punycoding.
port: port.toString(10),
hash: options.hash,
ext: options.ext,
};
let contentType = CryptoUtils.stripHeaderAttributes(options.contentType);
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/httpd.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/httpd.js
@@ -1743,17 +1743,17 @@ RequestReader.prototype =
throw HTTP_400;
}
try
{
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(fullPath);
- fullPath = uri.path;
+ fullPath = uri.pathQueryRef;
scheme = uri.scheme;
host = metadata._host = uri.asciiHost;
port = uri.port;
if (port === -1)
{
if (scheme === "http")
{
port = 80;
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js
@@ -90,17 +90,17 @@
// nsIChromeRegistry.wrappersEnabled() available from script
// and use it here. Until that's in the platform, though,
// we'll play it safe and parentify the filename unless
// we're absolutely certain things will be ok if we don't.
var filenameURI = ios.newURI(options.filename,
null,
baseURI);
if (filenameURI.scheme == 'chrome' &&
- filenameURI.path.indexOf('/content/') == 0)
+ filenameURI.pathQueryRef.indexOf('/content/') == 0)
// Content packages will always have wrappers made for them;
// if automatic wrappers have been disabled for the
// chrome package via a chrome manifest flag, then
// this still works too, to the extent that the
// content package is insecure anyways.
doParentifyFilename = false;
} catch (e) {}
if (doParentifyFilename)
--- a/startupcache/StartupCacheUtils.cpp
+++ b/startupcache/StartupCacheUtils.cpp
@@ -227,17 +227,17 @@ PathifyURI(nsIURI *in, nsACString &out)
if (!canonicalizeBase(spec, out)) {
if (NS_SUCCEEDED(uri->SchemeIs("file", &equals)) && equals) {
nsCOMPtr<nsIFileURL> baseFileURL;
baseFileURL = do_QueryInterface(uri, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString path;
- rv = baseFileURL->GetPath(path);
+ rv = baseFileURL->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
out.Append(path);
} else if (NS_SUCCEEDED(uri->SchemeIs("jar", &equals)) && equals) {
nsCOMPtr<nsIJARURI> jarURI = do_QueryInterface(uri, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIURI> jarFileURI;
--- a/toolkit/components/extensions/MatchPattern.cpp
+++ b/toolkit/components/extensions/MatchPattern.cpp
@@ -146,17 +146,17 @@ URLInfo::FilePath() const
return mFilePath;
}
const nsString&
URLInfo::Path() const
{
if (mPath.IsEmpty()) {
nsCString path;
- if (NS_SUCCEEDED(URINoRef()->GetPath(path))) {
+ if (NS_SUCCEEDED(URINoRef()->GetPathQueryRef(path))) {
AppendUTF8toUTF16(path, mPath);
}
}
return mPath;
}
const nsString&
URLInfo::Spec() const
--- a/toolkit/components/extensions/ext-cookies.js
+++ b/toolkit/components/extensions/ext-cookies.js
@@ -222,17 +222,17 @@ const query = function* (detailsIn, prop
if (!domainMatches(uri.host)) {
return false;
}
if (cookie.isSecure && uri.scheme != "https") {
return false;
}
- if (!pathMatches(uri.path)) {
+ if (!pathMatches(uri.pathQueryRef)) {
return false;
}
}
if ("name" in details && details.name != cookie.name) {
return false;
}
--- a/toolkit/components/jsdownloads/test/unit/head.js
+++ b/toolkit/components/jsdownloads/test/unit/head.js
@@ -288,17 +288,17 @@ function promiseStartLegacyDownload(aSou
let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
.createInstance(Ci.nsIWebBrowserPersist);
if (aOptions) {
aOptions.outPersist = persist;
}
let fileExtension = null, mimeInfo = null;
- let match = sourceURI.path.match(/\.([^.\/]+)$/);
+ let match = sourceURI.pathQueryRef.match(/\.([^.\/]+)$/);
if (match) {
fileExtension = match[1];
}
if (fileExtension) {
try {
mimeInfo = gMIMEService.getFromTypeAndExtension(null, fileExtension);
mimeInfo.preferredAction = Ci.nsIMIMEInfo.saveToDisk;
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -522,18 +522,18 @@ LoginManagerPrompter.prototype = {
_getRealmInfo(aRealmString) {
var httpRealm = /^.+ \(.+\)$/;
if (httpRealm.test(aRealmString))
return [null, null, null];
var uri = Services.io.newURI(aRealmString);
var pathname = "";
- if (uri.path != "/")
- pathname = uri.path;
+ if (uri.pathQueryRef != "/")
+ pathname = uri.pathQueryRef;
var formattedHostname = this._getFormattedHostname(uri);
return [formattedHostname, formattedHostname + pathname, uri.username];
},
/* ---------- nsIAuthPrompt2 prompts ---------- */
--- a/toolkit/components/places/PageIconProtocolHandler.js
+++ b/toolkit/components/places/PageIconProtocolHandler.js
@@ -89,17 +89,17 @@ PageIconProtocolHandler.prototype = {
// Create our channel.
let channel = Cc["@mozilla.org/network/input-stream-channel;1"]
.createInstance(Ci.nsIInputStreamChannel);
channel.QueryInterface(Ci.nsIChannel);
channel.setURI(uri);
channel.contentStream = pipe.inputStream;
channel.loadInfo = loadInfo;
- let pageURI = NetUtil.newURI(uri.path.replace(/[&#]size=[^&]+$/, ""));
+ let pageURI = NetUtil.newURI(uri.pathQueryRef.replace(/[&#]size=[^&]+$/, ""));
let preferredSize = PlacesUtils.favicons.preferredSizeFromURI(uri);
PlacesUtils.favicons.getFaviconDataForPage(pageURI, (iconURI, len, data, mimeType) => {
if (len == 0) {
streamDefaultFavicon(uri, loadInfo, pipe.outputStream, channel);
} else {
try {
channel.contentType = mimeType;
serveIcon(pipe, data, len);
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -1691,17 +1691,17 @@ Search.prototype = {
// We don't know if this url is in Places or not, and checking that would
// be expensive. Thus we also don't know if we may have an icon.
// If we'd just try to fetch the icon for the typed string, we'd cause icon
// flicker, since the url keeps changing while the user types.
// By default we won't provide an icon, but for the subset of urls with a
// host we'll check for a typed slash and set favicon for the host part.
if (hostExpected &&
- (this._trimmedOriginalSearchString.endsWith("/") || uri.path.length > 1)) {
+ (this._trimmedOriginalSearchString.endsWith("/") || uri.pathQueryRef.length > 1)) {
match.icon = `page-icon:${uri.prePath}/`;
}
this._addMatch(match);
return true;
},
_onResultRow(row) {
--- a/toolkit/components/places/nsAnnoProtocolHandler.cpp
+++ b/toolkit/components/places/nsAnnoProtocolHandler.cpp
@@ -285,17 +285,17 @@ nsAnnoProtocolHandler::AllowPort(int32_t
// Splits an annotation URL into its URI and name parts
nsresult
nsAnnoProtocolHandler::ParseAnnoURI(nsIURI* aURI,
nsIURI** aResultURI, nsCString& aName)
{
nsresult rv;
nsAutoCString path;
- rv = aURI->GetPath(path);
+ rv = aURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
int32_t firstColon = path.FindChar(':');
if (firstColon <= 0)
return NS_ERROR_MALFORMED_URI;
rv = NS_NewURI(aResultURI, Substring(path, firstColon + 1));
NS_ENSURE_SUCCESS(rv, rv);
--- a/toolkit/components/places/nsFaviconService.cpp
+++ b/toolkit/components/places/nsFaviconService.cpp
@@ -385,17 +385,17 @@ nsFaviconService::SetAndFetchFaviconForP
rv = aFaviconURI->GetSpec(icon.spec);
NS_ENSURE_SUCCESS(rv, rv);
// URIs can arguably lack a host.
Unused << aFaviconURI->GetHost(icon.host);
if (StringBeginsWith(icon.host, NS_LITERAL_CSTRING("www."))) {
icon.host.Cut(0, 4);
}
nsAutoCString path;
- rv = aFaviconURI->GetPath(path);
+ rv = aFaviconURI->GetPathQueryRef(path);
if (NS_SUCCEEDED(rv) && path.EqualsLiteral("/favicon.ico")) {
icon.rootIcon = 1;
}
}
// If the page url points to an image, the icon's url will be the same.
// TODO (Bug 403651): store a resample of the image. For now avoid that
// for database size and UX concerns.
@@ -458,17 +458,17 @@ nsFaviconService::ReplaceFaviconData(nsI
IconData* iconData = &(iconKey->iconData);
iconData->expiration = aExpiration;
iconData->status = ICON_STATUS_CACHED;
iconData->fetchMode = FETCH_NEVER;
nsresult rv = aFaviconURI->GetSpec(iconData->spec);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString path;
- rv = aFaviconURI->GetPath(path);
+ rv = aFaviconURI->GetPathQueryRef(path);
if (NS_SUCCEEDED(rv) && path.EqualsLiteral("/favicon.ico")) {
iconData->rootIcon = 1;
}
// URIs can arguably lack a host.
Unused << aFaviconURI->GetHost(iconData->host);
if (StringBeginsWith(iconData->host, NS_LITERAL_CSTRING("www."))) {
iconData->host.Cut(0, 4);
}
--- a/toolkit/components/reader/Readability.js
+++ b/toolkit/components/reader/Readability.js
@@ -1296,17 +1296,17 @@ Readability.prototype = {
/**
* Find a cleaned up version of the current URL, to use for comparing links for possible next-pageyness.
*
* @author Dan Lacy
* @return string the base url
**/
_findBaseUrl: function() {
var uri = this._uri;
- var noUrlParams = uri.path.split("?")[0];
+ var noUrlParams = uri.pathQueryRef.split("?")[0];
var urlSlashes = noUrlParams.split("/").reverse();
var cleanedSegments = [];
var possibleType = "";
for (var i = 0, slashLen = urlSlashes.length; i < slashLen; i += 1) {
var segment = urlSlashes[i];
// Split off and save anything that looks like a file type.
--- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
@@ -196,17 +196,17 @@ nsUrlClassifierUtils::GetKeyForURI(nsIUR
if (host.IsEmpty()) {
return NS_ERROR_MALFORMED_URI;
}
nsresult rv = CanonicalizeHostname(host, _retval);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString path;
- rv = innerURI->GetPath(path);
+ rv = innerURI->GetPathQueryRef(path);
NS_ENSURE_SUCCESS(rv, rv);
// strip out anchors
int32_t ref = path.FindChar('#');
if (ref != kNotFound)
path.SetLength(ref);
nsAutoCString temp;
--- a/toolkit/content/contentAreaUtils.js
+++ b/toolkit/content/contentAreaUtils.js
@@ -1044,17 +1044,17 @@ function getDefaultFileName(aDefaultFile
// 4) Use the document title
return docTitle;
if (aDefaultFileName)
// 5) Use the caller-provided name, if any
return validateFileName(aDefaultFileName);
// 6) If this is a directory, use the last directory name
- var path = aURI.path.match(/\/([^\/]+)\/$/);
+ var path = aURI.pathQueryRef.match(/\/([^\/]+)\/$/);
if (path && path.length > 1)
return validateFileName(path[1]);
try {
if (aURI.host)
// 7) Use the host.
return aURI.host;
} catch (e) {
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -796,17 +796,17 @@ PopupNotifications.prototype = {
popupnotification.setAttribute("learnmoreurl", n.options.learnMoreURL);
else
popupnotification.removeAttribute("learnmoreurl");
if (n.options.displayURI) {
let uri;
try {
if (n.options.displayURI instanceof Ci.nsIFileURL) {
- uri = n.options.displayURI.path;
+ uri = n.options.displayURI.pathQueryRef;
} else {
uri = n.options.displayURI.hostPort;
}
popupnotification.setAttribute("origin", uri);
} catch (e) {
Cu.reportError(e);
popupnotification.removeAttribute("origin");
}
--- a/toolkit/modules/addons/MatchPattern.jsm
+++ b/toolkit/modules/addons/MatchPattern.jsm
@@ -103,17 +103,17 @@ SingleMatchPattern.prototype = {
return uri => uri.host === host;
},
matches(uri, ignorePath = false) {
return (
this.schemes.includes(uri.scheme) &&
this.hostMatch(uri) &&
(ignorePath || (
- this.pathMatch(uri.cloneIgnoringRef().path)
+ this.pathMatch(uri.cloneIgnoringRef().pathQueryRef)
))
);
},
// Tests if this can possibly overlap with the |other| SingleMatchPattern.
overlapsIgnoringPath(other) {
return this.schemes.some(scheme => other.schemes.includes(scheme)) &&
(this.hostMatch(other) || other.hostMatch(this));
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ -448,18 +448,18 @@ nsUnknownContentTypeDialog.prototype = {
var iconPath = "goat";
this.mSourcePath = url.prePath;
if (url instanceof Components.interfaces.nsIURL) {
// A url, use file name from it.
fname = iconPath = url.fileName;
this.mSourcePath += url.directory;
} else {
// A generic uri, use path.
- fname = url.path;
- this.mSourcePath += url.path;
+ fname = url.pathQueryRef;
+ this.mSourcePath += url.pathQueryRef;
}
if (suggestedFileName)
fname = iconPath = suggestedFileName;
var displayName = fname.replace(/ +/g, " ");
this.mTitle = this.dialogElement("strings").getFormattedString("title", [displayName]);
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -1975,17 +1975,17 @@ this.XPIProvider = {
aURI = ChromeRegistry.convertChromeURL(aURI);
return this._resolveURIToFile(aURI);
case "resource":
aURI = Services.io.newURI(ResProtocolHandler.resolveURI(aURI));
return this._resolveURIToFile(aURI);
case "view-source":
- aURI = Services.io.newURI(aURI.path);
+ aURI = Services.io.newURI(aURI.pathQueryRef);
return this._resolveURIToFile(aURI);
case "about":
if (aURI.spec == "about:blank") {
// Do not attempt to map about:blank
return null;
}
--- a/toolkit/mozapps/extensions/test/browser/browser_openDialog.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_openDialog.js
@@ -16,17 +16,17 @@ var CustomChromeProtocol = {
newURI: function CCP_newURI(aSpec, aOriginCharset, aBaseUri) {
let uri = Cc["@mozilla.org/network/simple-uri;1"].
createInstance(Ci.nsIURI);
uri.spec = aSpec;
return uri;
},
newChannel2: function CCP_newChannel2(aURI, aLoadInfo) {
- let url = Services.io.newURI("chrome:" + aURI.path);
+ let url = Services.io.newURI("chrome:" + aURI.pathQueryRef);
let ch = Services.io.newChannelFromURIWithLoadInfo(url, aLoadInfo);
ch.originalURI = aURI;
return ch;
},
newChannel: function CCP_newChannel(aURI) {
return this.newChannel2(aURI, null);
},
--- a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
@@ -310,17 +310,17 @@ function run_test_provider() {
restartManager();
const provider = new TestProvider(Components.results.NS_ERROR_NOT_AVAILABLE);
AddonManagerPrivate.registerProvider(provider);
check_mapping(provider.uri, provider.id);
let u2 = provider.uri.clone();
- u2.path = "notmapped";
+ u2.pathQueryRef = "notmapped";
do_check_eq(AddonManager.mapURIToAddonID(u2), null);
AddonManagerPrivate.unregisterProvider(provider);
run_test_provider_nomap();
}
// Tests that custom providers are correctly handled, even not implementing