summaryrefslogtreecommitdiff
path: root/crocoite
diff options
context:
space:
mode:
Diffstat (limited to 'crocoite')
-rw-r--r--crocoite/behavior.py3
-rw-r--r--crocoite/data/extract-links.js4
2 files changed, 5 insertions, 2 deletions
diff --git a/crocoite/behavior.py b/crocoite/behavior.py
index c658699..95e8160 100644
--- a/crocoite/behavior.py
+++ b/crocoite/behavior.py
@@ -256,7 +256,8 @@ class ExtractLinks (Behavior):
def onfinish (self):
tab = self.loader.tab
self.useScript (self.script)
- self.links = list (set (tab.Runtime.evaluate (expression=self.script, returnByValue=True)['result']['value']))
+ result = tab.Runtime.evaluate (expression=self.script, returnByValue=True)
+ self.links = list (set (result['result']['value']))
# available behavior scripts. Order matters, move those modifying the page
# towards the end of available
diff --git a/crocoite/data/extract-links.js b/crocoite/data/extract-links.js
index 5199a63..4d1a3d0 100644
--- a/crocoite/data/extract-links.js
+++ b/crocoite/data/extract-links.js
@@ -1,6 +1,7 @@
/* Extract links from a page
*/
+(function () {
/* --- copy&paste from click.js --- */
/* Element is visible if itself and all of its parents are
*/
@@ -31,4 +32,5 @@ for (let i=0; i < x.length; i++) {
ret.push (x[i].href);
}
}
-ret; /* immediately return results, for use with Runtime.evaluate() */
+return ret; /* immediately return results, for use with Runtime.evaluate() */
+})();