Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
fix (experiment): #2164 retire originalNewTabSites experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
rlr committed Feb 14, 2017
1 parent d175873 commit a318975
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 41 deletions.
6 changes: 1 addition & 5 deletions addon/Feeds/TopSitesFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ module.exports = class TopSitesFeed extends Feed {

let links;
// Get links from places
if (experiments.originalNewTabSites) {
links = yield PlacesProvider.links.asyncGetTopNewTabSites();
} else {
links = yield PlacesProvider.links.getTopFrecentSites();
}
links = yield PlacesProvider.links.getTopFrecentSites();

// Get metadata from PreviewProvider
links = yield this.options.getCachedMetadata(links, "TOP_FRECENT_SITES_RESPONSE");
Expand Down
21 changes: 1 addition & 20 deletions addon/PlacesProvider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals XPCOMUtils, Services, gPrincipal, EventEmitter, PlacesUtils, Task, Bookmarks, SyncedTabs, NewTabUtils */
/* globals XPCOMUtils, Services, gPrincipal, EventEmitter, PlacesUtils, Task, Bookmarks, SyncedTabs */

"use strict";

Expand All @@ -9,7 +9,6 @@ const simplePrefs = require("sdk/simple-prefs");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://services-sync/SyncedTabs.jsm");
Cu.import("resource://gre/modules/NewTabUtils.jsm");

XPCOMUtils.defineLazyGetter(this, "EventEmitter", () => {
const {EventEmitter} = Cu.import("resource://devtools/shared/event-emitter.js", {});
Expand Down Expand Up @@ -322,24 +321,6 @@ Links.prototype = {
}
},

asyncGetTopNewTabSites: Task.async(function*() {
const links = NewTabUtils.links.getLinks();
const QUERY_LIMIT = TOP_SITES_LENGTH * 2;
let result = [];
for (let link of links) {
if (!link || link.type === "affiliate" || this.blockedURLs.has(link.url)) {
continue;
}

link.favicon = yield this.getFavicon(link.url);
result.push(link);
if (result.length >= QUERY_LIMIT) {
break;
}
}
return result;
}),

getFavicon: Task.async(function*(url) {
let sqlQuery = `SELECT moz_favicons.mime_type as mimeType, moz_favicons.data as favicon
FROM moz_favicons
Expand Down
16 changes: 1 addition & 15 deletions content-test/addon/Feeds/TopSitesFeed.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
const testLinks = ["foo.com", "bar.com"];
const getCachedMetadata = sites => sites.map(site => site.toUpperCase());
const PlacesProvider = {
links: {
asyncGetTopNewTabSites: sinon.spy(() => Promise.resolve(testLinks)),
getTopFrecentSites: sinon.spy(() => Promise.resolve(testLinks))
}
};
const PlacesProvider = {links: {getTopFrecentSites: sinon.spy(() => Promise.resolve(testLinks))}};
const getScreenshots = sinon.spy(() => Promise.resolve(["foo"]));
const moment = require("moment");
const TopSitesFeed = require("inject!addon/Feeds/TopSitesFeed")({
Expand All @@ -20,7 +15,6 @@ describe("TopSitesFeed", () => {
let reduxState;
beforeEach(() => {
PlacesProvider.links.getTopFrecentSites.reset();
PlacesProvider.links.asyncGetTopNewTabSites.reset();
reduxState = {Experiments: {values: {}}};
instance = new TopSitesFeed({getCachedMetadata});
instance.store = {getState() {return reduxState;}};
Expand Down Expand Up @@ -48,14 +42,6 @@ describe("TopSitesFeed", () => {
assert.equal(action.type, "TOP_FRECENT_SITES_RESPONSE", "type");
assert.deepEqual(action.data, getCachedMetadata(testLinks));
}));
it("should use the original tiles when in the experiment", () => {
reduxState.Experiments.values.originalNewTabSites = true;
return instance.getData().then(() => {
assert.notCalled(PlacesProvider.links.getTopFrecentSites);
assert.calledOnce(PlacesProvider.links.asyncGetTopNewTabSites);
assert.calledWith(instance.options.getCachedMetadata, testLinks, "TOP_FRECENT_SITES_RESPONSE");
});
});
it("should add screenshots when in the experiment", () => {
reduxState.Experiments.values.screenshots = true;
return instance.getData().then(result => {
Expand Down
2 changes: 1 addition & 1 deletion experiments.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
},
"originalNewTabSites": {
"name": "Original about:newtab top sites",
"active": true,
"active": false,
"description": "Use the sites from the original about:newtab",
"control": {
"value": false,
Expand Down

0 comments on commit a318975

Please sign in to comment.