Merge remote-tracking branch 'mozilla/central'
This commit is contained in:
Коммит
f8dec4b4bf
|
@ -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: {
|
||||
|
|
Загрузка…
Ссылка в новой задаче