summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <none@none>2013-02-26 01:32:00 +0100
committerportix <none@none>2013-02-26 01:32:00 +0100
commitce38b37da1fadbca561439d1a8a22c3abf217d70 (patch)
tree2a4f7e87d1696dd17d483d83cc72b6d9e5d93a95
parentf1ddce570eec1666144d7fa80c37ed83991d5ec5 (diff)
downloaddwb-ce38b37da1fadbca561439d1a8a22c3abf217d70.zip
Use script.debug instead of extensions.debug in extensions; remove extensions.debug, extensions.enableDebugging, extensions.reload
-rw-r--r--api/dwb-js.757
-rw-r--r--api/jsapi.7.txt24
-rw-r--r--api/jsapi.txt53
-rw-r--r--extensions/requestpolicy3
-rw-r--r--extensions/userscripts24
-rw-r--r--scripts/lib/extensions.js25
6 files changed, 17 insertions, 169 deletions
diff --git a/api/dwb-js.7 b/api/dwb-js.7
index 3853a1ab..16a6ef3b 100644
--- a/api/dwb-js.7
+++ b/api/dwb-js.7
@@ -2,12 +2,12 @@
.\" Title: dwb-js
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.0 <http://docbook.sf.net/>
-.\" Date: 02/25/2013
+.\" Date: 02/26/2013
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "DWB\-JS" "7" "02/25/2013" "\ \&" "\ \&"
+.TH "DWB\-JS" "7" "02/26/2013" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -3997,12 +3997,6 @@ extensions\&.bind("mySecondExtension", "Control M");
.\}
.sp
The default searchpaths for extensions are $XDG_DATA_HOME/dwb/extensions/ and /usr/share/dwb/extensions/\&.
-.SS "Properties"
-.PP
-\fIextensions\&.enableDebugging (Boolean, read, write)\fR
-.RS 4
-Whether to enable debugging messages\&.
-.RE
.SS "Methods"
.sp
.it 1 an-trap
@@ -4051,27 +4045,6 @@ Command that can be used on command line
.nr an-break-flag 1
.br
.ps +1
-\fBvoid extensions.debug(String name, String message)\fR
-.RS 4
-.sp
-Prints a debug message and the call stack to stdout, enableDebugging must be set to true in order to print debug messages\&.
-.PP
-\fIname\fR
-.RS 4
-Name of the extension
-.RE
-.PP
-\fImessage\fR
-.RS 4
-The debug message to print\&.
-.RE
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
\fBvoid extensions.disableAll()\fR
.RS 4
.sp
@@ -4109,32 +4082,6 @@ True if the extension was loaded
.nr an-break-flag 1
.br
.ps +1
-\fBBoolean extensions.reload(String name, [Object config])\fR
-.RS 4
-.sp
-Reloads an extension
-.PP
-\fIname\fR
-.RS 4
-Name of the extension
-.RE
-.PP
-\fIconfig\fR
-.RS 4
-The new config for the script, if omitted the old config is used, optional
-.RE
-.PP
-\fIreturns\fR
-.RS 4
-True if the extension was successfully reloaded
-.RE
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
\fBBoolean extensions.toggle(String name, [Object config])\fR
.RS 4
.sp
diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt
index 67294728..52fc211e 100644
--- a/api/jsapi.7.txt
+++ b/api/jsapi.7.txt
@@ -2101,10 +2101,6 @@ extensions.bind("mySecondExtension", "Control M");
The default searchpaths for extensions are $XDG_DATA_HOME/dwb/extensions/ and
/usr/share/dwb/extensions/.
-=== Properties
-
-_extensions.enableDebugging (Boolean, read, write)_;; Whether to enable debugging messages.
-
=== Methods
==== void extensions.bind(String name, String shortcut, [Object options])
@@ -2119,16 +2115,6 @@ options.config::: Config passed to extensions.load
options.command::: Command that can be used on command line
****
-
-==== void extensions.debug(String name, String message)
-****
-Prints a debug message and the call stack to stdout, enableDebugging must be
-set to true in order to print debug messages.
-
-_name_;; Name of the extension
-_message_;; The debug message to print.
-****
-
==== void extensions.disableAll()
****
Disables all extensions.
@@ -2144,16 +2130,6 @@ $XDG_CONFIG_HOME/dwb/extensionrc, optional
_returns_;; True if the extension was loaded
****
-==== Boolean extensions.reload(String name, [Object config])
-****
-Reloads an extension
-
-_name_;; Name of the extension
-_config_;; The new config for the script, if omitted the old config is used,
-optional
-_returns_;; True if the extension was successfully reloaded
-****
-
==== Boolean extensions.toggle(String name, [Object config])
****
Toggles an extension
diff --git a/api/jsapi.txt b/api/jsapi.txt
index 22e66888..57037c79 100644
--- a/api/jsapi.txt
+++ b/api/jsapi.txt
@@ -3523,21 +3523,7 @@ extensions.bind("mySecondExtension", "Control M");
The default searchpaths for extensions are +$XDG_DATA_HOME/dwb/extensions/+ and
+/usr/share/dwb/extensions/+.
-The +extensions+ object has the following properties and functions
-
-=== Properties ===
-
-****
-[float]
-==== *enableDebugging* ====
-
-[source,javascript]
-----
-extensions.enableDebugging Boolean read
-----
-
-Whether to enable debugging messages.
-****
+The +extensions+ object has the following functions
=== Methods ===
@@ -3562,24 +3548,6 @@ options.command::: Command that can be used on commandline
****
****
-[[extensiondebug,debug]]
-[float]
-==== *debug()* ====
-
-[source,javascript]
-----
-void extensions.debug(String name, String message)
-----
-Prints a debug message and the call stack to stdout, +enableDebugging+ must be
-set to +true+ in order to print debug messages.
-
- ::
-
-_name_;; Name of the extension
-_message_;; The debug message to print.
-****
-
-****
[[extensiondisableAll,disableAll]]
[float]
==== *disableAll()* ====
@@ -3629,25 +3597,6 @@ _returns_;; True if the extension was loaded
****
****
-[[extensionload,reload]]
-[float]
-==== *reload()* ====
-
-[source,javascript]
-----
-Boolean extensions.reload(String name, [Object config])
-----
-Reloads an extension
-
- ::
-
-_name_;; Name of the extension
-_config_;; The new config for the script, if omitted the old config is used,
-optional
-_returns_;; True if the extension was successfully reloaded
-****
-
-****
[[extensiontoggle,toggle]]
[float]
==== *toggle()* ====
diff --git a/extensions/requestpolicy b/extensions/requestpolicy
index 44455c8d..84f7daae 100644
--- a/extensions/requestpolicy
+++ b/extensions/requestpolicy
@@ -448,7 +448,8 @@ return {
}
catch (e)
{
- extensions.debug(me, e, "Error parsing persistentList");
+ script.debug(e);
+ return false;
}
}
persistentList = persistentList || {};
diff --git a/extensions/userscripts b/extensions/userscripts
index 14b98a59..689b07de 100644
--- a/extensions/userscripts
+++ b/extensions/userscripts
@@ -262,7 +262,7 @@ function handle(frame, array, isMainFrame) //{{{
}
catch (e)
{
- extensions.debug(me);
+ script.debug(e);
}
}
}//}}}
@@ -381,25 +381,25 @@ function parseScript(path) //{{{
var userscript;
var i, items, key, value, idx, m, matches = [], numVal;
- var script = io.read(path);
- if (!script || (/^\s*$/).test(script))
+ var curScript = io.read(path);
+ if (!curScript || (/^\s*$/).test(curScript))
return;
- var metaStart = script.search(/(^|\n)\/\/\s*==UserScript==/);
- var metaEnd = script.search(/\n\/\/\s*==\/UserScript==/);
+ var metaStart = curScript.search(/(^|\n)\/\/\s*==UserScript==/);
+ var metaEnd = curScript.search(/\n\/\/\s*==\/UserScript==/);
userscript = new UserScript();
if (metaStart == -1 || metaEnd == -1)
{
- userscript.script = script;
+ userscript.script = curScript;
userscript.include = [ { regExp : /.*/, isTld : false} ];
onEnd.push(userscript);
return;
}
- var meta = script.substring(metaStart, metaEnd).split("\n");
- var scriptStart = script.substring(metaEnd+1).indexOf("\n") + metaEnd + 1;
+ var meta = curScript.substring(metaStart, metaEnd).split("\n");
+ var scriptStart = curScript.substring(metaEnd+1).indexOf("\n") + metaEnd + 1;
var regValue = /\s[^\/@]\S?/;
var regIsRule = /^\s*\/\/\s*@/;
@@ -432,7 +432,7 @@ function parseScript(path) //{{{
userscript[key] = numVal;
}
catch (e) {
- extensions.debug(me, e);
+ script.debug(e);
}
}
else if (key == "unwrap")
@@ -446,7 +446,7 @@ function parseScript(path) //{{{
}
catch(e)
{
- extensions.debug(me, e);
+ script.debug(e);
}
}
@@ -464,8 +464,8 @@ function parseScript(path) //{{{
userscript.scriptId = userscript.namespace + "::" + userscript.name;
userscript.scriptId = userscript.scriptId.replace(/\s+/g, "_");
userscript.script = "var DWB_scriptId = '" + userscript.scriptId + "';" +
- util.getBody(GM_compatability) + script.substring(0, metaStart) +
- script.substring(scriptStart);
+ util.getBody(GM_compatability) + curScript.substring(0, metaStart) +
+ curScript.substring(scriptStart);
getRequirements(userscript);
diff --git a/scripts/lib/extensions.js b/scripts/lib/extensions.js
index 7638c0c8..7d1a2356 100644
--- a/scripts/lib/extensions.js
+++ b/scripts/lib/extensions.js
@@ -1,6 +1,5 @@
(function () {
var _config = {};
- var _debug = false;
var _registered = {};
var _configLoaded = false;
@@ -62,22 +61,6 @@
io.print("\033[1mDWB EXTENSION WARNING: \033[0mextension \033[1m" + name + "\033[0m: " + message, "stderr");
}
},
- "enableDebugging" :
- {
- set : function (value)
- {
- if (typeof value == "boolean")
- _debug = value;
- }
- },
- "debug" :
- {
- value : function (name, message) {
- if (_debug) {
- io.print("\033[1mDWB EXTENSION DEBUG: \033[0mextension \033[1m" + name + "\033[0m\n" + getStack(1), "stderr");
- }
- }
- },
"error" :
{
value : function (name, a, b) {
@@ -225,14 +208,6 @@
_unload(key, true);
}
},
- "reload" :
- {
- value : function ()
- {
- _unload(arguments[0], false);
- return extensions.load.apply(this, arguments);
- }
- },
"toggle" :
{
value : function(name, c)