Issue #756 - Remove Contextual Identity from UnifiedComplete

reverts m-c 1287866
This commit is contained in:
Gaming4JC 2019-03-18 18:38:30 -04:00 • committed by Roy Tam
commit 50bf383712
6 changed files with 40 additions and 116 deletions

View file

@ -286,19 +286,19 @@ var addBookmark = Task.async(function* (aBookmarkObj) {
}
});
function addOpenPages(aUri, aCount=1, aUserContextId=0) {
function addOpenPages(aUri, aCount=1) {
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Ci.mozIPlacesAutoComplete);
for (let i = 0; i < aCount; i++) {
ac.registerOpenPage(aUri, aUserContextId);
ac.registerOpenPage(aUri);
}
}
function removeOpenPages(aUri, aCount=1, aUserContextId=0) {
function removeOpenPages(aUri, aCount=1) {
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Ci.mozIPlacesAutoComplete);
for (let i = 0; i < aCount; i++) {
ac.unregisterOpenPage(aUri, aUserContextId);
ac.unregisterOpenPage(aUri);
}
}

View file

@ -11,11 +11,9 @@ add_task(function* test_tab_matches() {
let uri2 = NetUtil.newURI("http://xyz.net/");
let uri3 = NetUtil.newURI("about:mozilla");
let uri4 = NetUtil.newURI("data:text/html,test");
let uri5 = NetUtil.newURI("http://foobar.org");
yield PlacesTestUtils.addVisits([
{ uri: uri1, title: "ABC rocks" },
{ uri: uri2, title: "xyz.net - we're better than ABC" },
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ" }
{ uri: uri2, title: "xyz.net - we're better than ABC" }
]);
addOpenPages(uri1, 1);
// Pages that cannot be registered in history.
@ -37,8 +35,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("three results, both normal results are tab matches");
@ -48,39 +45,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
});
do_print("a container tab is not visible in 'switch to tab'");
addOpenPages(uri5, 1, /* userContextId: */ 3);
yield check_autocomplete({
search: "abc",
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
});
do_print("a container tab should not see 'switch to tab' for other container tabs");
yield check_autocomplete({
search: "abc",
searchParam: "enable-actions user-context-id:3",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://foobar.org/", { title: "foobar.org - much better than ABC, definitely better than XYZ" }),
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("a different container tab should not see any 'switch to tab'");
yield check_autocomplete({
search: "abc",
searchParam: "enable-actions user-context-id:2",
matches: [ makeSearchMatch("abc", { heuristic: true }),
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }) ]
});
do_print("three results, both normal results are tab matches, one has multiple tabs");
@ -90,8 +55,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }) ]
});
do_print("three results, no tab matches (disable-private-actions)");
@ -100,8 +64,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions disable-private-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("two results (actions disabled)");
@ -109,8 +72,7 @@ add_task(function* test_tab_matches() {
search: "abc",
searchParam: "",
matches: [ { uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("three results, no tab matches");
@ -121,8 +83,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("tab match search with restriction character");