Skip to content

Commit 97c4998

Browse files
authored
v12.6
Compatible with pale moon v27
1 parent 3d58558 commit 97c4998

File tree

10 files changed

+361
-53
lines changed

10 files changed

+361
-53
lines changed

about.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import url(chrome://global/skin/about.css);
22

33
html {
4-
font-family: message-box, sans-serif;
54
font-size: 16px;
65
}
76
body {

about.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ function process(addons) {
336336
try {
337337
let base = resolveURI(a.getResourceURI(".").cloneIgnoringRef());
338338
let notes;
339-
if (a.id == "about-addons-memory@tn123.org") {
339+
if (a.id == "about-addons-memory-pm@securefox.org") {
340340
notes = [_("footnote-thisaddon")];
341341
}
342342
known.push({

about.xhtml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE html [
3-
<!ENTITY % aboutDTD SYSTEM "chrome://about-addons-memory/locale/about.dtd">
3+
<!ENTITY % aboutDTD SYSTEM "chrome://about-addons-memory-pm/locale/about.dtd">
44
%aboutDTD;
5-
<!ENTITY % defaboutDTD SYSTEM "chrome://about-addons-memory/content/en-US/about.dtd">
5+
<!ENTITY % defaboutDTD SYSTEM "chrome://about-addons-memory-pm/content/en-US/about.dtd">
66
%defaboutDTD;
77
]>
88
<html xmlns="http://www.w3.org/1999/xhtml">
99
<head>
1010
<title>about:addons-memory</title>
1111
<meta content="width=800" name="viewport"/>
1212
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
13-
<script src="chrome://about-addons-memory/content/about.js" type="text/javascript;version=1.8"></script>
14-
<link rel="stylesheet" type="text/css" href="chrome://about-addons-memory/content/about.css"/>
13+
<script src="chrome://about-addons-memory-pm/content/about.js" type="text/javascript;version=1.8"></script>
14+
<link rel="stylesheet" type="text/css" href="chrome://about-addons-memory-pm/content/about.css"/>
1515
</head>
1616
<body data-footnote-locations="&footnote.locations.label;" data-footnote-thisaddon="&footnote.thisaddon.label;" data-by="&by.label;">
17-
<h1>about:addons-memory</h1>
17+
<h1 align="center">Addons Memory Usage Stats</h1>
18+
<p align="center">Pale Moon Extension : [email protected]</p>
19+
<p class="remark"><strong>&note.label;</strong> &remark.count.label; - &remark.conclusion.label;</p>
20+
<p align="center"><button style="width:400px;align:center" onclick="minimizeMemoryUsage(function() location.reload());">----- &minimize.label; -----</button></p>
1821
<table>
1922
<thead>
2023
<tr>
@@ -27,8 +30,5 @@
2730
</thead>
2831
<tbody id="tbody"><td id="loading" class="loading" colspan="5"></td></tbody>
2932
</table>
30-
<p><button onclick="minimizeMemoryUsage(function() location.reload());">&minimize.label;</button></p>
31-
<p class="remark"><strong>&note.label;</strong> &remark.count.label;</p>
32-
<p class="remark">&remark.conclusion.label;</p>
3333
</body>
3434
</html>

bootstrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const global = this;
88
function install() {}
99
function uninstall() {}
1010
function startup(data) {
11-
// will unload itself
12-
Components.utils.import("chrome://about-addons-memory/content/loader.jsm");
11+
// will unload itself
12+
Components.utils.import("chrome://about-addons-memory-pm/content/loader.jsm");
1313
_setupLoader(data, function real_startup() {
1414
try {
1515
require("main");

chrome.manifest

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
content about-addons-memory ./
2-
locale about-addons-memory en-US en-US/
3-
locale about-addons-memory de de/
4-
locale about-addons-memory fr fr/
5-
locale about-addons-memory ja ja/
6-
locale about-addons-memory sv-SE sv-SE/
7-
locale about-addons-memory zh-CN zh-CN/
8-
locale about-addons-memory zh-TW zh-TW/
1+
content about-addons-memory-pm ./
2+
locale about-addons-memory-pm en-US en-US/
3+
locale about-addons-memory-pm de de/
4+
locale about-addons-memory-pm fr fr/
5+
locale about-addons-memory-pm ja ja/
6+
locale about-addons-memory-pm sv-SE sv-SE/
7+
locale about-addons-memory-pm zh-CN zh-CN/
8+
locale about-addons-memory-pm zh-TW zh-TW/

install.rdf

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,49 @@
44
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
55
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
66
<Description about="urn:mozilla:install-manifest">
7-
<em:id>about-addons-memory@tn123.org</em:id>
8-
<em:name>about:addons-memory</em:name>
7+
<em:id>about-addons-memory-pm@securefox.org</em:id>
8+
<em:name>about:addons-memory-pm</em:name>
99
<em:description>Adds an about:addons-memory page that details add-on memory usage</em:description>
10-
<em:version>11</em:version>
11-
<em:creator>Nils Maier</em:creator>
10+
<em:version>12.6</em:version>
11+
<em:creator>Intika (PM) - Nils Maier (FF)</em:creator>
1212

1313
<em:bootstrap>true</em:bootstrap>
14-
<em:multiprocessCompatible>true</em:multiprocessCompatible>
1514
<em:type>2</em:type>
16-
15+
16+
<!-- PaleMoon -->
17+
<em:targetApplication>
18+
<Description>
19+
<em:id>{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}</em:id>
20+
<em:minVersion>27.1.0b1</em:minVersion>
21+
<em:maxVersion>*</em:maxVersion>
22+
</Description>
23+
</em:targetApplication>
24+
1725
<!-- Firefox -->
1826
<em:targetApplication>
19-
<Description>
20-
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
21-
<em:minVersion>45.0</em:minVersion>
22-
<em:maxVersion>50.*</em:maxVersion>
23-
</Description>
27+
<Description>
28+
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
29+
<em:minVersion>19.0</em:minVersion>
30+
<em:maxVersion>28.*</em:maxVersion>
31+
</Description>
2432
</em:targetApplication>
2533

2634
<!-- Android -->
2735
<em:targetApplication>
28-
<Description>
29-
<em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
30-
<em:minVersion>45.0</em:minVersion>
31-
<em:maxVersion>50.*</em:maxVersion>
32-
</Description>
36+
<Description>
37+
<em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
38+
<em:minVersion>19.0</em:minVersion>
39+
<em:maxVersion>28.*</em:maxVersion>
40+
</Description>
3341
</em:targetApplication>
3442

3543
<!-- Seamonkey -->
3644
<em:targetApplication>
37-
<Description>
38-
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
39-
<em:minVersion>2.40</em:minVersion>
40-
<em:maxVersion>2.47.*</em:maxVersion>
41-
</Description>
45+
<Description>
46+
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
47+
<em:minVersion>2.16</em:minVersion>
48+
<em:maxVersion>2.25.*</em:maxVersion>
49+
</Description>
4250
</em:targetApplication>
4351
</Description>
44-
</RDF>
52+
</RDF>

loader.jsm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ var lazy = XPCOMUtils.defineLazyGetter;
200200

201201
let logging;
202202
try {
203-
logging = require("sdk/logging");
203+
logging = require("logging");
204204
for (let [k,v] in new Iterator(logging)) {
205205
exports[k] = v;
206206
}
207207

208-
let prefs = require("sdk/preferences");
208+
let prefs = require("preferences");
209209
exports.prefs = prefs.prefs;
210210
exports.globalPrefs = prefs.globalPrefs;
211211

logging.js

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
3+
* You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
"use strict";
5+
6+
const global = this;
7+
8+
Instances.register("ScriptError", "@mozilla.org/scripterror;1", "nsIScriptError", "init");
9+
10+
var UNKNOWN_STACK = {
11+
stackMsg: "",
12+
sourceName: "unknown",
13+
sourceLine: "",
14+
lineNumber: 0,
15+
columnNumber: 0
16+
};
17+
Object.freeze(UNKNOWN_STACK);
18+
19+
function prepareStack(stack) {
20+
if (!stack || !(stack instanceof Ci.nsIStackFrame)) {
21+
stack = Components.stack;
22+
for (let i = 0; stack && i < 2; ++i) {
23+
stack = stack.caller;
24+
}
25+
if (!stack) {
26+
return UNKNOWN_STACK;
27+
}
28+
}
29+
let rv = {};
30+
rv.sourceName = stack.filename;
31+
rv.sourceLine = stack.sourceLine;
32+
rv.lineNumber = stack.lineNumber;
33+
let message = [];
34+
for (let i = 0; stack && i < 6; ++i, stack = stack.caller) {
35+
if (stack.lineNumber) {
36+
message.push("\t" + (stack.name || "[anonymous]") + "() @ " + stack.filename + ":" + stack.lineNumber);
37+
}
38+
else {
39+
message.push("\t[native @ " + (stack.languageName || "???" ) + "]");
40+
}
41+
}
42+
rv.stackMsg = message.join("\n");
43+
rv.prototype = UNKNOWN_STACK;
44+
return rv;
45+
}
46+
47+
const {
48+
errorFlag,
49+
warningFlag,
50+
exceptionFlag
51+
} = Ci.nsIScriptError;
52+
53+
Object.defineProperties(exports, {
54+
LOG_DEBUG: {value: 0, enumerable: true},
55+
LOG_INFO: {value: 1, enumerable: true},
56+
LOG_ERROR: {value: 2, enumerable: true},
57+
LOG_NONE: {value: 0x7FFFFFFF},
58+
PREFIX: {get: function() prefix},
59+
setLogLevel: {value: function(l) global.level = l}
60+
});
61+
62+
var prefix = ADDON.name;
63+
var level = exports.LOG_NONE;
64+
65+
exports.log = function(level, message, exception) {
66+
try {
67+
if (global.level > level) {
68+
return;
69+
}
70+
71+
if (message instanceof Ci.nsIScriptError || message instanceof Ci.nsIException || message.fileName) {
72+
exception = message;
73+
message = exception.message;
74+
}
75+
else if (exception) {
76+
message = message + " [Exception: " + exception.message + "]";
77+
}
78+
79+
let {
80+
stackMsg,
81+
sourceName,
82+
sourceLine,
83+
lineNumber,
84+
columnNumber
85+
} = prepareStack((exception && exception.location) || null);
86+
87+
if (stackMsg) {
88+
message += "\n" + stackMsg;
89+
}
90+
91+
let category = "component javascript";
92+
93+
if (exception) {
94+
if (exception instanceof Ci.nsIScriptError) {
95+
sourceName = exception.sourceName;
96+
sourceLine = exception.sourceLine;
97+
lineNumber = exception.lineNumber;
98+
columnNumber = exception.columnNumber;
99+
category = exception.category;
100+
}
101+
else if (exception instanceof Ci.nsIException) {
102+
sourceName = exception.filename;
103+
lineNumber = exception.lineNumber;
104+
}
105+
else {
106+
sourceName = exception.fileName || sourceName;
107+
lineNumber = exception.lineNumber || lineNumber;
108+
}
109+
}
110+
111+
let levelMsg;
112+
switch (level) {
113+
case exports.LOG_ERROR:
114+
levelMsg = "error";
115+
break;
116+
case exports.LOG_INFO:
117+
levelMsg = "info";
118+
break;
119+
default:
120+
levelMsg = "debug";
121+
}
122+
123+
message = global.prefix + " (" + levelMsg + ") - " + message;
124+
125+
const scriptError = new Instances.ScriptError(
126+
message,
127+
sourceName,
128+
sourceLine,
129+
lineNumber,
130+
columnNumber,
131+
level >= exports.LOG_ERROR ? errorFlag : warningFlag,
132+
category);
133+
Services.console.logMessage(scriptError);
134+
}
135+
catch (ex) {
136+
reportError("failed to log");
137+
reportError(ex);
138+
reportError(exception || message);
139+
}
140+
}
141+
142+
/* vim: set et ts=2 sw=2 : */

main.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@
66
function AboutModule() {
77
}
88
AboutModule.prototype = {
9-
uri: Services.io.newURI("chrome://about-addons-memory/content/about.xhtml", null, null),
9+
uri: Services.io.newURI("chrome://about-addons-memory-pm/content/about.xhtml", null, null),
1010
classDescription: "about:addons-memory about module",
1111
classID: Components.ID("fda5ee40-a5d6-11e1-b3dd-0800200c9a66"),
1212
contractID: '@mozilla.org/network/protocol/about;1?what=addons-memory',
1313

1414
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
1515

16-
newChannel: function(aURI) {
17-
let chan;
16+
newChannel : function(aURI) {
1817
try {
19-
chan = Services.io.newChannelFromURI2(
18+
let chan = Services.io.newChannelFromURI(this.uri);
19+
chan.originalURI = aURI;
20+
return chan;
21+
}
22+
catch (ex) {
23+
let channew = Services.io.newChannelFromURI2(
2024
this.uri,
2125
null,
2226
Services.scriptSecurityManager.getSystemPrincipal(),
2327
null,
2428
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
2529
Ci.nsIContentPolicy.TYPE_OTHER);
30+
channew.originalURI = aURI;
31+
return channew;
2632
}
27-
catch (ex) {
28-
chan = Services.io.newChannelFromURI(this.uri);
29-
}
30-
chan.originalURI = aURI;
31-
return chan;
3233
},
3334
getURIFlags: function(aURI) 0
3435
};

0 commit comments

Comments
 (0)