From: Adam Thompson <arthompson1990@gmail.com>
To: Karl Dahlke <eklhad@comcast.net>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] new window assert
Date: Sat, 26 Apr 2014 18:29:25 +0100 [thread overview]
Message-ID: <20140426172925.GR23557@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <20140326040415.eklhad@comcast.net>
[-- 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 --]
next prev parent reply other threads:[~2014-04-26 17:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-26 4:04 Karl Dahlke
2014-04-26 17:29 ` Adam Thompson [this message]
2014-04-26 18:16 ` Chris Brannon
2014-04-27 6:17 ` Adam Thompson
2014-04-27 12:41 ` Chris Brannon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140426172925.GR23557@toaster.adamthompson.me.uk \
--to=arthompson1990@gmail.com \
--cc=Edbrowse-dev@lists.the-brannons.com \
--cc=eklhad@comcast.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).