Merge remote-tracking branch 'mozilla/central'

This commit is contained in:
Ed Lee 2019-06-15 06:59:50 -07:00
Родитель 1d35b28798 bc6a91fa9c
Коммит f8dec4b4bf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 40B7250312F03605
3 изменённых файлов: 30 добавлений и 5 удалений

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

@ -249,8 +249,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 = [];

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

@ -44,7 +44,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: {