librelist archives

« back to archive

Several short miscellaneous questions

Several short miscellaneous questions

From:
Sean McAfee
Date:
2014-05-04 @ 04:48
Hi folks--

I've accumulated a number of unrelated Conkeror questions, which I
figured would be more convenient to present all at once rather than
spread across multiple messages.

* Is there any way to manipulate a buffer's contents sooner than
  buffer_loaded_hook allows?

I have some routines attached to buffer_loaded_hook that remove content
from a page.  One site I often visit usually takes several seconds to
load fully, so when my routine fires and removes its content, the text
on the page suddenly shifts upwards.  I'd rather be able to set up a
routine that fires as soon as possible, even if it has to set up a timer
and repeatedly check until the element it wants to remove is present.

* How can I emit debugging messages?

Debugging Javascript on Conkeror has not been trivial.  Two tactics I've
used have been A) throwing an exception and B) creating a new <pre>
element somewhere on the displayed page and adding text nodes to it.
Both of these are pains in the ass--especially approach A, which
requires me to start conkeror from a terminal and cannot be used in
functions which return a needed value, or from other than the end of a
function.

* scroll-top-left doesn't work.

At some point, I can't remember when, Meta-< stopped taking me to the
top of the page.  The keypad's Home key doesn't work either.  "C-h k
M-<" and "C-h k Home" both inform me that those keys are bound to
scroll-top-left in bindings/default/basic-commands.js, but pressing them
does nothing.  M-> and End take me to the end of the page as usual,
though.  This behavior persists even after I remove ~/.conkerorrc.

I work remotely over an ssh tunnel, and I run Conkeror on my work
machine, tunnelling it back to my laptop.  Weirdly, M-< and Home work
normally on this other Conkeror instance, at the same time they don't
work on the local Conkeror.

* How can I enforce an ordering among the files in ~/.conkerorrc/?

My original init file eventually grew large enough that I divided it
into a number of separate files.  There are dependencies among some of
them, but I don't know of a way to have file B require that file A is
loaded first.  The require() function doesn't work for this purpose.
All I've been able to do so far is name the files in ascending lexical
order, so that for example "a-foo.js" can be depended upon by
"b-bar.js", etc.  Is there a better way?

* Iframes are treated as a single opaque element.

A number of sites use Disqus to manage comments, which are presented in
a single iframe element.  Conkeror cannot search for text in these
frames, follow links in them, etc.  Can it be made to do so?

* A profusion of download frames.

Whenever I start a download, a new top-level frame is spawned.  Multiple
downloads create multiple frames.  If I want to keep track of them all,
I need to leave these mostly-empty frames open.  I realize I could just
kill them and call download-manager-show-builtin-ui, but is there some
way to have a new download buffer just show up as a tab in an existing
frame?

Thanks for any help anyone can offer, for any of these questions.

Re: [conkeror] Several short miscellaneous questions

From:
John J. Foerch
Date:
2014-05-04 @ 15:07
On Sat, May 03, 2014 at 09:48:46PM -0700, Sean McAfee wrote:
> Hi folks--
> 
> I've accumulated a number of unrelated Conkeror questions, which I
> figured would be more convenient to present all at once rather than
> spread across multiple messages.

Hi,

Not all of your questions are easy, but I'll try to throw some pointers,
and maybe other users can join in.

> 
> * Is there any way to manipulate a buffer's contents sooner than
>   buffer_loaded_hook allows?
> 
> I have some routines attached to buffer_loaded_hook that remove content
> from a page.  One site I often visit usually takes several seconds to
> load fully, so when my routine fires and removes its content, the text
> on the page suddenly shifts upwards.  I'd rather be able to set up a
> routine that fires as soon as possible, even if it has to set up a timer
> and repeatedly check until the element it wants to remove is present.
> 


If the content being removed are embedded documents like images, flash
objects, or frames, you can prevent their being downloaded with the module
'content-policy'.  It may be unsafe to modify the DOM before the 'load'
event has occurred because it will be in inconsistent state.  However, you
can read more about that here:


https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Intercepting_Page_Loads


