bug 225695 : follow-up to the fix for bug 44272. the first part of three ; tree-wide sweep to replace escape/unescape with en|decodeURI(Component). r=bz, sr=rbs, a=asa

This commit is contained in:
jshin%mailaps.org 2003-12-03 21:41:37 +00:00
Родитель ba315ca6d7
Коммит 88492d9c99
19 изменённых файлов: 32 добавлений и 32 удалений

Просмотреть файл

@ -1686,7 +1686,7 @@ function OpenSearch(tabName, searchStr, newTabFlag)
BrowserLoadURL()
} else {
if (searchStr) {
var escapedSearchStr = escape(searchStr);
var escapedSearchStr = encodeURIComponent(searchStr);
defaultSearchURL += escapedSearchStr;
var searchDS = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
.getService(Components.interfaces.nsIInternetSearchService);
@ -3813,7 +3813,7 @@ function launchExternalUrl(aURL)
function sendLink(url, title)
{
// generate a mailto url based on the url and the url's title
var mailtoUrl = url ? "mailto:?body=" + url + "&subject=" + escape(title) : "mailto:";
var mailtoUrl = url ? "mailto:?body=" + url + "&subject=" + encodeURIComponent(title) : "mailto:";
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI(mailtoUrl, null, null);

Просмотреть файл

@ -735,7 +735,7 @@ function getDefaultFileName(aDefaultFileName, aNameFromHeaders, aDocumentURI, aD
var url = aDocumentURI.QueryInterface(Components.interfaces.nsIURL);
if (url.fileName != "") {
// 2) Use the actual file name, if present
return validateFileName(unescape(url.fileName));
return validateFileName(decodeURIComponent(url.fileName));
}
} catch (e) {
try {

Просмотреть файл

@ -135,7 +135,7 @@
if (this.currentEngine != "__PhoenixFindInPage") {
var ISEARCHSVC = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
.getService(Components.interfaces.nsIInternetSearchService);
var searchURL = ISEARCHSVC.GetInternetSearchURL(this.currentEngine, escape(this.value),
var searchURL = ISEARCHSVC.GetInternetSearchURL(this.currentEngine, encodeURIComponent(this.value),
0, 0, {value:0});
gURLBar.value = searchURL;
BrowserLoadURL(this.mEnterEvent); // from autocomplete.xml

Просмотреть файл

@ -274,7 +274,7 @@ function searchHistory(aInput)
GroupBy(gHistoryGrouping);
else
gHistoryTree.setAttribute("ref",
"find:datasource=history&match=Name&method=contains&text=" + escape(aInput));
"find:datasource=history&match=Name&method=contains&text=" + encodeURIComponent(aInput));
}
function onUnload()

Просмотреть файл

@ -127,7 +127,7 @@ function AddAttachment(attachment)
item.setAttribute("label", attachment.name); //use for display only
item.attachment = attachment; //full attachment object stored here
try {
item.setAttribute("tooltiptext", unescape(attachment.url));
item.setAttribute("tooltiptext", decodeURI(attachment.url));
} catch(e) {
item.setAttribute("tooltiptext", attachment.url);
}

Просмотреть файл

@ -6,7 +6,7 @@ function getErrorCode()
url = document.location.href;
error = url.search(/e\=/);
duffUrl = url.search(/\&u\=/);
return unescape(url.slice(error + 2, duffUrl));
return decodeURIComponent(url.slice(error + 2, duffUrl));
}
function getDuffUrl()
@ -14,14 +14,14 @@ function getDuffUrl()
url = document.location.href;
duffUrl = url.search(/u\=/);
desc = url.search(/\&d\=/);
return unescape(url.slice(duffUrl + 2, desc));
return decodeURIComponent(url.slice(duffUrl + 2, desc));
}
function getDescription()
{
url = document.location.href;
desc = url.search(/d\=/);
return unescape(url.slice(desc + 2));
return decodeURIComponent(url.slice(desc + 2));
}
function retryThis()

Просмотреть файл

@ -224,7 +224,7 @@ function make_chart(expr, field, type, value) {
"</tr>";
return "&field" + expr + "=" + field +
"&type" + expr + "=" + type +
"&value" + expr + "=" + escape(value).replace(/[+]/g,"%2B");
"&value" + expr + "=" + encodeURIComponent(value).replace(/[+]/g,"%2B");
}
// returns true if at least one of comparelist had the prefix, false otherwise
@ -302,7 +302,7 @@ function make_query_URL(url, input, searchLong) {
return no_result;
}
for (i=1; i<parts.length; i+=2) {
parts[i] = escape(parts[i]);
parts[i] = encodeURIComponent(parts[i]);
}
input2 = parts.join('"');
@ -423,7 +423,7 @@ function make_query_URL(url, input, searchLong) {
abort = true;
}
for (var i=1; i<parts.length; i+=2) {
parts[i] = unescape(parts[i]);
parts[i] = decodeURIComponent(parts[i]);
}
var value2 = parts.join('');
@ -712,10 +712,10 @@ function QuickSearch ()
{
if (input.indexOf(",") == -1) {
// only _one_ bug number --> show_bug
go_to(bugzilla+"show_bug.cgi?id="+escape(input));
go_to(bugzilla+"show_bug.cgi?id="+encodeURIComponent(input));
} else {
// comma-separated bug numbers --> buglist
go_to(bugzilla+"buglist.cgi?bug_id="+escape(input)
go_to(bugzilla+"buglist.cgi?bug_id="+encodeURIComponent(input)
+ "&bugidtype=include&order=bugs.bug_id");
}
}

Просмотреть файл

@ -198,7 +198,7 @@ function viewPartialSourceForSelection(selection)
// all our content is held by the data:URI and URIs are internally stored as utf-8 (see nsIURI.idl)
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
getBrowser().webNavigation
.loadURI("view-source:data:text/html;charset=utf-8," + escape(tmpNode.innerHTML),
.loadURI("view-source:data:text/html;charset=utf-8," + encodeURIComponent(tmpNode.innerHTML),
loadFlags, null, null, null);
}

Просмотреть файл

@ -748,7 +748,7 @@ function Translate()
if (targetURI.indexOf(serviceDomain) >= 0)
BrowserReload();
else {
loadURI(service + escape(targetURI));
loadURI(encodeURI(service + targetURI));
}
}
@ -1025,7 +1025,7 @@ function OpenSearch(tabName, forceDialogFlag, searchStr, newWindowFlag)
}
} else {
if (searchStr) {
var escapedSearchStr = escape(searchStr);
var escapedSearchStr = encodeURIComponent(searchStr);
defaultSearchURL += escapedSearchStr;
var searchDS = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
.getService(Components.interfaces.nsIInternetSearchService);

Просмотреть файл

@ -423,7 +423,7 @@
var searchService = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService);
var searchEng = item.getAttribute("searchEngine");
var searchEngUrl = item.getAttribute("searchBarUrl");
var escapedSearch = escape(this.mSearchValue)
var escapedSearch = encodeURIComponent(this.mSearchValue)
if (searchEngUrl) {
searchEngUrl += escapedSearch;
return searchEngUrl;

Просмотреть файл

@ -196,7 +196,7 @@ function viewPartialSourceForSelection(selection)
// all our content is held by the data:URI and URIs are internally stored as utf-8 (see nsIURI.idl)
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
getBrowser().webNavigation
.loadURI("view-source:data:text/html;charset=utf-8," + escape(tmpNode.innerHTML),
.loadURI("view-source:data:text/html;charset=utf-8," + encodeURIComponent(tmpNode.innerHTML),
loadFlags, null, null, null);
}

Просмотреть файл

@ -172,7 +172,7 @@
if (match) {
if (debug)
dump(" matched regexp. found '" + match[1] + "'\n");
return unescape(match[1]);
return decodeURIComponent(match[1]);
}
return null;
}

Просмотреть файл

@ -766,7 +766,7 @@ function getDefaultFileName(aDefaultFileName, aNameFromHeaders, aDocumentURI, aD
var url = aDocumentURI.QueryInterface(Components.interfaces.nsIURL);
if (url.fileName != "") {
// 2) Use the actual file name, if present
return validateFileName(unescape(url.fileName));
return validateFileName(decodeURIComponent(url.fileName));
}
} catch (e) {
try {

Просмотреть файл

@ -438,7 +438,7 @@
this.originalRef = this.tree.getAttribute("ref");
}
this.tree.setAttribute("ref",
"find:datasource=rdf:bookmarks&match=http://home.netscape.com/NC-rdf#Name&method=contains&text=" + escape(aInput));
"find:datasource=rdf:bookmarks&match=http://home.netscape.com/NC-rdf#Name&method=contains&text=" + encodeURIComponent(aInput));
}
]]></body>
</method>

