You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Erel Segal <er...@gmail.com> on 2008/08/12 17:30:13 UTC

Re: Problem running a "real" application

After some tracing, I think I found a bug.

When calling an RPC service, execution arrives at rpc.js, to the function
   function process(rpc)

In that function, there is a line:
   var result = service.apply(rpc, rpc.a);

Where :
 * service is a function, typically registered by gadgets.IfrGadgetService,
in this case, it is the function
gadgets.IfrGadgetService.prototype.requestNavigateTo
 * rpc is a struct containing 5 fields related to the request (s, f, c, a,
t).

According to the Javascript documentation:

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Function:apply

The "apply" function takes two arguments: the first it the "this" variable
and the second is the array of arguments.

So, in this case, the "this" variable is the rpc struct, but it is passed to
a function that belongs to the gadgets.IfrGadgetService class!

This seems like a bug, don't you think?

2008/7/31, Erel Segal <er...@gmail.com>:
>
> "It would seem that gadgets.js (the sample container js code)
> requestNavigateTo is erroring out, i get the same thing if i try an app that
> navigates in the sample container" - Do you mean that there is a bug in
> gadgets.js ?
>
> 2008/7/29, Chris Chabot <ch...@xs4all.nl>:
>>
>> Hey Erel,
>>
>> It would seem that gadgets.js (the sample container js code)
>> requestNavigateTo is erroring out, i get the same thing if i try an app that
>> navigates in the sample container (see http://www.shindig-demo.org/ for a
>> hosted java based demo).
>>
>> If you'd run this in a container with a working requestNavigateTo rpc
>> implementation you'd be able to get past that point, however unfortunately
>> typeracer is tied to specific platforms (
>> http://typeracer.com/orkut/gadget.xml and
>> http://typeracer.com/hi5/gadget.xml for instance) and they don't have a
>> 'open social compliant version' that will work on any open social container
>> ;(
>>
>> To be completely honest most social apps are tied to specific containers
>> at the moment, and the rare few that are not either require your public key
>> to be able to verify your signed requests (and often work on their end to
>> add your container, etc), or require a version that works on your specific
>> container..  So what that leaves you with is either the sample gadgets,
>> iGoogle style gadget's that are not social, or a very few rare apps that are
>> social but don't do signed requests / require back-end configuration on
>> their end.
>>
>> http://opensocial.musicmazaa.com/app/index.xml is such an gadget for
>> instance that is social and works 'everywhere', but with the obvious
>> downside that if requests are not signed ... well there is no way to
>> validate the owner / viewer so 'hacking' the info is as simple as changing
>> an ID in firebug.
>>
>>        -- Chris
>>
>>
>> On Jul 29, 2008, at 5:04 PM, Erel Segal wrote:
>>
>>  OK, I picked at random some application that looked both simple and fun -
>>> the TypeRacer application
>>>  ( http://typeracer.com/orkut/gadget.xml ).
>>>
>>> It works fine on Orkut, so I am sure it has no bugs.
>>>
>>> I put the link inside javcascript/container/sample2.html, so that I can
>>> be
>>> sure that all javascript files are included correctly.
>>>
>>> When I clicked the "play now" link, I got a javascript error:
>>>  "this.getGadgetIdFromModuleId is not a function"
>>>
>>> The trace shows:
>>>  * gadgets.IfrGadgetService.prototype.requestNavigateTo  (in gadgets.js)
>>>  * process (in rpc.js)
>>>  * getRelayUrl (in rpc.js)
>>>
>>> Probably, the gadget tried to call "requestNavigateTo" to navigate to a
>>> different view, but got an error.
>>>
>>> Do you have any clue, what have gone wrong?
>>>
>>
>>
>

Re: Problem running a "real" application

Posted by Erel Segal <er...@gmail.com>.
I found a workaround - in rpc.js I replaced the line:

      var result = service.apply(rpc, rpc.a);

with the following lines:

      var gadgetService = gadgets.IfrContainer.prototype.gadgetService;
      gadgetService.f = rpc.f;  // copy the "from" field
      var result = service.apply(gadgetService, rpc.a);

It's certainly NOT a fix, because the gadgetService should be taken from
somewhere else, but it seems to work, I don't get those strange Javascript
errors anymore.



Now there is a new problem: the requestNavigateTo function navigates to "
http://localhost/canvas". This is because of the function
   gadgets.IfrGadgetService.prototype.getUrlForView
which says:
   "This is a silly implementation that will need to be overriden by almost
all real containers"
and just returns "/canvas" when the gadget requests to navigate to a canvas
view.

Can you give me a hint, how to override this implementation in a real
container?



2008/8/12, Erel Segal <er...@gmail.com>:
>
> After some tracing, I think I found a bug.
>
> When calling an RPC service, execution arrives at rpc.js, to the function
>    function process(rpc)
>
> In that function, there is a line:
>    var result = service.apply(rpc, rpc.a);
>
> Where :
>  * service is a function, typically registered by gadgets.IfrGadgetService,
> in this case, it is the function
> gadgets.IfrGadgetService.prototype.requestNavigateTo
>  * rpc is a struct containing 5 fields related to the request (s, f, c, a,
> t).
>
> According to the Javascript documentation:
>
> http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Function:apply
>
> The "apply" function takes two arguments: the first it the "this" variable
> and the second is the array of arguments.
>
> So, in this case, the "this" variable is the rpc struct, but it is passed
> to a function that belongs to the gadgets.IfrGadgetService class!
>
> This seems like a bug, don't you think?
>
> 2008/7/31, Erel Segal <er...@gmail.com>:
>>
>> "It would seem that gadgets.js (the sample container js code)
>> requestNavigateTo is erroring out, i get the same thing if i try an app that
>> navigates in the sample container" - Do you mean that there is a bug in
>> gadgets.js ?
>>
>> 2008/7/29, Chris Chabot <ch...@xs4all.nl>:
>>>
>>> Hey Erel,
>>>
>>> It would seem that gadgets.js (the sample container js code)
>>> requestNavigateTo is erroring out, i get the same thing if i try an app that
>>> navigates in the sample container (see http://www.shindig-demo.org/ for
>>> a hosted java based demo).
>>>
>>> If you'd run this in a container with a working requestNavigateTo rpc
>>> implementation you'd be able to get past that point, however unfortunately
>>> typeracer is tied to specific platforms (
>>> http://typeracer.com/orkut/gadget.xml and
>>> http://typeracer.com/hi5/gadget.xml for instance) and they don't have a
>>> 'open social compliant version' that will work on any open social container
>>> ;(
>>>
>>> To be completely honest most social apps are tied to specific containers
>>> at the moment, and the rare few that are not either require your public key
>>> to be able to verify your signed requests (and often work on their end to
>>> add your container, etc), or require a version that works on your specific
>>> container..  So what that leaves you with is either the sample gadgets,
>>> iGoogle style gadget's that are not social, or a very few rare apps that are
>>> social but don't do signed requests / require back-end configuration on
>>> their end.
>>>
>>> http://opensocial.musicmazaa.com/app/index.xml is such an gadget for
>>> instance that is social and works 'everywhere', but with the obvious
>>> downside that if requests are not signed ... well there is no way to
>>> validate the owner / viewer so 'hacking' the info is as simple as changing
>>> an ID in firebug.
>>>
>>>        -- Chris
>>>
>>>
>>> On Jul 29, 2008, at 5:04 PM, Erel Segal wrote:
>>>
>>>  OK, I picked at random some application that looked both simple and fun
>>>> -
>>>> the TypeRacer application
>>>>  ( http://typeracer.com/orkut/gadget.xml ).
>>>>
>>>> It works fine on Orkut, so I am sure it has no bugs.
>>>>
>>>> I put the link inside javcascript/container/sample2.html, so that I can
>>>> be
>>>> sure that all javascript files are included correctly.
>>>>
>>>> When I clicked the "play now" link, I got a javascript error:
>>>>  "this.getGadgetIdFromModuleId is not a function"
>>>>
>>>> The trace shows:
>>>>  * gadgets.IfrGadgetService.prototype.requestNavigateTo  (in gadgets.js)
>>>>  * process (in rpc.js)
>>>>  * getRelayUrl (in rpc.js)
>>>>
>>>> Probably, the gadget tried to call "requestNavigateTo" to navigate to a
>>>> different view, but got an error.
>>>>
>>>> Do you have any clue, what have gone wrong?
>>>>
>>>
>>>
>>
>