--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -1,13 +1,12 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
/* import-globals-from ../../../../toolkit/content/globalOverlay.js */
/* import-globals-from ../../../../toolkit/content/contentAreaUtils.js */
/* import-globals-from ../../../../toolkit/content/treeUtils.js */
/* import-globals-from feeds.js */
/* import-globals-from permissions.js */
/* import-globals-from security.js */
@@ -234,17 +233,17 @@ const PERMISSION_CONTRACTID = "@mozi
const PREFERENCES_CONTRACTID = "@mozilla.org/preferences-service;1";
// a number of services I'll need later
// the cache services
const nsICacheStorageService = Components.interfaces.nsICacheStorageService;
const nsICacheStorage = Components.interfaces.nsICacheStorage;
const cacheService = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"].getService(nsICacheStorageService);
-var loadContextInfo = LoadContextInfo.fromLoadContext(
+var loadContextInfo = Services.loadContextInfo.fromLoadContext(
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsILoadContext), false);
var diskStorage = cacheService.diskCacheStorage(loadContextInfo, false);
const nsICookiePermission = Components.interfaces.nsICookiePermission;
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
--- a/browser/base/content/test/general/browser_sanitizeDialog.js
+++ b/browser/base/content/test/general/browser_sanitizeDialog.js
@@ -13,17 +13,16 @@
* test checks the UI of the dialog and makes sure it's correctly connected to
* the sanitize timespan code.
*
* Some of this code, especially the history creation parts, was taken from
* browser/base/content/test/general/browser_sanitize-timespans.js.
*/
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-var {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
"resource://gre/modules/FormHistory.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Timer",
"resource://gre/modules/Timer.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
@@ -548,19 +547,19 @@ add_task(async function test_offline_cac
// Give www.example.com privileges to store offline data
Services.perms.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
Services.perms.addFromPrincipal(principal, "offline-app", Ci.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
// Store something to the offline cache
var appcacheserv = Cc["@mozilla.org/network/application-cache-service;1"]
.getService(Ci.nsIApplicationCacheService);
- var appcachegroupid = appcacheserv.buildGroupIDForInfo(makeURI(URL + "/manifest"), LoadContextInfo.default);
+ var appcachegroupid = appcacheserv.buildGroupIDForInfo(makeURI(URL + "/manifest"), Services.LoadContextInfo.default);
var appcache = appcacheserv.createApplicationCache(appcachegroupid);
- var storage = Services.cache2.appCacheStorage(LoadContextInfo.default, appcache);
+ var storage = Services.cache2.appCacheStorage(Services.LoadContextInfo.default, appcache);
// Open the dialog
let wh = new WindowHelper();
wh.onload = function() {
this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
// Show details
this.toggleDetails();
// Clear only offlineApps
--- a/browser/base/content/test/general/browser_save_private_link_perwindowpb.js
+++ b/browser/base/content/test/general/browser_save_private_link_perwindowpb.js
@@ -26,18 +26,17 @@ function promiseNoCacheEntry(filename) {
onCacheEntryVisitCompleted() {
resolve();
}
};
function Visitor() {}
let cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Ci.nsICacheStorageService);
- let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", null);
- let storage = cache.diskCacheStorage(LoadContextInfo.default, false);
+ let storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
storage.asyncVisitStorage(new Visitor(), true /* Do walk entries */);
});
}
function promiseImageDownloaded() {
return new Promise((resolve, reject) => {
let fileName;
let MockFilePicker = SpecialPowers.MockFilePicker;
--- a/browser/components/originattributes/test/browser/browser_cache.js
+++ b/browser/components/originattributes/test/browser/browser_cache.js
@@ -5,17 +5,16 @@
* originAttributes. And then, it verifies the number of cache entries and
* the originAttributes of loading channels. If these two pages belong to
* the same originAttributes, the number of cache entries for a certain
* resource would be one. Otherwise, it would be two.
*/
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
let protocolProxyService = Cc["@mozilla.org/network/protocol-proxy-service;1"]
.getService(Ci.nsIProtocolProxyService);
const TEST_DOMAIN = "http://example.net";
const TEST_PATH = "/browser/browser/components/originattributes/test/browser/";
const TEST_PAGE = TEST_DOMAIN + TEST_PATH + "file_cache.html";
let suffixes = ["iframe.html", "link.css", "script.js", "img.png", "object.png",
@@ -52,17 +51,17 @@ function cacheDataForContext(loadContext
if (iid.equals(Ci.nsICacheStorageVisitor))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};
// Visiting the disk cache also visits memory storage so we do not
// need to use Services.cache2.memoryCacheStorage() here.
- let storage = Services.cache2.diskCacheStorage(loadContextInfo, false);
+ let storage = Services.cache2.diskCacheStorage(Services.LoadContextInfo, false);
storage.asyncVisitStorage(cacheVisitor, true);
});
}
let countMatchingCacheEntries = function(cacheEntries, domain, fileSuffix) {
return cacheEntries.map(entry => entry.uri.asciiSpec)
.filter(spec => spec.includes(domain))
.filter(spec => spec.includes("file_thirdPartyChild." + fileSuffix))
@@ -215,27 +214,27 @@ async function doTest(aBrowser) {
return 0;
}
// The check function, which checks the number of cache entries.
async function doCheck(aShouldIsolate, aInputA, aInputB) {
let expectedEntryCount = 1;
let data = [];
- data = data.concat(await cacheDataForContext(LoadContextInfo.default));
- data = data.concat(await cacheDataForContext(LoadContextInfo.private));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, {})));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 1 })));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 1 })));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 2 })));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 2 })));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.com" })));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.com" })));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.org" })));
- data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.org" })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.default));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.private));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, {})));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { userContextId: 1 })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { userContextId: 1 })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { userContextId: 2 })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { userContextId: 2 })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { firstPartyDomain: "example.com" })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { firstPartyDomain: "example.com" })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { firstPartyDomain: "example.org" })));
+ data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { firstPartyDomain: "example.org" })));
if (aShouldIsolate) {
expectedEntryCount = 2;
}
for (let suffix of suffixes) {
let foundEntryCount = countMatchingCacheEntries(data, "example.net", suffix);
let result = (expectedEntryCount === foundEntryCount);
--- a/browser/components/originattributes/test/browser/browser_sanitize.js
+++ b/browser/components/originattributes/test/browser/browser_sanitize.js
@@ -1,16 +1,14 @@
/**
* Bug 1270338 - Add a mochitest to ensure Sanitizer clears data for all containers
*/
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
-
const TEST_DOMAIN = "http://example.net/";
let tempScope = {};
Services.scriptloader.loadSubScript("chrome://browser/content/sanitize.js",
tempScope);
let Sanitizer = tempScope.Sanitizer;
function setCookies(aBrowser) {
@@ -34,36 +32,36 @@ function cacheDataForContext(loadContext
if (iid.equals(Ci.nsICacheStorageVisitor))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};
// Visiting the disk cache also visits memory storage so we do not
// need to use Services.cache2.memoryCacheStorage() here.
- let storage = Services.cache2.diskCacheStorage(loadContextInfo, false);
+ let storage = Services.cache2.diskCacheStorage(Services.loadContextInfo, false);
storage.asyncVisitStorage(cacheVisitor, true);
});
}
function checkCookiesSanitized(aBrowser) {
ContentTask.spawn(aBrowser, null, function() {
is(content.document.cookie, "",
"Cookies of all origin attributes should be cleared.");
});
}
function checkCacheExists(aShouldExist) {
return async function() {
let loadContextInfos = [
- LoadContextInfo.default,
- LoadContextInfo.custom(false, { userContextId: 1 }),
- LoadContextInfo.custom(false, { userContextId: 2 }),
- LoadContextInfo.custom(false, { firstPartyDomain: "example.com" }),
- LoadContextInfo.custom(false, { firstPartyDomain: "example.org" }),
+ Services.loadContextInfo.default,
+ Services.loadContextInfo.custom(false, { userContextId: 1 }),
+ Services.loadContextInfo.custom(false, { userContextId: 2 }),
+ Services.loadContextInfo.custom(false, { firstPartyDomain: "example.com" }),
+ Services.loadContextInfo.custom(false, { firstPartyDomain: "example.org" }),
];
let i = 0;
for (let loadContextInfo of loadContextInfos) {
let cacheURIs = await cacheDataForContext(loadContextInfo);
is(cacheURIs.includes(TEST_DOMAIN), aShouldExist, TEST_DOMAIN + " should "
+ (aShouldExist ? "not " : "") + "be cached for all origin attributes." + i++);
}
};
--- a/browser/components/places/tests/unit/head_bookmarks.js
+++ b/browser/components/places/tests/unit/head_bookmarks.js
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var Ci = Components.interfaces;
var Cc = Components.classes;
var Cr = Components.results;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/LoadContextInfo.jsm");
// Import common head.
/* import-globals-from ../../../../../toolkit/components/places/tests/head_common.js */
var commonFile = do_get_file("../../../../../toolkit/components/places/tests/head_common.js", false);
if (commonFile) {
let uri = Services.io.newFileURI(commonFile);
Services.scriptloader.loadSubScript(uri.spec, this);
}
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -8,17 +8,16 @@
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/Downloads.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource:///modules/ShellService.jsm");
Components.utils.import("resource:///modules/TransientPrefs.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
-Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CloudStorage",
"resource://gre/modules/CloudStorage.jsm");
// Constants & Enumeration Values
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
const TYPE_MAYBE_VIDEO_FEED = "application/vnd.mozilla.maybe.video.feed";
const TYPE_MAYBE_AUDIO_FEED = "application/vnd.mozilla.maybe.audio.feed";
const TYPE_PDF = "application/pdf";
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cache.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cache.js
@@ -1,18 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// Check about:cache after private browsing
// This test covers MozTrap test 6047
// bug 880621
-var {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", null);
-
var tmp = {};
Services.scriptloader.loadSubScript("chrome://browser/content/sanitize.js", tmp);
var Sanitizer = tmp.Sanitizer;
function test() {
@@ -60,20 +58,20 @@ function sanitizeCache() {
s.sanitize();
}
function getStorageEntryCount(device, goon) {
var storage;
switch (device) {
case "private":
- storage = Services.cache2.diskCacheStorage(LoadContextInfo.private, false);
+ storage = Services.cache2.diskCacheStorage(Services.loadContextInfo.private, false);
break;
case "regular":
- storage = Services.cache2.diskCacheStorage(LoadContextInfo.default, false);
+ storage = Services.cache2.diskCacheStorage(Services.loadContextInfo.default, false);
break;
default:
throw "Unknown device " + device + " at getStorageEntryCount";
}
var visitor = {
entryCount: 0,
onCacheStorageInfo(aEntryCount, aConsumption) {
--- a/browser/components/tests/unit/test_distribution.js
+++ b/browser/components/tests/unit/test_distribution.js
@@ -1,17 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that preferences are properly set by distribution.ini
*/
-Cu.import("resource://gre/modules/LoadContextInfo.jsm");
-
// Import common head.
var commonFile = do_get_file("../../../../toolkit/components/places/tests/head_common.js", false);
/* import-globals-from ../../../../toolkit/components/places/tests/head_common.js */
if (commonFile) {
let uri = Services.io.newFileURI(commonFile);
Services.scriptloader.loadSubScript(uri.spec, this);
}
--- a/browser/modules/offlineAppCache.jsm
+++ b/browser/modules/offlineAppCache.jsm
@@ -1,20 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-this.EXPORTED_SYMBOLS = ["OfflineAppCacheHelper"];
+Components.utils.import("resource://gre/modules/Services.jsm");
-Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
+this.EXPORTED_SYMBOLS = ["OfflineAppCacheHelper"];
const Cc = Components.classes;
const Ci = Components.interfaces;
this.OfflineAppCacheHelper = {
clear() {
var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
- var appCacheStorage = cacheService.appCacheStorage(LoadContextInfo.default, null);
+ var appCacheStorage = cacheService.appCacheStorage(Services.loadContextInfo.default, null);
try {
appCacheStorage.asyncEvictStorage(null);
} catch (er) {}
}
};
--- a/devtools/client/shared/AppCacheUtils.jsm
+++ b/devtools/client/shared/AppCacheUtils.jsm
@@ -20,21 +20,22 @@
* - Too many dot dot slash operators
* - SETTINGS section is valid
* - Invalid section name
* - etc.
*/
"use strict";
+Components.utils.import("resource://gre/modules/Services.jsm");
+
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
var { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
var { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
-var { LoadContextInfo } = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
var { gDevTools } = require("devtools/client/framework/devtools");
var Services = require("Services");
var promise = require("promise");
this.EXPORTED_SYMBOLS = ["AppCacheUtils"];
@@ -249,17 +250,17 @@ AppCacheUtils.prototype = {
listEntries: function ACU_show(searchTerm) {
if (!Services.prefs.getBoolPref("browser.cache.disk.enable")) {
throw new Error(l10n.GetStringFromName("cacheDisabled"));
}
let entries = [];
- let appCacheStorage = Services.cache2.appCacheStorage(LoadContextInfo.default, null);
+ let appCacheStorage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, null);
appCacheStorage.asyncVisitStorage({
onCacheStorageInfo: function () {},
onCacheEntryInfo: function (aURI, aIdEnhance, aDataSize, aFetchCount, aLastModifiedTime, aExpirationTime) {
let lowerKey = aURI.asciiSpec.toLowerCase();
if (searchTerm && lowerKey.indexOf(searchTerm.toLowerCase()) == -1) {
return;
--- a/devtools/client/styleeditor/test/browser_styleeditor_private_perwindowpb.js
+++ b/devtools/client/styleeditor/test/browser_styleeditor_private_perwindowpb.js
@@ -4,18 +4,16 @@
"use strict";
// This test makes sure that the style editor does not store any
// content CSS files in the permanent cache when opened from PB mode.
const TEST_URL = "http://" + TEST_HOST + "/browser/devtools/client/" +
"styleeditor/test/test_private.html";
-const {LoadContextInfo} =
- Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
const cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Ci.nsICacheStorageService);
add_task(function* () {
info("Opening a new private window");
let win = OpenBrowserWindow({private: true});
yield waitForDelayedStartupFinished(win);
@@ -59,17 +57,17 @@ function checkDiskCacheFor(host) {
},
onCacheEntryVisitCompleted: function () {
is(foundPrivateData, false, "web content present in disk cache");
resolve();
}
};
function Visitor() {}
- let storage = cache.diskCacheStorage(LoadContextInfo.default, false);
+ let storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
storage.asyncVisitStorage(new Visitor(),
/* Do walk entries */
true);
});
}
function waitForDelayedStartupFinished(win) {
return new Promise(resolve => {
--- a/dom/html/test/browser_bug649778.js
+++ b/dom/html/test/browser_bug649778.js
@@ -1,21 +1,20 @@
// Test for bug 649778 - document.write may cause a document to be written to disk cache even when the page has Cache-Control: no-store
// Globals
var testPath = "http://mochi.test:8888/browser/dom/html/test/";
var popup;
-var {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", null);
var {Services} = Cu.import("resource://gre/modules/Services.jsm", null);
function checkCache(url, inMemory, shouldExist, cb)
{
var cache = Services.cache2;
- var storage = cache.diskCacheStorage(LoadContextInfo.default, false);
+ var storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
function CheckCacheListener(inMemory, shouldExist)
{
this.inMemory = inMemory;
this.shouldExist = shouldExist;
this.onCacheEntryCheck = function() {
return Components.interfaces.nsICacheEntryOpenCallback.ENTRY_WANTED;
};
--- a/mobile/android/modules/Sanitizer.jsm
+++ b/mobile/android/modules/Sanitizer.jsm
@@ -1,22 +1,21 @@
// -*- indent-tabs-mode: nil; js-indent-level: 4 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/* globals LoadContextInfo, FormHistory, Accounts */
+/* globals FormHistory, Accounts */
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/LoadContextInfo.jsm");
Cu.import("resource://gre/modules/FormHistory.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Downloads.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Accounts.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DownloadIntegration",
"resource://gre/modules/DownloadIntegration.jsm");
@@ -149,17 +148,17 @@ Sanitizer.prototype = {
return true;
}
},
offlineApps: {
clear: function() {
return new Promise(function(resolve, reject) {
var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
- var appCacheStorage = cacheService.appCacheStorage(LoadContextInfo.default, null);
+ var appCacheStorage = cacheService.appCacheStorage(Services.loadContextInfo.default, null);
try {
appCacheStorage.asyncEvictStorage(null);
} catch (er) {}
resolve();
});
},
--- a/netwerk/test/unit/head_cache.js
+++ b/netwerk/test/unit/head_cache.js
@@ -1,10 +1,9 @@
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
-Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
var _CSvc;
function get_cache_service() {
if (_CSvc)
return _CSvc;
return _CSvc = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
@@ -15,41 +14,41 @@ function evict_cache_entries(where)
var clearDisk = (!where || where == "disk" || where == "all");
var clearMem = (!where || where == "memory" || where == "all");
var clearAppCache = (where == "appcache");
var svc = get_cache_service();
var storage;
if (clearMem) {
- storage = svc.memoryCacheStorage(LoadContextInfo.default);
+ storage = svc.memoryCacheStorage(Services.loadContextInfo.default);
storage.asyncEvictStorage(null);
}
if (clearDisk) {
- storage = svc.diskCacheStorage(LoadContextInfo.default, false);
+ storage = svc.diskCacheStorage(Services.loadContextInfo.default, false);
storage.asyncEvictStorage(null);
}
if (clearAppCache) {
- storage = svc.appCacheStorage(LoadContextInfo.default, null);
+ storage = svc.appCacheStorage(Services.loadContextInfo.default, null);
storage.asyncEvictStorage(null);
}
}
function createURI(urispec)
{
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return ioServ.newURI(urispec);
}
function getCacheStorage(where, lci, appcache)
{
- if (!lci) lci = LoadContextInfo.default;
+ if (!lci) lci = Services.loadContextInfo.default;
var svc = get_cache_service();
switch (where) {
case "disk": return svc.diskCacheStorage(lci, false);
case "memory": return svc.memoryCacheStorage(lci);
case "appcache": return svc.appCacheStorage(lci, appcache);
case "pin": return svc.pinningCacheStorage(lci);
}
return null;
--- a/netwerk/test/unit/test_cache2-21-anon-storage.js
+++ b/netwerk/test/unit/test_cache2-21-anon-storage.js
@@ -1,26 +1,26 @@
-Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
function run_test()
{
do_get_profile();
// Create and check an entry anon disk storage
- asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
+ asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.anonymous,
new OpenCallback(NEW, "an1", "an1", function(entry) {
- asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
+ asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.anonymous,
new OpenCallback(NORMAL, "an1", "an1", function(entry) {
// Create and check an entry non-anon disk storage
- asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
+ asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default,
new OpenCallback(NEW, "na1", "na1", function(entry) {
- asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
+ asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default,
new OpenCallback(NORMAL, "na1", "na1", function(entry) {
// check the anon entry is still there and intact
- asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
+ asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.anonymous,
new OpenCallback(NORMAL, "an1", "an1", function(entry) {
finish_cache2_test();
})
);
})
);
})
);
--- a/netwerk/test/unit/test_cache2-22-anon-visit.js
+++ b/netwerk/test/unit/test_cache2-22-anon-visit.js
@@ -1,37 +1,37 @@
-Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
function run_test()
{
do_get_profile();
var mc = new MultipleCallbacks(2, function() {
- var storage = getCacheStorage("disk", LoadContextInfo.default);
+ var storage = getCacheStorage("disk", Services.loadContextInfo.default);
storage.asyncVisitStorage(
new VisitCallback(1, 1024, ["http://an2/"], function() {
- storage = getCacheStorage("disk", LoadContextInfo.anonymous);
+ storage = getCacheStorage("disk", Services.loadContextInfo.anonymous);
storage.asyncVisitStorage(
new VisitCallback(1, 1024, ["http://an2/"], function() {
finish_cache2_test();
}),
true
);
}),
true
);
});
- asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
+ asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default,
new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {
mc.fired();
})
);
- asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
+ asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.anonymous,
new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {
mc.fired();
})
);
do_test_pending();
}
--- a/netwerk/test/unit/test_cache2-23-read-over-chunk.js
+++ b/netwerk/test/unit/test_cache2-23-read-over-chunk.js
@@ -1,25 +1,25 @@
-Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
function run_test()
{
do_get_profile();
const kChunkSize = (256 * 1024);
var payload = "";
for (var i = 0; i < (kChunkSize + 10); ++i) {
if (i < (kChunkSize - 5))
payload += "0";
else
payload += String.fromCharCode(i + 65);
}
- asyncOpenCacheEntry("http://read/", "disk", Ci.nsICacheStorage.OPEN_TRUNCATE, LoadContextInfo.default,
+ asyncOpenCacheEntry("http://read/", "disk", Ci.nsICacheStorage.OPEN_TRUNCATE, Services.loadContextInfo.default,
new OpenCallback(NEW|WAITFORWRITE, "", payload, function(entry) {
var is = entry.openInputStream(0);
pumpReadStream(is, function(read) {
do_check_eq(read.length, kChunkSize + 10);
is.close();
do_check_true(read == payload); // not using do_check_eq since logger will fail for the 1/4MB string
finish_cache2_test();
});
--- a/netwerk/test/unit/test_cache2-24-exists.js
+++ b/netwerk/test/unit/test_cache2-24-exists.js
@@ -1,9 +1,9 @@
-Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
function run_test()
{
do_get_profile();
var mc = new MultipleCallbacks(2, function() {
var mem = getCacheStorage("memory");
var disk = getCacheStorage("disk");
@@ -12,22 +12,22 @@ function run_test()
do_check_true(mem.exists(createURI("http://m1/"), ""));
do_check_false(mem.exists(createURI("http://m2/"), ""));
do_check_true(disk.exists(createURI("http://d1/"), ""));
do_check_throws_nsIException(() => disk.exists(createURI("http://d2/"), ""), 'NS_ERROR_NOT_AVAILABLE');
finish_cache2_test();
});
- asyncOpenCacheEntry("http://d1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
+ asyncOpenCacheEntry("http://d1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default,
new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function(entry) {
mc.fired();
})
);
- asyncOpenCacheEntry("http://m1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
+ asyncOpenCacheEntry("http://m1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default,
new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function(entry) {
mc.fired();
})
);
do_test_pending();
}
--- a/netwerk/test/unit/test_cache2-25-chunk-memory-limit.js
+++ b/netwerk/test/unit/test_cache2-25-chunk-memory-limit.js
@@ -1,10 +1,8 @@
-Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
-
function gen_200k()
{
var i;
var data="0123456789ABCDEFGHIJLKMNO";
for (i=0; i<13; i++)
data+=data;
return data;
}
--- a/netwerk/test/unit/test_cache2-27-force-valid-for.js
+++ b/netwerk/test/unit/test_cache2-27-force-valid-for.js
@@ -1,19 +1,19 @@
-Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
function run_test()
{
do_get_profile();
var mc = new MultipleCallbacks(2, function() {
finish_cache2_test();
});
- asyncOpenCacheEntry("http://m1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
+ asyncOpenCacheEntry("http://m1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default,
new OpenCallback(NEW, "meta", "data", function(entry) {
// Check the default
equal(entry.isForcedValid, false);
// Forced valid and confirm
entry.forceValidFor(2);
do_timeout(1000, function() {
equal(entry.isForcedValid, true);
--- a/netwerk/test/unit/test_inhibit_caching.js
+++ b/netwerk/test/unit/test_inhibit_caching.js
@@ -1,9 +1,10 @@
-Cu.import('resource://gre/modules/LoadContextInfo.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
+
Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/NetUtil.jsm");
var first = true;
function contentHandler(metadata, response)
{
response.setHeader("Content-Type", 'text/plain');
var body = "first";
--- a/netwerk/test/unit/test_predictor.js
+++ b/netwerk/test/unit/test_predictor.js
@@ -1,17 +1,16 @@
var Ci = Components.interfaces;
var Cu = Components.utils;
var Cr = Components.results;
var Cc = Components.classes;
Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/LoadContextInfo.jsm");
var running_single_process = false;
var predictor = null;
function is_child_process() {
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processType == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
}
@@ -101,17 +100,17 @@ Verifier.prototype = {
do_check_true(false, "Got prefetch for unexpected uri " + uri.asciiSpec);
} else {
this.expected_prefetches.splice(index, 1);
}
dump("checking validity of entry for " + uri.spec + "\n");
var checker = new ValidityChecker(this, status);
asyncOpenCacheEntry(uri.spec, "disk",
- Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
+ Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default,
checker);
},
onPredictPreconnect: function verifier_onPredictPreconnect(uri) {
var origin = extract_origin(uri);
var index = this.expected_preconnects.indexOf(origin);
if (index == -1 && !this.complete) {
do_check_true(false, "Got preconnect for unexpected uri " + origin);
@@ -174,17 +173,17 @@ var prepListener = {
this.numEntriesOpened++;
if (this.numEntriesToOpen == this.numEntriesOpened) {
this.continueCallback();
}
}
};
function open_and_continue(uris, continueCallback) {
- var ds = Services.cache2.diskCacheStorage(LoadContextInfo.default, false);
+ var ds = Services.cache2.diskCacheStorage(Services.loadContextInfo.default, false);
prepListener.init(uris.length, continueCallback);
for (var i = 0; i < uris.length; ++i) {
ds.asyncOpenURI(uris[i], "", Ci.nsICacheStorage.OPEN_NORMALLY,
prepListener);
}
}
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -1,11 +1,10 @@
{
"name": "mozillaeslintsetup",
- "requires": true,
"lockfileVersion": 1,
"dependencies": {
"acorn": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz",
"integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w=="
},
"acorn-jsx": {
@@ -453,21 +452,17 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-4.0.0.tgz",
"integrity": "sha512-xK/909qOTq5JVzuO2jo4a24nQcWhkOBz9dOIkORvB7RxC75a4b6B9wFpBXAl8WDhwJGFDj5gBDRN+/L3kK/ghw==",
"requires": {
"htmlparser2": "3.9.2"
}
},
"eslint-plugin-mozilla": {
- "version": "file:tools/lint/eslint/eslint-plugin-mozilla",
- "requires": {
- "ini-parser": "0.0.2",
- "sax": "1.2.4"
- }
+ "version": "file:tools/lint/eslint/eslint-plugin-mozilla"
},
"eslint-plugin-no-unsanitized": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-2.0.1.tgz",
"integrity": "sha1-yt7dDQrRfI3FIm23/4hATlmo1n8=",
"requires": {
"eslint": "3.19.0"
},
@@ -1431,33 +1426,33 @@
"is-fullwidth-code-point": "2.0.0"
}
},
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
},
+ "string_decoder": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
+ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
+ "requires": {
+ "safe-buffer": "5.1.1"
+ }
+ },
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"requires": {
"is-fullwidth-code-point": "2.0.0",
"strip-ansi": "4.0.0"
}
},
- "string_decoder": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
- "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
- "requires": {
- "safe-buffer": "5.1.1"
- }
- },
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"requires": {
"ansi-regex": "3.0.0"
},
"dependencies": {
deleted file mode 100644
--- a/toolkit/modules/LoadContextInfo.jsm
+++ /dev/null
@@ -1,15 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * This jsm is here only for compatibility. Extension developers may use it
- * to build nsILoadContextInfo to pass down to HTTP cache APIs. Originally
- * it was possible to implement nsILoadContextInfo in JS. But now it turned
- * out to be a built-in class only, so we need a component (service) as
- * a factory to build nsILoadContextInfo in a JS code.
- */
-
-this.EXPORTED_SYMBOLS = ["LoadContextInfo"];
-this.LoadContextInfo = Components.classes["@mozilla.org/load-context-info-factory;1"]
- .getService(Components.interfaces.nsILoadContextInfoFactory);
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -86,19 +86,16 @@ with Files('Integration.jsm'):
BUG_COMPONENT = ('Toolkit', 'Async Tooling')
with Files('JSONFile.jsm'):
BUG_COMPONENT = ('Toolkit', 'Form Manager')
with Files('LightweightThemeConsumer.jsm'):
BUG_COMPONENT = ('Firefox', 'Toolbars and Customization')
-with Files('LoadContextInfo.jsm'):
- BUG_COMPONENT = ('Core', 'Networking: Cache')
-
with Files('Memory.jsm'):
BUG_COMPONENT = ('Core', 'DOM: Content Processes')
with Files('NLP.jsm'):
BUG_COMPONENT = ('Toolkit', 'Find Toolbar')
with Files('NewTabUtils.jsm'):
BUG_COMPONENT = ('Firefox', 'Tabbed Browser')