зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1558917 - Referrer no longer sent for new tab links r=thecount
Differential Revision: https://phabricator.services.mozilla.com/D35073 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
61e2880c1d
Коммит
2a8ae9339f
|
@ -248,8 +248,16 @@ class PlacesFeed {
|
|||
// Always include the referrer (even for http links) if we have one
|
||||
const {event, referrer, typedBonus} = action.data;
|
||||
if (referrer) {
|
||||
params.referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSAFE_URL;
|
||||
params.referrerURI = Services.io.newURI(referrer);
|
||||
const ReferrerInfo = Components.Constructor(
|
||||
"@mozilla.org/referrer-info;1",
|
||||
"nsIReferrerInfo",
|
||||
"init"
|
||||
);
|
||||
params.referrerInfo = new ReferrerInfo(
|
||||
Ci.nsIHttpChannel.REFERRER_POLICY_UNSAFE_URL,
|
||||
true,
|
||||
Services.io.newURI(referrer)
|
||||
);
|
||||
}
|
||||
|
||||
// Pocket gives us a special reader URL to open their stories in
|
||||
|
|
|
@ -193,8 +193,12 @@ describe("PlacesFeed", () => {
|
|||
feed.onAction(openLinkAction);
|
||||
|
||||
const [, , params] = openLinkIn.firstCall.args;
|
||||
assert.propertyVal(params, "referrerPolicy", 5);
|
||||
assert.propertyVal(params.referrerURI, "spec", "foo.com/ref");
|
||||
assert.nestedPropertyVal(params, "referrerInfo.referrerPolicy", 5);
|
||||
assert.nestedPropertyVal(
|
||||
params,
|
||||
"referrerInfo.originalReferrer.spec",
|
||||
"foo.com/ref"
|
||||
);
|
||||
});
|
||||
it("should mark link with typed bonus as typed before opening OPEN_LINK", () => {
|
||||
const callOrder = [];
|
||||
|
|
|
@ -43,7 +43,20 @@ const TEST_GLOBAL = {
|
|||
ClientEnvironment: {
|
||||
get userId() { return "foo123"; },
|
||||
},
|
||||
Components: {isSuccessCode: () => true},
|
||||
Components: {
|
||||
Constructor(classId) {
|
||||
switch (classId) {
|
||||
case "@mozilla.org/referrer-info;1":
|
||||
return function(referrerPolicy, sendReferrer, originalReferrer) {
|
||||
this.referrerPolicy = referrerPolicy;
|
||||
this.sendReferrer = sendReferrer;
|
||||
this.originalReferrer = originalReferrer;
|
||||
};
|
||||
}
|
||||
return function() {};
|
||||
},
|
||||
isSuccessCode: () => true,
|
||||
},
|
||||
// eslint-disable-next-line object-shorthand
|
||||
ContentSearchUIController: function() {}, // NB: This is a function/constructor
|
||||
Cc: {
|
||||
|
|
Загрузка…
Ссылка в новой задаче