> * How can I emit debugging messages?
> 
> Debugging Javascript on Conkeror has not been trivial.  Two tactics I've
> used have been A) throwing an exception and B) creating a new <pre>
> element somewhere on the displayed page and adding text nodes to it.
> Both of these are pains in the ass--especially approach A, which
> requires me to start conkeror from a terminal and cannot be used in
> functions which return a needed value, or from other than the end of a
> function.
> 

Are you referring to debug messages from Conkeror itself, or from within
content/web-pages?

For the former, I get by with 'dumpln' calls (which print to stderr) and
the extension MozRepl which allows you to test and develop code in
Conkeror from an Emacs session.

I'm currently working on a logging system which will provide more options
for routing debugging messages.


> * scroll-top-left doesn't work.
> 
> At some point, I can't remember when, Meta-< stopped taking me to the
> top of the page.  The keypad's Home key doesn't work either.  "C-h k
> M-<" and "C-h k Home" both inform me that those keys are bound to
> scroll-top-left in bindings/default/basic-commands.js, but pressing them
> does nothing.  M-> and End take me to the end of the page as usual,
> though.  This behavior persists even after I remove ~/.conkerorrc.
> 
> I work remotely over an ssh tunnel, and I run Conkeror on my work
> machine, tunnelling it back to my laptop.  Weirdly, M-< and Home work
> normally on this other Conkeror instance, at the same time they don't
> work on the local Conkeror.
> 

The M-< problem was fixed October 17, 2013.  Try updating, and write back
if the problem persists.


> * How can I enforce an ordering among the files in ~/.conkerorrc/?
> 
> My original init file eventually grew large enough that I divided it
> into a number of separate files.  There are dependencies among some of
> them, but I don't know of a way to have file B require that file A is
> loaded first.  The require() function doesn't work for this purpose.
> All I've been able to do so far is name the files in ascending lexical
> order, so that for example "a-foo.js" can be depended upon by
> "b-bar.js", etc.  Is there a better way?
> 

You're correct that 'require' does not work for this purpose.  The reason
is that ~/.conkerorrc is not considered a repository of modules - just a
bucket of *.js files that are loaded at startup.  If you have need of
modules, make a directory for your modules, add its location to
'load_paths', and 'require' away.

    let (home = get_home_directory().clone()) {
        home.appendRelativePath(".conkerorrc/modules");
        load_paths.unshift("file://"+home.path);
    }


> * Iframes are treated as a single opaque element.
> 
> A number of sites use Disqus to manage comments, which are presented in
> a single iframe element.  Conkeror cannot search for text in these
> frames, follow links in them, etc.  Can it be made to do so?
> 

isearch needs work.


> * A profusion of download frames.
> 
> Whenever I start a download, a new top-level frame is spawned.  Multiple
> downloads create multiple frames.  If I want to keep track of them all,
> I need to leave these mostly-empty frames open.  I realize I could just
> kill them and call download-manager-show-builtin-ui, but is there some
> way to have a new download buffer just show up as a tab in an existing
> frame?
> 

Configure the variable download_buffer_automatic_open_target.


> Thanks for any help anyone can offer, for any of these questions.

Hope this helps.

-- 
John Foerch

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
Sean McAfee
Date:
2014-05-04 @ 18:29
jjfoerch@earthlink.net wrote:
> On Sat, May 03, 2014 at 09:48:46PM -0700, Sean McAfee wrote:
>> * Is there any way to manipulate a buffer's contents sooner than
>>   buffer_loaded_hook allows?

> If the content being removed are embedded documents like images, flash
> objects, or frames, you can prevent their being downloaded with the module
> 'content-policy'.  It may be unsafe to modify the DOM before the 'load'
> event has occurred because it will be in inconsistent state.

So far, deleting nodes during buffer_dom_content_loaded_hook hasn't
caused any noticeable problems.  I'll keep an eye on it, though.

>> * How can I emit debugging messages?

> Are you referring to debug messages from Conkeror itself, or from within
> content/web-pages?

From Conkeror.  From my own Javascript code, anyway.

> For the former, I get by with 'dumpln' calls (which print to stderr) and
> the extension MozRepl which allows you to test and develop code in
> Conkeror from an Emacs session.

Nice, I'll check it out.

