From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:558:fe21:29:69:252:207:43; helo=resqmta-ch2-11v.sys.comcast.net; envelope-from=eklhad@comcast.net; receiver= Received: from resqmta-ch2-11v.sys.comcast.net (resqmta-ch2-11v.sys.comcast.net [IPv6:2001:558:fe21:29:69:252:207:43]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 6746177AAF for ; Thu, 1 Feb 2018 12:37:45 -0800 (PST) Received: from resomta-ch2-20v.sys.comcast.net ([69.252.207.116]) by resqmta-ch2-11v.sys.comcast.net with ESMTP id hLcTeKXAVAbquhLcXeeMMQ; Thu, 01 Feb 2018 20:38:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1517517489; bh=AayOS1LTTOmpwFeGjspzKnFquN/KDW17O5MUuxMX4AQ=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=DSxc5c+/AYnsU/59xIYXD2134JQMV4xpek1NPgIfJjIYcO6VJ/ui5V83h/h7I0aoH uKcfyrPbnMZf+M7AT3WD5CVRh+J1WUPSbzGp0SuSG3HBiGy/f1Qy6QtywhZO9RnkSZ DnCIDobnrtRdV+Igk/ijLf7EcmafsCsNpVEmEDp3Oqq2SP3rXLDxZW+ug4tNNA1Tk4 rJZqUuGLrtULm8vnzuD2gdoWniZsBkfTrGBUY71gm7p0gqP1e1cAZdaPQsdzBiBaQS 6WFs6iW4lCTkmOAZRopVWq5doWubLzybUrwEJkXtk5EXbxXU6tevdu4QW5QHO4sK20 pCCk4/jj/7PDw== Received: from unknown ([IPv6:2601:408:c300:8f09:21e:4fff:fec2:a0f1]) by resomta-ch2-20v.sys.comcast.net with SMTP id hLcWewG6GGSWphLcXeDziG; Thu, 01 Feb 2018 20:38:09 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke Reply-to: Karl Dahlke User-Agent: edbrowse/3.7.1 Date: Thu, 01 Feb 2018 15:38:08 -0500 Message-ID: <20180101153808.eklhad@comcast.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=nextpart-eb-060848 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfCOk9SoRRKPr7anzMmJR7sZQOwVOc4MyHYk7aR5KfX3/qAvDhm5FYie/086nWqzJm4If/5FGM4ckvW2/PRKvuykGhQmAMsLQijjm7fGQ/niNaHWwvD1p yNN6DCMqsWrmUEHlKYmKZFfLQozQb3j3Zmtvk4o9TD8ezv+tEzNfd0Uk Subject: [Edbrowse-dev] Array != Array X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.25 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 20:37:45 -0000 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --nextpart-eb-060848 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Folks there's a really long saga I could tell you, but maybe I can cut = it down to a Readers Digest version. It started about 5 commits ago (back up if you like), and I found that I could browse jsrt, our regression test, unbrowse, = and browse, and the second time there was a type error, which you see = with db3. Why the second time and not the first? I spent an entire day tracking it down. I distilled it to a 70 line C program, which I thought revealed a bug = in duktape. I sent it to Sami for review. He felt it was not a bug, but a consequence of different windows and = different name spaces. We didn't run into this until we started doing cross frame references, = and building universal edbrowse functions in the master window that = must run in all frames. Now it shows up. When a function references a global variable foo, foo is locked into = foo in that window (at compile time), not another window. That's not too surprising, but Array is a native class, never declared = by us at all. I thought it was universal. I created an array in one frame, and asked instanceof Array from = another, and it failed. Even though it is native, Array is still a class per window. Below is my reply to Sami's explanation. Yes I fixed the problem, and am on the prowl for other problems of this = ilk. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I will have to digest what you are saying. Array is a native class, so I thought it was somewhat universal, but it = is not. I have a small web page with a frame, and in my js debugger, window.Array !=3D=3D frames[0].contentWindow.Array; Indeed they are different. It follows that their prototypes will also be different objects, and = perhaps that is key. I've seen some web pages, not many, but some, that add things to = Array.prototype, and you wouldn't want that to spill over into = unrelated websites that were up at the same time, so I (grudgingly) admit this is how it has to be. So then how do I ask instanceof Array when dipping into other frames or = building master functions that apply to all frames? Looking at js from www.nasa.gov, I see that they use Array.isArray(x) = instead of x instanceof Array. You support that, and hey ho, it works. I guess other developers have run into this same issue. This has solved my current problem / confusion, I'll send you = additional questions if they come up. I don't remember now if your programmers guide talks about lexical = bindings and realms and such, but you should mention that even native = functions or classes are distinct entities, as they are bound to = various contexts. Even implicit classes like Array and Date. Karl Dahlke --nextpart-eb-060848--