base::StringPrintf fails silently on Windows (using %1$s, %2$s) |
|
Issue description
This code fails on windows bots and doesn't print any error:
std::string script = base::StringPrintf(
"var %1$s_%2$s_event = 0;"
"document.getElementById('%1$s').on%2$s = function() {"
" %1$s_%2$s_event = 1;"
"};\n",
element_name, event);
https://codereview.chromium.org/2750323003/#ps40001 ( chrome/renderer/autofill/password_generation_test_utils.cc)
This code works:
std::string script = base::StringPrintf(
"%s_%s_event = 0;"
"document.getElementById('%s').on%s = function() {"
" %s_%s_event = 1;"
"};",
element_name, event, element_name, event, element_name, event);
What is the expected result?
The code should work since it works on Linux, or print a error message.
What happens instead?
The code fails w/o any output.
,
Mar 24 2017
Thanks for info thestig@. I believe a note to stringprintf might be not enough. A developer might not take a look at the declaration of stringprintf. It would be nice if the function cause run-time error (compilation error is not possible as I understand). |
|
►
Sign in to add a comment |
|
Comment 1 by thestig@chromium.org
, Mar 22 2017Owner: thakis@chromium.org