>> * scroll-top-left doesn't work.

> The M-< problem was fixed October 17, 2013.  Try updating, and write back
> if the problem persists.

I had been updated to early this past February.  I just git-pulled
again, and I see no change, even without a ~/.conkerorrc.


--Sean

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
John J. Foerch
Date:
2014-05-04 @ 18:41
On Sun, May 04, 2014 at 11:29:16AM -0700, Sean McAfee wrote:
> jjfoerch@earthlink.net wrote:
> > On Sat, May 03, 2014 at 09:48:46PM -0700, Sean McAfee wrote:
> >> * Is there any way to manipulate a buffer's contents sooner than
> >>   buffer_loaded_hook allows?
> 
> > If the content being removed are embedded documents like images, flash
> > objects, or frames, you can prevent their being downloaded with the module
> > 'content-policy'.  It may be unsafe to modify the DOM before the 'load'
> > event has occurred because it will be in inconsistent state.
> 
> So far, deleting nodes during buffer_dom_content_loaded_hook hasn't
> caused any noticeable problems.  I'll keep an eye on it, though.

It's not a problem in buffer_dom_content_loaded_hook.  It would be a
problem if you tried to modify the dom before that, like modifying it as
it downloaded.

-- 
John Foerch

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
John J. Foerch
Date:
2014-05-05 @ 13:32
On Sun, May 04, 2014 at 11:29:16AM -0700, Sean McAfee wrote:
> >> * scroll-top-left doesn't work.
> 
> > The M-< problem was fixed October 17, 2013.  Try updating, and write back
> > if the problem persists.
> 
> I had been updated to early this past February.  I just git-pulled
> again, and I see no change, even without a ~/.conkerorrc.
> 
> 
> --Sean

If you can narrow down the problem any further by experimenting with the
code, that would be helpful.  I can't reproduce the problem here.

-- 
John Foerch

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
Sean McAfee
Date:
2014-05-12 @ 02:34
On Mon, May 5, 2014 at 6:32 AM, John J. Foerch <jjfoerch@earthlink.net>wrote:

> On Sun, May 04, 2014 at 11:29:16AM -0700, Sean McAfee wrote:
> > >> * scroll-top-left doesn't work.
> >
> > > The M-< problem was fixed October 17, 2013.  Try updating, and write
> back
> > > if the problem persists.
> >
> > I had been updated to early this past February.  I just git-pulled
> > again, and I see no change, even without a ~/.conkerorrc.
>
> If you can narrow down the problem any further by experimenting with the
> code, that would be helpful.  I can't reproduce the problem here.
>
>
I copied the interactive definition of scroll-top-left from commands.js
directly into one of my startup files, as a starting point for
investigation.  The investigation didn't last long, however, since I found
that M-< started immediately behaving as it should.

I shortly reduced the issue to simplest terms:

* Without any ~/.conkerorrc, M-< does nothing.
* With a .conkerorrc file containing only a copy of the
interactive("scroll-top-left", ...) call from commands.js, M-< works as
expected.

Pretty weird.  Any ideas?


--Sean

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
John J. Foerch
Date:
2014-05-12 @ 15:32
On Sun, May 11, 2014 at 07:34:25PM -0700, Sean McAfee wrote:
> On Mon, May 5, 2014 at 6:32 AM, John J. Foerch <jjfoerch@earthlink.net> wrote:
> 
>     On Sun, May 04, 2014 at 11:29:16AM -0700, Sean McAfee wrote:
>     > >> * scroll-top-left doesn't work.
>     >
>     > > The M-< problem was fixed October 17, 2013.  Try updating, and write
>     back
>     > > if the problem persists.
>     >
>     > I had been updated to early this past February.  I just git-pulled
>     > again, and I see no change, even without a ~/.conkerorrc.
> 
>     If you can narrow down the problem any further by experimenting with the
>     code, that would be helpful.  I can't reproduce the problem here.
>    
> 
> 
> I copied the interactive definition of scroll-top-left from commands.js
> directly into one of my startup files, as a starting point for investigation. 
> The investigation didn't last long, however, since I found that M-< started
> immediately behaving as it should.
> 
> I shortly reduced the issue to simplest terms:
> 
> * Without any ~/.conkerorrc, M-< does nothing.
> * With a .conkerorrc file containing only a copy of the interactive
> ("scroll-top-left", ...) call from commands.js, M-< works as expected.
> 
> Pretty weird.  Any ideas?
> 
> 
> --Sean

