Asynchronous Noun Suggestions

21 views
Skip to first unread message

Irakli Gozalishvili

unread,
Mar 16, 2009, 11:16:11 AM3/16/09
to ubiquity-firefox
Hi I'm trying  to make async suggestions in noun type but it not seems to work as I expected. my noun type looks like

var Suggester = {
        _name : 'Suggester',
       
        suggest : function(text, html, makeSuggestion) {
           
            Utils.setTimeout(function suggestAsync() {               
                for each (var number in [1,2,3,4]) {
                    displayMessage(number);
                    makeSuggestion({
                        text : number
                        summary : number,
                        html : number
                    });
                }
            }, 300);
            return [];
        }
    }

I was expecting to see the suggestion but unfortunately I don't. I only see the numbers through AlertService (displayMessage), any ideas what am I doing  wrong?  Or its not even supposed  to work ??

Thanks
--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands

Irakli Gozalishvili

unread,
Mar 16, 2009, 1:57:14 PM3/16/09
to ubiquity-firefox
I just discovered that problem is in something different. It's not about setTimeout-s cause the same code works in 0.2pre 7 but doesn't works in 0.2pre17 so guess there is sort of regression, or might changes in the API..

Any help is welcome !!  
--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


Fernando Takai

unread,
Mar 16, 2009, 1:58:06 PM3/16/09
to ubiquity...@googlegroups.com

Irakli Gozalishvili

unread,
Mar 16, 2009, 1:59:57 PM3/16/09
to ubiquity...@googlegroups.com
Thanks but I know this tutorial and don't think what I'm doing is somehow different so .. :(

--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Phone: +31 614 205275

Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


Irakli Gozalishvili

unread,
Mar 17, 2009, 10:26:46 AM3/17/09
to ubiquity...@googlegroups.com
Am I the only one having this problem ??

--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


Johnny Baillargeaux

unread,
Mar 17, 2009, 10:58:17 AM3/17/09
to ubiquity...@googlegroups.com
I confirm, i've exactly the same problem with the latest release. My code worked perfectly before the upgrade (0.2pre17).

Regards,
Johnny Baillargeaux

2009/3/17 Irakli Gozalishvili <rfo...@gmail.com>

Johnny Baillargeaux

unread,
Mar 19, 2009, 10:17:29 AM3/19/09
to ubiquity...@googlegroups.com
i've installed the latest version 0.2pre19 today, but i still have the same problem unfortunately...

2009/3/17 Johnny Baillargeaux <jbx...@googlemail.com>

Irakli Gozalishvili

unread,
Mar 21, 2009, 3:35:30 PM3/21/09
to ubiquity...@googlegroups.com
Still have the problem with
0.2pre24

Can anybody tell us if there is any plan to fix this or might this feature is dropped at all, or might there is some new way to push suggestions


Thanks 
--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Phone: +31 614 205275
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


Atul Varma

unread,
Mar 21, 2009, 6:51:35 PM3/21/09
to ubiquity-firefox
Hi Irakli,

Sorry about this, I've actually been having the same problem and just
looked into it.

It appears as though Ubiquity has regressed in the case where an
asynchronous noun-type initially returns NO suggestions but later
returns some. So for instance, the following noun type works:

var Suggester = {
_name : 'Suggester',

suggest : function(text, html, makeSuggestion) {

Utils.setTimeout(function suggestAsync() {
for each (var number in [1,2,3,4]) {
//Components.utils.reportError("making a sugg.");
makeSuggestion({
text : number,
summary : number,
html : number
});
}
}, 300);
return [CmdUtils.makeSugg("blah")];
}
}

If you remove the 'CmdUtils.makeSugg("blah")', then this noun type
will appear to stop working.

Lemme talk to Jono or Mitcho and see if we can get this fixed soon.

- Atul
> >>>>>https://wiki.mozilla.org/Labs/Ubiquity/Ubiquity_0.1_Author_Tutorial#I...

Irakli Gozalishvili

unread,
Mar 21, 2009, 8:48:05 PM3/21/09
to ubiquity...@googlegroups.com
Thanks a lot I opened bug report for this
https://bugzilla.mozilla.org/show_bug.cgi?id=484615

--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


Fernando Takai

unread,
Mar 22, 2009, 3:34:26 PM3/22/09
to ubiquity...@googlegroups.com
Irakli,

Can you open a bug on our trac system? http://ubiquity.mozilla.com/trac/
http://twitter.com/fernando_takai

Get Ubiquity: https://ubiquity.mozilla.com

Irakli Gozalishvili

unread,
Mar 22, 2009, 6:51:03 PM3/22/09
to ubiquity...@googlegroups.com
Done
http://ubiquity.mozilla.com/trac/ticket/619

--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


satyr

unread,
Mar 23, 2009, 7:23:43 PM3/23/09
to ubiquity-firefox
What behavior do you expect when a verb has no args matched
synchronously, then later gets async ones, anyway?

[1] The verb isn't suggested at first, but later (suddenly) pops up.
[2] The verb is suggested with no args filled, then the async suggs
follow.

I'd think [1] can be annoying and not a good UI.
If you want [2], then it can be achieved by suggesting a dummy sugg
(return [{text:''}]).

satyr

unread,
Mar 23, 2009, 7:59:53 PM3/23/09
to ubiquity-firefox
e.g.:

var noun = {
_name : 'timer',
suggest : function(text, html, callback) {
for each(var i in [1, 2, 3, 4]) with({i:i})
Utils.setTimeout(function suggestAsync(){
callback(CmdUtils.makeSugg(i +'', null, i));
}, i * 1e3);
return [{text: '-', summary: '...loading'.italics()}];
// ^ must provide a non empty `text' because of [parser.js L367]
// (which should check summary instead of text)
}
};
CmdUtils.CreateCommand({
name: 'test',
icon: 'chrome://ubiquity/skin/icons/favicon.ico',
takes: {_: noun},
modifiers: {_: noun},
execute: function(dob, mod){},
preview: function(pbl, dob, mod){},
});

Stephen Elson

unread,
Mar 25, 2009, 4:54:55 PM3/25/09
to ubiquity-firefox
Note that this problem is also in the recently released 0.1.7 version,
which has rendered a lot of async commands broken.

Steve

Irakli Gozalishvili

unread,
Mar 25, 2009, 9:27:45 PM3/25/09
to ubiquity...@googlegroups.com
Thanks for suggestions / example, I already use similar workaround but still it's workaround
1) is expected behavior, and actually it was working that way till some regression

regards 
--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


Reply all
Reply to author
Forward
0 new messages