Prevent potential memory leaks
Este commit está contenido en:
12
bootstrap.js
vendido
12
bootstrap.js
vendido
@@ -11,6 +11,16 @@ const CAA_URI = Services.io.newURI(CAA_URL, null, null);
|
|||||||
|
|
||||||
const nsIURI = CC("@mozilla.org/network/simple-uri;1", "nsIURI");
|
const nsIURI = CC("@mozilla.org/network/simple-uri;1", "nsIURI");
|
||||||
|
|
||||||
|
const CAA_MODULES = [
|
||||||
|
"chrome://ca-archive/content/about.js",
|
||||||
|
"chrome://ca-archive/content/addon.js",
|
||||||
|
"chrome://ca-archive/content/db.js",
|
||||||
|
"chrome://ca-archive/content/epl.js",
|
||||||
|
"chrome://ca-archive/content/list.js",
|
||||||
|
"chrome://ca-archive/content/tcloud.js",
|
||||||
|
"chrome://ca-archive/content/versions.js"
|
||||||
|
];
|
||||||
|
|
||||||
let factory, gWindowListener = null, branch = "extensions.ca-archive.";
|
let factory, gWindowListener = null, branch = "extensions.ca-archive.";
|
||||||
|
|
||||||
let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
|
let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
|
||||||
@@ -292,6 +302,8 @@ function shutdown(data, reason) {
|
|||||||
if (styleSheetService.sheetRegistered(styleSheetURI, styleSheetService.USER_SHEET)) {
|
if (styleSheetService.sheetRegistered(styleSheetURI, styleSheetService.USER_SHEET)) {
|
||||||
styleSheetService.unregisterSheet(styleSheetURI, styleSheetService.USER_SHEET);
|
styleSheetService.unregisterSheet(styleSheetURI, styleSheetService.USER_SHEET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAA_MODULES.forEach(Cu.unload, Cu);
|
||||||
}
|
}
|
||||||
|
|
||||||
function install(data, reason) {}
|
function install(data, reason) {}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
(function () {
|
(function () {
|
||||||
var Cu = Components.utils;
|
var Cu = Components.utils;
|
||||||
|
|
||||||
let dbname = "ca-archive-17110901.sqlite"; let ver = "17110902";
|
let dbname = "ca-archive-17110901.sqlite";
|
||||||
|
|
||||||
Cu.import("chrome://ca-archive/content/db.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/db.js");
|
||||||
if (!DB.openDB(dbname, document)) {
|
if (!DB.openDB(dbname, document)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -20,25 +20,25 @@
|
|||||||
try {
|
try {
|
||||||
let params, url = decodeURI(document.location);
|
let params, url = decodeURI(document.location);
|
||||||
if ((params = /^caa:addon\/(.+?)\/versions\/?(\?page=(\d+)(#.+)?)?$/.exec(url)) !== null) {
|
if ((params = /^caa:addon\/(.+?)\/versions\/?(\?page=(\d+)(#.+)?)?$/.exec(url)) !== null) {
|
||||||
Cu.import("chrome://ca-archive/content/versions.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/versions.js");
|
||||||
Versions.showPage(document, DB.db, params[1], params[3]);
|
Versions.showPage(document, DB.db, params[1], params[3]);
|
||||||
} else if ((params = /^caa:addon\/(.+?)\/(eula|privacy|license\/(.+))$/.exec(url)) !== null) {
|
} else if ((params = /^caa:addon\/(.+?)\/(eula|privacy|license\/(.+))$/.exec(url)) !== null) {
|
||||||
Cu.import("chrome://ca-archive/content/epl.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/epl.js");
|
||||||
EPL.showPage(document, DB.db, params[1], params[2], params[3]);
|
EPL.showPage(document, DB.db, params[1], params[2], params[3]);
|
||||||
} else if ((params = /^caa:addon\/(.+?)\/?$/.exec(url)) !== null) {
|
} else if ((params = /^caa:addon\/(.+?)\/?$/.exec(url)) !== null) {
|
||||||
Cu.import("chrome://ca-archive/content/addon.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/addon.js");
|
||||||
Addon.showPage(document, DB.db, params[1]);
|
Addon.showPage(document, DB.db, params[1]);
|
||||||
} else if ((params = /^caa:list(\/([a-z-]+))?(\?tag=(.+?)|\?q=(.+?))?([\?|\&]sort=(\w+))?\&?(page=(\d+))?$/.exec(url)) !== null) {
|
} else if ((params = /^caa:list(\/([a-z-]+))?(\?tag=(.+?)|\?q=(.+?))?([\?|\&]sort=(\w+))?\&?(page=(\d+))?$/.exec(url)) !== null) {
|
||||||
Cu.import("chrome://ca-archive/content/list.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/list.js");
|
||||||
List.showPage(document, DB.db, params[2], params[4], params[5], params[7], params[9]);
|
List.showPage(document, DB.db, params[2], params[4], params[5], params[7], params[9]);
|
||||||
} else if (url == "caa:") {
|
} else if (url == "caa:") {
|
||||||
Cu.import("chrome://ca-archive/content/tcloud.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/tcloud.js");
|
||||||
TCloud.showPage(document, DB.db);
|
TCloud.showPage(document, DB.db);
|
||||||
} else if (url == "caa:about") {
|
} else if (url == "caa:about") {
|
||||||
Cu.import("chrome://ca-archive/content/about.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/about.js");
|
||||||
About.showPage(document, DB.db);
|
About.showPage(document, DB.db);
|
||||||
} else if ((params = /^caa:(.+)$/.exec(url)) !== null) {
|
} else if ((params = /^caa:(.+)$/.exec(url)) !== null) {
|
||||||
Cu.import("chrome://ca-archive/content/list.js" + "?" + ver);
|
Cu.import("chrome://ca-archive/content/list.js");
|
||||||
List.showPage(document, DB.db, undefined, undefined, params[1], undefined, undefined);
|
List.showPage(document, DB.db, undefined, undefined, params[1], undefined, undefined);
|
||||||
} else {
|
} else {
|
||||||
document.location = "caa:list";
|
document.location = "caa:list";
|
||||||
|
|||||||
Referencia en una nueva incidencia
Block a user