Yes.  Are these behaviors consistently reproducible for you?  Run conkeror
in a terminal, and see if there are any relevant error messages at startup
or when pressing M-< or calling the command via M-x scroll-top-left.

-- 
John Foerch

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
Sean McAfee
Date:
2014-05-13 @ 06:55
On Mon, May 12, 2014 at 8:32 AM, John J. Foerch <jjfoerch@earthlink.net>wrote:

> On Sun, May 11, 2014 at 07:34:25PM -0700, Sean McAfee wrote:
> > * Without any ~/.conkerorrc, M-< does nothing.
> > * With a .conkerorrc file containing only a copy of the interactive
> > ("scroll-top-left", ...) call from commands.js, M-< works as expected.
>
> Are these behaviors consistently reproducible for you?


Yes.


>  Run conkeror
> in a terminal, and see if there are any relevant error messages at startup
> or when pressing M-< or calling the command via M-x scroll-top-left.
>
>
There are a handful of GLib errors immediately upon startup, which I'm
pretty sure I always see when I launch conkeror in a terminal.  No
additional output appears when I press M-<.  When I type M-x
scroll-top-left, I get another few errors like:

Console error: [JavaScript Error: "TypeError: props is undefined" {file:
"chrome://conkeror/content/minibuffer-read.js" line: 71}]
  Category: chrome javascript

...with line 73 reported instead of 71 half the time.  When I press return,
nothing happens and no additional text appears in the terminal.  All of the
above is without any ~/.conkerorrc.

I'm using Xulrunner 24.0b10, if it matters.


--Sean

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
Sean McAfee
Date:
2014-05-16 @ 04:09
On Mon, May 12, 2014 at 11:55 PM, Sean McAfee <eefacm@gmail.com> wrote:

> On Mon, May 12, 2014 at 8:32 AM, John J. Foerch <jjfoerch@earthlink.net>wrote:
>
>> On Sun, May 11, 2014 at 07:34:25PM -0700, Sean McAfee wrote:
>> > * Without any ~/.conkerorrc, M-< does nothing.
>> > * With a .conkerorrc file containing only a copy of the interactive
>> > ("scroll-top-left", ...) call from commands.js, M-< works as expected.
>>
>> Are these behaviors consistently reproducible for you?
>>
>
> Yes.
>
>

Argh, nevermind.  I just poked around deeper and discovered that I somehow
had two separate Conkeror source repositories checked out, and apparently
for some time I've only ever been updating the one that my desktop shortcut
and shell-script wrapper DON'T point to.  Now that I've set things right,
M-< works perfectly.

Sorry for being such a bonehead.


--Sean

Re: Fwd: [conkeror] Several short miscellaneous questions

From:
John J. Foerch
Date:
2014-05-16 @ 04:17
On Thu, May 15, 2014 at 09:09:51PM -0700, Sean McAfee wrote:
> On Mon, May 12, 2014 at 11:55 PM, Sean McAfee <eefacm@gmail.com> wrote:
> 
>     On Mon, May 12, 2014 at 8:32 AM, John J. Foerch <jjfoerch@earthlink.net>
>     wrote:
> 
>         On Sun, May 11, 2014 at 07:34:25PM -0700, Sean McAfee wrote:
>         > * Without any ~/.conkerorrc, M-< does nothing.
>         > * With a .conkerorrc file containing only a copy of the interactive
>         > ("scroll-top-left", ...) call from commands.js, M-< works as
>         expected.
> 
>         Are these behaviors consistently reproducible for you?
> 
> 
>     Yes.
>      
> 
> 
> Argh, nevermind.  I just poked around deeper and discovered that I somehow had
> two separate Conkeror source repositories checked out, and apparently for some
> time I've only ever been updating the one that my desktop shortcut and
> shell-script wrapper DON'T point to.  Now that I've set things right, M-< works
> perfectly.
> 
> Sorry for being such a bonehead.
> 
> 
> --Sean

