Ticket #238 (accepted defect)

Opened 15 months ago

Last modified 3 weeks ago

Firefox won't quit normally w/ Ubiquity enabled, nom noms memory

Reported by: marcello.herreshoff.myopenid.com Owned by: abcdefu.wordpress.com
Priority: blocker Milestone:
Component: builtin-commands Keywords: try-to-reproduce
Cc: atul.toolness.com, marcello.herreshoff.myopenid.com

Description (last modified by atul.toolness.com) (diff)

The automate-form-input command allows you to go to an arbitrary website, click on a form, and type "automate-form-input <name-of-command>", whereupon a new command with that name is created.

It doesn't matter whether the form is a GET-method form, a POST-method form, a form with an onsubmit or a form with a button with an onclick. It works. If, for example, you go to vimeo.com and type "automate-form-input vimeo-search", the following:
//This command was automatically generated by the automate-form-input command.
CmdUtils?.CreateAutomationCommand?({

name: "vimeo-search",
author: "automate-form-input",
url: "http://vimeo.com/",
icon: "http://vimeo.com/favicon.ico",
inject: true,
code: "(document.getElementById("searchterms")).value = query.text;

" +

" var form = (document.search); (form.onsubmit ? (form.onsubmit() ? form.submit(): 1) : form.submit());"

});
gets added to your local collection of commands.

In addition the Automation infrastructure should be useful for creating other commands.

Attachments

automations.diff (11.6 kB) - added by marcello.herreshoff.myopenid.com 15 months ago.
Patch on 0.1.1 release, created with the shell command: diff -c -r oldubiq/ ubiquity@…/

Change History

Changed 15 months ago by marcello.herreshoff.myopenid.com

Patch on 0.1.1 release, created with the shell command: diff -c -r oldubiq/ ubiquity@…/

  Changed 15 months ago by marcello.herreshoff.myopenid.com

  • cc Atul, Varma, <varmaa@…>, marcello.herreshoff.myopenid.com added; Atul Varma <varmaa@…> removed

  Changed 15 months ago by atul.toolness.com

  • cc atul.toolness.com added; Atul, Varma, <varmaa@…> removed

  Changed 15 months ago by marcello.herreshoff.myopenid.com

  • owner ? deleted
  • status changed from new to assigned

follow-up: ↓ 5   Changed 15 months ago by abcdefu.wordpress.com

  • owner set to abcdefu.wordpress.com
  • status changed from assigned to accepted

Interesting command. I really like the idea of commands being able to generate other commands. Wouldn't it be possible to also make this command do something like Google Chrome search shortcuts? Because right now, if you create a search command for NYTimes, it waits for the page to load (which takes a long time) before clicking the search button. I guess it should be possible to extract the search URL and use it directly.

I haven't had time to look through the code line-by-line yet. But it seems that most of the functions you put in cmdutils.js can actually just be in builtincmds.js

in reply to: ↑ 4   Changed 15 months ago by marcello.herreshoff.myopenid.com

Replying to abcdefu.wordpress.com:

Interesting command. I really like the idea of commands being able to generate other commands. Wouldn't it be possible to also make this command do something like Google Chrome search shortcuts? Because right now, if you create a search command for NYTimes, it waits for the page to load (which takes a long time) before clicking the search button. I guess it should be possible to extract the search URL and use it directly.

I actually thought of that, and in fact, before writing the version I sent you I also wrote this:
http://stanford.edu/~marce110/verbs/new-command-from-search-box.html
which uses a copy of some of the internal code firefox uses to create keyword searches.

I decided against this version because I wanted it to work for sites other than searches. For example:

//This command was automatically generated by the automate-form-input command.
CmdUtils.CreateAutomationCommand({
  name: "listentoyoutube",
  author: "automate-form-input",
  url: "http://listentoyoutube.com/",
  icon: "http://listentoyoutube.com/favicon.ico",
  inject: true,
  code: "(document.getElementById("url")).value = query.text; (document.getElementById("submit")).click();"
});

