mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1318371: Flush jar caches by path rather than creating a nsIFile in the content process. r=billm
MozReview-Commit-ID: 4J88w5lxEsP --HG-- extra : rebase_source : af96201524bd1caeaf5c1ac2a80e47e8d3111590 extra : amend_source : 12f124c75cb035aa5326fad65cfb2325dc845a3d
This commit is contained in:
parent
fbd57c7dd3
commit
29a9c0be12
@ -13,6 +13,7 @@
|
||||
#include "nsIDataSignatureVerifier.h"
|
||||
#include "prprf.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <sys/stat.h>
|
||||
@ -1360,7 +1361,14 @@ nsZipReaderCache::Observe(nsISupports *aSubject,
|
||||
mZips.Clear();
|
||||
}
|
||||
else if (strcmp(aTopic, "flush-cache-entry") == 0) {
|
||||
nsCOMPtr<nsIFile> file = do_QueryInterface(aSubject);
|
||||
nsCOMPtr<nsIFile> file;
|
||||
if (aSubject) {
|
||||
file = do_QueryInterface(aSubject);
|
||||
} else if (aSomeData) {
|
||||
nsDependentString fileName(aSomeData);
|
||||
Unused << NS_NewLocalFile(fileName, false, getter_AddRefs(file));
|
||||
}
|
||||
|
||||
if (!file)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -895,10 +895,7 @@ ExtensionManager = {
|
||||
}
|
||||
|
||||
case "Extension:FlushJarCache": {
|
||||
let nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
|
||||
"initWithPath");
|
||||
let file = new nsIFile(data.path);
|
||||
flushJarCache(file);
|
||||
flushJarCache(data.path);
|
||||
Services.cpmm.sendAsyncMessage("Extension:FlushJarCacheComplete");
|
||||
break;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ class ExtensionTestCommon {
|
||||
static generate(data) {
|
||||
let file = this.generateXPI(data);
|
||||
|
||||
flushJarCache(file);
|
||||
flushJarCache(file.path);
|
||||
Services.ppmm.broadcastAsyncMessage("Extension:FlushJarCache", {path: file.path});
|
||||
|
||||
let fileURI = Services.io.newFileURI(file);
|
||||
|
@ -885,8 +885,8 @@ function getMessageManager(target) {
|
||||
return target.QueryInterface(Ci.nsIMessageSender);
|
||||
}
|
||||
|
||||
function flushJarCache(jarFile) {
|
||||
Services.obs.notifyObservers(jarFile, "flush-cache-entry", null);
|
||||
function flushJarCache(jarPath) {
|
||||
Services.obs.notifyObservers(null, "flush-cache-entry", jarPath);
|
||||
}
|
||||
|
||||
const PlatformInfo = Object.freeze({
|
||||
|
@ -12,9 +12,6 @@ var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
var {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
var nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
|
||||
"initWithPath");
|
||||
|
||||
const MSG_JAR_FLUSH = "AddonJarFlush";
|
||||
const MSG_MESSAGE_MANAGER_CACHES_FLUSH = "AddonMessageManagerCachesFlush";
|
||||
|
||||
@ -23,8 +20,7 @@ try {
|
||||
if (Services.appinfo.processType !== Services.appinfo.PROCESS_TYPE_DEFAULT) {
|
||||
// Propagate JAR cache flush notifications across process boundaries.
|
||||
addMessageListener(MSG_JAR_FLUSH, function(message) {
|
||||
let file = new nsIFile(message.data);
|
||||
Services.obs.notifyObservers(file, "flush-cache-entry", null);
|
||||
Services.obs.notifyObservers(null, "flush-cache-entry", message.data);
|
||||
});
|
||||
// Propagate message manager caches flush notifications across processes.
|
||||
addMessageListener(MSG_MESSAGE_MANAGER_CACHES_FLUSH, function() {
|
||||
|
Loading…
Reference in New Issue
Block a user