Bug 419656 - Location bar instrumentation misses unencoded urls. r=gavin, b-ff3=beltzner

This commit is contained in:
edward.lee@engineering.uiuc.edu 2008-03-12 16:39:40 -07:00
Родитель 7d33897585
Коммит 8ec7076dc8
4 изменённых файлов: 37 добавлений и 4 удалений

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

@ -1950,11 +1950,11 @@ function checkForDirectoryListing()
}
}
function URLBarSetURI(aURI) {
function URLBarSetURI(aURI, aMustUseURI) {
var value = getBrowser().userTypedValue;
var state = "invalid";
if (!value) {
if (!value || aMustUseURI) {
if (aURI) {
// If the url has "wyciwyg://" as the protocol, strip it off.
// Nobody wants to see it on the urlbar for dynamically generated

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

@ -242,6 +242,34 @@
}
]]></body>
</method>
<property name="textValue"
onget="return this.value;">
<setter>
<![CDATA[
// Force load the value into the urlbar to get it unescaped
try {
let uri = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).
newURI(val, null, null);
URLBarSetURI(uri, true);
} catch (ex) {
// Incase the value isn't actually a URI
this.value = val;
}
// Completing a result should simulate the user typing the result, so
// fire an input event.
let evt = document.createEvent("UIEvents");
evt.initUIEvent("input", true, false, window, 0);
this.mIgnoreInput = true;
this.dispatchEvent(evt);
this.mIgnoreInput = false;
return this.value;
]]>
</setter>
</property>
</implementation>
<handlers>

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

@ -561,7 +561,7 @@ nsNavHistory::AutoCompleteProcessSearch(mozIStorageStatement* aQuery,
NS_ConvertUTF8toUTF16 faviconURI(faviconSpec);
// New item: append to our results and put it in our hash table
rv = mCurrentResult->AppendMatch(entryURL, title, faviconURI, style);
rv = mCurrentResult->AppendMatch(escapedEntryURL, title, faviconURI, style);
NS_ENSURE_SUCCESS(rv, rv);
mCurrentResultURLs.Put(escapedEntryURL, PR_TRUE);

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

@ -1013,6 +1013,11 @@
// trim the leading/trailing whitespace
var trimmedSearchString = controller.searchString.replace(/^\s+/, "").replace(/\s+$/, "");
// Unescape the URI spec for showing as an entry in the popup
let url = Components.classes["@mozilla.org/intl/texttosuburi;1"].
getService(Components.interfaces.nsITextToSubURI).
unEscapeURIForUI("UTF-8", controller.getValueAt(this._currentIndex));
if (this._currentIndex < existingItemsCount) {
// re-use the existing item
item = this.richlistbox.childNodes[this._currentIndex];
@ -1025,7 +1030,7 @@
// set these attributes before we set the class
// so that we can use them from the contructor
item.setAttribute("image", controller.getImageAt(this._currentIndex));
item.setAttribute("url", controller.getValueAt(this._currentIndex));
item.setAttribute("url", url);
item.setAttribute("title", controller.getCommentAt(this._currentIndex));
item.setAttribute("type", controller.getStyleAt(this._currentIndex));
item.setAttribute("text", trimmedSearchString);