edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] new window assert
@ 2014-04-26  4:04 Karl Dahlke
  2014-04-26 17:29 ` Adam Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Dahlke @ 2014-04-26  4:04 UTC (permalink / raw)
  To: Edbrowse-dev

Well javascript gets more interesting every day.

In js you can call new Window(url) to bring up a new window,
a new web page; then use the back key to go back to the first window.
But there is also the native method window.open(url)
which does exactly the same thing.
I had native functions in jsdom.cpp to do both these,
and I really dislike redundant code.
Isn't there some way to convert open into new Window?
There is, but I had to google around to find it.
Answer on stackoverflow.com, they have a lot of answers over there.
So I got rid of the native code window.open() in jsdom.cpp and put this
in startwindow.js.

function open() {
return Window.apply(this, arguments);
}

You can't use the new Window syntax here, no way to make that work,
but fortunately calling Window is the same as calling new Window,
or any class/constructor for that matter,
and if you do it this way you can apply the arguments of the calling function.
So open(), which can have from 1 to 3 arguments,
those are just passed through to the constructor.
Pretty cool eh?
I mean I didn't know js could do that.

Here's something even cooler.
When I do it this way the assert goes away.
No, I don't really know why.
I guess it didn't have anything to do with global flags,
as I wrote in my last email.
Perhaps the problem was the way I was mapping open() over to the constructor in C,
using the spider API.
It was messy and hairy, and hard to get right.

This reaffirms my theme of putting as much as possible into startwindow.js.
It's much less code here, easier to read and maintain,
less potential for bugs, and independent of the js api.
Even if we switch js engines some day, we won't have to change startwindow.js.

So now I can go to BankOfAmerica.com and click on
{Where do I enter my Passcode?}
and it works.
The more I play with edbrowse, the more problems I find and fix.

Karl Dahlke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] new window assert
  2014-04-26  4:04 [Edbrowse-dev] new window assert Karl Dahlke
@ 2014-04-26 17:29 ` Adam Thompson
  2014-04-26 18:16   ` Chris Brannon
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Thompson @ 2014-04-26 17:29 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: Edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 2514 bytes --]

On Sat, Apr 26, 2014 at 04:04:15AM +0000, Karl Dahlke wrote:
> In js you can call new Window(url) to bring up a new window,
> a new web page; then use the back key to go back to the first window.
> But there is also the native method window.open(url)
> which does exactly the same thing.
> I had native functions in jsdom.cpp to do both these,
> and I really dislike redundant code.

Yeah, i didn't know about the new window syntax.

> Isn't there some way to convert open into new Window?
> There is, but I had to google around to find it.
> Answer on stackoverflow.com, they have a lot of answers over there.

Agreed, I've spent much of my life over the last few years looking at
stackoverflow.com answers.

> So I got rid of the native code window.open() in jsdom.cpp and put this
> in startwindow.js.
> 
> function open() {
> return Window.apply(this, arguments);
> }
> 
> You can't use the new Window syntax here, no way to make that work,
> but fortunately calling Window is the same as calling new Window,
> or any class/constructor for that matter,
> and if you do it this way you can apply the arguments of the calling function.
> So open(), which can have from 1 to 3 arguments,
> those are just passed through to the constructor.
> Pretty cool eh?
> I mean I didn't know js could do that.

It certainly looks useful.

> Here's something even cooler.
> When I do it this way the assert goes away.
> No, I don't really know why.
> I guess it didn't have anything to do with global flags,
> as I wrote in my last email.

That's a bit odd.

> Perhaps the problem was the way I was mapping open() over to the constructor in C,
> using the spider API.
> It was messy and hairy, and hard to get right.

Yeah, it certainly looks that way, but I'd like to know what was wrong.

> This reaffirms my theme of putting as much as possible into startwindow.js.
> It's much less code here, easier to read and maintain,
> less potential for bugs, and independent of the js api.
> Even if we switch js engines some day, we won't have to change startwindow.js.

Well, hopefully we won't as long as we stick to standard ECMA script.

> So now I can go to BankOfAmerica.com and click on
> {Where do I enter my Passcode?}
> and it works.
> The more I play with edbrowse, the more problems I find and fix.

Yeah, it's hard to test everything, particularly where js is concerned.
On the subject of testing is there full window coverage in jsrt?

Cheers,
Adam.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] new window assert
  2014-04-26 17:29 ` Adam Thompson
@ 2014-04-26 18:16   ` Chris Brannon
  2014-04-27  6:17     ` Adam Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Brannon @ 2014-04-26 18:16 UTC (permalink / raw)
  To: Edbrowse-dev

Adam Thompson <arthompson1990@gmail.com> writes:

> Agreed, I've spent much of my life over the last few years looking at
> stackoverflow.com answers.

Yes, it's a really nice site.
Have you ever tried posting to it with edbrowse?  I haven't, but I
really should, because I know I'd have a lot to contribute.

Another site I really enjoy reading is reddit.com.  Unfortunately, there
are so many visual-only captchas there that it is unusable, unless
you're using something like webvism.  So it's another place where I do
not contribute.

-- Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] new window assert
  2014-04-26 18:16   ` Chris Brannon
@ 2014-04-27  6:17     ` Adam Thompson
  2014-04-27 12:41       ` Chris Brannon
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Thompson @ 2014-04-27  6:17 UTC (permalink / raw)
  To: Chris Brannon; +Cc: Edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 868 bytes --]

On Sat, Apr 26, 2014 at 11:16:12AM -0700, Chris Brannon wrote:
> Adam Thompson <arthompson1990@gmail.com> writes:
> 
> > Agreed, I've spent much of my life over the last few years looking at
> > stackoverflow.com answers.
> 
> Yes, it's a really nice site.
> Have you ever tried posting to it with edbrowse?  I haven't, but I
> really should, because I know I'd have a lot to contribute.

Not yet, usually because of lack of time on my part.
I'd be interested to know if it works though.

> Another site I really enjoy reading is reddit.com.  Unfortunately, there
> are so many visual-only captchas there that it is unusable, unless
> you're using something like webvism.  So it's another place where I do
> not contribute.

Webvism?  Can't say I've ever heard of it.  What does it do (appologies if this gets slightly off topic).

Cheers,
Adam.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] new window assert
  2014-04-27  6:17     ` Adam Thompson
@ 2014-04-27 12:41       ` Chris Brannon
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Brannon @ 2014-04-27 12:41 UTC (permalink / raw)
  To: Edbrowse-dev

Adam Thompson <arthompson1990@gmail.com> writes:

> Webvism?  Can't say I've ever heard of it.  What does it do
> (appologies if this gets slightly off topic).

Webvism is both a service and a Firefox plugin for solving captchas.
The solutions are crowd-sourced.  When you run across a captcha, you
upload it to webvism, and some kind soul on the net will solve it for
you.  The service is invitation-only.  Apparently, you can request an
invitation from their site.
I've never used it on Linux, but I guess it will work with Firefox on
Linux as well as it does with Firefox on Windows.
Anyway, this is what a lot of blind folks seem to be using to solve
captchas.  Too bad it's only available for one browser.

BTW, this isn't off-topic at all, since it relates to web accessibility.
But now that you mention it, I should probably write a brief message
about list rules.

-- Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-27 12:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-26  4:04 [Edbrowse-dev] new window assert Karl Dahlke
2014-04-26 17:29 ` Adam Thompson
2014-04-26 18:16   ` Chris Brannon
2014-04-27  6:17     ` Adam Thompson
2014-04-27 12:41       ` Chris Brannon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).