You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by piotrz <pi...@gmail.com> on 2015/04/10 10:37:17 UTC

[Flex, JS] Error calling method on NPObject!

Hi Guys, 

I am struggling in my application with the problem on calling Flex method
from the JavaScript. 
Getting error: "Error calling method on NPObject!" - It is very
intermittent. 

Anyone had these problem ? Maybe someone could provide some solution. 
Currently if these error occurs I am trying to call these method once again,
but sometimes retry is also failing. 

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [Flex, JS] Error calling method on NPObject!

Posted by Alex Harui <ah...@adobe.com>.
Piotr, did you see my reply?  Have you tried proving that the callbacks
are set up in time?

BTW, a gentle reminder: using “*” in allowDomain/allowInsecureDomain for
ExternalInterface callbacks puts the onus on you to ensure that there is
no way anyone can misuse your SWF to steal information.  allowDomain is a
whitelist, “*” essentially puts every person on the planet on the
whitelist.

-Alex

On 4/12/15, 11:18 PM, "piotrz" <pi...@gmail.com> wrote:

>Hi James,
>
>Everything is on https. I am using both lines currently.
>
>Security.allowDomain("*");
>Security.allowInsecureDomain("*");
>
>Wondering whether this could break anything because both are used.
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-metho
>d-on-NPObject-tp10044p10058.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: [Flex, JS] Error calling method on NPObject!

Posted by piotrz <pi...@gmail.com>.
Evyatar,

Like I said this is only pseudo code, so I have correct attributes name in
my app. :)

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10083.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [Flex, JS] Error calling method on NPObject!

Posted by Evyatar Ben Halevi-Arbib <ev...@gmail.com>.
Hey,

According to your code snippet it seems like you use the wrong identifier -
"app" instead of "application".
You should use the same value that is being populated in the attributes id
property.

Regards,
Evyatar

On Tue, Apr 14, 2015 at 11:04 AM, piotrz <pi...@gmail.com> wrote:

> Hi Evyatar,
>
> This is pseudo code [1] which shows you how I call my function.
>
> I think we could get different stack trace error in JS if my function won't
> be registered in AS.
>
> [1] https://paste.apache.org/fYBX
>
> Piotr
>
>
>
> -----
> Apache Flex PMC
> piotrzarzycki21@gmail.com
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10080.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: [Flex, JS] Error calling method on NPObject!

Posted by Alex Harui <ah...@adobe.com>.
If I understand your code, you are creating an app with a myJSFunction
that calls the SWF callback.  When does myJSFunction get called?  What
guarantee do you have that the SWF has set up the callback by the time
myJSFUnction gets called?

-Alex

On 4/14/15, 1:04 AM, "piotrz" <pi...@gmail.com> wrote:

>Hi Evyatar,
>
>This is pseudo code [1] which shows you how I call my function.
>
>I think we could get different stack trace error in JS if my function
>won't
>be registered in AS.
>
>[1] https://paste.apache.org/fYBX
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-metho
>d-on-NPObject-tp10044p10080.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: [Flex, JS] Error calling method on NPObject!

Posted by piotrz <pi...@gmail.com>.
Hi Evyatar,

This is pseudo code [1] which shows you how I call my function.

I think we could get different stack trace error in JS if my function won't
be registered in AS.

[1] https://paste.apache.org/fYBX

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10080.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [Flex, JS] Error calling method on NPObject!

Posted by Evyatar Ben Halevi-Arbib <ev...@gmail.com>.
Hey,

We also use both commands on our applications and everything works just
fine.

How are you calling the SWF object from JavaScript?
Maybe you get a null reference, so no methods can be called on it...

Regards,
Evyatar

On Mon, Apr 13, 2015 at 9:18 AM, piotrz <pi...@gmail.com> wrote:

> Hi James,
>
> Everything is on https. I am using both lines currently.
>
> Security.allowDomain("*");
> Security.allowInsecureDomain("*");
>
> Wondering whether this could break anything because both are used.
>
> Piotr
>
>
>
> -----
> Apache Flex PMC
> piotrzarzycki21@gmail.com
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10058.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: [Flex, JS] Error calling method on NPObject!

Posted by piotrz <pi...@gmail.com>.
Hi James,

Everything is on https. I am using both lines currently.

Security.allowDomain("*"); 
Security.allowInsecureDomain("*"); 

Wondering whether this could break anything because both are used.

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10058.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [Flex, JS] Error calling method on NPObject!

Posted by Alex Harui <ah...@adobe.com>.
To unsubscribe, send an email to users-unsubscribe@flex.apache.org and I
think the mailing list robot will send you a confirmation email and once
you reply to that you should be unsubscribed.

-Alex

On 4/14/15, 10:21 AM, "Benjamin A. Boyce" <bo...@gmail.com> wrote:

