Closed Bug 860276 Opened 11 years ago Closed 6 years ago

engines whose URLs specify a template that includes a query string in addition to <Param>s fail to properly construct the submission URI

Categories

(Firefox :: Search, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mkaply, Unassigned)

Details

I added DuckDuckGo from https://duckduckgo.com/

It's search syntax is:

https://duckduckgo.com/?q=test

I then made this call:

Services.search.getEngineByName("DuckDuckGo").addParam("fluffy", "bunny", null);

When I executed a search, it was:

https://duckduckgo.com/?q=testfluffy=bunny

Subsequent addParams worked properly (Adding &fluffy=bunny).

So adding the very first parameter if there is not already a parameter doesn't seem to work.
See http://hg.mozilla.org/mozilla-central/annotate/ee5ca214e87c/netwerk/base/public/nsIBrowserSearchService.idl#l54. 

But this isn't really a problem with addParam, it's a fundamental issue with engines whose URL templates specify a query string in addition to specifying <Param>s, e.g.:

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Example Search</ShortName>
<Url type="text/html" method="GET" template="https://www.example.com/?search={searchTerms}">
  <Param name="otherparam" value="othervalue"/>
</Url>
</SearchPlugin>

The fix is to improve the logic in SRCH_EURL_getSubmission that does the string munging (the "url += dataString" part needs to consider the presence of existing query string parameters).
Summary: nsISearchEngine addParam doesn't properly handle the first parameter → engines whose URLs specify a template that includes a query string in addition to <Param>s fail to properly construct the submission URI
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Legacy Extensions.
Resolution: INACTIVE → WONTFIX
You need to log in before you can comment on or make changes to this bug.