Просмотреть файл

@ -58,7 +58,7 @@ function find()
var searchURI = "find:datasource=rdf:bookmarks"
searchURI += "&match=" + match.selectedItem.value;
searchURI += "&method=" + method.selectedItem.value;
searchURI += "&text=" + escape(gSearchField.value);
searchURI += "&text=" + encodeURIComponent(gSearchField.value);
var bmWindow = findMostRecentWindow("bookmarks:searchresults", "chrome://communicator/content/bookmarks/bookmarksManager.xul", searchURI);
// Update the root of the tree if we're using an existing search window.

Просмотреть файл

@ -57,7 +57,7 @@ function find()
var searchURI = "find:datasource=history"
searchURI += "&match=" + match.selectedItem.value;
searchURI += "&method=" + method.selectedItem.value;
searchURI += "&text=" + escape(gSearchField.value);
searchURI += "&text=" + encodeURIComponent(gSearchField.value);
var hstWindow = findMostRecentWindow("history:searchresults", "chrome://communicator/content/history/history.xul", searchURI);
// Update the root of the tree if we're using an existing search window.

Просмотреть файл

@ -70,7 +70,7 @@ function (bReferrer)
sCDT += '&pane=nswr6';
sCDT += '&wid='+this.m_sWindowID;
return escape(sCDT);
return encodeURIComponent(sCDT);
}
NavObserver.prototype.TrackContext =