>im sorry, having a hard time unsubscribing from this mail list. Anyone
>have
>any advice? Ive been to the apache page, unsubscribed, but I am still
>getting emails.
>
>On 10 April 2015 at 08:11, James M. Greene <ja...@gmail.com>
>wrote:
>
>> Correction, that should have read:
>>
>> Are your *HTML page* and SWF file both being retrieved via the same
>> protocol (i.e. "http://" vs. "https://")?  They need to be, unless you
>>do
>> go ahead and use `Security.allowInsecureDomain(...)`.
>>
>> Sincerely,
>>     James Greene
>>
>>
>> On Fri, Apr 10, 2015 at 10:10 AM, James M. Greene <
>> james.m.greene@gmail.com>
>> wrote:
>>
>> > Are your JS and SWF file both being retrieved via the same protocol
>>(i.e.
>> > "http://" vs. "https://")?  They need to be, unless you do go ahead
>>and
>> > use `Security.allowInsecureDomain(...)`.
>> >
>> > Sincerely,
>> >     James Greene
>> >
>> >
>> > On Fri, Apr 10, 2015 at 7:33 AM, piotrz <pi...@gmail.com>
>> wrote:
>> >
>> >> I am reading about that on the other forums and some folks are
>>pointing
>> >> that
>> >> it could be some kind of security issues.
>> >>
>> >> My application is behind https domain, both js file which is trying
>>to
>> >> communicate with my swf are in the same domain.
>> >>
>> >> I see that at the initialization of app someone use these two lines:
>> >>
>> >> Security.allowDomain("*");
>> >> Security.allowInsecureDomain("*");
>> >>
>> >> Documentation is saying that we shouldn't use "allowInsecureDomain"
>>for
>> >> communication between HTTPS files - This is probably my case. - Could
>> this
>> >> cause in some way my errors because these two methods has been used
>>at
>> the
>> >> same time ?
>> >>
>> >> "Do not use this method to enable scripting between non-HTTPS files,
>> >> between
>> >> HTTPS files, or from HTTPS files to non-HTTPS files."
>> >>
>> >> Piotr
>> >>
>> >>
>> >>
>> >> -----
>> >> Apache Flex PMC
>> >> piotrzarzycki21@gmail.com
>> >> --
>> >> View this message in context:
>> >>
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-meth
>>od-on-NPObject-tp10044p10048.html
>> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>> >>
>> >
>> >
>>


Re: [Flex, JS] Error calling method on NPObject!

Posted by "Benjamin A. Boyce" <bo...@gmail.com>.
im sorry, having a hard time unsubscribing from this mail list. Anyone have
any advice? Ive been to the apache page, unsubscribed, but I am still
getting emails.

On 10 April 2015 at 08:11, James M. Greene <ja...@gmail.com> wrote:

> Correction, that should have read:
>
> Are your *HTML page* and SWF file both being retrieved via the same
> protocol (i.e. "http://" vs. "https://")?  They need to be, unless you do
> go ahead and use `Security.allowInsecureDomain(...)`.
>
> Sincerely,
>     James Greene
>
>
> On Fri, Apr 10, 2015 at 10:10 AM, James M. Greene <
> james.m.greene@gmail.com>
> wrote:
>
> > Are your JS and SWF file both being retrieved via the same protocol (i.e.
> > "http://" vs. "https://")?  They need to be, unless you do go ahead and
> > use `Security.allowInsecureDomain(...)`.
> >
> > Sincerely,
> >     James Greene
> >
> >
> > On Fri, Apr 10, 2015 at 7:33 AM, piotrz <pi...@gmail.com>
> wrote:
> >
> >> I am reading about that on the other forums and some folks are pointing
> >> that
> >> it could be some kind of security issues.
> >>
> >> My application is behind https domain, both js file which is trying to
> >> communicate with my swf are in the same domain.
> >>
> >> I see that at the initialization of app someone use these two lines:
> >>
> >> Security.allowDomain("*");
> >> Security.allowInsecureDomain("*");
> >>
> >> Documentation is saying that we shouldn't use "allowInsecureDomain" for
> >> communication between HTTPS files - This is probably my case. - Could
> this
> >> cause in some way my errors because these two methods has been used at
> the
> >> same time ?
> >>
> >> "Do not use this method to enable scripting between non-HTTPS files,
> >> between
> >> HTTPS files, or from HTTPS files to non-HTTPS files."
> >>
> >> Piotr
> >>
> >>
> >>
> >> -----
> >> Apache Flex PMC
> >> piotrzarzycki21@gmail.com
> >> --
> >> View this message in context:
> >>
> http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10048.html
> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
> >>
> >
> >
>

Re: [Flex, JS] Error calling method on NPObject!

Posted by "James M. Greene" <ja...@gmail.com>.
Correction, that should have read:

Are your *HTML page* and SWF file both being retrieved via the same
protocol (i.e. "http://" vs. "https://")?  They need to be, unless you do
go ahead and use `Security.allowInsecureDomain(...)`.

Sincerely,
    James Greene


On Fri, Apr 10, 2015 at 10:10 AM, James M. Greene <ja...@gmail.com>
wrote:

