mirror of
https://github.com/roytam1/boc-uxp.git
synced 2021-11-05 16:13:16 +00:00
47e1f1572f
abprime and inspector remain busted
97 lines
2.6 KiB
HTML
97 lines
2.6 KiB
HTML
<html>
|
|
<head>
|
|
<title>Adblock Plus Errors</title>
|
|
<style type="text/css">
|
|
.warning, .error
|
|
{
|
|
border: 1px dashed black;
|
|
margin: 5px;
|
|
padding: 2px;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
.error
|
|
{
|
|
background-color: #fff0f0;
|
|
}
|
|
|
|
.warning
|
|
{
|
|
background-color: #ffffe0;
|
|
}
|
|
|
|
button
|
|
{
|
|
float: right;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<button onclick="window.location.reload();">Refresh</button>
|
|
<button onclick="clearErrors();">Clear errors</button>
|
|
|
|
<script type="application/x-javascript;version=1.7">
|
|
try {
|
|
Components.utils.import("chrome://adblockplus-modules/content/Utils.jsm");
|
|
|
|
let text = "You are running Adblock Plus " + Utils.addonVersion;
|
|
let build = Utils.addonBuild;
|
|
if (build)
|
|
text += ", build " + build;
|
|
text += ".";
|
|
document.write("<p>" + text + "</p>");
|
|
} catch (e) {}
|
|
|
|
let messages = {};
|
|
Components.classes["@mozilla.org/consoleservice;1"]
|
|
.getService(Components.interfaces.nsIConsoleService)
|
|
.getMessageArray(messages, {});
|
|
messages = messages.value || [];
|
|
|
|
messages = messages.filter(function(message)
|
|
{
|
|
return (message instanceof Components.interfaces.nsIScriptError &&
|
|
!/^https?:/i.test(message.sourceName) &&
|
|
(/adblock/i.test(message.errorMessage) || /adblock/i.test(message.sourceName)));
|
|
});
|
|
|
|
if (messages.length)
|
|
{
|
|
document.write("<p>Errors related to Adblock Plus:</p>");
|
|
|
|
for each (let message in messages)
|
|
{
|
|
let type = (message.flags & Components.interfaces.nsIScriptError.warningFlag ? "warning" : "error");
|
|
let html = "<b>" + (type == "warning" ? "Warning:" : "Error:") + "</b><br>";
|
|
html += encodeHTML(message.errorMessage) + "<br><br>";
|
|
if (message.sourceLine)
|
|
html += "Source line: " + encodeHTML(message.sourceLine) + "<br>";
|
|
if (message.sourceName)
|
|
html += "Location: " + encodeHTML(message.sourceName) + " line " + message.lineNumber + "<br>";
|
|
html = html.replace(/(<br>)+$/, "");
|
|
document.write("<div class='" + type + "'>" +
|
|
html +
|
|
"</div>");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
document.write("<p>No errors found.</p>");
|
|
}
|
|
|
|
function encodeHTML(string)
|
|
{
|
|
return string.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
}
|
|
|
|
function clearErrors()
|
|
{
|
|
Components.classes["@mozilla.org/consoleservice;1"]
|
|
.getService(Components.interfaces.nsIConsoleService)
|
|
.reset();
|
|
window.location.reload();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|