Hi Carlos, AIUI, both AS on Flash and JS in the browser handle "!=" (and not "!==") the same, which is that whether an property is undefined or null, the "!=" test will return true. The advantage of "!=" is that in Flash (and maybe future browser runtimes or other runtimes) all properties that are defined to have a value (of null in Flash), so this single test works without having to resort to use ["propName"] to work around the fact that only '*' types can have undefined as a value.
I would expect there are lots of tests for "!= null" in the Royale framework code and fewer places were folks test against "undefined". My 2 cents, -Alex On 3/20/19, 10:43 AM, "Carlos Rovira" <carlosrov...@apache.org> wrote: Hi Alex, the problem is that msg is an Object and headers is not coming so is undefined, not null, and the property doesn't exits. So if I understand right the right way would be to check != undefined. If in this scenario I could change for != null I can do it, but I tough is not valid El mié., 20 mar. 2019 a las 16:37, Alex Harui (<aha...@adobe.com.invalid>) escribió: > Hi Carlos, > > I guess that’s ok, but I expected you would just test for “!= null”. Is > null an allowed value with a different meaning than undefined? > > -Alex > > From: Carlos Rovira <carlosrov...@apache.org> > Date: Wednesday, March 20, 2019 at 2:44 AM > To: "dev@royale.apache.org" <dev@royale.apache.org>, Alex Harui < > aha...@adobe.com> > Subject: Re: [royale-asjs] branch develop updated: amfchannel: ensure > headers are not undefined, this is needed in shared enviroments when the > application can be hosted in a domain but served through other domain. In > this cases interacting with AMF can produce ... > > Hi Alex, you're right. I committed a different notation that removes > warnings. Let me know if is ok for you. > thanks > > El mié., 20 mar. 2019 a las 1:49, Alex Harui (<aha...@adobe.com.invalid>) > escribió: > Carlos, > > This change is causing warnings. Are you not getting the same warnings? > > -Alex > > frameworks/projects/MXRoyale/src/main/royale/mx/messaging/channels/AMFChannel.as(549): > col: 21 Illogical comparison with undefined. Only untyped variables (or > variables of type *) can be undefined. > > frameworks/projects/MXRoyale/src/main/royale/mx/messaging/channels/AMFChannel.as(545): > col: 62 Illogical comparison with undefined. Only untyped variables (or > variables of type *) can be undefined. > > On 3/19/19, 10:37 AM, "carlosrov...@apache.org<mailto: > carlosrov...@apache.org>" <carlosrov...@apache.org<mailto: > carlosrov...@apache.org>> wrote: > > This is an automated email from the ASF dual-hosted git repository. > > carlosrovira pushed a commit to branch develop > in repository > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&data=02%7C01%7Caharui%40adobe.com%7C664fa82003604b7381ef08d6ad5b8967%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636887005995756156&sdata=%2FCN8kEawGX0xcemd%2BQzrTgj6UOSVfzQ8E7%2F%2BAHAL%2B9M%3D&reserved=0 > < > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&data=02%7C01%7Caharui%40adobe.com%7C664fa82003604b7381ef08d6ad5b8967%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636887005995756156&sdata=%2FCN8kEawGX0xcemd%2BQzrTgj6UOSVfzQ8E7%2F%2BAHAL%2B9M%3D&reserved=0 > > > > > The following commit(s) were added to refs/heads/develop by this push: > new 9efd0d4 amfchannel: ensure headers are not undefined, this > is needed in shared enviroments when the application can be hosted in a > domain but served through other domain. In this cases interacting with AMF > can produce access denied (401) errors that can generate messages without > headers, but we still want Royale executes its faulhandler > 9efd0d4 is described below > > commit 9efd0d41ef153025d20447362ec1b66c1889303c > Author: Carlos Rovira <carlosrov...@apache.org<mailto: > carlosrov...@apache.org>> > AuthorDate: Tue Mar 19 18:36:56 2019 +0100 > > amfchannel: ensure headers are not undefined, this is needed in > shared enviroments when the application can be hosted in a domain but > served through other domain. In this cases interacting with AMF can produce > access denied (401) errors that can generate messages without headers, but > we still want Royale executes its faulhandler > --- > .../MXRoyale/src/main/royale/mx/messaging/channels/AMFChannel.as > | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git > a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/channels/AMFChannel.as > b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/channels/AMFChannel.as > index 8803f6b..3938a04 100644 > --- > a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/channels/AMFChannel.as > +++ > b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/channels/AMFChannel.as > @@ -542,11 +542,11 @@ public class AMFChannel extends > NetConnectionChannel > _log.debug("'{0}' fault handler called. {1}", id, > msg.toString()); > > // Set the server assigned RoyaleClient Id. > - if (RoyaleClient.getInstance().id == null && > msg.headers[AbstractMessage.FLEX_CLIENT_ID_HEADER] != null) > + if (RoyaleClient.getInstance().id == null && > msg.headers != undefined && > msg.headers[AbstractMessage.FLEX_CLIENT_ID_HEADER] != null) > RoyaleClient.getInstance().id = > msg.headers[AbstractMessage.FLEX_CLIENT_ID_HEADER]; > > // Process the features advertised by the server > endpoint. > - if (msg.headers[CommandMessage.MESSAGING_VERSION] != > null) > + if (msg.headers != undefined && > msg.headers[CommandMessage.MESSAGING_VERSION] != null) > { > var serverVersion:Number = > msg.headers[CommandMessage.MESSAGING_VERSION] as Number; > handleServerMessagingVersion(serverVersion); > > > > > -- > Carlos Rovira > https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C664fa82003604b7381ef08d6ad5b8967%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636887005995756156&sdata=kGjJwZebC%2F6LqO%2FqRmhKQTEePxrwPiDsNrvPUWK1Rrs%3D&reserved=0< > https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C664fa82003604b7381ef08d6ad5b8967%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636887005995756156&sdata=kGjJwZebC%2F6LqO%2FqRmhKQTEePxrwPiDsNrvPUWK1Rrs%3D&reserved=0 > > > > -- Carlos Rovira https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C664fa82003604b7381ef08d6ad5b8967%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636887005995756156&sdata=kGjJwZebC%2F6LqO%2FqRmhKQTEePxrwPiDsNrvPUWK1Rrs%3D&reserved=0