Backed out changeset 6e58c931a044 (bug 1680019) for casuing failure at sandbox-navigation-timing.tentative.html. CLOSED TREE

This commit is contained in:
Butkovits Atila 2020-12-21 22:48:53 +02:00
Родитель 1a217045f8
Коммит 127ca97821
6 изменённых файлов: 8 добавлений и 82 удалений

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

@ -1346,10 +1346,7 @@ pref("prompts.defaultModalType", 3);
pref("browser.topsites.useRemoteSetting", false);
// The base URL for the Quick Suggest anonymizing proxy. To make a request to
// the proxy, include a campaign ID in the path.
pref("browser.partnerlink.attributionURL", "https://topsites.services.mozilla.com/cid/");
pref("browser.partnerlink.campaign.topsites", "amzn_2020_a1");
pref("browser.partnerlink.attributionURL", "https://topsites.services.mozilla.com/cid/amzn_2020_a1");
// Whether to show tab level system prompts opened via nsIPrompt(Service) as
// SubDialogs in the TabDialogBox (true) or as TabModalPrompt in the

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

@ -383,23 +383,6 @@ class PlacesFeed {
}
}
/**
* Sends an attribution request for Top Sites interactions.
* @param {object} data
* Attribution paramters from a Top Site.
*/
makeAttributionRequest(data) {
let args = Object.assign(
{
campaignID: Services.prefs.getStringPref(
"browser.partnerlink.campaign.topsites"
),
},
data
);
PartnerLinkAttribution.makeRequest(args);
}
async fillSearchTopSiteTerm({ _target, data }) {
const searchEngine = await Services.search.getEngineByAlias(data.label);
_target.browser.ownerGlobal.gURLBar.search(data.label, {
@ -560,7 +543,7 @@ class PlacesFeed {
break;
}
case at.PARTNER_LINK_ATTRIBUTION:
this.makeAttributionRequest(action.data);
PartnerLinkAttribution.makeRequest(action.data);
break;
}
}

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

@ -39,9 +39,6 @@ describe("PlacesFeed", () => {
archivePocketEntry: sandbox.spy(() => Promise.resolve()),
},
});
globals.set("PartnerLinkAttribution", {
makeRequest: sandbox.spy(),
});
sandbox
.stub(global.PlacesUtils.bookmarks, "TYPE_BOOKMARK")
.value(TYPE_BOOKMARK);
@ -568,22 +565,6 @@ describe("PlacesFeed", () => {
feed.onAction(action);
assert.calledWith(feed.handoffSearchToAwesomebar, action);
});
it("should call makeAttributionRequest on PARTNER_LINK_ATTRIBUTION", () => {
sinon.stub(feed, "makeAttributionRequest");
let data = { targetURL: "https://partnersite.com", source: "topsites" };
feed.onAction({
type: at.PARTNER_LINK_ATTRIBUTION,
data,
});
assert.calledOnce(feed.makeAttributionRequest);
assert.calledWithExactly(feed.makeAttributionRequest, data);
});
it("should call PartnerLinkAttribution.makeRequest when calling makeAttributionRequest", () => {
let data = { targetURL: "https://partnersite.com", source: "topsites" };
feed.makeAttributionRequest(data);
assert.calledOnce(global.PartnerLinkAttribution.makeRequest);
});
});
describe("handoffSearchToAwesomebar", () => {

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

@ -945,9 +945,6 @@ class UrlbarInput {
PartnerLinkAttribution.makeRequest({
targetURL: result.payload.url,
source: "urlbar",
campaignID: Services.prefs.getStringPref(
"browser.partnerlink.campaign.topsites"
),
});
}

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

@ -18,20 +18,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
});
var PartnerLinkAttribution = {
/**
* Sends an attribution request to an anonymizing proxy.
*
* @param {string} targetURL
* The URL we are routing through the anonmyzing proxy.
* @param {string} source
* The source of the anonmized request, e.g. "urlbar".
* @param {string} [campaignID]
* The campaign ID for attribution. This should be a valid path on the
* anonymizing proxy. For example, if `campaignID` was `foo`, we'd send an
* attribution request to https://topsites.mozilla.com/cid/foo.
* Optional. If it's not provided, we default to the topsites campaign.
*/
async makeRequest({ targetURL, source, campaignID }) {
async makeRequest({ targetURL, source }) {
let partner = targetURL.match(/^https?:\/\/(?:www.)?([^.]*)/)[1];
function record(method, objectString) {
@ -43,21 +30,13 @@ var PartnerLinkAttribution = {
}
record("click", source);
let attributionUrl = Services.prefs.getStringPref(
const attributionUrl = Services.prefs.getStringPref(
"browser.partnerlink.attributionURL"
);
if (!attributionUrl) {
record("attribution", "abort");
return;
}
// The default campaign is topsites.
if (!campaignID) {
campaignID = Services.prefs.getStringPref(
"browser.partnerlink.campaign.topsites"
);
}
attributionUrl = attributionUrl + campaignID;
let result = await sendRequest(attributionUrl, source, targetURL);
record("attribution", result ? "success" : "failure");
},
@ -71,14 +50,7 @@ var PartnerLinkAttribution = {
* The target URL to filter and include in the attribution.
*/
async makeSearchEngineRequest(engine, targetUrl) {
let cid;
if (engine.attribution?.cid) {
cid = engine.attribution.cid;
} else if (engine.sendAttributionRequest) {
cid = Services.prefs.getStringPref(
"browser.partnerlink.campaign.topsites"
);
} else {
if (!engine.sendAttributionRequest) {
return;
}
@ -101,11 +73,10 @@ var PartnerLinkAttribution = {
return;
}
let attributionUrl = Services.prefs.getStringPref(
const attributionUrl = Services.prefs.getStringPref(
"browser.partnerlink.attributionURL",
""
);
attributionUrl = attributionUrl + cid;
targetParams.delete(searchUrlQueryParamName);
let strippedTargetUrl = `${url.prePath}${url.filePath}`;

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

@ -54,11 +54,8 @@ add_task(async function setup() {
let json = await response.json();
await SearchTestUtils.updateRemoteSettingsConfig(json.data);
let topsitesAttribution = Services.prefs.getStringPref(
"browser.partnerlink.campaign.topsites"
);
gHttpServer = new HttpServer();
gHttpServer.registerPathHandler(`/cid/${topsitesAttribution}`, submitHandler);
gHttpServer.registerPathHandler("/", submitHandler);
gHttpServer.start(-1);
await SpecialPowers.pushPrefEnv({
@ -73,7 +70,7 @@ add_task(async function setup() {
//
[
"browser.partnerlink.attributionURL",
`http://localhost:${gHttpServer.identity.primaryPort}/cid/`,
`http://localhost:${gHttpServer.identity.primaryPort}/`,
],
],
});