> Are your JS and SWF file both being retrieved via the same protocol (i.e.
> "http://" vs. "https://")?  They need to be, unless you do go ahead and
> use `Security.allowInsecureDomain(...)`.
>
> Sincerely,
>     James Greene
>
>
> On Fri, Apr 10, 2015 at 7:33 AM, piotrz <pi...@gmail.com> wrote:
>
>> I am reading about that on the other forums and some folks are pointing
>> that
>> it could be some kind of security issues.
>>
>> My application is behind https domain, both js file which is trying to
>> communicate with my swf are in the same domain.
>>
>> I see that at the initialization of app someone use these two lines:
>>
>> Security.allowDomain("*");
>> Security.allowInsecureDomain("*");
>>
>> Documentation is saying that we shouldn't use "allowInsecureDomain" for
>> communication between HTTPS files - This is probably my case. - Could this
>> cause in some way my errors because these two methods has been used at the
>> same time ?
>>
>> "Do not use this method to enable scripting between non-HTTPS files,
>> between
>> HTTPS files, or from HTTPS files to non-HTTPS files."
>>
>> Piotr
>>
>>
>>
>> -----
>> Apache Flex PMC
>> piotrzarzycki21@gmail.com
>> --
>> View this message in context:
>> http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10048.html
>> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>>
>
>

Re: [Flex, JS] Error calling method on NPObject!

Posted by "James M. Greene" <ja...@gmail.com>.
Are your JS and SWF file both being retrieved via the same protocol (i.e.
"http://" vs. "https://")?  They need to be, unless you do go ahead and use
`Security.allowInsecureDomain(...)`.

Sincerely,
    James Greene


On Fri, Apr 10, 2015 at 7:33 AM, piotrz <pi...@gmail.com> wrote:

> I am reading about that on the other forums and some folks are pointing
> that
> it could be some kind of security issues.
>
> My application is behind https domain, both js file which is trying to
> communicate with my swf are in the same domain.
>
> I see that at the initialization of app someone use these two lines:
>
> Security.allowDomain("*");
> Security.allowInsecureDomain("*");
>
> Documentation is saying that we shouldn't use "allowInsecureDomain" for
> communication between HTTPS files - This is probably my case. - Could this
> cause in some way my errors because these two methods has been used at the
> same time ?
>
> "Do not use this method to enable scripting between non-HTTPS files,
> between
> HTTPS files, or from HTTPS files to non-HTTPS files."
>
> Piotr
>
>
>
> -----
> Apache Flex PMC
> piotrzarzycki21@gmail.com
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10048.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: [Flex, JS] Error calling method on NPObject!

Posted by piotrz <pi...@gmail.com>.
Alex,

Thank you for your response.

I have try/catch around my function in JS. I will also try to add try/catch
inside my callback function in AS as you suggested and will see what I get.

I have also inside my callback function in AS code for removing registered
callback:

ExternalInterface.addCallback("myfunction", null);

Will try to move this code a bit later. 

Piotr




-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10079.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [Flex, JS] Error calling method on NPObject!

Posted by Alex Harui <ah...@adobe.com>.
I haven’t dealt with this error before, but after reading [1], the fact it
is intermittent leads me to believe it isn’t a security issue.

It’s been my experience that at startup, JS feels like it runs in a
separate thread than Flash.  If your SWF is setting up a callback from the
JS side, you don’t really know when that SWF will have run that code and
if you call too soon, the callback won’t be ready.

The information at [1] also implied that if your callback results in an
exception being thrown in AS you can get this sort of error as well, so
adding a try/catch block just inside your callback might help mask the
problem, but the root of the problem may be that something else still
isn’t setup in the SWF at the time of the callback.

HTH,
-Alex

[1] 
http://stackoverflow.com/questions/8936795/uncaught-error-error-calling-met
hod-on-npobject

On 4/10/15, 5:33 AM, "piotrz" <pi...@gmail.com> wrote:

>I am reading about that on the other forums and some folks are pointing
>that
>it could be some kind of security issues.
>
>My application is behind https domain, both js file which is trying to
>communicate with my swf are in the same domain.
>
>I see that at the initialization of app someone use these two lines:
>
>Security.allowDomain("*");
>Security.allowInsecureDomain("*");
>
>Documentation is saying that we shouldn't use "allowInsecureDomain" for
>communication between HTTPS files - This is probably my case. - Could this
>cause in some way my errors because these two methods has been used at the
>same time ?
>
>"Do not use this method to enable scripting between non-HTTPS files,
>between
>HTTPS files, or from HTTPS files to non-HTTPS files."
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-metho
>d-on-NPObject-tp10044p10048.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: [Flex, JS] Error calling method on NPObject!

Posted by piotrz <pi...@gmail.com>.
I am reading about that on the other forums and some folks are pointing that
it could be some kind of security issues.

My application is behind https domain, both js file which is trying to
communicate with my swf are in the same domain.

I see that at the initialization of app someone use these two lines: 

Security.allowDomain("*");
Security.allowInsecureDomain("*");

Documentation is saying that we shouldn't use "allowInsecureDomain" for
communication between HTTPS files - This is probably my case. - Could this
cause in some way my errors because these two methods has been used at the
same time ?

"Do not use this method to enable scripting between non-HTTPS files, between
HTTPS files, or from HTTPS files to non-HTTPS files."

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-JS-Error-calling-method-on-NPObject-tp10044p10048.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.