Closed
Bug 900865
Opened 11 years ago
Closed 11 years ago
Make homepage call nsSearchService.getSubmission for all searches
Categories
(Firefox :: Search, defect)
Firefox
Search
Tracking
()
RESOLVED
FIXED
Firefox 26
People
(Reporter: mikedeboer, Assigned: mikedeboer)
References
Details
Attachments
(1 file, 4 obsolete files)
(deleted),
patch
|
mikedeboer
:
review+
|
Details | Diff | Splinter Review |
As mentioned in bug 890690 comment 14, the current implementation to support POST search engines in about:home duplicates behavior as implemented by nsSearchService.getSubmission().
To allow getSubmission() to be called from a non-chrome context like about:home, we need to use events to transfer messages between differently privileged areas.
Severity: major → normal
status-firefox22:
unaffected → ---
status-firefox23:
fixed → ---
status-firefox24:
fixed → ---
status-firefox25:
fixed → ---
tracking-firefox23:
+ → ---
tracking-firefox24:
+ → ---
tracking-firefox25:
+ → ---
Version: unspecified → Trunk
Assignee | ||
Comment 1•11 years ago
|
||
Gavin, as you might notice from this patch, I can pretty much revert the entire changeset from bug 890690. Is there a reason you might still postDataString somewhere? If not, I'll revert all those changes to this new - preferred - way of doing things.
Instead of introducing a new event, I simply reused 'AboutHomeSearchEvent', which was only used for FHR. I was careful not to break the FHR mechanism (and luckily, it is covered by a unit test). Do you agree that that is the correct direction?
Thanks!
Attachment #788904 -
Flags: feedback?(gavin.sharp)
Assignee | ||
Comment 2•11 years ago
|
||
In fact, in this case we don't even need the 'searchEngineURL' attribute anymore for about:home...
Since this is starting to look so elegant and simple, I begin to wonder if this implementation was tried before, but disregarded for some reason?
Comment 3•11 years ago
|
||
Comment on attachment 788904 [details] [diff] [review]
Patch v1: make about:home call nsSearchService.getSubmission
Looks good - this does look like it will simplify things a lot. The history is in bug 563723. IIRC we didn't take this approach just because it wasn't necessary (about:home then was less tied to the search service and had a hardcoded list of engines, didn't support POST data, etc.).
Attachment #788904 -
Flags: feedback?(gavin.sharp) → feedback+
Assignee | ||
Comment 4•11 years ago
|
||
Part of this patch is about reverting the code I added for bug 890690. I also reverted the UUID of nsISearchEngine, is that the correct thing to do?
I also removed the searchEngineURL attribute and the corresponding code in AboutHomeUtils.jsm. \o/
I checked the unit tests and they run without problems. Could do a try run to be safe.
Assignee: nobody → mdeboer
Attachment #788904 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #789199 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 5•11 years ago
|
||
Report exception when it occurs. This will never ever happen, but still...
Attachment #789199 -
Attachment is obsolete: true
Attachment #789199 -
Flags: review?(gavin.sharp)
Attachment #789201 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 6•11 years ago
|
||
Assignee | ||
Comment 7•11 years ago
|
||
Try run looks good.
Comment 8•11 years ago
|
||
Comment on attachment 789201 [details] [diff] [review]
Patch v1.3: make about:home call nsISearchEngine.getSubmission
>diff --git a/browser/base/content/abouthome/aboutHome.js b/browser/base/content/abouthome/aboutHome.js
> function onSearchSubmit(aEvent)
>+ // Send an event that will perform a search. This was originally added so
>+ // Firefox Health Report could record that a search from about:home had
>+ // occurred, but now it will also perform the search (properly) in
>+ // browser.js through nsISearchEngine.getSubmission().
I think the "this was originally added" bit is not really relevant to someone looking at this code (and can be found in blame), so I would just remove it.
>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
> let updateSearchEngine = function() {
>+ // Again, keep the searchEngineName as the last attribute, because the
> // mutation observer in aboutHome.js is counting on that.
>+ docElt.setAttribute("searchEngineName", Services.search.defaultEngine.name);
This comment isn't so useful now, since it's not the only attribute.
>+ // Trigger a search through nsISearchEngine.getSubmission()
>+ let submission = Services.search.currentEngine.getSubmission(data.searchTerms);
>+ openUILinkIn(submission.uri.spec, "current", null, submission.postData);
I think this might do the wrong thing if about:home is loaded in an app tab (it will open the search in a new tab). Probably better to use gBrowser.loadURI? Also, in theory you want to use the same tab that the event bubbles up from, rather than the currently selected tab, but since I think it's impossible for the event to be fired in a background tab in practice, I guess you don't need to worry about that.
r=me with those addressed.
Attachment #789201 -
Flags: review?(gavin.sharp) → review+
Comment 9•11 years ago
|
||
and sorry for the delay!
Assignee | ||
Comment 10•11 years ago
|
||
Patch with Gavin's comments addressed. Carrying over r=gavin.
Attachment #789201 -
Attachment is obsolete: true
Attachment #796600 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 11•11 years ago
|
||
Comment 12•11 years ago
|
||
Backed out for mochitest-bc crashes.
https://hg.mozilla.org/integration/fx-team/rev/e994f93c5b39
Whiteboard: [fixed-in-fx-team]
Comment 13•11 years ago
|
||
Assignee | ||
Comment 14•11 years ago
|
||
Another try push for this, because I only see Win XP crashes in the logs...
https://tbpl.mozilla.org/?tree=Try&rev=d2aeead9167a
Assignee | ||
Comment 15•11 years ago
|
||
Try push looks good, so I attempted another push to integration:
https://hg.mozilla.org/integration/fx-team/rev/41729438f597
Comment 16•11 years ago
|
||
Still crashing, even after a clobber.
https://hg.mozilla.org/integration/fx-team/rev/a93b157d7ab4
Assignee | ||
Comment 17•11 years ago
|
||
Now with a completely new UUID for the nsISearchSubmission interface.
Attachment #796600 -
Attachment is obsolete: true
Attachment #797909 -
Flags: review+
Assignee | ||
Comment 18•11 years ago
|
||
Trying _again_ with this new version.
https://hg.mozilla.org/integration/fx-team/rev/75d9df61d0e1
Comment 19•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
Depends on: 927132
You need to log in
before you can comment on or make changes to this bug.
Description
•