summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Maglione <kris@vimperator.org>2010-06-03 20:24:16 -0400
committerKris Maglione <kris@vimperator.org>2010-06-03 20:24:16 -0400
commita6f90714e4320d057607d105b6acbf6509ba508c (patch)
tree77e686f45172347e8730d552f12f161d854f235e
parentb6267c4f19c4f2b2f37626cd666ceb09a818a6d7 (diff)
downloadpentadactyl-a6f90714e4320d057607d105b6acbf6509ba508c.tar.gz
Fix broken JS completion.
--HG-- branch : testing
-rw-r--r--common/Makefile4
-rw-r--r--common/content/bookmarks.js7
-rw-r--r--common/content/buffer.js3
-rw-r--r--common/content/finder.js10
-rw-r--r--common/content/hints.js2
-rw-r--r--common/content/javascript.js38
-rw-r--r--common/content/liberator.js4
-rw-r--r--common/content/util.js2
-rw-r--r--common/make_jar.sh4
-rw-r--r--vimperator/TODO28
-rw-r--r--vimperator/install.rdf2
11 files changed, 51 insertions, 53 deletions
diff --git a/common/Makefile b/common/Makefile
index a918fc96..95441a2e 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -99,8 +99,8 @@ dist: $(XPI)
$(RDF): $(RDF_IN) Makefile
@echo "Preparing release..."
- $(SED) -e "s,###VERSION###,$(VERSION),g" \
- -e "s,###DATE###,$(BUILD_DATE),g" \
+ $(SED) -e "s,@VERSION@,$(VERSION),g" \
+ -e "s,@DATE@,$(BUILD_DATE),g" \
< $< > $@
@echo "SUCCESS: $@"
diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js
index 95ecdba9..7c7d47f0 100644
--- a/common/content/bookmarks.js
+++ b/common/content/bookmarks.js
@@ -656,8 +656,11 @@ const Bookmarks = Module("bookmarks", {
let rest = item.url.length - end.length;
let query = item.url.substring(begin.length, rest);
if (item.url.substr(rest) == end && query.indexOf("&") == -1) {
- item.url = decodeURIComponent(query.replace(/#.*/, ""));
- return item;
+ try {
+ item.url = decodeURIComponent(query.replace(/#.*/, ""));
+ return item;
+ }
+ catch (e) {}
}
return null;
}).filter(util.identity);
diff --git a/common/content/buffer.js b/common/content/buffer.js
index dda58534..4a6d4266 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -169,7 +169,7 @@ const Buffer = Module("buffer", {
// called when the active document is scrolled
_updateBufferPosition: function _updateBufferPosition() {
statusline.updateBufferPosition();
- modes.show();
+ modes.show(); // Clear the status line.
},
onDOMContentLoaded: function onDOMContentLoaded(event) {
@@ -283,6 +283,7 @@ const Buffer = Module("buffer", {
setTimeout(function () {
statusline.updateBufferPosition();
statusline.updateZoomLevel();
+ modes.show(); // Clear the status line.
}, 500);
},
// called at the very end of a page load
diff --git a/common/content/finder.js b/common/content/finder.js
index 6af97a47..aa78d3a7 100644
--- a/common/content/finder.js
+++ b/common/content/finder.js
@@ -361,7 +361,7 @@ const RangeFind = Class("RangeFind", {
// This doesn't work yet.
resetCaret: function () {
let equal = RangeFind.equal;
- letselection = this.win.getSelection();
+ let selection = this.win.getSelection();
if (selection.rangeCount == 0)
selection.addRange(this.pageStart);
function getLines() {
@@ -627,7 +627,13 @@ const RangeFind = Class("RangeFind", {
range.collapse(before);
return range;
},
- equal: function (r1, r2) !r1.compareBoundaryPoints(Range.START_TO_START, r2) && !r1.compareBoundaryPoints(Range.END_TO_END, r2)
+ equal: function (r1, r2) {
+ try {
+ return !r1.compareBoundaryPoints(Range.START_TO_START, r2) && !r1.compareBoundaryPoints(Range.END_TO_END, r2)
+ }
+ catch (e) {}
+ return false;
+ }
});
// vim: set fdm=marker sw=4 ts=4 et:
diff --git a/common/content/hints.js b/common/content/hints.js
index 4459c0b2..60babe15 100644
--- a/common/content/hints.js
+++ b/common/content/hints.js
@@ -268,7 +268,7 @@ const Hints = Module("hints", {
let hint = { elem: elem, showText: false };
// TODO: for iframes, this calculation is wrong
- rect = elem.getBoundingClientRect();
+ let rect = elem.getBoundingClientRect();
if (!rect || rect.top > height || rect.bottom < 0 || rect.left > width || rect.right < 0)
continue;
diff --git a/common/content/javascript.js b/common/content/javascript.js
index 98804f7c..cdc097ee 100644
--- a/common/content/javascript.js
+++ b/common/content/javascript.js
@@ -37,7 +37,10 @@ const JavaScript = Module("javascript", {
let seen = {};
let ret = {};
- try {
+ if(obj == null)
+ return;
+
+ if(options["jsdebugger"]) {
let orig = obj;
let top = services.get("debugger").wrapValue(obj);
@@ -56,13 +59,16 @@ const JavaScript = Module("javascript", {
}
// The debugger doesn't list some properties. I can't guess why.
for (let k in orig)
- if (k in orig && !('|' + k in seen) && obj.hasOwnProperty(k) == toplevel)
+ if (k in orig && !('|' + k in seen) && orig.hasOwnProperty(k) == toplevel)
yield [k, this.getKey(orig, k)]
}
- catch(e) {
+ else {
for (k in allkeys(obj))
- if (obj.hasOwnProperty(k) == toplevel)
- yield [k, this.getKey(obj, k)];
+ try {
+ if (obj.hasOwnProperty(k) == toplevel)
+ yield [k, this.getKey(obj, k)];
+ }
+ catch (e) {}
}
},
@@ -230,8 +236,6 @@ const JavaScript = Module("javascript", {
case "'":
case "/":
case "{":
- this._push(this._c);
- break;
case "[":
this._push(this._c);
break;
@@ -341,6 +345,10 @@ const JavaScript = Module("javascript", {
_complete: function (objects, key, compl, string, last) {
const self = this;
+
+ if(!options["jsdebugger"] && !this.context.message)
+ this.context.message = "For better completion data, please enable the JavaScript debugger (:set jsdebugger)";
+
let orig = compl;
if (!compl) {
compl = function (context, obj, recurse) {
@@ -427,7 +435,8 @@ const JavaScript = Module("javascript", {
// Okay, have parse stack. Figure out what we're completing.
// Find any complete statements that we can eval before we eval our object.
- // This allows for things like: let doc = window.content.document; let elem = doc.createElement...; elem.<Tab>
+ // This allows for things like:
+ // let doc = window.content.document; let elem = doc.createEle<Tab> ...
let prev = 0;
for (let [, v] in Iterator(this._get(0).fullStatements)) {
let key = this._str.substring(prev, v + 1);
@@ -437,14 +446,13 @@ const JavaScript = Module("javascript", {
prev = v + 1;
}
- // In a string. Check if we're dereferencing an object.
- // Otherwise, do nothing.
+ // In a string. Check if we're dereferencing an object or
+ // completing a function argument. Otherwise, do nothing.
if (this._last == "'" || this._last == '"') {
- //
+
// str = "foo[bar + 'baz"
// obj = "foo"
// key = "bar + ''"
- //
// The top of the stack is the sting we're completing.
// Wrap it in its delimiters and eval it to process escape sequences.
@@ -520,7 +528,7 @@ const JavaScript = Module("javascript", {
return null;
}
- //
+
// str = "foo.bar.baz"
// obj = "foo.bar"
// key = "baz"
@@ -528,11 +536,11 @@ const JavaScript = Module("javascript", {
// str = "foo"
// obj = [modules, window]
// key = "foo"
- //
+
let [offset, obj, key] = this._getObjKey(-1);
- // Wait for a keypress before completing the default objects.
+ // Wait for a keypress before completing when there's no key
if (!this.context.tabPressed && key == "" && obj.length > 1) {
this.context.waitingForTab = true;
this.context.message = "Waiting for key press";
diff --git a/common/content/liberator.js b/common/content/liberator.js
index 5403ad16..a4617b4c 100644
--- a/common/content/liberator.js
+++ b/common/content/liberator.js
@@ -136,7 +136,7 @@ const Liberator = Module("liberator", {
forceNewWindow: false,
/** @property {string} The Liberator version string. */
- version: "###VERSION### (created: ###DATE###)", // these VERSION and DATE tokens are replaced by the Makefile
+ version: "@VERSION@ (created: @DATE@)", // these VERSION and DATE tokens are replaced by the Makefile
/**
* @property {Object} The map of command-line options. These are
@@ -331,7 +331,7 @@ const Liberator = Module("liberator", {
// you don't like them you can set verbose=0, or use :silent when
// someone adds it. I reckon another flag and 'class' of messages
// is just going to unnecessarily complicate things. --djk
- flags |= commandline.APPEND_TO_MESSAGES | commandline.DISALLOW_MULTILINE;
+ flags |= commandline.APPEND_TO_MESSAGES; // | commandline.DISALLOW_MULTILINE;
if (verbosity == null)
verbosity = 0; // verbosity level is exclusionary
diff --git a/common/content/util.js b/common/content/util.js
index 77e74526..f5afd454 100644
--- a/common/content/util.js
+++ b/common/content/util.js
@@ -726,7 +726,7 @@ const Util = Module("util", {
// Ok, not a valid proto. If it looks like URL-ish (foo.com/bar),
// let Gecko figure it out.
- if (/[.\/]/.test(url) && !/\s/.test(url) || /^[\w-.]+:\d+(?:\/|$)/.test(url))
+ if (/^[a-zA-Z0-9-.]+(?:\/|$)/.test(url) && /[.\/]/.test(url) && !/\s/.test(url) || /^[a-zA-Z0-9-.]+:\d+(?:\/|$)/.test(url))
return url;
// TODO: it would be clearer if the appropriate call to
diff --git a/common/make_jar.sh b/common/make_jar.sh
index a0b04e79..2f4d9312 100644
--- a/common/make_jar.sh
+++ b/common/make_jar.sh
@@ -18,8 +18,8 @@ getfiles () {
find "$@" -not -path '*\.hg*' 2>/dev/null | grep -E "$filter" || true
}
copytext () {
- sed -e "s,###VERSION###,$VERSION,g" \
- -e "s,###DATE###,$BUILD_DATE,g" \
+ sed -e "s,@VERSION@,$VERSION,g" \
+ -e "s,@DATE@,$BUILD_DATE,g" \
<"$1" >"$2"
cmp -s "$1" "$2" ||
( echo "modified: $1"; diff -u "$1" "$2" | grep '^[-+][^-+]' )
diff --git a/vimperator/TODO b/vimperator/TODO
index 382ffc27..b3d08ca0 100644
--- a/vimperator/TODO
+++ b/vimperator/TODO
@@ -42,7 +42,6 @@ BUGS:
FEATURES:
8 Document Textarea, Caret and Visual modes.
-8 Incremental searches should retreat to their starting position on <Backspace>
8 Replace config.name tests in liberator with more specific feature
tests or overridable APIs where at all feasible.
8 change the extension ID to vimperator@vimperator.org rather than
@@ -65,25 +64,11 @@ FEATURES:
8 :redir and 'verbosefile'
8 middleclick in content == p, and if command line is open, paste there the clipboard buffer
8 all search commands should start searching from the top of the visible viewport
-8 :addsearch wikpedia http://en.wikipedia.org/wiki/Special:Search?search=%s to allow saving of
- quick searches in the RC file.
- Why not just add a bookmark? --Kris
- This would require performance tests, how fast it is to add 20 keywords that way, as we need
- to search all existing bookmarks to see if the keyword is already defined, and then just update
- that bookmark. --mst
-
- Wah? I don't see how that's especially relevant, since they only
- need to be added once, but, if you insist:
- :100time bookmarks.getKeywords().some(function(k) k.keyword == "wikipedia")
- Code execution summary
- Executed: 100 times
- Average time: 2.48 msec
- Total time: 0.25 sec
- --Kris
-
8 allow for multiple ex commands separated with | (see #24)
8 <C-o>/<C-i> should work as in vim (i.e., save page positions as well as
locations in the history list).
+8 jump to the next heading with ]h, next image ]i, previous textbox [t and so on
+8 pipe selected text/link/website to an external command
7 use ctrl-n/p in insert mode for word completion
7 implement QuickFix window based on ItemList
7 wherever possible: get rid of dialogs and ask console-like dialog questions
@@ -93,7 +78,7 @@ FEATURES:
opera's fast forward does something like this
7 make an option to disable session saving by default when you close Firefox
7 The output of the pageinfo-command should contain the security-information of ssl-encrypted sites
-7 Add :every command
+7 :grep support (needs location list)
6 :mksession
6 add [count] support to :b* and :tab* commands where missing
6 registers
@@ -101,12 +86,10 @@ FEATURES:
always be the default register. --Ted
6 check/correct spellings in insert mode with some mappings
6 add more autocommands (TabClose, TabOpen, TabChanged etc)
-6 jump to the next heading with ]h, next image ]i, previous textbox [t and so on
-6 :grep support (needs location list)
-6 pipe selected text/link/website to an external command
6 Use ctrl-w+j/k/w to switch between sidebar, content, preview window
6 Command :tags for getting a list of used tags
6 ;?<hint> should show more information
+6 Add information to liberator/HACKING file about testing and optimization
5 when looking at a zoomed out image (because it's large), zi should zoom in
maybe with this? : http://mxr.mozilla.org/seamonkey/source/content/html/document/public/nsIImageDocument.idl
5 make a command to search within google search results
@@ -117,8 +100,5 @@ FEATURES:
3 add a command-line window (:help cmdline-window in Vim).
3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab]
have a look into the split browser extension
-1 Add information to liberator/HACKING file about testing and optimization
-1 Document remote branches in liberator/HACKING
1 Reformat liberator/HACKING so that git diff can find sections and report changes @ somewhere
-- many other ideas are listed in the wiki
diff --git a/vimperator/install.rdf b/vimperator/install.rdf
index 62c6cc5c..5e0bc867 100644
--- a/vimperator/install.rdf
+++ b/vimperator/install.rdf
@@ -4,7 +4,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>vimperator@mozdev.org</em:id>
<em:name>Vimperator</em:name>
- <em:version>###VERSION###</em:version>
+ <em:version>@VERSION@</em:version>
<em:description>Make Firefox behave like Vim</em:description>
<em:creator>Martin Stubenschrott</em:creator>
<em:homepageURL>http://vimperator.org</em:homepageURL>