From a6ffea5e99129e2b979ccea6fdbc487e08e022ef Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 19 Jan 2024 16:24:18 +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 | 86 ++----------------- .../unit/test_quicksuggest_addons.js | 35 ++++++++ .../test_quicksuggest_dynamicWikipedia.js | 45 ++++++++++ .../unit/test_quicksuggest_mdn.js | 69 +++++++++++++++ .../unit/test_quicksuggest_yelp.js | 86 +------------------ 6 files changed, 156 insertions(+), 173 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 6cfc06f8c3040..780d5c443adba 100644 --- a/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_yelp.js +++ b/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest_yelp.js @@ -260,52 +260,6 @@ Yelp " ) ; -/ -/ -TODO -: -After -fixing -bug -1868922 -need -to -change -the -value -to -case -- -sensitive -. -/ -/ -This -value -should -be -" -https -: -/ -/ -www -. -yelp -. -com -/ -search -? -find_desc -= -RaMeN -& -find_loc -= -tOkYo -" -. Assert . equal @@ -330,44 +284,14 @@ search ? find_desc = -ramen +RaMeN & find_loc = -tokyo +tOkYo " ) ; -/ -/ -TODO -: -After -fixing -bug -1868922 -need -to -change -the -value -to -case -- -sensitive -. -/ -/ -This -value -should -be -" -RaMeN -iN -tOkYo -" -. Assert . equal @@ -378,9 +302,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 57b2db2fdd888..71b9c6b82f7ac 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_addons.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_addons.js @@ -2167,6 +2167,41 @@ false } ) } +{ +input +: +" +FoUrTh +" +expected +: +makeExpectedResult +( +{ +suggestion +: +REMOTE_SETTINGS_RESULTS +[ +0 +] +. +attachment +[ +3 +] +source +: +" +remote +- +settings +" +setUtmParams +: +false +} +) +} ] ; / 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 e43b5eb1187c7..0a06c32ca3ab2 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js @@ -405,6 +405,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 98ab0222a034b..ddbd126d4318a 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_mdn.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_mdn.js @@ -1086,6 +1086,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 2b72a99c39be8..4257b093c3a59 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js @@ -287,30 +287,8 @@ tOkYo expected : { -/ -/ -TODO +url : -After -fixing -bug -1868922 -need -to -change -the -value -to -case -- -sensitive -. -/ -/ -This -value -should -be " https : @@ -336,58 +314,8 @@ find_loc = tOkYo " -. -url -: -" -https -: -/ -/ -www -. -yelp -. -com -/ -search -? -find_desc -= -best -+ -ramen -+ -delivery -& -find_loc -= -tokyo -" -/ -/ -TODO +title : -After -fixing -bug -1868922 -need -to -change -the -value -to -case -- -sensitive -. -/ -/ -This -value -should -be " BeSt RaMeN @@ -395,16 +323,6 @@ dElIvErY iN tOkYo " -. -title -: -" -best -ramen -delivery -in -tokyo -" } } ]