Ah, glad to know that's cleared up.  Would have been a great mystery!

-- 
John Foerch

Re: Several short miscellaneous questions

From:
Sean McAfee
Date:
2014-05-04 @ 18:18
On Sun, May 4, 2014 at 2:26 AM, Scott Jaderholm <jaderholm@gmail.com> wrote:

> On Sat, May 03 2014,Sean McAfee wrote:
>
> > * Is there any way to manipulate a buffer's contents sooner than
> >   buffer_loaded_hook allows?
>
> Maybe buffer_dom_content_loaded_hook.
>
>
Aha, perfect!  Or at least it seems perfect so far.  I seem to remember
noticing that hook on a Conkeror doc page, but since there were no details
I didn't check it out any further.  I should have consulted the source, as
I did just now.


> > * How can I emit debugging messages?
>
> Maybe dumpln and dump_obj.


Great!  Well, it's crude, but it's much better than what I had been doing.


> * Iframes are treated as a single opaque element.
>
> You can focus the iframe with ";" or "m ;" and then isearch should work.
> In Disqus it seems like only the initial 10-30 (too lazy to count) or so
> links are hinted. Not sure why. You open the url of the iframe with "m
> f" and then the links appear to all be hinted.
>
>
Good tips; I hadn't been aware of the ";" command.  I'm reminded of another
Disqus-related peculiarity, though.

Often when I'm browsing with my RSS reader, I'll open a new page and
immediately return to the reader, thinking that I'll return to the new page
in a little while, after Disqus has had time to load.  What I find when I
return is that the "loading" spinner is still going, no matter how long
I've left the page alone.  If I open the page and wait, Disqus always loads
normally.  Somehow, it only loads when the page it's in is visible.  Anyone
know what could be going on here?


> > * A profusion of download frames.
>
> Maybe this:
> download_buffer_automatic_open_target=OPEN_NEW_BUFFER;
>
>
Awesome, again.  Thanks!


--Sean

Re: [conkeror] Re: Several short miscellaneous questions

From:
John J. Foerch
Date:
2014-05-04 @ 18:25
On Sun, May 04, 2014 at 11:18:03AM -0700, Sean McAfee wrote:
> On Sun, May 4, 2014 at 2:26 AM, Scott Jaderholm <jaderholm@gmail.com> wrote:
> 
>     On Sat, May 03 2014,Sean McAfee wrote:
> 
>     > * Is there any way to manipulate a buffer's contents sooner than
>     >   buffer_loaded_hook allows?
> 
>     Maybe buffer_dom_content_loaded_hook.
> 
> 
> 
> Aha, perfect!  Or at least it seems perfect so far.  I seem to remember
> noticing that hook on a Conkeror doc page, but since there were no details I
> didn't check it out any further.  I should have consulted the source, as I did
> just now.
>  

buffer_dom_content_loaded_hook runs after buffer_loaded_hook.

-- 
John Foerch

Re: [conkeror] Re: Several short miscellaneous questions

From:
John J. Foerch
Date:
2014-05-04 @ 18:26
On Sun, May 04, 2014 at 02:25:04PM -0400, John J. Foerch wrote:
> On Sun, May 04, 2014 at 11:18:03AM -0700, Sean McAfee wrote:
> > On Sun, May 4, 2014 at 2:26 AM, Scott Jaderholm <jaderholm@gmail.com> wrote:
> > 
> >     On Sat, May 03 2014,Sean McAfee wrote:
> > 
> >     > * Is there any way to manipulate a buffer's contents sooner than
> >     >   buffer_loaded_hook allows?
> > 
> >     Maybe buffer_dom_content_loaded_hook.
> > 
> > 
> > 
> > Aha, perfect!  Or at least it seems perfect so far.  I seem to remember
> > noticing that hook on a Conkeror doc page, but since there were no details I
> > didn't check it out any further.  I should have consulted the source, as I did
> > just now.
> >  
> 
> buffer_dom_content_loaded_hook runs after buffer_loaded_hook.
> 

Sorry I take that back.. had it backwards in my mind.  Ignore that message.

-- 
John Foerch