Closed Bug 1690016 Opened 3 years ago Closed 3 years ago

Amazon search suggestions are no longer displayed if a special locale character is used in the string

Categories

(Firefox :: Search, defect, P2)

Firefox 87
Desktop
All
defect
Points:
2

Tracking

()

VERIFIED FIXED
92 Branch
Iteration:
92.2 - Jul 26 - Aug 8
Tracking Status
firefox87 --- wontfix
firefox92 --- verified

People

(Reporter: cbaica, Assigned: bugzilla)

Details

Attachments

(1 file)

Affected versions

  • Fx87.0a1

Pre-requisites

  • Install a DE Firefox locale.

Steps to reproduce

  1. Launch Firefox.
  2. Click on the address bar and select the amazon one-off from the drop-down.
  3. Start typing 'stühle'.

Expected result

  • Search suggestions are displayed for the typed word.

Actual result

  • Search suggestions are not displayed.

Regression range

  • Not a regression.

Additional notes

  • The search suggestions dissappear after the special character 'ü' is typed (or pasted).
  • No suggestions are displayed for copy/pasted words containing special characters.
Priority: -- → P1
Severity: normal → S2
Priority: P1 → --

Compare the network responses from:

https://completion.amazon.de/search/complete?q=stühle&search-alias=aps&mkt=4
https://www.google.com/complete/search?client=firefox&q=stü

Google has the first element returned as "stü" whereas Amazon has it as "st\u00FC".

I haven't tested/dug into the code, but I suspect that the encoded version that Amazon is returning is enough to throw our suggested results off.

They are setting text/javascript;charset=UTF-8 in the response header, and the rest of the suggestions are utf-8, so I'm a little surprised the first element isn't as well.

Has STR: --- → yes
Flags: needinfo?(htwyford)

SearchSuggestionController throws out suggestions if the remote search string does not match the typed one. This will need a workaround. We can also let Amazon know, since this seems like a bug on their end.

Assignee: nobody → htwyford
Status: NEW → ASSIGNED
Iteration: --- → 88.1 - Feb 22 - Mar 7
Points: --- → 2
Flags: needinfo?(htwyford)

We could fix this by replacing this block with

try {
  if (
    !Array.isArray(serverResults) ||
    !serverResults[0] ||
    (this._searchString.localeCompare(serverResults[0], undefined, {
      sensitivity: "base",
    }) &&
      // Some engines (e.g. Amazon) return a search string containing
      // escaped Unicode sequences. Try decoding the remote search string
      // and compare that with our typed search string.
      this._searchString.localeCompare(
        decodeURIComponent(
          JSON.parse('"' + serverResults[0].replace(/\"/g, '\\"') + '"')
        ),
        undefined,
        {
          sensitivity: "base",
        }
      ))
  ) {
    // something is wrong here so drop remote results
    deferredResponse.resolve(
      "Unexpected response, this._searchString does not match remote response"
    );
    return;
  }
} catch (ex) {
  deferredResponse.resolve(
    `Failed to parse the remote response string: ${ex}`
  );
  return;
}

but we're going to try reaching out to Amazon first to see if this is a bug or something intentional. I'll remove the iteration for now.

Iteration: 88.1 - Feb 22 - Mar 7 → ---
Priority: -- → P2
Iteration: --- → 92.2 - Jul 26 - Aug 8
Pushed by htwyford@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c6fb19f57dca
Allow suggestions from engines that escape Unicode characters. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch

The issue is verified fixed in the latest Fx92.0a1 build on Windows 10 and Ubuntu 20. While having the amazon search engine as default and typeing or pasting special charcaters, or words containing special characters, search suggestions are still provided.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: