From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from qmta05.westchester.pa.mail.comcast.net (qmta05.westchester.pa.mail.comcast.net [IPv6:2001:558:fe14:43:76:96:62:48]) by hurricane.the-brannons.com (Postfix) with ESMTP id CA90977AF8 for ; Sat, 26 Apr 2014 01:05:05 -0700 (PDT) Received: from omta04.westchester.pa.mail.comcast.net ([76.96.62.35]) by qmta05.westchester.pa.mail.comcast.net with comcast id uY4N1n0010ldTLk55Y4gvG; Sat, 26 Apr 2014 08:04:40 +0000 Received: from eklhad ([IPv6:2601:4:5380:92e:21e:4fff:fec2:a0f1]) by omta04.westchester.pa.mail.comcast.net with comcast id uY4f1n00558M3EY01Y4fsx; Sat, 26 Apr 2014 08:04:39 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke User-Agent: edbrowse/3.5.1 Date: Sat, 26 Apr 2014 04:04:15 +0000 Message-ID: <20140326040415.eklhad@comcast.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1398499480; bh=mvaxiYo4NTozl77hGVz2owo5lWBQeI38E8cpbk5af3E=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=DPr7Dlh0idxPur7tIMUfeD8HBMMUSz8NzRinyCdkA1/3WkuUXsog0A++4U/4uSj6K OTNtfausrGMWU2yAhIcTJsCuQTGIUwWHBI+gUMk3udE99hpsztyNzZSQtD0wX33d8v yYu8J8C3J3tTUfBWgCOUTlb/jkElCnqhfSGnOCTN6vw/sB2TBQAkLTbMGo0UIrlmqc BjQzQHgRwnQSovuR9Bd6dp+Zo2HC1yQvdKGxiESMO+VTDcsCGHeWW7Hh5m8RD+Nyrb CiY9ILQTHX5F/4xuFxpc6BptCxrbwCieKK3ODcA7e6IAHoxyYZlg7yD5yaEuhEsdnQ Oy3MZ2/GACoJw== Subject: [Edbrowse-dev] new window assert X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Karl Dahlke List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Apr 2014 08:05:06 -0000 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