From b71b3303ec589f8a3e7902b79f3cfa5408cae44e Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 19 Jan 2024 16:02:37 +0000 Subject: [PATCH] Bug 1868922: Pass user's query as is to Rust component to keep string cases r=adw Differential Revision: https://phabricator.services.mozilla.com/D198513 UltraBlame original commit: 0253ebfe13cce5635229aee23e86f203caced14b --- .../urlbar/private/SuggestBackendRust.sys.mjs | 8 --- .../browser/browser_quicksuggest_yelp.js | 10 +-- .../unit/test_quicksuggest_addons.js | 35 ++++++++++ .../test_quicksuggest_dynamicWikipedia.js | 45 ++++++++++++ .../unit/test_quicksuggest_mdn.js | 69 +++++++++++++++++++ .../unit/test_quicksuggest_yelp.js | 18 ++--- 6 files changed, 163 insertions(+), 22 deletions(-) diff --git a/browser/components/urlbar/private/SuggestBackendRust.sys.mjs b/browser/components/urlbar/private/SuggestBackendRust.sys.mjs index c5120937cf43e..ca6dfa1febe16 100644 --- a/browser/components/urlbar/private/SuggestBackendRust.sys.mjs +++ b/browser/components/urlbar/private/SuggestBackendRust.sys.mjs @@ -1005,14 +1005,6 @@ return ] ; } -searchString -= -searchString -. -toLocaleLowerCase -( -) -; / / Build diff --git a/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_yelp.js b/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_yelp.js index be3932d166027..89e01fb64cacf 100644 --- a/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_yelp.js +++ b/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_yelp.js @@ -247,11 +247,11 @@ search ? find_desc = -ramen +RaMeN & find_loc = -tokyo +tOkYo " ) ; @@ -265,9 +265,9 @@ payload . title " -ramen -in -tokyo +RaMeN +iN +tOkYo " ) ; diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_addons.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_addons.js index dc4cfbc7fe3ec..9cbe032cdf9d9 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_addons.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_addons.js @@ -1899,6 +1899,41 @@ false } ) } +{ +input +: +" +FoUrTh +" +expected +: +makeExpectedResult +( +{ +suggestion +: +REMOTE_SETTINGS_RESULTS +[ +0 +] +. +attachment +[ +3 +] +source +: +" +remote +- +settings +" +setUtmParams +: +false +} +) +} ] ; UrlbarPrefs diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js index 6980467a520cd..833416e877044 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js @@ -255,6 +255,51 @@ sponsored } ) ; +add_task +( +async +function +mixedCaseQuery +( +) +{ +await +check_results +( +{ +context +: +createContext +( +" +TeSt +" +{ +providers +: +[ +UrlbarProviderQuickSuggest +. +name +] +isPrivate +: +false +} +) +matches +: +[ +makeExpectedResult +( +) +] +} +) +; +} +) +; function makeExpectedResult ( diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_mdn.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_mdn.js index 9391a3ebfbd5d..5792745141445 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_mdn.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_mdn.js @@ -925,6 +925,75 @@ forceSync } ) ; +add_task +( +async +function +mixedCaseQuery +( +) +{ +const +suggestion += +REMOTE_SETTINGS_DATA +[ +0 +] +. +attachment +[ +1 +] +; +const +keyword += +" +InPuT +" +; +await +check_results +( +{ +context +: +createContext +( +keyword +{ +providers +: +[ +UrlbarProviderQuickSuggest +. +name +] +isPrivate +: +false +} +) +matches +: +[ +makeExpectedResult +( +{ +searchString +: +keyword +suggestion +} +) +] +} +) +; +} +) +; function makeExpectedResult ( diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js index 7634cd370985f..ba1d28bc52102 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js @@ -240,24 +240,24 @@ search ? find_desc = -best +BeSt + -ramen +RaMeN + -delivery +dElIvErY & find_loc = -tokyo +tOkYo " title : " -best -ramen -delivery -in -tokyo +BeSt +RaMeN +dElIvErY +iN +tOkYo " } }