It uses the document URI rather than the form's baseURI when calling newURI on the action attribute's value. (Also it can use the property rather than the attribute, since XPCNativeWrappers mean we don't need to worry about bug 264607.)
It can just use form.mozActionURI once the relevant patch in bug 566128 lands.
(In reply to comment #1) > It can just use form.mozActionURI once the relevant patch in bug 566128 lands. FTR: form.mozActionUri was introduced and then removed through bug 607145.
Hey Gavin, this has been marked as a good first bug for some time now but no one's taken it up. Maybe it would do better if it were a mentored bug. What do you think?
Created attachment 767822 [details] [diff] [review] Patch
This could be a good opportunity to gain some test-writing experience! This is testable with a browser-chrome test, I think (https://developer.mozilla.org/en-US/docs/Browser_chrome_tests). An example of a test that loads a page and tests how chrome interacts with it is http://mxr.mozilla.org/mozilla-central/source/browser/base/content/test/browser_bug581947.js. You could create a new test next to that (maybe name it browser_addKeywordSearch.js), have it load a page with a form whose baseURI is non-default, then call AddKeywordForSearchField directly and check that it creates a keyword with the right URI. Ping me in person if you want to chat about this more!
Created attachment 768297 [details] [diff] [review] Patch New patch including tests.
Created attachment 768348 [details] [diff] [review] Patch Patch updated based on Gavin's review.