allows you to be on a youtube page and type <C-L> <Alt-space> listen <Enter> and automatically start converting the sound-track of the video into mp3.

Also, sites like vimeo.com do send you to another page after the search, but the behavior isn't specified in the form's action field. (In fact, if you try to make a standard firefox keyword search bookmark for vimeo, it doesn't work until you manually change
http://vimeo.com/?=%s to http://vimeo.com/videos/search:%s )

That's why it looks to me as though loading up the page and performing the search really does seem to be the only fully general way to do this properly. I definitely agree that spending the user's time with a pageload is bad, but having a generated command fail to work as expected is way worse. That said, it would certainly be nice if future versions of this command certainly should detect well-behaved sites and output more streamlined commands in that case. (if, of course, that's even possible... some sites innocently use onsubmit to check if the values of the form are correct, but some use it to hijack the submit event and do something AJAX-ish.) Maybe the only real answer is to offer the users both options and give them names which make the difference clear.

I haven't had time to look through the code line-by-line yet. But it seems that most of the functions you put in cmdutils.js can actually just be in builtincmds.js

Is there any special reason why they shouldn't be in cmdutils.js?

It strikes me that functionality like CmdUtils?.UserCode? and CmdUtils?.runAutomation and the other functions might be useful to other command writers, no? Also, for generated code not to be bloated, it is a must that something like CmdUtils?.CreateAutomationCommand? be visible from the sandbox where the user's code is evaluating.

PS:
Incidentally, I realize that this block of code:

    Application.activeWindow.tabs.forEach(function (tab){
      if(tab.document.location == "chrome://ubiquity/content/editor.html"){
        tab.document.location.reload(true);
      }
    });

really ought to have been inside
CmdUtils?.UserCode?.setCode
so that refreshes happen after anyone calling it changes the User's code.

  Changed 15 months ago by abcdefu.wordpress.com

I really love this command! I'm sure it's going to a killer command for Ubiquity to have. Thanks for letting us build it in!

I agree with you that both commands are powerful and we should probably include both. I'll commit this soon.

  Changed 15 months ago by marcello.herreshoff.myopenid.com

Incidentally, here's another example of the sorts of things you can do with automations.
http://stanford.edu/~marce110/verbs/wordle-from-text.html
This one was hand crafted, but all it took was a brief look at the page source of http://wordle.net/create

  Changed 15 months ago by azarask.in/aza

  • milestone changed from Ubiquity 0.1.2: Raging Stream to Command Updates

  Changed 15 months ago by marcello.herreshoff.myopenid.com

Thanks for your work. ( http://hg.toolness.com/ubiquity-firefox/rev/2713b98604e6 )
Incidentally, if you're going to rename the command, you might also want to change the lines:
+ help: "Select a searchbox, click it and then type new-command... keyword, and a command named keyword will be created.",

and

+ var code = '

//Note: This command was automatically generated by the new-command-from-searchbox command.
'

to match the new name.

  Changed 15 months ago by abcdefu.wordpress.com

Thanks for the tip. I corrected it in 743e49b6bc12. And I created a new ticket to discuss "make-new-search-command". See #289.

  Changed 15 months ago by abcdefu.wordpress.com

In my earlier change, I forgot to move the tab refreshing code into CmdUtils?.UserCode?.setCode . Did that in 6eed1825327e

  Changed 14 months ago by abcdefu.wordpress.com

  • milestone changed from Command Updates to Ubiquity 0.1.3: Lexivore

  Changed 12 months ago by atul.toolness.com

  • description modified (diff)
  • milestone changed from Ubiquity 0.1.3: Lexivore to To Do Later

  Changed 8 months ago by atul.toolness.com

  • milestone deleted

Milestone To Do Later deleted

  Changed 4 months ago by www.google.com/accounts/o8/id?id=aitoawk8su4aysp7nbwear8_j3i1bdkxdj1jr6c

If you’re a dedicated follower of tiffany co like me. Don't miss the tiffany uk & co. on sale including pendants, necklace, earrings, bracelets on line. tiffanys is the one thing that outlasts the cake, champagne and music. links of london jewelry discount , famous for its sweetie and friendship bracelets.
Christian Audigier designer, ed hardy , is a brand of Christian Audigier, and now are favored in the moderning world as a mark of its nice tatoo.

  Changed 3 months ago by me.yahoo.com/a/fdd90cg9icmsicxvoyjf4zcwm.tm7dh0#f4bbc

  Changed 3 months ago by me.yahoo.com/a/fdd90cg9icmsicxvoyjf4zcwm.tm7dh0#f4bbc

  Changed 3 months ago by me.yahoo.com/a/fdd90cg9icmsicxvoyjf4zcwm.tm7dh0#f4bbc

  Changed 3 months ago by me.yahoo.com/a/fdd90cg9icmsicxvoyjf4zcwm.tm7dh0#f4bbc

  Changed 3 months ago by me.yahoo.com/a/fdd90cg9icmsicxvoyjf4zcwm.tm7dh0#f4bbc

  Changed 2 months ago by me.yahoo.com/a/snsj.p44t4tus418p1wh798_igswug2_klajani3#4cb1d

  Changed 2 months ago by me.yahoo.com/a/snsj.p44t4tus418p1wh798_igswug2_klajani3#4cb1d

Lexivore to To Do Later
website design customized logo

  Changed 5 weeks ago by www.google.com/accounts/o8/id?id=aitoawn5wq6idsarqpxfsd05dor4durexebf6yo

i really love this command!

Auto Insurance Quotes

  Changed 3 weeks ago by www.google.com/accounts/o8/id?id=aitoawmtb3gjpkmn8lsxu5paedcc7hdyekstayq

  • keywords try-to-reproduce added; automatic-form-input, form, input, textarea, automatic removed
  • priority changed from major to blocker
  • type changed from enhancement to defect
  • component changed from ubiquity-firefox-core to builtin-commands
  • summary changed from automatic-form-input command to Firefox won't quit normally w/ Ubiquity enabled, nom noms memory

We are providing all kinds of louis vuitton handbags, wallets and purses in ourgucci Online Store, all items of which have the most popular styles and are the newest and at discounted prices.

We also provide helpful shopping guide tips for you to choose and compare our bags and other accessories. Get your sale of replica handbags today and you will never be disappointed with it.

  Changed 3 weeks ago by www.google.com/accounts/o8/id?id=aitoawlb9bmbiqglcp9flmc9_cfigsheyqr1yc0

Welcome to our company, our company Huayi Trade Co.,LTD are good at selling the top quality designer bags (Balenciaga ,Chanel , Chloe' ,Christian Dior ,Dolce&Gabbana , Fendi , Gucci , Hermes , Galliera GM ,Miu Miu , Prada ), they are mirror image bags which are identical to the real onesLouis Vuitton Galliera GM . Our company locates inthe leather town in China, Speedy 25since 2003 we did this business we have won great trust and popularity from our customers from all over the world. We areexpanding our business, any inquiry for wholesale business is warmly welcome, Louis Vuitton Speedy 25just contact us, you can get our prompt reply.We have enlish speaking representative to answer phone call, or we can call you if convenient for you.

  Changed 3 weeks ago by www.google.com/accounts/o8/id?id=aitoawkclkx2iowpzwyrxpiaq6wrdn-gz_z3spc

When the economy became a bit less predictable, more women started looking for ways to make their wedding dresses a little less costly. Some women opted to donate their used wedding dresses to other brides-to-be. Others still choose to cherish this garment, saving it for future daughters or granddaughters to wear in their weddings.

The new shop, designer wedding gowns, is almost directly opposite his existing ready-to-wear and couture boutique, at No. 27, which opened in 1984.

The models this week were nine divorcees who were willing to give their designer wedding dresses major makeovers! The designers had to turn old wedding dress into a hip outfit they “can wear in the next chapter of their lives.”

Note: See TracTickets for help on using tickets.