Permalink
Browse files

Clean up on noscript.js

removed extraneous dumpln calls
brought it up to date with extension_is_enabled for loading
added noscript to the default-modules
  • Loading branch information...
1 parent cf37e8b commit 7070419fd279644e1904c190e8f8b4359ad8ef77 Dave Kerschner committed with retroj Feb 26, 2010
Showing with 11 additions and 12 deletions.
  1. +1 −0 defaults/preferences/default-modules.js
  2. +10 −12 modules/extensions/noscript.js
@@ -49,6 +49,7 @@ pref("conkeror.load.tab-bar", 0);
pref("conkeror.load.extensions/dom-inspector", 1);
pref("conkeror.load.extensions/adblockplus", 1);
pref("conkeror.load.extensions/venkman", 1);
+pref("conkeror.load.extensions/noscript", 1);
// Page mode modules
pref("conkeror.load.page-modes/youtube", 1);
@@ -1,11 +1,11 @@
-require("window.js");
-require("utils.js");
-var noscript_service = Cc["@maone.net/noscript-service;1"] ?
- Cc["@maone.net/noscript-service;1"].createInstance().wrappedJSObject : null;
+require("extension.js");
-if (! noscript_service)
- dumpln("WARNING: noscript wrapper loaded, but extension is not present.");
+if (!extension_is_enabled("{73a6fe31-595d-460b-a920-fcc0f8843232}"))
+ throw skip_module_load;
+
+var noscript_service = Cc["@maone.net/noscript-service;1"]
+ .createInstance().wrappedJSObject;
function unique(a) {
var r = new Array();
@@ -41,7 +41,7 @@ function showObject(p, o) {
}
function setObjectVisibility(document, callback) {
- tags = ["object", "embed"];
+ var tags = ["object", "embed"];
const ns = noscript_service;
var rx = ns.hideOnUnloadRegExp;
if (!rx) return;
@@ -53,8 +53,9 @@ function setObjectVisibility(document, callback) {
};
var objects = null;
+ var local_objects, count;
+
for each(var tag in tags) {
- dumpln('tag: '+tag);
local_objects = document.getElementsByTagName(tag);
count = local_objects.count;
if (count) {
@@ -73,8 +74,7 @@ function setObjectVisibility(document, callback) {
function ns_allow_temp(url, buffer, P, allow) {
- dumpln(url);
- dumpln(allow);
+ var enabled, temp;
const ns = noscript_service;
if (allow == "Y" || allow == "y" || allow == "yes" || allow == "Yes") {
enabled = true;
@@ -92,7 +92,6 @@ function ns_allow_temp(url, buffer, P, allow) {
}
interactive("ns-toggle-temp", "Allow a site temporary access to javascript", function(I) {
- dumpln(I.window);
const ns = noscript_service;
var urls = new Array();
var level = ns.getPref("toolbarToggle", 3);
@@ -110,7 +109,6 @@ interactive("ns-toggle-temp", "Allow a site temporary access to javascript", f
}
}
urls = unique(urls);
- dumpln(urls);
while (url2 = urls.pop()) {
ns_allow_temp(url2, I.buffer,I.P, (yield I.minibuffer.read ($prompt = "Allow "+url2+"? [Y/[N]]")));
}

0 comments on commit 7070419

Please sign in to comment.