Просмотреть файл

@ -125,7 +125,7 @@ function loadResultsList( aSearchURL )
{
var resultsTree = document.getElementById( "resultsList" );
if (!resultsTree) return false;
resultsTree.setAttribute("ref", unescape(aSearchURL));
resultsTree.setAttribute("ref", decodeURI(aSearchURL));
return true;
}

Просмотреть файл

@ -139,7 +139,7 @@ function rememberSearchText(target)
}
}
textNode.value = unescape(target);
textNode.value = decodeURI(target);
doEnabling();
}
}
@ -479,7 +479,7 @@ function haveSearchResults()
// convert plusses (+) back to spaces
target = target.replace(/\+/g, " ");
var textNode = document.getElementById("sidebar-search-text");
textNode.value = unescape(target);
textNode.value = decodeURI(target);
return true;
}
}
@ -831,7 +831,7 @@ function OpenSearch(aSearchStr, engineURIs)
var searchDS = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService);
var escapedSearchStr = escape(aSearchStr);
var escapedSearchStr = encodeURIComponent(aSearchStr);
sidebarInitiatedSearch = true;
searchDS.RememberLastSearchText(escapedSearchStr);
sidebarInitiatedSearch = false;
@ -877,7 +877,7 @@ function OpenSearch(aSearchStr, engineURIs)
}
searchURL += ("&text=" + escapedSearchStr);
gURL = searchURL;
loadURLInContent("chrome://communicator/content/search/internetresults.xul?" + escape(searchURL));
loadURLInContent(encodeURI("chrome://communicator/content/search/internetresults.xul?" + searchURL));
}
}
catch (ex) {
@ -915,7 +915,7 @@ function saveSearch()
if (target) {
// convert plusses (+) back to spaces
target = target.replace(/\+/g, " ");
lastSearchText = unescape(target);
lastSearchText = decodeURI(target);
}
}
@ -961,7 +961,7 @@ function showMoreResults(direction)
// get search term
var searchTerm = document.getElementById("sidebar-search-text").value;
searchTerm = escape(searchTerm);
searchTerm = encodeURIComponent(searchTerm);
// change page number
if (direction > 0)