Bug 1426438 - Remove NewTabURL.jsm. r=florian

MozReview-Commit-ID: JDiEzEju3zP

--HG--
extra : rebase_source : 3743879bd6315dc7967163bc91f02c23a45b0d13
This commit is contained in:
Nihanth Subramanya 2017-12-21 00:03:12 +05:30
parent 57f9284cef
commit a0762f90d1
5 changed files with 0 additions and 85 deletions

View File

@ -84,9 +84,6 @@ var whitelist = [
// browser/extensions/pdfjs/content/web/viewer.js
{file: "resource://pdf.js/build/pdf.worker.js"},
// Add-on API introduced in bug 1118285
{file: "resource://app/modules/NewTabURL.jsm"},
// browser/components/newtab bug 1355166
{file: "resource://app/modules/NewTabSearchProvider.jsm"},
{file: "resource://app/modules/NewTabWebChannel.jsm"},

View File

@ -1,33 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {utils: Cu} = Components;
this.EXPORTED_SYMBOLS = ["NewTabURL"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
"@mozilla.org/browser/aboutnewtab-service;1",
"nsIAboutNewTabService");
this.NewTabURL = {
get() {
return aboutNewTabService.newTabURL;
},
get overridden() {
return aboutNewTabService.overridden;
},
override(newURL) {
aboutNewTabService.newTabURL = newURL;
},
reset() {
aboutNewTabService.resetNewTabURL();
}
};

View File

@ -17,7 +17,6 @@ EXTRA_JS_MODULES += [
'NewTabPrefsProvider.jsm',
'NewTabRemoteResources.jsm',
'NewTabSearchProvider.jsm',
'NewTabURL.jsm',
'NewTabWebChannel.jsm'
]

View File

@ -1,47 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
"use strict";
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/NewTabURL.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
"@mozilla.org/browser/aboutnewtab-service;1",
"nsIAboutNewTabService");
add_task(async function() {
let defaultURL = aboutNewTabService.newTabURL;
Services.prefs.setBoolPref("browser.newtabpage.activity-stream.enabled", false);
Assert.equal(NewTabURL.get(), defaultURL, `Default newtab URL should be ${defaultURL}`);
let url = "http://example.com/";
let notificationPromise = promiseNewtabURLNotification(url);
NewTabURL.override(url);
await notificationPromise;
Assert.ok(NewTabURL.overridden, "Newtab URL should be overridden");
Assert.equal(NewTabURL.get(), url, "Newtab URL should be the custom URL");
notificationPromise = promiseNewtabURLNotification(defaultURL);
NewTabURL.reset();
await notificationPromise;
Assert.ok(!NewTabURL.overridden, "Newtab URL should not be overridden");
Assert.equal(NewTabURL.get(), defaultURL, "Newtab URL should be the default");
// change newtab page to activity stream
Services.prefs.setBoolPref("browser.newtabpage.activity-stream.enabled", true);
Assert.equal(NewTabURL.get(), "about:newtab", `Newtab URL should be about:newtab`);
Assert.ok(!NewTabURL.overridden, "Newtab URL should not be overridden");
});
function promiseNewtabURLNotification(aNewURL) {
return new Promise(resolve => {
Services.obs.addObserver(function observer(aSubject, aTopic, aData) { // jshint ignore:line
Services.obs.removeObserver(observer, aTopic);
Assert.equal(aData, aNewURL, "Data for newtab-url-changed notification should be new URL.");
resolve();
}, "newtab-url-changed");
});
}

View File

@ -6,4 +6,3 @@ skip-if = toolkit == 'android'
[test_AboutNewTabService.js]
[test_NewTabPrefsProvider.js]
[test_NewTabSearchProvider.js]
[test_NewTabURL.js]