зеркало из https://github.com/mozilla/pjs.git
Bug 419656 - Location bar instrumentation misses unencoded urls. r=gavin, b-ff3=beltzner
This commit is contained in:
Родитель
7d33897585
Коммит
8ec7076dc8
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче