mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 959573 - Land UnifiedAutocomplete (disabled by default). rs=ttaubert
This commit is contained in:
parent
5fd9bc2afa
commit
2b41888dd7
@ -457,6 +457,8 @@
|
||||
@BINPATH@/components/nsPlacesDBFlush.js
|
||||
@BINPATH@/components/nsPlacesAutoComplete.manifest
|
||||
@BINPATH@/components/nsPlacesAutoComplete.js
|
||||
@BINPATH@/components/UnifiedComplete.manifest
|
||||
@BINPATH@/components/UnifiedComplete.js
|
||||
@BINPATH@/components/nsPlacesExpiration.js
|
||||
@BINPATH@/components/PlacesProtocolHandler.js
|
||||
@BINPATH@/components/PlacesCategoriesStarter.js
|
||||
|
@ -81,6 +81,10 @@
|
||||
Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
|
||||
.getService(Components.interfaces.mozIPlacesAutoComplete);
|
||||
</field>
|
||||
<field name="_unifiedComplete" readonly="true">
|
||||
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
|
||||
.getService(Components.interfaces.mozIPlacesAutoComplete);
|
||||
</field>
|
||||
<field name="mTabBox" readonly="true">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "tabbox");
|
||||
</field>
|
||||
@ -744,8 +748,10 @@
|
||||
}
|
||||
|
||||
let autocomplete = this.mTabBrowser._placesAutocomplete;
|
||||
let unifiedComplete = this.mTabBrowser._unifiedComplete;
|
||||
if (this.mBrowser.registeredOpenURI) {
|
||||
autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
|
||||
unifiedComplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
|
||||
delete this.mBrowser.registeredOpenURI;
|
||||
}
|
||||
// Tabs in private windows aren't registered as "Open" so
|
||||
@ -754,6 +760,7 @@
|
||||
(!PrivateBrowsingUtils.isWindowPrivate(window) ||
|
||||
PrivateBrowsingUtils.permanentPrivateBrowsing)) {
|
||||
autocomplete.registerOpenPage(aLocation);
|
||||
unifiedComplete.registerOpenPage(aLocation);
|
||||
this.mBrowser.registeredOpenURI = aLocation;
|
||||
}
|
||||
}
|
||||
@ -1956,6 +1963,7 @@
|
||||
|
||||
if (browser.registeredOpenURI && !aTabWillBeMoved) {
|
||||
this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
|
||||
this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
|
||||
delete browser.registeredOpenURI;
|
||||
}
|
||||
|
||||
@ -2282,6 +2290,7 @@
|
||||
// If the current URI is registered as open remove it from the list.
|
||||
if (aOurBrowser.registeredOpenURI) {
|
||||
this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
|
||||
this._unifiedComplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
|
||||
delete aOurBrowser.registeredOpenURI;
|
||||
}
|
||||
|
||||
@ -3091,6 +3100,7 @@
|
||||
let browser = this.getBrowserAtIndex(i);
|
||||
if (browser.registeredOpenURI) {
|
||||
this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
|
||||
this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
|
||||
delete browser.registeredOpenURI;
|
||||
}
|
||||
browser.webProgress.removeProgressListener(this.mTabFilters[i]);
|
||||
|
@ -68,6 +68,12 @@
|
||||
this.inputField.addEventListener("overflow", this, false);
|
||||
this.inputField.addEventListener("underflow", this, false);
|
||||
|
||||
try {
|
||||
if (this._prefs.getBoolPref("unifiedcomplete")) {
|
||||
this.setAttribute("autocompletesearch", "unifiedcomplete");
|
||||
}
|
||||
} catch (ex) {}
|
||||
|
||||
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var textBox = document.getAnonymousElementByAttribute(this,
|
||||
"anonid", "textbox-input-box");
|
||||
@ -599,6 +605,14 @@
|
||||
case "trimURLs":
|
||||
this._mayTrimURLs = this._prefs.getBoolPref(aData);
|
||||
break;
|
||||
case "unifiedcomplete":
|
||||
let useUnifiedComplete = false;
|
||||
try {
|
||||
useUnifiedComplete = this._prefs.getBoolPref(aData);
|
||||
} catch (ex) {}
|
||||
this.setAttribute("autocompletesearch",
|
||||
useUnifiedComplete ? "unifiedcomplete"
|
||||
: "urlinline history");
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
|
@ -430,6 +430,8 @@
|
||||
@BINPATH@/components/nsTaggingService.js
|
||||
@BINPATH@/components/nsPlacesAutoComplete.manifest
|
||||
@BINPATH@/components/nsPlacesAutoComplete.js
|
||||
@BINPATH@/components/UnifiedComplete.manifest
|
||||
@BINPATH@/components/UnifiedComplete.js
|
||||
@BINPATH@/components/nsPlacesExpiration.js
|
||||
@BINPATH@/browser/components/PlacesProtocolHandler.js
|
||||
@BINPATH@/components/PlacesCategoriesStarter.js
|
||||
|
@ -126,7 +126,7 @@ this.PriorityUrlProvider = Object.freeze({
|
||||
matches.delete(token);
|
||||
},
|
||||
|
||||
getMatchingSpec: function (searchToken) {
|
||||
getMatch: function (searchToken) {
|
||||
return Task.spawn(function* () {
|
||||
yield promiseInitialized();
|
||||
for (let [token, match] of matches.entries()) {
|
||||
|
1236
toolkit/components/places/UnifiedComplete.js
Normal file
1236
toolkit/components/places/UnifiedComplete.js
Normal file
File diff suppressed because it is too large
Load Diff
2
toolkit/components/places/UnifiedComplete.manifest
Normal file
2
toolkit/components/places/UnifiedComplete.manifest
Normal file
@ -0,0 +1,2 @@
|
||||
component {f964a319-397a-4d21-8be6-5cdd1ee3e3ae} UnifiedComplete.js
|
||||
contract @mozilla.org/autocomplete/search;1?name=unifiedcomplete {f964a319-397a-4d21-8be6-5cdd1ee3e3ae}
|
@ -87,6 +87,8 @@ if CONFIG['MOZ_PLACES']:
|
||||
EXTRA_COMPONENTS += [
|
||||
'nsPlacesAutoComplete.js',
|
||||
'nsPlacesAutoComplete.manifest',
|
||||
'UnifiedComplete.js',
|
||||
'UnifiedComplete.manifest',
|
||||
]
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
|
@ -11,7 +11,7 @@ function run_test() {
|
||||
add_task(function* search_engine_match() {
|
||||
let engine = yield promiseDefaultSearchEngine();
|
||||
let token = engine.getResultDomain();
|
||||
let match = yield PriorityUrlProvider.getMatchingSpec(token.substr(0, 1));
|
||||
let match = yield PriorityUrlProvider.getMatch(token.substr(0, 1));
|
||||
do_check_eq(match.url, engine.searchForm);
|
||||
do_check_eq(match.title, engine.name);
|
||||
do_check_eq(match.iconUrl, engine.iconURI ? engine.iconURI.spec : null);
|
||||
@ -19,7 +19,7 @@ add_task(function* search_engine_match() {
|
||||
});
|
||||
|
||||
add_task(function* no_match() {
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatchingSpec("test"));
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatch("test"));
|
||||
});
|
||||
|
||||
add_task(function* hide_search_engine_nomatch() {
|
||||
@ -29,16 +29,16 @@ add_task(function* hide_search_engine_nomatch() {
|
||||
Services.search.removeEngine(engine);
|
||||
yield promiseTopic;
|
||||
do_check_true(engine.hidden);
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatchingSpec(token.substr(0, 1)));
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatch(token.substr(0, 1)));
|
||||
});
|
||||
|
||||
add_task(function* add_search_engine_match() {
|
||||
let promiseTopic = promiseSearchTopic("engine-added");
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatchingSpec("bacon"));
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatch("bacon"));
|
||||
Services.search.addEngineWithDetails("bacon", "", "bacon", "Search Bacon",
|
||||
"GET", "http://www.bacon.moz/?search={searchTerms}");
|
||||
yield promiseSearchTopic;
|
||||
let match = yield PriorityUrlProvider.getMatchingSpec("bacon");
|
||||
let match = yield PriorityUrlProvider.getMatch("bacon");
|
||||
do_check_eq(match.url, "http://www.bacon.moz");
|
||||
do_check_eq(match.title, "bacon");
|
||||
do_check_eq(match.iconUrl, null);
|
||||
@ -50,7 +50,7 @@ add_task(function* remove_search_engine_nomatch() {
|
||||
let promiseTopic = promiseSearchTopic("engine-removed");
|
||||
Services.search.removeEngine(engine);
|
||||
yield promiseTopic;
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatchingSpec("bacon"));
|
||||
do_check_eq(null, yield PriorityUrlProvider.getMatch("bacon"));
|
||||
});
|
||||
|
||||
function promiseDefaultSearchEngine() {
|
||||
|
Loading…
Reference in New Issue
Block a user