Bug 1230373 - Enable mozilla/use-services for browser/components/ r=mossop
MozReview-Commit-ID: 9m9iss3jUJJ
This commit is contained in:
@@ -5,5 +5,7 @@ module.exports = {
|
|||||||
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
||||||
// be removed & synced with the mozilla/recommended value.
|
// be removed & synced with the mozilla/recommended value.
|
||||||
"complexity": ["error", 61],
|
"complexity": ["error", 61],
|
||||||
|
|
||||||
|
"mozilla/use-services": "error",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ add_task(async function() {
|
|||||||
// longer, we skip this for now.
|
// longer, we skip this for now.
|
||||||
];
|
];
|
||||||
|
|
||||||
let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
|
||||||
for (let cid in Cc) {
|
for (let cid in Cc) {
|
||||||
let result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
|
let result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@@ -25,7 +24,7 @@ add_task(async function() {
|
|||||||
let contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
|
let contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
|
||||||
try {
|
try {
|
||||||
let am = Cc[contract].getService(Ci.nsIAboutModule);
|
let am = Cc[contract].getService(Ci.nsIAboutModule);
|
||||||
let uri = ios.newURI("about:" + aboutType);
|
let uri = Services.io.newURI("about:" + aboutType);
|
||||||
let flags = am.getURIFlags(uri);
|
let flags = am.getURIFlags(uri);
|
||||||
if (!(flags & Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT) &&
|
if (!(flags & Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT) &&
|
||||||
networkURLs.indexOf(aboutType) == -1) {
|
networkURLs.indexOf(aboutType) == -1) {
|
||||||
|
|||||||
@@ -121,18 +121,13 @@ add_task(async function test_quota_clearStoragesForPrincipal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Using quota manager to clear all indexed DB for a given domain.
|
// Using quota manager to clear all indexed DB for a given domain.
|
||||||
let qms = Cc["@mozilla.org/dom/quota-manager-service;1"].
|
|
||||||
getService(Ci.nsIQuotaManagerService);
|
|
||||||
|
|
||||||
let caUtils = {};
|
let caUtils = {};
|
||||||
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js",
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
scriptLoader.loadSubScript("chrome://global/content/contentAreaUtils.js",
|
|
||||||
caUtils);
|
caUtils);
|
||||||
let httpURI = caUtils.makeURI("http://" + TEST_HOST);
|
let httpURI = caUtils.makeURI("http://" + TEST_HOST);
|
||||||
let httpPrincipal = Services.scriptSecurityManager
|
let httpPrincipal = Services.scriptSecurityManager
|
||||||
.createCodebasePrincipal(httpURI, {});
|
.createCodebasePrincipal(httpURI, {});
|
||||||
qms.clearStoragesForPrincipal(httpPrincipal, null, true);
|
Services.qms.clearStoragesForPrincipal(httpPrincipal, null, true);
|
||||||
|
|
||||||
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
||||||
// Open our tab in the given user context.
|
// Open our tab in the given user context.
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
|
|||||||
Cu.import("resource://gre/modules/ForgetAboutSite.jsm");
|
Cu.import("resource://gre/modules/ForgetAboutSite.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
let {HttpServer} = Cu.import("resource://testing-common/httpd.js", {});
|
let {HttpServer} = Cu.import("resource://testing-common/httpd.js", {});
|
||||||
let LoadContextInfo = Cc["@mozilla.org/load-context-info-factory;1"]
|
|
||||||
.getService(Ci.nsILoadContextInfoFactory);
|
|
||||||
let css = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
|
|
||||||
const USER_CONTEXTS = [
|
const USER_CONTEXTS = [
|
||||||
"default",
|
"default",
|
||||||
@@ -72,18 +68,16 @@ function getCookiesForOA(host, userContextId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createURI(uri) {
|
function createURI(uri) {
|
||||||
let ioServ = Cc["@mozilla.org/network/io-service;1"]
|
return Services.io.newURI(uri);
|
||||||
.getService(Components.interfaces.nsIIOService);
|
|
||||||
return ioServ.newURI(uri);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCacheStorage(where, lci, appcache) {
|
function getCacheStorage(where, lci, appcache) {
|
||||||
if (!lci) lci = LoadContextInfo.default;
|
if (!lci) lci = Services.loadContextInfo.default;
|
||||||
switch (where) {
|
switch (where) {
|
||||||
case "disk": return css.diskCacheStorage(lci, false);
|
case "disk": return Services.cache2.diskCacheStorage(lci, false);
|
||||||
case "memory": return css.memoryCacheStorage(lci);
|
case "memory": return Services.cache2.memoryCacheStorage(lci);
|
||||||
case "appcache": return css.appCacheStorage(lci, appcache);
|
case "appcache": return Services.cache2.appCacheStorage(lci, appcache);
|
||||||
case "pin": return css.pinningCacheStorage(lci);
|
case "pin": return Services.cache2.pinningCacheStorage(lci);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -166,19 +160,19 @@ async function test_cache_cleared() {
|
|||||||
await OpenCacheEntry("http://" + TEST_HOST + "/",
|
await OpenCacheEntry("http://" + TEST_HOST + "/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
LoadContextInfo.custom(false, {userContextId}));
|
Services.loadContextInfo.custom(false, {userContextId}));
|
||||||
|
|
||||||
await OpenCacheEntry("http://" + TEST_HOST + "/",
|
await OpenCacheEntry("http://" + TEST_HOST + "/",
|
||||||
"memory",
|
"memory",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
LoadContextInfo.custom(false, {userContextId}));
|
Services.loadContextInfo.custom(false, {userContextId}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check that caches have been set correctly.
|
// Check that caches have been set correctly.
|
||||||
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
||||||
let mem = getCacheStorage("memory", LoadContextInfo.custom(false, {userContextId}));
|
let mem = getCacheStorage("memory", Services.loadContextInfo.custom(false, {userContextId}));
|
||||||
let disk = getCacheStorage("disk", LoadContextInfo.custom(false, {userContextId}));
|
let disk = getCacheStorage("disk", Services.loadContextInfo.custom(false, {userContextId}));
|
||||||
|
|
||||||
Assert.ok(mem.exists(createURI("http://" + TEST_HOST + "/"), ""), "The memory cache has been set correctly");
|
Assert.ok(mem.exists(createURI("http://" + TEST_HOST + "/"), ""), "The memory cache has been set correctly");
|
||||||
Assert.ok(disk.exists(createURI("http://" + TEST_HOST + "/"), ""), "The disk cache has been set correctly");
|
Assert.ok(disk.exists(createURI("http://" + TEST_HOST + "/"), ""), "The disk cache has been set correctly");
|
||||||
@@ -189,8 +183,8 @@ async function test_cache_cleared() {
|
|||||||
|
|
||||||
// Check that do caches be removed or not?
|
// Check that do caches be removed or not?
|
||||||
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
||||||
let mem = getCacheStorage("memory", LoadContextInfo.custom(false, {userContextId}));
|
let mem = getCacheStorage("memory", Services.loadContextInfo.custom(false, {userContextId}));
|
||||||
let disk = getCacheStorage("disk", LoadContextInfo.custom(false, {userContextId}));
|
let disk = getCacheStorage("disk", Services.loadContextInfo.custom(false, {userContextId}));
|
||||||
|
|
||||||
Assert.ok(!mem.exists(createURI("http://" + TEST_HOST + "/"), ""), "The memory cache is cleared");
|
Assert.ok(!mem.exists(createURI("http://" + TEST_HOST + "/"), ""), "The memory cache is cleared");
|
||||||
Assert.ok(!disk.exists(createURI("http://" + TEST_HOST + "/"), ""), "The disk cache is cleared");
|
Assert.ok(!disk.exists(createURI("http://" + TEST_HOST + "/"), ""), "The disk cache is cleared");
|
||||||
|
|||||||
@@ -31,13 +31,11 @@ DistributionCustomizer.prototype = {
|
|||||||
// For parallel xpcshell testing purposes allow loading the distribution.ini
|
// For parallel xpcshell testing purposes allow loading the distribution.ini
|
||||||
// file from the profile folder through an hidden pref.
|
// file from the profile folder through an hidden pref.
|
||||||
let loadFromProfile = Services.prefs.getBoolPref("distribution.testing.loadFromProfile", false);
|
let loadFromProfile = Services.prefs.getBoolPref("distribution.testing.loadFromProfile", false);
|
||||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
|
||||||
getService(Ci.nsIProperties);
|
|
||||||
|
|
||||||
let iniFile;
|
let iniFile;
|
||||||
try {
|
try {
|
||||||
iniFile = loadFromProfile ? dirSvc.get("ProfD", Ci.nsIFile)
|
iniFile = loadFromProfile ? Services.dirsvc.get("ProfD", Ci.nsIFile)
|
||||||
: dirSvc.get("XREAppDist", Ci.nsIFile);
|
: Services.dirsvc.get("XREAppDist", Ci.nsIFile);
|
||||||
if (loadFromProfile) {
|
if (loadFromProfile) {
|
||||||
iniFile.leafName = "distribution";
|
iniFile.leafName = "distribution";
|
||||||
}
|
}
|
||||||
@@ -100,30 +98,6 @@ DistributionCustomizer.prototype = {
|
|||||||
return this._language;
|
return this._language;
|
||||||
},
|
},
|
||||||
|
|
||||||
get _prefSvc() {
|
|
||||||
let svc = Cc["@mozilla.org/preferences-service;1"].
|
|
||||||
getService(Ci.nsIPrefService);
|
|
||||||
this.__defineGetter__("_prefSvc", () => svc);
|
|
||||||
return this._prefSvc;
|
|
||||||
},
|
|
||||||
|
|
||||||
get _prefs() {
|
|
||||||
let branch = this._prefSvc.getBranch(null);
|
|
||||||
this.__defineGetter__("_prefs", () => branch);
|
|
||||||
return this._prefs;
|
|
||||||
},
|
|
||||||
|
|
||||||
get _ioSvc() {
|
|
||||||
let svc = Cc["@mozilla.org/network/io-service;1"].
|
|
||||||
getService(Ci.nsIIOService);
|
|
||||||
this.__defineGetter__("_ioSvc", () => svc);
|
|
||||||
return this._ioSvc;
|
|
||||||
},
|
|
||||||
|
|
||||||
_makeURI: function DIST__makeURI(spec) {
|
|
||||||
return this._ioSvc.newURI(spec);
|
|
||||||
},
|
|
||||||
|
|
||||||
async _parseBookmarksSection(parentGuid, section) {
|
async _parseBookmarksSection(parentGuid, section) {
|
||||||
let keys = Array.from(enumerate(this._ini.getKeys(section))).sort();
|
let keys = Array.from(enumerate(this._ini.getKeys(section))).sort();
|
||||||
let re = /^item\.(\d+)\.(\w+)\.?(\w*)/;
|
let re = /^item\.(\d+)\.(\w+)\.?(\w*)/;
|
||||||
@@ -211,8 +185,8 @@ DistributionCustomizer.prototype = {
|
|||||||
// Don't bother updating the livemark contents on creation.
|
// Don't bother updating the livemark contents on creation.
|
||||||
let parentId = await PlacesUtils.promiseItemId(parentGuid);
|
let parentId = await PlacesUtils.promiseItemId(parentGuid);
|
||||||
await PlacesUtils.livemarks.addLivemark({
|
await PlacesUtils.livemarks.addLivemark({
|
||||||
feedURI: this._makeURI(item.feedLink),
|
feedURI: Services.io.newURI(item.feedLink),
|
||||||
siteURI: this._makeURI(item.siteLink),
|
siteURI: Services.io.newURI(item.siteLink),
|
||||||
parentId, index, title: item.title
|
parentId, index, title: item.title
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -236,13 +210,13 @@ DistributionCustomizer.prototype = {
|
|||||||
|
|
||||||
if (item.icon && item.iconData) {
|
if (item.icon && item.iconData) {
|
||||||
try {
|
try {
|
||||||
let faviconURI = this._makeURI(item.icon);
|
let faviconURI = Services.io.newURI(item.icon);
|
||||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||||
faviconURI, item.iconData, 0,
|
faviconURI, item.iconData, 0,
|
||||||
Services.scriptSecurityManager.getSystemPrincipal());
|
Services.scriptSecurityManager.getSystemPrincipal());
|
||||||
|
|
||||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||||
this._makeURI(item.link), faviconURI, false,
|
Services.io.newURI(item.link), faviconURI, false,
|
||||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, null,
|
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, null,
|
||||||
Services.scriptSecurityManager.getSystemPrincipal());
|
Services.scriptSecurityManager.getSystemPrincipal());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -278,8 +252,8 @@ DistributionCustomizer.prototype = {
|
|||||||
// nsPrefService loads very early. Reload prefs so we can set
|
// nsPrefService loads very early. Reload prefs so we can set
|
||||||
// distribution defaults during the prefservice:after-app-defaults
|
// distribution defaults during the prefservice:after-app-defaults
|
||||||
// notification (see applyPrefDefaults below)
|
// notification (see applyPrefDefaults below)
|
||||||
this._prefSvc.QueryInterface(Ci.nsIObserver);
|
Services.prefs.QueryInterface(Ci.nsIObserver)
|
||||||
this._prefSvc.observe(null, "reload-default-prefs", null);
|
.observe(null, "reload-default-prefs", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_bookmarksApplied: false,
|
_bookmarksApplied: false,
|
||||||
@@ -313,7 +287,7 @@ DistributionCustomizer.prototype = {
|
|||||||
this._ini.getString("Global", "id") + ".bookmarksProcessed";
|
this._ini.getString("Global", "id") + ".bookmarksProcessed";
|
||||||
}
|
}
|
||||||
|
|
||||||
let bmProcessed = this._prefs.getBoolPref(bmProcessedPref, false);
|
let bmProcessed = Services.prefs.getBoolPref(bmProcessedPref, false);
|
||||||
|
|
||||||
if (!bmProcessed) {
|
if (!bmProcessed) {
|
||||||
if (sections.BookmarksMenu)
|
if (sections.BookmarksMenu)
|
||||||
@@ -322,7 +296,7 @@ DistributionCustomizer.prototype = {
|
|||||||
if (sections.BookmarksToolbar)
|
if (sections.BookmarksToolbar)
|
||||||
await this._parseBookmarksSection(PlacesUtils.bookmarks.toolbarGuid,
|
await this._parseBookmarksSection(PlacesUtils.bookmarks.toolbarGuid,
|
||||||
"BookmarksToolbar");
|
"BookmarksToolbar");
|
||||||
this._prefs.setBoolPref(bmProcessedPref, true);
|
Services.prefs.setBoolPref(bmProcessedPref, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -489,9 +463,7 @@ DistributionCustomizer.prototype = {
|
|||||||
let prefDefaultsApplied = this._prefDefaultsApplied || !this._ini;
|
let prefDefaultsApplied = this._prefDefaultsApplied || !this._ini;
|
||||||
if (this._customizationsApplied && this._bookmarksApplied &&
|
if (this._customizationsApplied && this._bookmarksApplied &&
|
||||||
prefDefaultsApplied) {
|
prefDefaultsApplied) {
|
||||||
let os = Cc["@mozilla.org/observer-service;1"].
|
Services.obs.notifyObservers(null, DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC);
|
||||||
getService(Ci.nsIObserverService);
|
|
||||||
os.notifyObservers(null, DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -625,12 +625,11 @@ XPCOMUtils.defineLazyGetter(this.DownloadsCommon, "error", () => {
|
|||||||
* Returns true if we are executing on Windows Vista or a later version.
|
* Returns true if we are executing on Windows Vista or a later version.
|
||||||
*/
|
*/
|
||||||
XPCOMUtils.defineLazyGetter(DownloadsCommon, "isWinVistaOrHigher", function() {
|
XPCOMUtils.defineLazyGetter(DownloadsCommon, "isWinVistaOrHigher", function() {
|
||||||
let os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
|
let os = Services.appinfo.OS;
|
||||||
if (os != "WINNT") {
|
if (os != "WINNT") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
|
return parseFloat(Services.sysinfo.getProperty("version")) >= 6;
|
||||||
return parseFloat(sysInfo.getProperty("version")) >= 6;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// DownloadsData
|
// DownloadsData
|
||||||
|
|||||||
@@ -17,10 +17,8 @@ add_task(async function test_indicatorDrop() {
|
|||||||
ok(downloadButton, "download button present");
|
ok(downloadButton, "download button present");
|
||||||
await promiseButtonShown(downloadButton.id);
|
await promiseButtonShown(downloadButton.id);
|
||||||
|
|
||||||
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
let EventUtils = {};
|
let EventUtils = {};
|
||||||
scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
||||||
|
|
||||||
async function task_drop(urls) {
|
async function task_drop(urls) {
|
||||||
let dragData = [[{type: "text/plain", data: urls.join("\n")}]];
|
let dragData = [[{type: "text/plain", data: urls.join("\n")}]];
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ registerCleanupFunction(async function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_indicatorDrop() {
|
add_task(async function test_indicatorDrop() {
|
||||||
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
let EventUtils = {};
|
let EventUtils = {};
|
||||||
scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
||||||
|
|
||||||
async function drop(win, urls) {
|
async function drop(win, urls) {
|
||||||
let dragData = [[{type: "text/plain", data: urls.join("\n")}]];
|
let dragData = [[{type: "text/plain", data: urls.join("\n")}]];
|
||||||
|
|||||||
@@ -311,8 +311,7 @@ initDevTools = function() {
|
|||||||
"Only local tab are currently supported by the WebExtensions DevTools API.";
|
"Only local tab are currently supported by the WebExtensions DevTools API.";
|
||||||
let scriptError = Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError);
|
let scriptError = Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError);
|
||||||
scriptError.init(msg, null, null, null, null, Ci.nsIScriptError.warningFlag, "content javascript");
|
scriptError.init(msg, null, null, null, null, Ci.nsIScriptError.warningFlag, "content javascript");
|
||||||
let consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
Services.console.logMessage(scriptError);
|
||||||
consoleService.logMessage(scriptError);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,6 @@
|
|||||||
// The ext-* files are imported into the same scopes.
|
// The ext-* files are imported into the same scopes.
|
||||||
/* import-globals-from ext-browser.js */
|
/* import-globals-from ext-browser.js */
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "strBundle", function() {
|
|
||||||
const stringSvc = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
|
|
||||||
return stringSvc.createBundle("chrome://global/locale/extensions.properties");
|
|
||||||
});
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
||||||
@@ -17,6 +12,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
|||||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||||
"resource://gre/modules/Services.jsm");
|
"resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyGetter(this, "strBundle", function() {
|
||||||
|
return Services.strings.createBundle("chrome://global/locale/extensions.properties");
|
||||||
|
});
|
||||||
|
|
||||||
var {
|
var {
|
||||||
ExtensionError,
|
ExtensionError,
|
||||||
} = ExtensionUtils;
|
} = ExtensionUtils;
|
||||||
|
|||||||
@@ -48,13 +48,10 @@ add_task(async function testIndexedDB() {
|
|||||||
await extension.awaitMessage("indexedDBCreated");
|
await extension.awaitMessage("indexedDBCreated");
|
||||||
await extension.awaitMessage("indexedDBCreated");
|
await extension.awaitMessage("indexedDBCreated");
|
||||||
|
|
||||||
let qms = SpecialPowers.Cc["@mozilla.org/dom/quota-manager-service;1"]
|
|
||||||
.getService(Ci.nsIQuotaManagerService);
|
|
||||||
|
|
||||||
function getOrigins() {
|
function getOrigins() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let origins = [];
|
let origins = [];
|
||||||
qms.getUsage(request => {
|
Services.qms.getUsage(request => {
|
||||||
for (let i = 0; i < request.result.length; ++i) {
|
for (let i = 0; i < request.result.length; ++i) {
|
||||||
if (request.result[i].origin.startsWith("http://mochi.test") ||
|
if (request.result[i].origin.startsWith("http://mochi.test") ||
|
||||||
request.result[i].origin.startsWith("http://example.com")) {
|
request.result[i].origin.startsWith("http://example.com")) {
|
||||||
|
|||||||
@@ -66,8 +66,7 @@ function makeWidgetId(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var focusWindow = async function focusWindow(win) {
|
var focusWindow = async function focusWindow(win) {
|
||||||
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
if (Services.focus.activeWindow == win) {
|
||||||
if (fm.activeWindow == win) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,17 +91,6 @@ function getPrefReaderForType(t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeGetCharPref(pref, defaultValue) {
|
|
||||||
var prefs =
|
|
||||||
Cc["@mozilla.org/preferences-service;1"].
|
|
||||||
getService(Ci.nsIPrefBranch);
|
|
||||||
try {
|
|
||||||
return prefs.getCharPref(pref);
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
function FeedConverter() {
|
function FeedConverter() {
|
||||||
}
|
}
|
||||||
FeedConverter.prototype = {
|
FeedConverter.prototype = {
|
||||||
@@ -193,11 +182,11 @@ FeedConverter.prototype = {
|
|||||||
getService(Ci.nsIFeedResultService);
|
getService(Ci.nsIFeedResultService);
|
||||||
if (!this._forcePreviewPage && result.doc) {
|
if (!this._forcePreviewPage && result.doc) {
|
||||||
let feed = result.doc.QueryInterface(Ci.nsIFeed);
|
let feed = result.doc.QueryInterface(Ci.nsIFeed);
|
||||||
let handler = safeGetCharPref(getPrefActionForType(feed.type), "ask");
|
let handler = Services.prefs.getCharPref(getPrefActionForType(feed.type), "ask");
|
||||||
|
|
||||||
if (handler != "ask") {
|
if (handler != "ask") {
|
||||||
if (handler == "reader")
|
if (handler == "reader")
|
||||||
handler = safeGetCharPref(getPrefReaderForType(feed.type), "bookmarks");
|
handler = Services.prefs.getCharPref(getPrefReaderForType(feed.type), "bookmarks");
|
||||||
switch (handler) {
|
switch (handler) {
|
||||||
case "web":
|
case "web":
|
||||||
let wccr =
|
let wccr =
|
||||||
@@ -230,9 +219,6 @@ FeedConverter.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let ios =
|
|
||||||
Cc["@mozilla.org/network/io-service;1"].
|
|
||||||
getService(Ci.nsIIOService);
|
|
||||||
let chromeChannel;
|
let chromeChannel;
|
||||||
|
|
||||||
// handling a redirect, hence forwarding the loadInfo from the old channel
|
// handling a redirect, hence forwarding the loadInfo from the old channel
|
||||||
@@ -250,8 +236,8 @@ FeedConverter.prototype = {
|
|||||||
feedService.addFeedResult(result);
|
feedService.addFeedResult(result);
|
||||||
|
|
||||||
// Now load the actual XUL document.
|
// Now load the actual XUL document.
|
||||||
let aboutFeedsURI = ios.newURI("about:feeds");
|
let aboutFeedsURI = Services.io.newURI("about:feeds");
|
||||||
chromeChannel = ios.newChannelFromURIWithLoadInfo(aboutFeedsURI, loadInfo);
|
chromeChannel = Services.io.newChannelFromURIWithLoadInfo(aboutFeedsURI, loadInfo);
|
||||||
chromeChannel.originalURI = result.uri;
|
chromeChannel.originalURI = result.uri;
|
||||||
|
|
||||||
// carry the origin attributes from the channel that loaded the feed.
|
// carry the origin attributes from the channel that loaded the feed.
|
||||||
@@ -259,7 +245,7 @@ FeedConverter.prototype = {
|
|||||||
Services.scriptSecurityManager.createCodebasePrincipal(aboutFeedsURI,
|
Services.scriptSecurityManager.createCodebasePrincipal(aboutFeedsURI,
|
||||||
loadInfo.originAttributes);
|
loadInfo.originAttributes);
|
||||||
} else {
|
} else {
|
||||||
chromeChannel = ios.newChannelFromURIWithLoadInfo(result.uri, loadInfo);
|
chromeChannel = Services.io.newChannelFromURIWithLoadInfo(result.uri, loadInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
chromeChannel.loadGroup = this._request.loadGroup;
|
chromeChannel.loadGroup = this._request.loadGroup;
|
||||||
@@ -374,7 +360,7 @@ FeedResultService.prototype = {
|
|||||||
feedReader = "default";
|
feedReader = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
let handler = safeGetCharPref(getPrefActionForType(feedType), "bookmarks");
|
let handler = Services.prefs.getCharPref(getPrefActionForType(feedType), "bookmarks");
|
||||||
if (handler == "ask" || handler == "reader")
|
if (handler == "ask" || handler == "reader")
|
||||||
handler = feedReader;
|
handler = feedReader;
|
||||||
|
|
||||||
@@ -477,10 +463,7 @@ function GenericProtocolHandler() {
|
|||||||
}
|
}
|
||||||
GenericProtocolHandler.prototype = {
|
GenericProtocolHandler.prototype = {
|
||||||
_init(scheme) {
|
_init(scheme) {
|
||||||
let ios =
|
this._http = Services.io.getProtocolHandler("http");
|
||||||
Cc["@mozilla.org/network/io-service;1"].
|
|
||||||
getService(Ci.nsIIOService);
|
|
||||||
this._http = ios.getProtocolHandler("http");
|
|
||||||
this._scheme = scheme;
|
this._scheme = scheme;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -553,9 +536,7 @@ GenericProtocolHandler.prototype = {
|
|||||||
|
|
||||||
newChannel2(aUri, aLoadInfo) {
|
newChannel2(aUri, aLoadInfo) {
|
||||||
let inner = aUri.QueryInterface(Ci.nsINestedURI).innerURI;
|
let inner = aUri.QueryInterface(Ci.nsINestedURI).innerURI;
|
||||||
let channel = Cc["@mozilla.org/network/io-service;1"].
|
let channel = Services.io.newChannelFromURIWithLoadInfo(inner, aLoadInfo);
|
||||||
getService(Ci.nsIIOService).
|
|
||||||
newChannelFromURIWithLoadInfo(inner, aLoadInfo);
|
|
||||||
|
|
||||||
const schemeId = this._getTelemetrySchemeId();
|
const schemeId = this._getTelemetrySchemeId();
|
||||||
Services.telemetry.getHistogramById("FEED_PROTOCOL_USAGE").add(schemeId);
|
Services.telemetry.getHistogramById("FEED_PROTOCOL_USAGE").add(schemeId);
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ const FEEDWRITER_CID = Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}");
|
|||||||
const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1";
|
const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1";
|
||||||
|
|
||||||
function LOG(str) {
|
function LOG(str) {
|
||||||
let prefB = Cc["@mozilla.org/preferences-service;1"].
|
let shouldLog = Services.prefs.getBoolPref("feeds.log", false);
|
||||||
getService(Ci.nsIPrefBranch);
|
|
||||||
|
|
||||||
let shouldLog = prefB.getBoolPref("feeds.log", false);
|
|
||||||
|
|
||||||
if (shouldLog)
|
if (shouldLog)
|
||||||
dump("*** Feeds: " + str + "\n");
|
dump("*** Feeds: " + str + "\n");
|
||||||
@@ -33,10 +30,8 @@ function LOG(str) {
|
|||||||
* @returns an nsIURI object, or null if the creation of the URI failed.
|
* @returns an nsIURI object, or null if the creation of the URI failed.
|
||||||
*/
|
*/
|
||||||
function makeURI(aURLSpec, aCharset) {
|
function makeURI(aURLSpec, aCharset) {
|
||||||
let ios = Cc["@mozilla.org/network/io-service;1"].
|
|
||||||
getService(Ci.nsIIOService);
|
|
||||||
try {
|
try {
|
||||||
return ios.newURI(aURLSpec, aCharset);
|
return Services.io.newURI(aURLSpec, aCharset);
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -124,12 +119,10 @@ FeedWriter.prototype = {
|
|||||||
* The URI spec to set as the href
|
* The URI spec to set as the href
|
||||||
*/
|
*/
|
||||||
_safeSetURIAttribute(element, attribute, uri) {
|
_safeSetURIAttribute(element, attribute, uri) {
|
||||||
let secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
|
||||||
getService(Ci.nsIScriptSecurityManager);
|
|
||||||
const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
|
const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
|
||||||
try {
|
try {
|
||||||
// TODO Is this necessary?
|
// TODO Is this necessary?
|
||||||
secman.checkLoadURIStrWithPrincipal(this._feedPrincipal, uri, flags);
|
Services.scriptSecurityManager.checkLoadURIStrWithPrincipal(this._feedPrincipal, uri, flags);
|
||||||
// checkLoadURIStrWithPrincipal will throw if the link URI should not be
|
// checkLoadURIStrWithPrincipal will throw if the link URI should not be
|
||||||
// loaded, either because our feedURI isn't allowed to load it or per
|
// loaded, either because our feedURI isn't allowed to load it or per
|
||||||
// the rules specified in |flags|, so we'll never "linkify" the link...
|
// the rules specified in |flags|, so we'll never "linkify" the link...
|
||||||
@@ -144,9 +137,7 @@ FeedWriter.prototype = {
|
|||||||
__bundle: null,
|
__bundle: null,
|
||||||
get _bundle() {
|
get _bundle() {
|
||||||
if (!this.__bundle) {
|
if (!this.__bundle) {
|
||||||
this.__bundle = Cc["@mozilla.org/intl/stringbundle;1"].
|
this.__bundle = Services.strings.createBundle(URI_BUNDLE);
|
||||||
getService(Ci.nsIStringBundleService).
|
|
||||||
createBundle(URI_BUNDLE);
|
|
||||||
}
|
}
|
||||||
return this.__bundle;
|
return this.__bundle;
|
||||||
},
|
},
|
||||||
@@ -492,9 +483,7 @@ FeedWriter.prototype = {
|
|||||||
* @returns moz-icon url of the given file as a string
|
* @returns moz-icon url of the given file as a string
|
||||||
*/
|
*/
|
||||||
_getFileIconURL(file) {
|
_getFileIconURL(file) {
|
||||||
let ios = Cc["@mozilla.org/network/io-service;1"].
|
let fph = Services.io.getProtocolHandler("file")
|
||||||
getService(Ci.nsIIOService);
|
|
||||||
let fph = ios.getProtocolHandler("file")
|
|
||||||
.QueryInterface(Ci.nsIFileProtocolHandler);
|
.QueryInterface(Ci.nsIFileProtocolHandler);
|
||||||
let urlSpec = fph.getURLSpecFromFile(file);
|
let urlSpec = fph.getURLSpecFromFile(file);
|
||||||
return "moz-icon://" + urlSpec + "?size=16";
|
return "moz-icon://" + urlSpec + "?size=16";
|
||||||
@@ -801,9 +790,7 @@ FeedWriter.prototype = {
|
|||||||
this._document = window.document;
|
this._document = window.document;
|
||||||
this._handlersList = this._document.getElementById("handlersMenuList");
|
this._handlersList = this._document.getElementById("handlersMenuList");
|
||||||
|
|
||||||
let secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
this._feedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(this._feedURI, {});
|
||||||
getService(Ci.nsIScriptSecurityManager);
|
|
||||||
this._feedPrincipal = secman.createCodebasePrincipal(this._feedURI, {});
|
|
||||||
|
|
||||||
LOG("Subscribe Preview: feed uri = " + this._window.location.href);
|
LOG("Subscribe Preview: feed uri = " + this._window.location.href);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
var Cc = Components.classes;
|
var Cc = Components.classes;
|
||||||
var Ci = Components.interfaces;
|
var Ci = Components.interfaces;
|
||||||
|
var Cu = Components.utils;
|
||||||
var Cr = Components.results;
|
var Cr = Components.results;
|
||||||
|
|
||||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ var Cu = Components.utils;
|
|||||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
var feedFeedURI = ios.newURI("feed://example.com/feed.xml");
|
var feedFeedURI = Services.io.newURI("feed://example.com/feed.xml");
|
||||||
var httpFeedURI = ios.newURI("feed:http://example.com/feed.xml");
|
var httpFeedURI = Services.io.newURI("feed:http://example.com/feed.xml");
|
||||||
var httpURI = ios.newURI("http://example.com/feed.xml");
|
var httpURI = Services.io.newURI("http://example.com/feed.xml");
|
||||||
|
|
||||||
var httpsFeedURI =
|
var httpsFeedURI =
|
||||||
ios.newURI("feed:https://example.com/feed.xml");
|
Services.io.newURI("feed:https://example.com/feed.xml");
|
||||||
var httpsURI = ios.newURI("https://example.com/feed.xml");
|
var httpsURI = Services.io.newURI("https://example.com/feed.xml");
|
||||||
|
|
||||||
var feedChannel = NetUtil.newChannel({
|
var feedChannel = NetUtil.newChannel({
|
||||||
uri: feedFeedURI,
|
uri: feedFeedURI,
|
||||||
@@ -36,8 +36,8 @@ function run_test() {
|
|||||||
do_check_true(httpsURI.equals(httpsChannel.URI));
|
do_check_true(httpsURI.equals(httpsChannel.URI));
|
||||||
|
|
||||||
// check that we throw creating feed: URIs from file and ftp
|
// check that we throw creating feed: URIs from file and ftp
|
||||||
Assert.throws(function() { ios.newURI("feed:ftp://example.com/feed.xml"); },
|
Assert.throws(function() { Services.io.newURI("feed:ftp://example.com/feed.xml"); },
|
||||||
"Should throw an exception when trying to create a feed: URI with an ftp: inner");
|
"Should throw an exception when trying to create a feed: URI with an ftp: inner");
|
||||||
Assert.throws(function() { ios.newURI("feed:file:///var/feed.xml"); },
|
Assert.throws(function() { Services.io.newURI("feed:file:///var/feed.xml"); },
|
||||||
"Should throw an exception when trying to create a feed: URI with a file: inner");
|
"Should throw an exception when trying to create a feed: URI with a file: inner");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
function run_test() {
|
function run_test() {
|
||||||
var success = false;
|
var success = false;
|
||||||
try {
|
try {
|
||||||
ios.newURI("feed:javascript:alert('hi');");
|
Services.io.newURI("feed:javascript:alert('hi');");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ function run_test() {
|
|||||||
|
|
||||||
success = false;
|
success = false;
|
||||||
try {
|
try {
|
||||||
ios.newURI("feed:data:text/html,hi");
|
Services.io.newURI("feed:data:text/html,hi");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ function run_test() {
|
|||||||
|
|
||||||
success = false;
|
success = false;
|
||||||
try {
|
try {
|
||||||
ios.newURI("pcast:javascript:alert('hi');");
|
Services.io.newURI("pcast:javascript:alert('hi');");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ function run_test() {
|
|||||||
|
|
||||||
success = false;
|
success = false;
|
||||||
try {
|
try {
|
||||||
ios.newURI("pcast:data:text/html,hi");
|
Services.io.newURI("pcast:data:text/html,hi");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ var MigrationWizard = { /* exported MigrationWizard */
|
|||||||
},
|
},
|
||||||
|
|
||||||
uninit() {
|
uninit() {
|
||||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
var os = Services.obs;
|
||||||
.getService(Components.interfaces.nsIObserverService);
|
|
||||||
os.removeObserver(this, "Migration:Started");
|
os.removeObserver(this, "Migration:Started");
|
||||||
os.removeObserver(this, "Migration:ItemBeforeMigrate");
|
os.removeObserver(this, "Migration:ItemBeforeMigrate");
|
||||||
os.removeObserver(this, "Migration:ItemAfterMigrate");
|
os.removeObserver(this, "Migration:ItemAfterMigrate");
|
||||||
@@ -419,22 +418,16 @@ var MigrationWizard = { /* exported MigrationWizard */
|
|||||||
if (this._newHomePage) {
|
if (this._newHomePage) {
|
||||||
try {
|
try {
|
||||||
// set homepage properly
|
// set homepage properly
|
||||||
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
|
|
||||||
.getService(Components.interfaces.nsIPrefService);
|
|
||||||
var prefBranch = prefSvc.getBranch(null);
|
|
||||||
|
|
||||||
if (this._newHomePage == "DEFAULT") {
|
if (this._newHomePage == "DEFAULT") {
|
||||||
prefBranch.clearUserPref("browser.startup.homepage");
|
Services.prefs.clearUserPref("browser.startup.homepage");
|
||||||
} else {
|
} else {
|
||||||
prefBranch.setStringPref("browser.startup.homepage",
|
Services.prefs.setStringPref("browser.startup.homepage",
|
||||||
this._newHomePage);
|
this._newHomePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
var prefFile = Services.dirsvc.get("ProfDS", Components.interfaces.nsIFile);
|
||||||
.getService(Components.interfaces.nsIProperties);
|
|
||||||
var prefFile = dirSvc.get("ProfDS", Components.interfaces.nsIFile);
|
|
||||||
prefFile.append("prefs.js");
|
prefFile.append("prefs.js");
|
||||||
prefSvc.savePrefFile(prefFile);
|
Services.prefs.savePrefFile(prefFile);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
dump(ex);
|
dump(ex);
|
||||||
}
|
}
|
||||||
@@ -477,9 +470,7 @@ var MigrationWizard = { /* exported MigrationWizard */
|
|||||||
type = "misc. data";
|
type = "misc. data";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Cc["@mozilla.org/consoleservice;1"]
|
Services.console.logStringMessage("some " + type + " did not successfully migrate.");
|
||||||
.getService(Ci.nsIConsoleService)
|
|
||||||
.logStringMessage("some " + type + " did not successfully migrate.");
|
|
||||||
Services.telemetry.getKeyedHistogramById("FX_MIGRATION_ERRORS")
|
Services.telemetry.getKeyedHistogramById("FX_MIGRATION_ERRORS")
|
||||||
.add(this._source, Math.log2(numericType));
|
.add(this._source, Math.log2(numericType));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -981,9 +981,7 @@ BrowserGlue.prototype = {
|
|||||||
// Call trackStartupCrashEnd here in case the delayed call on startup hasn't
|
// Call trackStartupCrashEnd here in case the delayed call on startup hasn't
|
||||||
// yet occurred (see trackStartupCrashEnd caller in browser.js).
|
// yet occurred (see trackStartupCrashEnd caller in browser.js).
|
||||||
try {
|
try {
|
||||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
|
Services.startup.trackStartupCrashEnd();
|
||||||
.getService(Ci.nsIAppStartup);
|
|
||||||
appStartup.trackStartupCrashEnd();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Cu.reportError("Could not end startup crash tracking in quit-application-granted: " + e);
|
Cu.reportError("Could not end startup crash tracking in quit-application-granted: " + e);
|
||||||
}
|
}
|
||||||
@@ -1381,15 +1379,13 @@ BrowserGlue.prototype = {
|
|||||||
if (!actions || actions.indexOf("silent") != -1)
|
if (!actions || actions.indexOf("silent") != -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
|
|
||||||
getService(Ci.nsIURLFormatter);
|
|
||||||
var appName = gBrandBundle.GetStringFromName("brandShortName");
|
var appName = gBrandBundle.GetStringFromName("brandShortName");
|
||||||
|
|
||||||
function getNotifyString(aPropData) {
|
function getNotifyString(aPropData) {
|
||||||
var propValue = update.getProperty(aPropData.propName);
|
var propValue = update.getProperty(aPropData.propName);
|
||||||
if (!propValue) {
|
if (!propValue) {
|
||||||
if (aPropData.prefName)
|
if (aPropData.prefName)
|
||||||
propValue = formatter.formatURLPref(aPropData.prefName);
|
propValue = Services.urlFormatter.formatURLPref(aPropData.prefName);
|
||||||
else if (aPropData.stringParams)
|
else if (aPropData.stringParams)
|
||||||
propValue = gBrowserBundle.formatStringFromName(aPropData.stringName,
|
propValue = gBrowserBundle.formatStringFromName(aPropData.stringName,
|
||||||
aPropData.stringParams,
|
aPropData.stringParams,
|
||||||
@@ -1696,9 +1692,7 @@ BrowserGlue.prototype = {
|
|||||||
var accessKey = placesBundle.GetStringFromName("lockPromptInfoButton.accessKey");
|
var accessKey = placesBundle.GetStringFromName("lockPromptInfoButton.accessKey");
|
||||||
|
|
||||||
var helpTopic = "places-locked";
|
var helpTopic = "places-locked";
|
||||||
var url = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
|
var url = Services.urlFormatter.formatURLPref("app.support.baseURL");
|
||||||
getService(Components.interfaces.nsIURLFormatter).
|
|
||||||
formatURLPref("app.support.baseURL");
|
|
||||||
url += helpTopic;
|
url += helpTopic;
|
||||||
|
|
||||||
var win = RecentWindow.getMostRecentBrowserWindow();
|
var win = RecentWindow.getMostRecentBrowserWindow();
|
||||||
|
|||||||
@@ -127,9 +127,7 @@ async function doInit(aMode) {
|
|||||||
["network.predictor.enable-prefetch", false]]});
|
["network.predictor.enable-prefetch", false]]});
|
||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
|
|
||||||
randomSuffix = Math.random();
|
randomSuffix = Math.random();
|
||||||
stopObservingChannels = startObservingChannels(aMode);
|
stopObservingChannels = startObservingChannels(aMode);
|
||||||
|
|||||||
@@ -254,16 +254,12 @@ add_task(async function setup() {
|
|||||||
// A clean up function to prevent affecting other tests.
|
// A clean up function to prevent affecting other tests.
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
// Clear all cookies.
|
// Clear all cookies.
|
||||||
let cookieMgr = Cc["@mozilla.org/cookiemanager;1"]
|
Services.cookies.removeAll();
|
||||||
.getService(Ci.nsICookieManager);
|
|
||||||
cookieMgr.removeAll();
|
|
||||||
|
|
||||||
// Clear all image caches and network caches.
|
// Clear all image caches and network caches.
|
||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_favicon_firstParty() {
|
add_task(async function test_favicon_firstParty() {
|
||||||
@@ -271,9 +267,7 @@ add_task(async function test_favicon_firstParty() {
|
|||||||
// Clear all image caches and network caches before running the test.
|
// Clear all image caches and network caches before running the test.
|
||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
|
|
||||||
// Clear Places favicon caches.
|
// Clear Places favicon caches.
|
||||||
await clearAllPlacesFavicons();
|
await clearAllPlacesFavicons();
|
||||||
@@ -292,9 +286,7 @@ add_task(async function test_favicon_cache_firstParty() {
|
|||||||
// Clear all image caches and network caches before running the test.
|
// Clear all image caches and network caches before running the test.
|
||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
|
|
||||||
// Start to observer the event of that favicon has been fully loaded and cached.
|
// Start to observer the event of that favicon has been fully loaded and cached.
|
||||||
let promiseForFaviconLoaded = waitOnFaviconLoaded(THIRD_PARTY_SITE + TEST_FAVICON_CACHE_URI);
|
let promiseForFaviconLoaded = waitOnFaviconLoaded(THIRD_PARTY_SITE + TEST_FAVICON_CACHE_URI);
|
||||||
|
|||||||
@@ -211,16 +211,12 @@ add_task(async function setup() {
|
|||||||
// A clean up function to prevent affecting other tests.
|
// A clean up function to prevent affecting other tests.
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
// Clear all cookies.
|
// Clear all cookies.
|
||||||
let cookieMgr = Cc["@mozilla.org/cookiemanager;1"]
|
Services.cookies.removeAll();
|
||||||
.getService(Ci.nsICookieManager);
|
|
||||||
cookieMgr.removeAll();
|
|
||||||
|
|
||||||
// Clear all image caches and network caches.
|
// Clear all image caches and network caches.
|
||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
|
|
||||||
// Clear Places favicon caches.
|
// Clear Places favicon caches.
|
||||||
clearAllPlacesFavicons();
|
clearAllPlacesFavicons();
|
||||||
@@ -231,9 +227,7 @@ add_task(async function test_favicon_userContextId() {
|
|||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
// Clear all network caches.
|
// Clear all network caches.
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
|
|
||||||
// Clear Places favicon caches.
|
// Clear Places favicon caches.
|
||||||
await clearAllPlacesFavicons();
|
await clearAllPlacesFavicons();
|
||||||
@@ -246,9 +240,7 @@ add_task(async function test_thirdPartyFavicon_userContextId() {
|
|||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
// Clear all network caches.
|
// Clear all network caches.
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
|
|
||||||
// Clear Places favicon caches.
|
// Clear Places favicon caches.
|
||||||
await clearAllPlacesFavicons();
|
await clearAllPlacesFavicons();
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ add_task(async function test_aboutURL() {
|
|||||||
"credits",
|
"credits",
|
||||||
];
|
];
|
||||||
|
|
||||||
let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
|
||||||
for (let cid in Cc) {
|
for (let cid in Cc) {
|
||||||
let result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
|
let result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@@ -152,7 +151,7 @@ add_task(async function test_aboutURL() {
|
|||||||
let contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
|
let contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
|
||||||
try {
|
try {
|
||||||
let am = Cc[contract].getService(Ci.nsIAboutModule);
|
let am = Cc[contract].getService(Ci.nsIAboutModule);
|
||||||
let uri = ios.newURI("about:" + aboutType);
|
let uri = Services.io.newURI("about:" + aboutType);
|
||||||
let flags = am.getURIFlags(uri);
|
let flags = am.getURIFlags(uri);
|
||||||
|
|
||||||
// We load pages with URI_SAFE_FOR_UNTRUSTED_CONTENT set, this means they
|
// We load pages with URI_SAFE_FOR_UNTRUSTED_CONTENT set, this means they
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ function doBefore() {
|
|||||||
imageCache.clearCache(true);
|
imageCache.clearCache(true);
|
||||||
imageCache.clearCache(false);
|
imageCache.clearCache(false);
|
||||||
info("XXX clearning network cache");
|
info("XXX clearning network cache");
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// the test function does nothing on purpose.
|
// the test function does nothing on purpose.
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ function checkCacheExists(aShouldExist) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_task(async function setup() {
|
add_task(async function setup() {
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// This will set the cookies and the cache.
|
// This will set the cookies and the cache.
|
||||||
|
|||||||
@@ -717,8 +717,7 @@ this.PlacesUIUtils = {
|
|||||||
var uri = PlacesUtils._uri(aURINode.uri);
|
var uri = PlacesUtils._uri(aURINode.uri);
|
||||||
if (uri.schemeIs("javascript") || uri.schemeIs("data")) {
|
if (uri.schemeIs("javascript") || uri.schemeIs("data")) {
|
||||||
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
|
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
|
||||||
var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"].
|
var brandShortName = Services.strings.
|
||||||
getService(Ci.nsIStringBundleService).
|
|
||||||
createBundle(BRANDING_BUNDLE_URI).
|
createBundle(BRANDING_BUNDLE_URI).
|
||||||
GetStringFromName("brandShortName");
|
GetStringFromName("brandShortName");
|
||||||
|
|
||||||
@@ -861,8 +860,7 @@ this.PlacesUIUtils = {
|
|||||||
var messageKey = "tabs.openWarningMultipleBranded";
|
var messageKey = "tabs.openWarningMultipleBranded";
|
||||||
var openKey = "tabs.openButtonMultiple";
|
var openKey = "tabs.openButtonMultiple";
|
||||||
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
|
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
|
||||||
var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"].
|
var brandShortName = Services.strings.
|
||||||
getService(Ci.nsIStringBundleService).
|
|
||||||
createBundle(BRANDING_BUNDLE_URI).
|
createBundle(BRANDING_BUNDLE_URI).
|
||||||
GetStringFromName("brandShortName");
|
GetStringFromName("brandShortName");
|
||||||
|
|
||||||
|
|||||||
@@ -620,9 +620,7 @@ var gEditItemOverlay = {
|
|||||||
this._firstEditedField = aNewField;
|
this._firstEditedField = aNewField;
|
||||||
|
|
||||||
// set the pref
|
// set the pref
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].
|
Services.prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField);
|
||||||
getService(Ci.nsIPrefBranch);
|
|
||||||
prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async onNamePickerChange() {
|
async onNamePickerChange() {
|
||||||
|
|||||||
@@ -476,9 +476,7 @@ var PlacesOrganizer = {
|
|||||||
* Prompts for a file and restores bookmarks to those in the file.
|
* Prompts for a file and restores bookmarks to those in the file.
|
||||||
*/
|
*/
|
||||||
onRestoreBookmarksFromFile: function PO_onRestoreBookmarksFromFile() {
|
onRestoreBookmarksFromFile: function PO_onRestoreBookmarksFromFile() {
|
||||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
let backupsDir = Services.dirsvc.get("Desk", Ci.nsIFile);
|
||||||
getService(Ci.nsIProperties);
|
|
||||||
let backupsDir = dirSvc.get("Desk", Ci.nsIFile);
|
|
||||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||||
let fpCallback = aResult => {
|
let fpCallback = aResult => {
|
||||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||||
@@ -507,9 +505,7 @@ var PlacesOrganizer = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// confirm ok to delete existing bookmarks
|
// confirm ok to delete existing bookmarks
|
||||||
var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
if (!Services.prompt.confirm(null,
|
||||||
getService(Ci.nsIPromptService);
|
|
||||||
if (!prompts.confirm(null,
|
|
||||||
PlacesUIUtils.getString("bookmarksRestoreAlertTitle"),
|
PlacesUIUtils.getString("bookmarksRestoreAlertTitle"),
|
||||||
PlacesUIUtils.getString("bookmarksRestoreAlert")))
|
PlacesUIUtils.getString("bookmarksRestoreAlert")))
|
||||||
return;
|
return;
|
||||||
@@ -527,9 +523,7 @@ var PlacesOrganizer = {
|
|||||||
var brandShortName = document.getElementById("brandStrings").
|
var brandShortName = document.getElementById("brandStrings").
|
||||||
getString("brandShortName");
|
getString("brandShortName");
|
||||||
|
|
||||||
Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
Services.prompt.alert(window, brandShortName, aMsg);
|
||||||
getService(Ci.nsIPromptService).
|
|
||||||
alert(window, brandShortName, aMsg);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -538,9 +532,7 @@ var PlacesOrganizer = {
|
|||||||
* of those items.
|
* of those items.
|
||||||
*/
|
*/
|
||||||
backupBookmarks: function PO_backupBookmarks() {
|
backupBookmarks: function PO_backupBookmarks() {
|
||||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
let backupsDir = Services.dirsvc.get("Desk", Ci.nsIFile);
|
||||||
getService(Ci.nsIProperties);
|
|
||||||
let backupsDir = dirSvc.get("Desk", Ci.nsIFile);
|
|
||||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||||
let fpCallback = function fpCallback_done(aResult) {
|
let fpCallback = function fpCallback_done(aResult) {
|
||||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ const DIALOG_URL_MINIMAL_UI = "chrome://browser/content/places/bookmarkPropertie
|
|||||||
|
|
||||||
Cu.import("resource:///modules/RecentWindow.jsm");
|
Cu.import("resource:///modules/RecentWindow.jsm");
|
||||||
var win = RecentWindow.getMostRecentBrowserWindow();
|
var win = RecentWindow.getMostRecentBrowserWindow();
|
||||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
|
||||||
getService(Ci.nsIWindowWatcher);
|
|
||||||
|
|
||||||
function add_bookmark(url) {
|
function add_bookmark(url) {
|
||||||
return PlacesUtils.bookmarks.insert({
|
return PlacesUtils.bookmarks.insert({
|
||||||
@@ -421,7 +419,7 @@ function open_properties_dialog(test) {
|
|||||||
function windowObserver(aSubject, aTopic, aData) {
|
function windowObserver(aSubject, aTopic, aData) {
|
||||||
if (aTopic != "domwindowopened")
|
if (aTopic != "domwindowopened")
|
||||||
return;
|
return;
|
||||||
ww.unregisterNotification(windowObserver);
|
Services.ww.unregisterNotification(windowObserver);
|
||||||
let observerWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
let observerWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||||
waitForFocus(async () => {
|
waitForFocus(async () => {
|
||||||
// Ensure overlay is loaded
|
// Ensure overlay is loaded
|
||||||
@@ -435,7 +433,7 @@ function open_properties_dialog(test) {
|
|||||||
}
|
}
|
||||||
}, observerWindow);
|
}, observerWindow);
|
||||||
}
|
}
|
||||||
ww.registerNotification(windowObserver);
|
Services.ww.registerNotification(windowObserver);
|
||||||
|
|
||||||
var command = null;
|
var command = null;
|
||||||
switch (test.action) {
|
switch (test.action) {
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
// Instead of loading EventUtils.js into the test scope in browser-test.js for all tests,
|
// Instead of loading EventUtils.js into the test scope in browser-test.js for all tests,
|
||||||
// we only need EventUtils.js for a few files which is why we are using loadSubScript.
|
// we only need EventUtils.js for a few files which is why we are using loadSubScript.
|
||||||
var EventUtils = {};
|
var EventUtils = {};
|
||||||
this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
|
||||||
|
|
||||||
add_task(async function test() {
|
add_task(async function test() {
|
||||||
// Make sure the bookmarks bar is visible and restore its state on cleanup.
|
// Make sure the bookmarks bar is visible and restore its state on cleanup.
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
/* import-globals-from ../../base/content/utilityOverlay.js */
|
||||||
|
|
||||||
var gConnectionsDialog = {
|
var gConnectionsDialog = {
|
||||||
beforeAccept() {
|
beforeAccept() {
|
||||||
var proxyTypePref = document.getElementById("network.proxy.type");
|
var proxyTypePref = document.getElementById("network.proxy.type");
|
||||||
@@ -99,11 +101,8 @@ var gConnectionsDialog = {
|
|||||||
var typedURL = document.getElementById("networkProxyAutoconfigURL").value;
|
var typedURL = document.getElementById("networkProxyAutoconfigURL").value;
|
||||||
var proxyTypeCur = document.getElementById("network.proxy.type").value;
|
var proxyTypeCur = document.getElementById("network.proxy.type").value;
|
||||||
|
|
||||||
var prefs =
|
var pacURL = Services.prefs.getCharPref("network.proxy.autoconfig_url");
|
||||||
Components.classes["@mozilla.org/preferences-service;1"].
|
var proxyType = Services.prefs.getIntPref("network.proxy.type");
|
||||||
getService(Components.interfaces.nsIPrefBranch);
|
|
||||||
var pacURL = prefs.getCharPref("network.proxy.autoconfig_url");
|
|
||||||
var proxyType = prefs.getIntPref("network.proxy.type");
|
|
||||||
|
|
||||||
var disableReloadPref =
|
var disableReloadPref =
|
||||||
document.getElementById("pref.advanced.proxies.disable_button.reload");
|
document.getElementById("pref.advanced.proxies.disable_button.reload");
|
||||||
@@ -168,10 +167,9 @@ var gConnectionsDialog = {
|
|||||||
doAutoconfigURLFixup() {
|
doAutoconfigURLFixup() {
|
||||||
var autoURL = document.getElementById("networkProxyAutoconfigURL");
|
var autoURL = document.getElementById("networkProxyAutoconfigURL");
|
||||||
var autoURLPref = document.getElementById("network.proxy.autoconfig_url");
|
var autoURLPref = document.getElementById("network.proxy.autoconfig_url");
|
||||||
var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
|
|
||||||
.getService(Components.interfaces.nsIURIFixup);
|
|
||||||
try {
|
try {
|
||||||
autoURLPref.value = autoURL.value = URIFixup.createFixupURI(autoURL.value, 0).spec;
|
autoURLPref.value = autoURL.value =
|
||||||
|
Services.uriFixup.createFixupURI(autoURL.value, 0).spec;
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -16,18 +16,14 @@ XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
|
|||||||
"resource://gre/modules/ContextualIdentityService.jsm");
|
"resource://gre/modules/ContextualIdentityService.jsm");
|
||||||
|
|
||||||
var gCookiesWindow = {
|
var gCookiesWindow = {
|
||||||
_cm: Components.classes["@mozilla.org/cookiemanager;1"]
|
|
||||||
.getService(Components.interfaces.nsICookieManager),
|
|
||||||
_hosts: {},
|
_hosts: {},
|
||||||
_hostOrder: [],
|
_hostOrder: [],
|
||||||
_tree: null,
|
_tree: null,
|
||||||
_bundle: null,
|
_bundle: null,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
Services.obs.addObserver(this, "cookie-changed");
|
||||||
.getService(Components.interfaces.nsIObserverService);
|
Services.obs.addObserver(this, "perm-changed");
|
||||||
os.addObserver(this, "cookie-changed");
|
|
||||||
os.addObserver(this, "perm-changed");
|
|
||||||
|
|
||||||
this._bundle = document.getElementById("bundlePreferences");
|
this._bundle = document.getElementById("bundlePreferences");
|
||||||
this._tree = document.getElementById("cookiesList");
|
this._tree = document.getElementById("cookiesList");
|
||||||
@@ -47,10 +43,8 @@ var gCookiesWindow = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
uninit() {
|
uninit() {
|
||||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
Services.obs.removeObserver(this, "cookie-changed");
|
||||||
.getService(Components.interfaces.nsIObserverService);
|
Services.obs.removeObserver(this, "perm-changed");
|
||||||
os.removeObserver(this, "cookie-changed");
|
|
||||||
os.removeObserver(this, "perm-changed");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateList(aInitialLoad) {
|
_populateList(aInitialLoad) {
|
||||||
@@ -475,7 +469,7 @@ var gCookiesWindow = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_loadCookies() {
|
_loadCookies() {
|
||||||
var e = this._cm.enumerator;
|
var e = Services.cookies.enumerator;
|
||||||
var hostCount = { value: 0 };
|
var hostCount = { value: 0 };
|
||||||
this._hosts = {};
|
this._hosts = {};
|
||||||
this._hostOrder = [];
|
this._hostOrder = [];
|
||||||
@@ -576,13 +570,11 @@ var gCookiesWindow = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
performDeletion: function gCookiesWindow_performDeletion(deleteItems) {
|
performDeletion: function gCookiesWindow_performDeletion(deleteItems) {
|
||||||
var psvc = Components.classes["@mozilla.org/preferences-service;1"]
|
|
||||||
.getService(Components.interfaces.nsIPrefBranch);
|
|
||||||
var blockFutureCookies = false;
|
var blockFutureCookies = false;
|
||||||
if (psvc.prefHasUserValue("network.cookie.blockFutureCookies"))
|
if (Services.prefs.prefHasUserValue("network.cookie.blockFutureCookies"))
|
||||||
blockFutureCookies = psvc.getBoolPref("network.cookie.blockFutureCookies");
|
blockFutureCookies = Services.prefs.getBoolPref("network.cookie.blockFutureCookies");
|
||||||
for (let item of deleteItems) {
|
for (let item of deleteItems) {
|
||||||
this._cm.remove(item.host, item.name, item.path,
|
Services.cookies.remove(item.host, item.name, item.path,
|
||||||
blockFutureCookies, item.originAttributes);
|
blockFutureCookies, item.originAttributes);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -722,7 +714,7 @@ var gCookiesWindow = {
|
|||||||
this._tree.treeBoxObject.rowCountChanged(0, -rowCount);
|
this._tree.treeBoxObject.rowCountChanged(0, -rowCount);
|
||||||
this.performDeletion(deleteItems);
|
this.performDeletion(deleteItems);
|
||||||
} else {
|
} else {
|
||||||
this._cm.removeAll();
|
Services.cookies.removeAll();
|
||||||
}
|
}
|
||||||
this._updateRemoveAllButton();
|
this._updateRemoveAllButton();
|
||||||
this.focusFilterBox();
|
this.focusFilterBox();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ Components.utils.import("resource://gre/modules/Downloads.jsm");
|
|||||||
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
||||||
Components.utils.import("resource:///modules/ShellService.jsm");
|
Components.utils.import("resource:///modules/ShellService.jsm");
|
||||||
Components.utils.import("resource:///modules/TransientPrefs.jsm");
|
Components.utils.import("resource:///modules/TransientPrefs.jsm");
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||||
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
|
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
|
||||||
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
|
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
|
||||||
@@ -149,9 +148,6 @@ var gMainPane = {
|
|||||||
return this._filter = document.getElementById("filter");
|
return this._filter = document.getElementById("filter");
|
||||||
},
|
},
|
||||||
|
|
||||||
_prefSvc: Cc["@mozilla.org/preferences-service;1"].
|
|
||||||
getService(Ci.nsIPrefBranch),
|
|
||||||
|
|
||||||
_mimeSvc: Cc["@mozilla.org/mime;1"].
|
_mimeSvc: Cc["@mozilla.org/mime;1"].
|
||||||
getService(Ci.nsIMIMEService),
|
getService(Ci.nsIMIMEService),
|
||||||
|
|
||||||
@@ -161,9 +157,6 @@ var gMainPane = {
|
|||||||
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
|
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
|
||||||
getService(Ci.nsIHandlerService),
|
getService(Ci.nsIHandlerService),
|
||||||
|
|
||||||
_ioSvc: Cc["@mozilla.org/network/io-service;1"].
|
|
||||||
getService(Ci.nsIIOService),
|
|
||||||
|
|
||||||
_backoffIndex: 0,
|
_backoffIndex: 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -239,9 +232,7 @@ var gMainPane = {
|
|||||||
if (AppConstants.platform == "win") {
|
if (AppConstants.platform == "win") {
|
||||||
// Functionality for "Show tabs in taskbar" on Windows 7 and up.
|
// Functionality for "Show tabs in taskbar" on Windows 7 and up.
|
||||||
try {
|
try {
|
||||||
let sysInfo = Cc["@mozilla.org/system-info;1"].
|
let ver = parseFloat(Services.sysinfo.getProperty("version"));
|
||||||
getService(Ci.nsIPropertyBag2);
|
|
||||||
let ver = parseFloat(sysInfo.getProperty("version"));
|
|
||||||
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
|
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
|
||||||
showTabsInTaskbar.hidden = ver < 6.1;
|
showTabsInTaskbar.hidden = ver < 6.1;
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
@@ -399,22 +390,22 @@ var gMainPane = {
|
|||||||
|
|
||||||
// Observe preferences that influence what we display so we can rebuild
|
// Observe preferences that influence what we display so we can rebuild
|
||||||
// the view when they change.
|
// the view when they change.
|
||||||
this._prefSvc.addObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
|
Services.prefs.addObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
|
||||||
this._prefSvc.addObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
|
Services.prefs.addObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
|
||||||
this._prefSvc.addObserver(PREF_FEED_SELECTED_APP, this);
|
Services.prefs.addObserver(PREF_FEED_SELECTED_APP, this);
|
||||||
this._prefSvc.addObserver(PREF_FEED_SELECTED_WEB, this);
|
Services.prefs.addObserver(PREF_FEED_SELECTED_WEB, this);
|
||||||
this._prefSvc.addObserver(PREF_FEED_SELECTED_ACTION, this);
|
Services.prefs.addObserver(PREF_FEED_SELECTED_ACTION, this);
|
||||||
this._prefSvc.addObserver(PREF_FEED_SELECTED_READER, this);
|
Services.prefs.addObserver(PREF_FEED_SELECTED_READER, this);
|
||||||
|
|
||||||
this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_APP, this);
|
Services.prefs.addObserver(PREF_VIDEO_FEED_SELECTED_APP, this);
|
||||||
this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_WEB, this);
|
Services.prefs.addObserver(PREF_VIDEO_FEED_SELECTED_WEB, this);
|
||||||
this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this);
|
Services.prefs.addObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this);
|
||||||
this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_READER, this);
|
Services.prefs.addObserver(PREF_VIDEO_FEED_SELECTED_READER, this);
|
||||||
|
|
||||||
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_APP, this);
|
Services.prefs.addObserver(PREF_AUDIO_FEED_SELECTED_APP, this);
|
||||||
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
|
Services.prefs.addObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
|
||||||
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
|
Services.prefs.addObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
|
||||||
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
|
Services.prefs.addObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
|
||||||
|
|
||||||
setEventListener("filter", "command", gMainPane.filter);
|
setEventListener("filter", "command", gMainPane.filter);
|
||||||
setEventListener("handlersView", "select",
|
setEventListener("handlersView", "select",
|
||||||
@@ -451,9 +442,7 @@ var gMainPane = {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Notify observers that the UI is now ready
|
// Notify observers that the UI is now ready
|
||||||
Components.classes["@mozilla.org/observer-service;1"]
|
Services.obs.notifyObservers(window, "main-pane-loaded");
|
||||||
.getService(Components.interfaces.nsIObserverService)
|
|
||||||
.notifyObservers(window, "main-pane-loaded");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
preInit() {
|
preInit() {
|
||||||
@@ -512,7 +501,7 @@ var gMainPane = {
|
|||||||
document.getElementById("browserContainersbox").setAttribute("data-hidden-from-search", "true");
|
document.getElementById("browserContainersbox").setAttribute("data-hidden-from-search", "true");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._prefSvc.addObserver(PREF_CONTAINERS_EXTENSION, this);
|
Services.prefs.addObserver(PREF_CONTAINERS_EXTENSION, this);
|
||||||
|
|
||||||
const link = document.getElementById("browserContainersLearnMore");
|
const link = document.getElementById("browserContainersLearnMore");
|
||||||
link.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "containers";
|
link.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "containers";
|
||||||
@@ -573,9 +562,7 @@ var gMainPane = {
|
|||||||
onGetStarted(aEvent) {
|
onGetStarted(aEvent) {
|
||||||
if (AppConstants.MOZ_DEV_EDITION) {
|
if (AppConstants.MOZ_DEV_EDITION) {
|
||||||
const Cc = Components.classes, Ci = Components.interfaces;
|
const Cc = Components.classes, Ci = Components.interfaces;
|
||||||
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
|
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
.getService(Ci.nsIWindowMediator);
|
|
||||||
let win = wm.getMostRecentWindow("navigator:browser");
|
|
||||||
|
|
||||||
fxAccounts.getSignedInUser().then(data => {
|
fxAccounts.getSignedInUser().then(data => {
|
||||||
if (win) {
|
if (win) {
|
||||||
@@ -760,9 +747,7 @@ var gMainPane = {
|
|||||||
var tabs = [];
|
var tabs = [];
|
||||||
|
|
||||||
const Cc = Components.classes, Ci = Components.interfaces;
|
const Cc = Components.classes, Ci = Components.interfaces;
|
||||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
|
win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
.getService(Ci.nsIWindowMediator);
|
|
||||||
win = wm.getMostRecentWindow("navigator:browser");
|
|
||||||
|
|
||||||
if (win && win.document.documentElement
|
if (win && win.document.documentElement
|
||||||
.getAttribute("windowtype") == "navigator:browser") {
|
.getAttribute("windowtype") == "navigator:browser") {
|
||||||
@@ -1333,24 +1318,24 @@ var gMainPane = {
|
|||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
window.removeEventListener("unload", this);
|
window.removeEventListener("unload", this);
|
||||||
this._prefSvc.removeObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
|
Services.prefs.removeObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
|
||||||
this._prefSvc.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
|
Services.prefs.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
|
||||||
this._prefSvc.removeObserver(PREF_FEED_SELECTED_APP, this);
|
Services.prefs.removeObserver(PREF_FEED_SELECTED_APP, this);
|
||||||
this._prefSvc.removeObserver(PREF_FEED_SELECTED_WEB, this);
|
Services.prefs.removeObserver(PREF_FEED_SELECTED_WEB, this);
|
||||||
this._prefSvc.removeObserver(PREF_FEED_SELECTED_ACTION, this);
|
Services.prefs.removeObserver(PREF_FEED_SELECTED_ACTION, this);
|
||||||
this._prefSvc.removeObserver(PREF_FEED_SELECTED_READER, this);
|
Services.prefs.removeObserver(PREF_FEED_SELECTED_READER, this);
|
||||||
|
|
||||||
this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_APP, this);
|
Services.prefs.removeObserver(PREF_VIDEO_FEED_SELECTED_APP, this);
|
||||||
this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_WEB, this);
|
Services.prefs.removeObserver(PREF_VIDEO_FEED_SELECTED_WEB, this);
|
||||||
this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this);
|
Services.prefs.removeObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this);
|
||||||
this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_READER, this);
|
Services.prefs.removeObserver(PREF_VIDEO_FEED_SELECTED_READER, this);
|
||||||
|
|
||||||
this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_APP, this);
|
Services.prefs.removeObserver(PREF_AUDIO_FEED_SELECTED_APP, this);
|
||||||
this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
|
Services.prefs.removeObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
|
||||||
this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
|
Services.prefs.removeObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
|
||||||
this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
|
Services.prefs.removeObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
|
||||||
|
|
||||||
this._prefSvc.removeObserver(PREF_CONTAINERS_EXTENSION, this);
|
Services.prefs.removeObserver(PREF_CONTAINERS_EXTENSION, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -1507,9 +1492,9 @@ var gMainPane = {
|
|||||||
this._visibleTypeDescriptionCount = {};
|
this._visibleTypeDescriptionCount = {};
|
||||||
|
|
||||||
// Get the preferences that help determine what types to show.
|
// Get the preferences that help determine what types to show.
|
||||||
var showPlugins = this._prefSvc.getBoolPref(PREF_SHOW_PLUGINS_IN_LIST);
|
var showPlugins = Services.prefs.getBoolPref(PREF_SHOW_PLUGINS_IN_LIST);
|
||||||
var hidePluginsWithoutExtensions =
|
var hidePluginsWithoutExtensions =
|
||||||
this._prefSvc.getBoolPref(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS);
|
Services.prefs.getBoolPref(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS);
|
||||||
|
|
||||||
for (let type in this._handledTypes) {
|
for (let type in this._handledTypes) {
|
||||||
// Yield before processing each handler info object to avoid monopolizing
|
// Yield before processing each handler info object to avoid monopolizing
|
||||||
@@ -2248,7 +2233,7 @@ var gMainPane = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getIconURLForFile(aFile) {
|
_getIconURLForFile(aFile) {
|
||||||
var fph = this._ioSvc.getProtocolHandler("file").
|
var fph = Services.io.getProtocolHandler("file").
|
||||||
QueryInterface(Ci.nsIFileProtocolHandler);
|
QueryInterface(Ci.nsIFileProtocolHandler);
|
||||||
var urlSpec = fph.getURLSpecFromFile(aFile);
|
var urlSpec = fph.getURLSpecFromFile(aFile);
|
||||||
|
|
||||||
@@ -2256,7 +2241,7 @@ var gMainPane = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getIconURLForWebApp(aWebAppURITemplate) {
|
_getIconURLForWebApp(aWebAppURITemplate) {
|
||||||
var uri = this._ioSvc.newURI(aWebAppURITemplate);
|
var uri = Services.io.newURI(aWebAppURITemplate);
|
||||||
|
|
||||||
// Unfortunately we can't use the favicon service to get the favicon,
|
// Unfortunately we can't use the favicon service to get the favicon,
|
||||||
// because the service looks in the annotations table for a record with
|
// because the service looks in the annotations table for a record with
|
||||||
@@ -2265,7 +2250,7 @@ var gMainPane = {
|
|||||||
// they'll only visit URLs derived from that template (i.e. with %s
|
// they'll only visit URLs derived from that template (i.e. with %s
|
||||||
// in the template replaced by the URL of the content being handled).
|
// in the template replaced by the URL of the content being handled).
|
||||||
|
|
||||||
if (/^https?$/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
|
if (/^https?$/.test(uri.scheme) && Services.prefs.getBoolPref("browser.chrome.favicons"))
|
||||||
return uri.prePath + "/favicon.ico";
|
return uri.prePath + "/favicon.ico";
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@@ -2485,9 +2470,7 @@ var gMainPane = {
|
|||||||
var currentDirPref = document.getElementById("browser.download.dir");
|
var currentDirPref = document.getElementById("browser.download.dir");
|
||||||
|
|
||||||
// Used in defining the correct path to the folder icon.
|
// Used in defining the correct path to the folder icon.
|
||||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
var fph = Services.io.getProtocolHandler("file")
|
||||||
.getService(Components.interfaces.nsIIOService);
|
|
||||||
var fph = ios.getProtocolHandler("file")
|
|
||||||
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
|
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
|
||||||
var iconUrlSpec;
|
var iconUrlSpec;
|
||||||
|
|
||||||
@@ -2538,9 +2521,7 @@ var gMainPane = {
|
|||||||
async _getDownloadsFolder(aFolder) {
|
async _getDownloadsFolder(aFolder) {
|
||||||
switch (aFolder) {
|
switch (aFolder) {
|
||||||
case "Desktop":
|
case "Desktop":
|
||||||
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
|
return Services.dirsvc.get("Desk", Components.interfaces.nsIFile);
|
||||||
.getService(Components.interfaces.nsIProperties);
|
|
||||||
return fileLoc.get("Desk", Components.interfaces.nsIFile);
|
|
||||||
case "Downloads":
|
case "Downloads":
|
||||||
let downloadsDir = await Downloads.getSystemDownloadsDirectory();
|
let downloadsDir = await Downloads.getSystemDownloadsDirectory();
|
||||||
return new FileUtils.File(downloadsDir);
|
return new FileUtils.File(downloadsDir);
|
||||||
@@ -2741,9 +2722,6 @@ HandlerInfoWrapper.prototype = {
|
|||||||
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
|
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
|
||||||
getService(Ci.nsIHandlerService),
|
getService(Ci.nsIHandlerService),
|
||||||
|
|
||||||
_prefSvc: Cc["@mozilla.org/preferences-service;1"].
|
|
||||||
getService(Ci.nsIPrefBranch),
|
|
||||||
|
|
||||||
_categoryMgr: Cc["@mozilla.org/categorymanager;1"].
|
_categoryMgr: Cc["@mozilla.org/categorymanager;1"].
|
||||||
getService(Ci.nsICategoryManager),
|
getService(Ci.nsICategoryManager),
|
||||||
|
|
||||||
@@ -2940,8 +2918,8 @@ HandlerInfoWrapper.prototype = {
|
|||||||
_getDisabledPluginTypes() {
|
_getDisabledPluginTypes() {
|
||||||
var types = "";
|
var types = "";
|
||||||
|
|
||||||
if (this._prefSvc.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES))
|
if (Services.prefs.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES))
|
||||||
types = this._prefSvc.getCharPref(PREF_DISABLED_PLUGIN_TYPES);
|
types = Services.prefs.getCharPref(PREF_DISABLED_PLUGIN_TYPES);
|
||||||
|
|
||||||
// Only split if the string isn't empty so we don't end up with an array
|
// Only split if the string isn't empty so we don't end up with an array
|
||||||
// containing a single empty string.
|
// containing a single empty string.
|
||||||
@@ -2957,7 +2935,7 @@ HandlerInfoWrapper.prototype = {
|
|||||||
if (disabledPluginTypes.indexOf(this.type) == -1)
|
if (disabledPluginTypes.indexOf(this.type) == -1)
|
||||||
disabledPluginTypes.push(this.type);
|
disabledPluginTypes.push(this.type);
|
||||||
|
|
||||||
this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
|
Services.prefs.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
|
||||||
disabledPluginTypes.join(","));
|
disabledPluginTypes.join(","));
|
||||||
|
|
||||||
// Update the category manager so existing browser windows update.
|
// Update the category manager so existing browser windows update.
|
||||||
@@ -2972,7 +2950,7 @@ HandlerInfoWrapper.prototype = {
|
|||||||
var type = this.type;
|
var type = this.type;
|
||||||
disabledPluginTypes = disabledPluginTypes.filter(v => v != type);
|
disabledPluginTypes = disabledPluginTypes.filter(v => v != type);
|
||||||
|
|
||||||
this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
|
Services.prefs.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
|
||||||
disabledPluginTypes.join(","));
|
disabledPluginTypes.join(","));
|
||||||
|
|
||||||
// Update the category manager so existing browser windows update.
|
// Update the category manager so existing browser windows update.
|
||||||
|
|||||||
@@ -254,7 +254,6 @@ function confirmRestartPrompt(aRestartToEnable, aDefaultButtonIndex,
|
|||||||
"featureDisableRequiresRestart",
|
"featureDisableRequiresRestart",
|
||||||
[brandName]);
|
[brandName]);
|
||||||
let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);
|
let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);
|
||||||
let prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
|
|
||||||
|
|
||||||
// Set up the first (index 0) button:
|
// Set up the first (index 0) button:
|
||||||
let button0Text = bundle.getFormattedString("okToRestartButton", [brandName]);
|
let button0Text = bundle.getFormattedString("okToRestartButton", [brandName]);
|
||||||
@@ -295,7 +294,7 @@ function confirmRestartPrompt(aRestartToEnable, aDefaultButtonIndex,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let buttonIndex = prompts.confirmEx(window, title, msg, buttonFlags,
|
let buttonIndex = Services.prompt.confirmEx(window, title, msg, buttonFlags,
|
||||||
button0Text, button1Text, button2Text,
|
button0Text, button1Text, button2Text,
|
||||||
null, {});
|
null, {});
|
||||||
|
|
||||||
|
|||||||
@@ -322,9 +322,7 @@ var gPrivacyPane = {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Notify observers that the UI is now ready
|
// Notify observers that the UI is now ready
|
||||||
Components.classes["@mozilla.org/observer-service;1"]
|
Services.obs.notifyObservers(window, "privacy-pane-loaded");
|
||||||
.getService(Components.interfaces.nsIObserverService)
|
|
||||||
.notifyObservers(window, "privacy-pane-loaded");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// TRACKING PROTECTION MODE
|
// TRACKING PROTECTION MODE
|
||||||
@@ -582,9 +580,7 @@ var gPrivacyPane = {
|
|||||||
true, false);
|
true, false);
|
||||||
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
|
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
|
||||||
pref.value = autoStart.hasAttribute("checked");
|
pref.value = autoStart.hasAttribute("checked");
|
||||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
|
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||||
.getService(Ci.nsIAppStartup);
|
|
||||||
appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1002,10 +998,8 @@ var gPrivacyPane = {
|
|||||||
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
|
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
|
||||||
getService(Ci.nsIPKCS11ModuleDB);
|
getService(Ci.nsIPKCS11ModuleDB);
|
||||||
if (secmodDB.isFIPSEnabled) {
|
if (secmodDB.isFIPSEnabled) {
|
||||||
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
|
||||||
getService(Ci.nsIPromptService);
|
|
||||||
var bundle = document.getElementById("bundlePreferences");
|
var bundle = document.getElementById("bundlePreferences");
|
||||||
promptService.alert(window,
|
Services.prompt.alert(window,
|
||||||
bundle.getString("pw_change_failed_title"),
|
bundle.getString("pw_change_failed_title"),
|
||||||
bundle.getString("pw_change2empty_in_fips_mode"));
|
bundle.getString("pw_change2empty_in_fips_mode"));
|
||||||
this._initMasterPasswordUI();
|
this._initMasterPasswordUI();
|
||||||
@@ -1250,9 +1244,7 @@ var gPrivacyPane = {
|
|||||||
*/
|
*/
|
||||||
clearCache() {
|
clearCache() {
|
||||||
try {
|
try {
|
||||||
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Components.interfaces.nsICacheStorageService);
|
|
||||||
cache.clear();
|
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
this.updateActualCacheSize();
|
this.updateActualCacheSize();
|
||||||
},
|
},
|
||||||
@@ -1332,10 +1324,7 @@ var gPrivacyPane = {
|
|||||||
actualSizeLabel.textContent = prefStrBundle.getString("actualDiskCacheSizeCalculated");
|
actualSizeLabel.textContent = prefStrBundle.getString("actualDiskCacheSizeCalculated");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var cacheService =
|
Services.cache2.asyncGetDiskConsumption(this.observer);
|
||||||
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
|
||||||
.getService(Components.interfaces.nsICacheStorageService);
|
|
||||||
cacheService.asyncGetDiskConsumption(this.observer);
|
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1486,11 +1475,7 @@ var gPrivacyPane = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var cacheService =
|
Services.cache2.asyncVisitStorage(visitor, false);
|
||||||
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
|
||||||
.getService(Components.interfaces.nsICacheStorageService);
|
|
||||||
var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
|
|
||||||
storage.asyncVisitStorage(visitor, false);
|
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1529,9 +1514,6 @@ var gPrivacyPane = {
|
|||||||
* Updates the list of offline applications
|
* Updates the list of offline applications
|
||||||
*/
|
*/
|
||||||
updateOfflineApps() {
|
updateOfflineApps() {
|
||||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
|
||||||
.getService(Components.interfaces.nsIPermissionManager);
|
|
||||||
|
|
||||||
var list = document.getElementById("offlineAppsList");
|
var list = document.getElementById("offlineAppsList");
|
||||||
while (list.firstChild) {
|
while (list.firstChild) {
|
||||||
list.firstChild.remove();
|
list.firstChild.remove();
|
||||||
@@ -1548,7 +1530,7 @@ var gPrivacyPane = {
|
|||||||
|
|
||||||
var bundle = document.getElementById("bundlePreferences");
|
var bundle = document.getElementById("bundlePreferences");
|
||||||
|
|
||||||
var enumerator = pm.enumerator;
|
var enumerator = Services.perms.enumerator;
|
||||||
while (enumerator.hasMoreElements()) {
|
while (enumerator.hasMoreElements()) {
|
||||||
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
|
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
|
||||||
if (perm.type == "offline-app" &&
|
if (perm.type == "offline-app" &&
|
||||||
@@ -1574,24 +1556,20 @@ var gPrivacyPane = {
|
|||||||
var origin = item.getAttribute("origin");
|
var origin = item.getAttribute("origin");
|
||||||
var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
|
var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
|
||||||
|
|
||||||
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
var flags = Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 +
|
||||||
.getService(Components.interfaces.nsIPromptService);
|
Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1;
|
||||||
var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
|
|
||||||
prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
|
|
||||||
|
|
||||||
var bundle = document.getElementById("bundlePreferences");
|
var bundle = document.getElementById("bundlePreferences");
|
||||||
var title = bundle.getString("offlineAppRemoveTitle");
|
var title = bundle.getString("offlineAppRemoveTitle");
|
||||||
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
|
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
|
||||||
var confirm = bundle.getString("offlineAppRemoveConfirm");
|
var confirm = bundle.getString("offlineAppRemoveConfirm");
|
||||||
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
|
var result = Services.prompt.confirmEx(window, title, prompt, flags, confirm,
|
||||||
null, null, null, {});
|
null, null, null, {});
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// get the permission
|
// get the permission
|
||||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
var perm = Services.perms.getPermissionObject(principal, "offline-app", true);
|
||||||
.getService(Components.interfaces.nsIPermissionManager);
|
|
||||||
var perm = pm.getPermissionObject(principal, "offline-app", true);
|
|
||||||
if (perm) {
|
if (perm) {
|
||||||
// clear offline cache entries
|
// clear offline cache entries
|
||||||
try {
|
try {
|
||||||
@@ -1607,7 +1585,7 @@ var gPrivacyPane = {
|
|||||||
}
|
}
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
|
|
||||||
pm.removePermission(perm);
|
Services.perms.removePermission(perm);
|
||||||
}
|
}
|
||||||
list.removeChild(item);
|
list.removeChild(item);
|
||||||
gPrivacyPane.offlineAppSelected();
|
gPrivacyPane.offlineAppSelected();
|
||||||
|
|||||||
@@ -156,9 +156,7 @@ var gSyncPane = {
|
|||||||
this.updateWeavePrefs();
|
this.updateWeavePrefs();
|
||||||
|
|
||||||
// Notify observers that the UI is now ready
|
// Notify observers that the UI is now ready
|
||||||
Components.classes["@mozilla.org/observer-service;1"]
|
Services.obs.notifyObservers(window, "sync-pane-loaded");
|
||||||
.getService(Components.interfaces.nsIObserverService)
|
|
||||||
.notifyObservers(window, "sync-pane-loaded");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_toggleComputerNameControls(editMode) {
|
_toggleComputerNameControls(editMode) {
|
||||||
|
|||||||
@@ -11,11 +11,8 @@ function initTest() {
|
|||||||
const searchTerm = "example";
|
const searchTerm = "example";
|
||||||
const dummyTerm = "elpmaxe";
|
const dummyTerm = "elpmaxe";
|
||||||
|
|
||||||
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
|
|
||||||
.getService(Components.interfaces.nsICookieManager);
|
|
||||||
|
|
||||||
// delete all cookies (might be left over from other tests)
|
// delete all cookies (might be left over from other tests)
|
||||||
cm.removeAll();
|
Services.cookies.removeAll();
|
||||||
|
|
||||||
// data for cookies
|
// data for cookies
|
||||||
var vals = [[searchTerm + ".com", dummyTerm, dummyTerm], // match
|
var vals = [[searchTerm + ".com", dummyTerm, dummyTerm], // match
|
||||||
@@ -29,15 +26,13 @@ function initTest() {
|
|||||||
// matches must correspond to above data
|
// matches must correspond to above data
|
||||||
const matches = 6;
|
const matches = 6;
|
||||||
|
|
||||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
|
||||||
.getService(Components.interfaces.nsIIOService);
|
|
||||||
var cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
|
var cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
|
||||||
.getService(Components.interfaces.nsICookieService);
|
.getService(Components.interfaces.nsICookieService);
|
||||||
var v;
|
var v;
|
||||||
// inject cookies
|
// inject cookies
|
||||||
for (v in vals) {
|
for (v in vals) {
|
||||||
let [host, name, value] = vals[v];
|
let [host, name, value] = vals[v];
|
||||||
var cookieUri = ios.newURI("http://" + host);
|
var cookieUri = Services.io.newURI("http://" + host);
|
||||||
cookieSvc.setCookieString(cookieUri, null, name + "=" + value + ";", null);
|
cookieSvc.setCookieString(cookieUri, null, name + "=" + value + ";", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,13 +50,9 @@ function isDisabled(win, expectation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runTest(win, searchTerm, cookies, matches) {
|
function runTest(win, searchTerm, cookies, matches) {
|
||||||
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
|
|
||||||
.getService(Components.interfaces.nsICookieManager);
|
|
||||||
|
|
||||||
|
|
||||||
// number of cookies should match injected cookies
|
// number of cookies should match injected cookies
|
||||||
var injectedCookies = 0,
|
var injectedCookies = 0,
|
||||||
injectedEnumerator = cm.enumerator;
|
injectedEnumerator = Services.cookies.enumerator;
|
||||||
while (injectedEnumerator.hasMoreElements()) {
|
while (injectedEnumerator.hasMoreElements()) {
|
||||||
injectedCookies++;
|
injectedCookies++;
|
||||||
injectedEnumerator.getNext();
|
injectedEnumerator.getNext();
|
||||||
@@ -127,7 +118,7 @@ function runTest(win, searchTerm, cookies, matches) {
|
|||||||
|
|
||||||
// check that datastore is also at 0
|
// check that datastore is also at 0
|
||||||
var remainingCookies = 0,
|
var remainingCookies = 0,
|
||||||
remainingEnumerator = cm.enumerator;
|
remainingEnumerator = Services.cookies.enumerator;
|
||||||
while (remainingEnumerator.hasMoreElements()) {
|
while (remainingEnumerator.hasMoreElements()) {
|
||||||
remainingCookies++;
|
remainingCookies++;
|
||||||
remainingEnumerator.getNext();
|
remainingEnumerator.getNext();
|
||||||
@@ -141,4 +132,3 @@ function runTest(win, searchTerm, cookies, matches) {
|
|||||||
win.close();
|
win.close();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,16 +65,16 @@ var testRunner = {
|
|||||||
{
|
{
|
||||||
expectPermObservancesDuringTestFunction: true,
|
expectPermObservancesDuringTestFunction: true,
|
||||||
test(params) {
|
test(params) {
|
||||||
let uri = params.ioService.newURI("http://test.com");
|
let uri = Services.io.newURI("http://test.com");
|
||||||
params.pm.add(uri, "popup", Ci.nsIPermissionManager.DENY_ACTION);
|
Services.perms.add(uri, "popup", Ci.nsIPermissionManager.DENY_ACTION);
|
||||||
is(params.tree.view.rowCount, 0, "adding unrelated permission should not change display");
|
is(params.tree.view.rowCount, 0, "adding unrelated permission should not change display");
|
||||||
params.btnApplyChanges.doCommand();
|
params.btnApplyChanges.doCommand();
|
||||||
},
|
},
|
||||||
observances: [{ type: "popup", origin: "http://test.com", data: "added",
|
observances: [{ type: "popup", origin: "http://test.com", data: "added",
|
||||||
capability: Ci.nsIPermissionManager.DENY_ACTION }],
|
capability: Ci.nsIPermissionManager.DENY_ACTION }],
|
||||||
cleanUp(params) {
|
cleanUp(params) {
|
||||||
let uri = params.ioService.newURI("http://test.com");
|
let uri = Services.io.newURI("http://test.com");
|
||||||
params.pm.remove(uri, "popup");
|
Services.perms.remove(uri, "popup");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -179,8 +179,8 @@ var testRunner = {
|
|||||||
expectPermObservancesDuringTestFunction: true,
|
expectPermObservancesDuringTestFunction: true,
|
||||||
test(params) {
|
test(params) {
|
||||||
for (let URL of ["http://a", "http://z", "http://b"]) {
|
for (let URL of ["http://a", "http://z", "http://b"]) {
|
||||||
let URI = params.ioService.newURI(URL);
|
let URI = Services.io.newURI(URL);
|
||||||
params.pm.add(URI, "cookie", Ci.nsIPermissionManager.ALLOW_ACTION);
|
Services.perms.add(URI, "cookie", Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
is(params.tree.view.rowCount, 3, "Three permissions should be present");
|
is(params.tree.view.rowCount, 3, "Three permissions should be present");
|
||||||
@@ -211,8 +211,8 @@ var testRunner = {
|
|||||||
"site should be sorted. 'a' should be third");
|
"site should be sorted. 'a' should be third");
|
||||||
|
|
||||||
for (let URL of ["http://a", "http://z", "http://b"]) {
|
for (let URL of ["http://a", "http://z", "http://b"]) {
|
||||||
let uri = params.ioService.newURI(URL);
|
let uri = Services.io.newURI(URL);
|
||||||
params.pm.remove(uri, "cookie");
|
Services.perms.remove(uri, "cookie");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -251,10 +251,6 @@ var testRunner = {
|
|||||||
btnBlock: doc.getElementById("btnBlock"),
|
btnBlock: doc.getElementById("btnBlock"),
|
||||||
btnApplyChanges: doc.getElementById("btnApplyChanges"),
|
btnApplyChanges: doc.getElementById("btnApplyChanges"),
|
||||||
btnRemove: doc.getElementById("removePermission"),
|
btnRemove: doc.getElementById("removePermission"),
|
||||||
pm: Cc["@mozilla.org/permissionmanager;1"]
|
|
||||||
.getService(Ci.nsIPermissionManager),
|
|
||||||
ioService: Cc["@mozilla.org/network/io-service;1"]
|
|
||||||
.getService(Ci.nsIIOService),
|
|
||||||
allowText: win.gPermissionManager._getCapabilityString(
|
allowText: win.gPermissionManager._getCapabilityString(
|
||||||
Ci.nsIPermissionManager.ALLOW_ACTION),
|
Ci.nsIPermissionManager.ALLOW_ACTION),
|
||||||
denyText: win.gPermissionManager._getCapabilityString(
|
denyText: win.gPermissionManager._getCapabilityString(
|
||||||
@@ -289,7 +285,7 @@ var testRunner = {
|
|||||||
"property: \"origin\" should be equal");
|
"property: \"origin\" should be equal");
|
||||||
}
|
}
|
||||||
|
|
||||||
os.removeObserver(permObserver, "perm-changed");
|
Services.obs.removeObserver(permObserver, "perm-changed");
|
||||||
|
|
||||||
let testCase = testRunner.tests[testRunner._currentTest];
|
let testCase = testRunner.tests[testRunner._currentTest];
|
||||||
if (!testCase.expectPermObservancesDuringTestFunction) {
|
if (!testCase.expectPermObservancesDuringTestFunction) {
|
||||||
@@ -303,10 +299,7 @@ var testRunner = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let os = Cc["@mozilla.org/observer-service;1"]
|
Services.obs.addObserver(permObserver, "perm-changed");
|
||||||
.getService(Ci.nsIObserverService);
|
|
||||||
|
|
||||||
os.addObserver(permObserver, "perm-changed");
|
|
||||||
|
|
||||||
if (testRunner._currentTest == 0) {
|
if (testRunner._currentTest == 0) {
|
||||||
is(params.tree.view.rowCount, 0, "no cookie exceptions");
|
is(params.tree.view.rowCount, 0, "no cookie exceptions");
|
||||||
|
|||||||
@@ -4,19 +4,17 @@ const PM_URL = "chrome://passwordmgr/content/passwordManager.xul";
|
|||||||
var passwordsDialog;
|
var passwordsDialog;
|
||||||
|
|
||||||
add_task(async function test_setup() {
|
add_task(async function test_setup() {
|
||||||
let pwmgr = Cc["@mozilla.org/login-manager;1"].
|
Services.logins.removeAllLogins();
|
||||||
getService(Ci.nsILoginManager);
|
|
||||||
pwmgr.removeAllLogins();
|
|
||||||
|
|
||||||
// add login data
|
// add login data
|
||||||
let nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
|
let nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
|
||||||
Ci.nsILoginInfo, "init");
|
Ci.nsILoginInfo, "init");
|
||||||
let login = new nsLoginInfo("http://example.com/", "http://example.com/", null,
|
let login = new nsLoginInfo("http://example.com/", "http://example.com/", null,
|
||||||
"user", "password", "u1", "p1");
|
"user", "password", "u1", "p1");
|
||||||
pwmgr.addLogin(login);
|
Services.logins.addLogin(login);
|
||||||
|
|
||||||
registerCleanupFunction(async function() {
|
registerCleanupFunction(async function() {
|
||||||
pwmgr.removeAllLogins();
|
Services.logins.removeAllLogins();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
let jar = getJar(rootDir);
|
let jar = getJar(rootDir);
|
||||||
if (jar) {
|
if (jar) {
|
||||||
@@ -8,7 +5,7 @@ if (jar) {
|
|||||||
rootDir = "file://" + tmpdir.path + "/";
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
}
|
}
|
||||||
/* import-globals-from privacypane_tests_perwindow.js */
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
Services.scriptloader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
test_pane_visibility,
|
test_pane_visibility,
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
let jar = getJar(rootDir);
|
let jar = getJar(rootDir);
|
||||||
if (jar) {
|
if (jar) {
|
||||||
@@ -7,7 +5,7 @@ if (jar) {
|
|||||||
rootDir = "file://" + tmpdir.path + "/";
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
}
|
}
|
||||||
/* import-globals-from privacypane_tests_perwindow.js */
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
Services.scriptloader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
test_custom_retention("rememberHistory", "remember"),
|
test_custom_retention("rememberHistory", "remember"),
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
requestLongerTimeout(2);
|
requestLongerTimeout(2);
|
||||||
|
|
||||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
let jar = getJar(rootDir);
|
let jar = getJar(rootDir);
|
||||||
if (jar) {
|
if (jar) {
|
||||||
@@ -9,8 +7,8 @@ if (jar) {
|
|||||||
rootDir = "file://" + tmpdir.path + "/";
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
}
|
}
|
||||||
/* import-globals-from privacypane_tests_perwindow.js */
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
Services.scriptloader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
|
let runtime = Services.appInfo;
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
test_custom_retention("acceptCookies", "remember"),
|
test_custom_retention("acceptCookies", "remember"),
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
let jar = getJar(rootDir);
|
let jar = getJar(rootDir);
|
||||||
if (jar) {
|
if (jar) {
|
||||||
@@ -7,7 +5,7 @@ if (jar) {
|
|||||||
rootDir = "file://" + tmpdir.path + "/";
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
}
|
}
|
||||||
/* import-globals-from privacypane_tests_perwindow.js */
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
Services.scriptloader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
test_locbar_suggestion_retention("history", true),
|
test_locbar_suggestion_retention("history", true),
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
let jar = getJar(rootDir);
|
let jar = getJar(rootDir);
|
||||||
if (jar) {
|
if (jar) {
|
||||||
@@ -7,7 +5,7 @@ if (jar) {
|
|||||||
rootDir = "file://" + tmpdir.path + "/";
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
}
|
}
|
||||||
/* import-globals-from privacypane_tests_perwindow.js */
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
Services.scriptloader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
// history mode should be initialized to remember
|
// history mode should be initialized to remember
|
||||||
|
|||||||
@@ -66,12 +66,10 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||||||
document.getElementById("startTour")
|
document.getElementById("startTour")
|
||||||
.addEventListener("click", dontShowIntroPanelAgain);
|
.addEventListener("click", dontShowIntroPanelAgain);
|
||||||
|
|
||||||
let formatURLPref = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
|
|
||||||
.getService(Ci.nsIURLFormatter).formatURLPref;
|
|
||||||
document.getElementById("startTour").setAttribute("href",
|
document.getElementById("startTour").setAttribute("href",
|
||||||
formatURLPref("privacy.trackingprotection.introURL"));
|
Services.urlFormatter.formatURLPref("privacy.trackingprotection.introURL"));
|
||||||
document.getElementById("learnMore").setAttribute("href",
|
document.getElementById("learnMore").setAttribute("href",
|
||||||
formatURLPref("app.support.baseURL") + "private-browsing");
|
Services.urlFormatter.formatURLPref("app.support.baseURL") + "private-browsing");
|
||||||
|
|
||||||
// Update state that depends on preferences.
|
// Update state that depends on preferences.
|
||||||
prefObserver.observe();
|
prefObserver.observe();
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ var {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm",
|
|||||||
|
|
||||||
var tmp = {};
|
var tmp = {};
|
||||||
|
|
||||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
Services.scriptloader.loadSubScript("chrome://browser/content/sanitize.js", tmp);
|
||||||
.getService(Ci.mozIJSSubScriptLoader)
|
|
||||||
.loadSubScript("chrome://browser/content/sanitize.js", tmp);
|
|
||||||
|
|
||||||
var Sanitizer = tmp.Sanitizer;
|
var Sanitizer = tmp.Sanitizer;
|
||||||
|
|
||||||
@@ -63,21 +61,14 @@ function sanitizeCache() {
|
|||||||
s.sanitize();
|
s.sanitize();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_cache_service() {
|
|
||||||
return Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
|
||||||
.getService(Components.interfaces.nsICacheStorageService);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStorageEntryCount(device, goon) {
|
function getStorageEntryCount(device, goon) {
|
||||||
var cs = get_cache_service();
|
|
||||||
|
|
||||||
var storage;
|
var storage;
|
||||||
switch (device) {
|
switch (device) {
|
||||||
case "private":
|
case "private":
|
||||||
storage = cs.diskCacheStorage(LoadContextInfo.private, false);
|
storage = Services.cache2.diskCacheStorage(LoadContextInfo.private, false);
|
||||||
break;
|
break;
|
||||||
case "regular":
|
case "regular":
|
||||||
storage = cs.diskCacheStorage(LoadContextInfo.default, false);
|
storage = Services.cache2.diskCacheStorage(LoadContextInfo.default, false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw "Unknown device " + device + " at getStorageEntryCount";
|
throw "Unknown device " + device + " at getStorageEntryCount";
|
||||||
|
|||||||
@@ -187,16 +187,12 @@ async function openTab(aBrowser, aURL) {
|
|||||||
// A clean up function to prevent affecting other tests.
|
// A clean up function to prevent affecting other tests.
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
// Clear all cookies.
|
// Clear all cookies.
|
||||||
let cookieMgr = Cc["@mozilla.org/cookiemanager;1"]
|
Services.cookies.removeAll();
|
||||||
.getService(Ci.nsICookieManager);
|
|
||||||
cookieMgr.removeAll();
|
|
||||||
|
|
||||||
// Clear all image caches and network caches.
|
// Clear all image caches and network caches.
|
||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_favicon_privateBrowsing() {
|
add_task(async function test_favicon_privateBrowsing() {
|
||||||
@@ -252,9 +248,7 @@ add_task(async function test_favicon_cache_privateBrowsing() {
|
|||||||
// Clear all image cahces and network cache before running the test.
|
// Clear all image cahces and network cache before running the test.
|
||||||
clearAllImageCaches();
|
clearAllImageCaches();
|
||||||
|
|
||||||
let networkCache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
Services.cache2.clear();
|
||||||
.getService(Ci.nsICacheStorageService);
|
|
||||||
networkCache.clear();
|
|
||||||
|
|
||||||
// Clear all favicons in Places.
|
// Clear all favicons in Places.
|
||||||
await clearAllPlacesFavicons();
|
await clearAllPlacesFavicons();
|
||||||
|
|||||||
@@ -23,10 +23,8 @@ registerCleanupFunction(function() {
|
|||||||
function test() {
|
function test() {
|
||||||
// initialization
|
// initialization
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
let ds = Cc["@mozilla.org/file/directory_service;1"].
|
let dir1 = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||||
getService(Ci.nsIProperties);
|
let dir2 = Services.dirsvc.get("TmpD", Ci.nsIFile);
|
||||||
let dir1 = ds.get("ProfD", Ci.nsIFile);
|
|
||||||
let dir2 = ds.get("TmpD", Ci.nsIFile);
|
|
||||||
let file = dir2.clone();
|
let file = dir2.clone();
|
||||||
file.append("pbtest.file");
|
file.append("pbtest.file");
|
||||||
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
|
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
|
||||||
|
|||||||
@@ -89,8 +89,7 @@ add_task(async function setup() {
|
|||||||
[["privacy.resistFingerprinting", true]]
|
[["privacy.resistFingerprinting", true]]
|
||||||
});
|
});
|
||||||
|
|
||||||
let appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
|
let appVersion = parseInt(Services.appinfo.version);
|
||||||
let appVersion = parseInt(appInfo.version);
|
|
||||||
let spoofedVersion = appVersion - ((appVersion - 3) % 7);
|
let spoofedVersion = appVersion - ((appVersion - 3) % 7);
|
||||||
spoofedUserAgent = `Mozilla/5.0 (${SPOOFED_OSCPU}; rv:${spoofedVersion}.0) Gecko/20100101 Firefox/${spoofedVersion}.0`;
|
spoofedUserAgent = `Mozilla/5.0 (${SPOOFED_OSCPU}; rv:${spoofedVersion}.0) Gecko/20100101 Firefox/${spoofedVersion}.0`;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
// Instead of loading EventUtils.js into the test scope in browser-test.js for all tests,
|
// Instead of loading EventUtils.js into the test scope in browser-test.js for all tests,
|
||||||
// we only need EventUtils.js for a few files which is why we are using loadSubScript.
|
// we only need EventUtils.js for a few files which is why we are using loadSubScript.
|
||||||
var EventUtils = {};
|
var EventUtils = {};
|
||||||
this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
||||||
getService(Ci.mozIJSSubScriptLoader);
|
|
||||||
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
|
|
||||||
|
|
||||||
const searchPopup = document.getElementById("PopupSearchAutoComplete");
|
const searchPopup = document.getElementById("PopupSearchAutoComplete");
|
||||||
const kValues = ["long text", "long text 2", "long text 3"];
|
const kValues = ["long text", "long text 2", "long text 3"];
|
||||||
|
|||||||
@@ -165,13 +165,12 @@ function restoreSession() {
|
|||||||
// restore the session into a new window and close the current tab
|
// restore the session into a new window and close the current tab
|
||||||
var newWindow = top.openDialog(top.location, "_blank", "chrome,dialog=no,all");
|
var newWindow = top.openDialog(top.location, "_blank", "chrome,dialog=no,all");
|
||||||
|
|
||||||
var obs = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
Services.obs.addObserver(function observe(win, topic) {
|
||||||
obs.addObserver(function observe(win, topic) {
|
|
||||||
if (win != newWindow) {
|
if (win != newWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obs.removeObserver(observe, topic);
|
Services.obs.removeObserver(observe, topic);
|
||||||
ss.setWindowState(newWindow, stateString, true);
|
ss.setWindowState(newWindow, stateString, true);
|
||||||
|
|
||||||
var tabbrowser = top.gBrowser;
|
var tabbrowser = top.gBrowser;
|
||||||
@@ -181,8 +180,7 @@ function restoreSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startNewSession() {
|
function startNewSession() {
|
||||||
var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
if (Services.prefs.getIntPref("browser.startup.page") == 0)
|
||||||
if (prefBranch.getIntPref("browser.startup.page") == 0)
|
|
||||||
getBrowserWindow().gBrowser.loadURI("about:blank");
|
getBrowserWindow().gBrowser.loadURI("about:blank");
|
||||||
else
|
else
|
||||||
getBrowserWindow().BrowserHome();
|
getBrowserWindow().BrowserHome();
|
||||||
@@ -280,8 +278,7 @@ function restoreSingleTab(aIx, aShifted) {
|
|||||||
ss.setTabState(newTab, JSON.stringify(tabState));
|
ss.setTabState(newTab, JSON.stringify(tabState));
|
||||||
|
|
||||||
// respect the preference as to whether to select the tab (the Shift key inverses)
|
// respect the preference as to whether to select the tab (the Shift key inverses)
|
||||||
var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
if (Services.prefs.getBoolPref("browser.tabs.loadInBackground") != !aShifted)
|
||||||
if (prefBranch.getBoolPref("browser.tabs.loadInBackground") != !aShifted)
|
|
||||||
tabbrowser.selectedTab = newTab;
|
tabbrowser.selectedTab = newTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ function test() {
|
|||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
// read the sessionstore.js mtime (picked from browser_248970_a.js)
|
// read the sessionstore.js mtime (picked from browser_248970_a.js)
|
||||||
let profilePath = Cc["@mozilla.org/file/directory_service;1"].
|
let profilePath = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||||
getService(Ci.nsIProperties).
|
|
||||||
get("ProfD", Ci.nsIFile);
|
|
||||||
function getSessionstoreFile() {
|
function getSessionstoreFile() {
|
||||||
let sessionStoreJS = profilePath.clone();
|
let sessionStoreJS = profilePath.clone();
|
||||||
sessionStoreJS.append("sessionstore.jsonlz4");
|
sessionStoreJS.append("sessionstore.jsonlz4");
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
function test() {
|
function test() {
|
||||||
var startup_info = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup).getStartupInfo();
|
var startup_info = Services.startup.getStartupInfo();
|
||||||
// No .process info on mac
|
// No .process info on mac
|
||||||
|
|
||||||
// Check if we encountered a telemetry error for the the process creation
|
// Check if we encountered a telemetry error for the the process creation
|
||||||
// timestamp and turn the first test into a known failure.
|
// timestamp and turn the first test into a known failure.
|
||||||
var telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
|
var snapshot = Services.telemetry.getHistogramById("STARTUP_MEASUREMENT_ERRORS")
|
||||||
var snapshot = telemetry.getHistogramById("STARTUP_MEASUREMENT_ERRORS")
|
|
||||||
.snapshot();
|
.snapshot();
|
||||||
|
|
||||||
if (snapshot.counts[0] == 0)
|
if (snapshot.counts[0] == 0)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||||
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
var Ci = Components.interfaces;
|
var Ci = Components.interfaces;
|
||||||
|
|
||||||
@@ -32,9 +33,7 @@ var gSetBackground = {
|
|||||||
|
|
||||||
if (AppConstants.platform == "win") {
|
if (AppConstants.platform == "win") {
|
||||||
// Hide fill + fit options if < Win7 since they don't work.
|
// Hide fill + fit options if < Win7 since they don't work.
|
||||||
var version = Components.classes["@mozilla.org/system-info;1"]
|
var version = Services.sysinfo.getProperty("version");
|
||||||
.getService(Ci.nsIPropertyBag2)
|
|
||||||
.getProperty("version");
|
|
||||||
var isWindows7OrHigher = (parseFloat(version) >= 6.1);
|
var isWindows7OrHigher = (parseFloat(version) >= 6.1);
|
||||||
if (!isWindows7OrHigher) {
|
if (!isWindows7OrHigher) {
|
||||||
document.getElementById("fillPosition").hidden = true;
|
document.getElementById("fillPosition").hidden = true;
|
||||||
@@ -80,9 +79,7 @@ var gSetBackground = {
|
|||||||
document.persist("menuPosition", "value");
|
document.persist("menuPosition", "value");
|
||||||
this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
|
this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
|
||||||
} else {
|
} else {
|
||||||
Components.classes["@mozilla.org/observer-service;1"]
|
Services.obs.addObserver(this, "shell:desktop-background-changed");
|
||||||
.getService(Ci.nsIObserverService)
|
|
||||||
.addObserver(this, "shell:desktop-background-changed");
|
|
||||||
|
|
||||||
var bundle = document.getElementById("backgroundBundle");
|
var bundle = document.getElementById("backgroundBundle");
|
||||||
var setDesktopBackground = document.getElementById("setDesktopBackground");
|
var setDesktopBackground = document.getElementById("setDesktopBackground");
|
||||||
@@ -195,9 +192,7 @@ if (AppConstants.platform != "macosx") {
|
|||||||
document.getElementById("setDesktopBackground").hidden = true;
|
document.getElementById("setDesktopBackground").hidden = true;
|
||||||
document.getElementById("showDesktopPreferences").hidden = false;
|
document.getElementById("showDesktopPreferences").hidden = false;
|
||||||
|
|
||||||
Components.classes["@mozilla.org/observer-service;1"]
|
Services.obs.removeObserver(this, "shell:desktop-background-changed");
|
||||||
.getService(Ci.nsIObserverService)
|
|
||||||
.removeObserver(this, "shell:desktop-background-changed");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ const DG_DRAW_BG_KEY = DG_BACKGROUND + "/draw_background";
|
|||||||
function onPageLoad() {
|
function onPageLoad() {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", onPageLoad, true);
|
gBrowser.selectedBrowser.removeEventListener("load", onPageLoad, true);
|
||||||
|
|
||||||
var bs = Cc["@mozilla.org/intl/stringbundle;1"].
|
var brandName = Services.strings.createBundle("chrome://branding/locale/brand.properties").
|
||||||
getService(Ci.nsIStringBundleService);
|
|
||||||
var brandName = bs.createBundle("chrome://branding/locale/brand.properties").
|
|
||||||
GetStringFromName("brandShortName");
|
GetStringFromName("brandShortName");
|
||||||
|
|
||||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||||||
// Load mocking/stubbing library, sinon
|
// Load mocking/stubbing library, sinon
|
||||||
// docs: http://sinonjs.org/docs/
|
// docs: http://sinonjs.org/docs/
|
||||||
/* global sinon */
|
/* global sinon */
|
||||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
|
||||||
loader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
|
|
||||||
|
|
||||||
registerCleanupFunction(function* () {
|
registerCleanupFunction(function* () {
|
||||||
// Cleanup window or the test runner will throw an error
|
// Cleanup window or the test runner will throw an error
|
||||||
|
|||||||
@@ -400,9 +400,7 @@ function writeUpdatesToXMLFile(aText) {
|
|||||||
const MODE_CREATE = 0x08;
|
const MODE_CREATE = 0x08;
|
||||||
const MODE_TRUNCATE = 0x20;
|
const MODE_TRUNCATE = 0x20;
|
||||||
|
|
||||||
let file = Cc["@mozilla.org/file/directory_service;1"].
|
let file = Services.dirsvc.get("UpdRootD", Ci.nsIFile);
|
||||||
getService(Ci.nsIProperties).
|
|
||||||
get("UpdRootD", Ci.nsIFile);
|
|
||||||
file.append("updates.xml");
|
file.append("updates.xml");
|
||||||
let fos = Cc["@mozilla.org/network/file-output-stream;1"].
|
let fos = Cc["@mozilla.org/network/file-output-stream;1"].
|
||||||
createInstance(Ci.nsIFileOutputStream);
|
createInstance(Ci.nsIFileOutputStream);
|
||||||
|
|||||||
@@ -186,9 +186,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
this.translation = aTranslation;
|
this.translation = aTranslation;
|
||||||
let bundle = Cc["@mozilla.org/intl/stringbundle;1"]
|
let bundle = Services.strings.createBundle("chrome://global/locale/languageNames.properties");
|
||||||
.getService(Ci.nsIStringBundleService)
|
|
||||||
.createBundle("chrome://global/locale/languageNames.properties");
|
|
||||||
let sortByLocalizedName = function(aList) {
|
let sortByLocalizedName = function(aList) {
|
||||||
return aList.map(code => [code, bundle.GetStringFromName(code)])
|
return aList.map(code => [code, bundle.GetStringFromName(code)])
|
||||||
.sort((a, b) => a[1].localeCompare(b[1]));
|
.sort((a, b) => a[1].localeCompare(b[1]));
|
||||||
@@ -362,16 +360,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let langBundle =
|
let langBundle =
|
||||||
Cc["@mozilla.org/intl/stringbundle;1"]
|
Services.strings.createBundle("chrome://global/locale/languageNames.properties");
|
||||||
.getService(Ci.nsIStringBundleService)
|
|
||||||
.createBundle("chrome://global/locale/languageNames.properties");
|
|
||||||
let langName = langBundle.GetStringFromName(lang);
|
let langName = langBundle.GetStringFromName(lang);
|
||||||
|
|
||||||
// Set the label and accesskey on the menuitem.
|
// Set the label and accesskey on the menuitem.
|
||||||
let bundle =
|
let bundle =
|
||||||
Cc["@mozilla.org/intl/stringbundle;1"]
|
Services.strings.createBundle("chrome://browser/locale/translation.properties");
|
||||||
.getService(Ci.nsIStringBundleService)
|
|
||||||
.createBundle("chrome://browser/locale/translation.properties");
|
|
||||||
let item = this._getAnonElt("neverForLanguage");
|
let item = this._getAnonElt("neverForLanguage");
|
||||||
const kStrId = "translation.options.neverForLanguage";
|
const kStrId = "translation.options.neverForLanguage";
|
||||||
item.setAttribute("label",
|
item.setAttribute("label",
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ var gContentAPI;
|
|||||||
var gContentWindow;
|
var gContentWindow;
|
||||||
var setDefaultBrowserCalled = false;
|
var setDefaultBrowserCalled = false;
|
||||||
|
|
||||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
Services.scriptloader
|
||||||
.getService(Ci.mozIJSSubScriptLoader)
|
|
||||||
.loadSubScript("chrome://mochikit/content/tests/SimpleTest/MockObjects.js", this);
|
.loadSubScript("chrome://mochikit/content/tests/SimpleTest/MockObjects.js", this);
|
||||||
|
|
||||||
function MockShellService() {}
|
function MockShellService() {}
|
||||||
|
|||||||
@@ -43,10 +43,9 @@ var observer = SpecialPowers.wrapCallbackObject({
|
|||||||
function getDialogDoc() {
|
function getDialogDoc() {
|
||||||
// Find the <browser> which contains notifyWindow, by looking
|
// Find the <browser> which contains notifyWindow, by looking
|
||||||
// through all the open windows and all the <browsers> in each.
|
// through all the open windows and all the <browsers> in each.
|
||||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
|
||||||
getService(Ci.nsIWindowMediator);
|
|
||||||
// var enumerator = wm.getEnumerator("navigator:browser");
|
// var enumerator = wm.getEnumerator("navigator:browser");
|
||||||
var enumerator = wm.getXULWindowEnumerator(null);
|
var enumerator = Services.wm.getXULWindowEnumerator(null);
|
||||||
|
|
||||||
while (enumerator.hasMoreElements()) {
|
while (enumerator.hasMoreElements()) {
|
||||||
var win = enumerator.getNext();
|
var win = enumerator.getNext();
|
||||||
|
|||||||
@@ -11,14 +11,12 @@ add_UITour_task(async function test_resetFirefox() {
|
|||||||
let canReset = await getConfigurationPromise("canReset");
|
let canReset = await getConfigurationPromise("canReset");
|
||||||
ok(!canReset, "Shouldn't be able to reset from mochitest's temporary profile.");
|
ok(!canReset, "Shouldn't be able to reset from mochitest's temporary profile.");
|
||||||
let dialogPromise = new Promise((resolve) => {
|
let dialogPromise = new Promise((resolve) => {
|
||||||
let winWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
Services.ww.registerNotification(function onOpen(subj, topic, data) {
|
||||||
getService(Ci.nsIWindowWatcher);
|
|
||||||
winWatcher.registerNotification(function onOpen(subj, topic, data) {
|
|
||||||
if (topic == "domwindowopened" && subj instanceof Ci.nsIDOMWindow) {
|
if (topic == "domwindowopened" && subj instanceof Ci.nsIDOMWindow) {
|
||||||
subj.addEventListener("load", function() {
|
subj.addEventListener("load", function() {
|
||||||
if (subj.document.documentURI ==
|
if (subj.document.documentURI ==
|
||||||
"chrome://global/content/resetProfile.xul") {
|
"chrome://global/content/resetProfile.xul") {
|
||||||
winWatcher.unregisterNotification(onOpen);
|
Services.ww.unregisterNotification(onOpen);
|
||||||
ok(true, "Observed search manager window open");
|
ok(true, "Observed search manager window open");
|
||||||
is(subj.opener, window,
|
is(subj.opener, window,
|
||||||
"Reset Firefox event opened a reset profile window.");
|
"Reset Firefox event opened a reset profile window.");
|
||||||
@@ -44,4 +42,3 @@ add_UITour_task(async function test_resetFirefox() {
|
|||||||
canReset = await getConfigurationPromise("canReset");
|
canReset = await getConfigurationPromise("canReset");
|
||||||
ok(!canReset, "Shouldn't be able to reset from mochitest's temporary profile once removed from the profile manager.");
|
ok(!canReset, "Shouldn't be able to reset from mochitest's temporary profile once removed from the profile manager.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user