diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-05-05 01:08:28 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-05-05 01:08:28 +0000 |
commit | f7f03bdc10d1c8aa2787c478ecdda92f2b7df008 (patch) | |
tree | fe51293053ab8126dc79b35f5f1c9406c5eb7158 | |
parent | ae88e3df0e2d2779c1b8c7ff9a17ef34c0bf23e6 (diff) | |
parent | e8640cee53e13f9dcf2a0f7f322f828d5ea5df16 (diff) | |
download | chromium-libpac-r-beta-2.tar.gz |
Snap for 6461449 from e8640cee53e13f9dcf2a0f7f322f828d5ea5df16 to rvc-releaseandroid-vts-11.0_r9android-vts-11.0_r8android-vts-11.0_r7android-vts-11.0_r6android-vts-11.0_r5android-vts-11.0_r4android-vts-11.0_r3android-vts-11.0_r2android-vts-11.0_r16android-vts-11.0_r15android-vts-11.0_r14android-vts-11.0_r13android-vts-11.0_r12android-vts-11.0_r11android-vts-11.0_r10android-vts-11.0_r1android-security-11.0.0_r1android-r-beta-3android-r-beta-2android-platform-11.0.0_r2android-platform-11.0.0_r1android-cts-11.0_r9android-cts-11.0_r8android-cts-11.0_r7android-cts-11.0_r6android-cts-11.0_r5android-cts-11.0_r4android-cts-11.0_r3android-cts-11.0_r2android-cts-11.0_r16android-cts-11.0_r15android-cts-11.0_r14android-cts-11.0_r13android-cts-11.0_r12android-cts-11.0_r11android-cts-11.0_r10android-cts-11.0_r1android-11.0.0_r6android-11.0.0_r5android-11.0.0_r4android-11.0.0_r3android-11.0.0_r25android-11.0.0_r2android-11.0.0_r17android-11.0.0_r1r-beta-2android11-tests-releaseandroid11-s1-releaseandroid11-release
Change-Id: I94d02fbb3036502b8d84234494950d5768c7b7b2
-rw-r--r-- | test/js-unittest/b_147664838.js | 21 | ||||
-rw-r--r-- | test/proxy_resolver_v8_unittest.cc | 13 | ||||
-rw-r--r-- | test/proxy_test_script.h | 24 |
3 files changed, 58 insertions, 0 deletions
diff --git a/test/js-unittest/b_147664838.js b/test/js-unittest/b_147664838.js new file mode 100644 index 0000000..d1d8b72 --- /dev/null +++ b/test/js-unittest/b_147664838.js @@ -0,0 +1,21 @@ +function FindProxyForURL(url, host){ + let re = /x/y; + let cnt = 0; + let str = re[Symbol.replace]("x", { + toString: () => { + cnt++; + if (cnt == 2) { + re.lastIndex = {valueOf: () => { + re.x = 42; + return 0; + }}; + } + return 'y$'; + } + }); + if (str != "y$") { + throw "regex mutated"; + return "FAIL"; + } + return "DIRECT"; +}
\ No newline at end of file diff --git a/test/proxy_resolver_v8_unittest.cc b/test/proxy_resolver_v8_unittest.cc index 3f6d20f..8469cab 100644 --- a/test/proxy_resolver_v8_unittest.cc +++ b/test/proxy_resolver_v8_unittest.cc @@ -657,6 +657,19 @@ TEST(ProxyResolverV8Test, B_139806216) { EXPECT_EQ("DIRECT", proxies[0]); } +TEST(ProxyResolverV8Test, B_147664838) { + ProxyResolverV8WithMockBindings resolver(new MockJSBindings()); + int result = resolver.SetPacScript(SCRIPT(B_147664838_JS)); + EXPECT_EQ(OK, result); + + // Execute FindProxyForURL(). + result = resolver.GetProxyForURL(kQueryUrl, kQueryHost, &kResults); + + EXPECT_EQ(OK, result); + std::vector<std::string> proxies = string16ToProxyList(kResults); + EXPECT_EQ(1U, proxies.size()); + EXPECT_EQ("DIRECT", proxies[0]); +} } // namespace } // namespace net diff --git a/test/proxy_test_script.h b/test/proxy_test_script.h index 500a57a..2a86491 100644 --- a/test/proxy_test_script.h +++ b/test/proxy_test_script.h @@ -35,6 +35,30 @@ " return \"DIRECT\";\n" \ "}\n" \ +#define B_147664838_JS \ + u""\ + "function FindProxyForURL(url, host){\n" \ + " let re = /x/y;\n" \ + " let cnt = 0;\n" \ + " let str = re[Symbol.replace](\"x\", {\n" \ + " toString: () => {\n" \ + " cnt++;\n" \ + " if (cnt == 2) {\n" \ + " re.lastIndex = {valueOf: () => {\n" \ + " re.x = 42;\n" \ + " return 0;\n" \ + " }};\n" \ + " }\n" \ + " return 'y$';\n" \ + " }\n" \ + " });\n" \ + " if (str != \"y$\") {\n" \ + " throw \"regex mutated\";\n" \ + " return \"FAIL\";\n" \ + " }\n" \ + " return \"DIRECT\";\n" \ + "}\n" \ + #define BINDING_FROM_GLOBAL_JS \ u""\ "// Calls a bindings outside of FindProxyForURL(). This causes the code to\n" \ |