1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879
|
/*
* Copyright (C) 2018-2024 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Quirks.h"
#include "AccessibilityObject.h"
#include "Attr.h"
#include "DOMTokenList.h"
#include "DeprecatedGlobalSettings.h"
#include "Document.h"
#include "DocumentInlines.h"
#include "DocumentLoader.h"
#include "DocumentStorageAccess.h"
#include "ElementAncestorIteratorInlines.h"
#include "ElementInlines.h"
#include "ElementTargetingTypes.h"
#include "EventNames.h"
#include "FrameLoader.h"
#include "HTMLArticleElement.h"
#include "HTMLBodyElement.h"
#include "HTMLCollection.h"
#include "HTMLDivElement.h"
#include "HTMLMetaElement.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
#include "HTMLTextAreaElement.h"
#include "HTMLVideoElement.h"
#include "JSEventListener.h"
#include "KeyframeEffect.h"
#include "LayoutUnit.h"
#include "LocalDOMWindow.h"
#include "LocalFrameView.h"
#include "MouseEvent.h"
#include "NamedNodeMap.h"
#include "NetworkStorageSession.h"
#include "NodeRenderStyle.h"
#include "OrganizationStorageAccessPromptQuirk.h"
#include "PlatformMouseEvent.h"
#include "QuirksData.h"
#include "RegistrableDomain.h"
#include "ResourceLoadObserver.h"
#include "ResourceRequest.h"
#include "SVGElementTypeHelpers.h"
#include "SVGPathElement.h"
#include "SVGSVGElement.h"
#include "ScriptController.h"
#include "ScriptSourceCode.h"
#include "Settings.h"
#include "SpaceSplitString.h"
#include "TrustedFonts.h"
#include "TypedElementDescendantIteratorInlines.h"
#include "UserAgent.h"
#include "UserContentTypes.h"
#include "UserScript.h"
#include "UserScriptTypes.h"
#include <JavaScriptCore/CodeBlock.h>
#include <JavaScriptCore/JSLock.h>
#include <JavaScriptCore/ScriptExecutable.h>
#include <JavaScriptCore/SourceCode.h>
#include <JavaScriptCore/SourceProvider.h>
#include <JavaScriptCore/StackVisitor.h>
#include <wtf/TZoneMallocInlines.h>
#include <wtf/text/MakeString.h>
#if PLATFORM(IOS_FAMILY)
#include <pal/system/ios/UserInterfaceIdiom.h>
#endif
#if PLATFORM(COCOA)
#include <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
#endif
namespace WebCore {
WTF_MAKE_TZONE_ALLOCATED_IMPL(Quirks);
static inline OptionSet<AutoplayQuirk> allowedAutoplayQuirks(Document& document)
{
auto* loader = document.loader();
if (!loader)
return { };
return loader->allowedAutoplayQuirks();
}
static inline OptionSet<AutoplayQuirk> allowedAutoplayQuirks(Document* document)
{
if (!document)
return { };
return allowedAutoplayQuirks(*document);
}
static HashMap<RegistrableDomain, String>& updatableStorageAccessUserAgentStringQuirks()
{
// FIXME: Make this a member of Quirks.
static MainThreadNeverDestroyed<HashMap<RegistrableDomain, String>> map;
return map.get();
}
#if USE(APPLE_INTERNAL_SDK)
#import <WebKitAdditions/QuirksAdditions.cpp>
#else
static inline bool needsDesktopUserAgentInternal(const URL&) { return false; }
static inline bool shouldPreventOrientationMediaQueryFromEvaluatingToLandscapeInternal(const URL&) { return false; }
#endif
Quirks::Quirks(Document& document)
: m_document(document)
{
determineRelevantQuirks();
}
Quirks::~Quirks() = default;
inline bool Quirks::needsQuirks() const
{
return m_document && m_document->settings().needsSiteSpecificQuirks();
}
bool Quirks::shouldIgnoreInvalidSignal() const
{
return needsQuirks();
}
// FIXME: Add more options to the helper to cover more patterns.
// - end of domain
// - full domain
// - path?
// or make different helpers
bool Quirks::isDomain(const String& domainString) const
{
return RegistrableDomain(topDocumentURL()).string() == domainString;
}
bool Quirks::domainStartsWith(const String& prefix) const
{
return RegistrableDomain(topDocumentURL()).string().startsWith(prefix);
}
bool Quirks::isEmbedDomain(const String& domainString) const
{
if (m_document->isTopDocument())
return false;
return RegistrableDomain(m_document->url()).string() == domainString;
}
// ceac.state.gov https://bugs.webkit.org/show_bug.cgi?id=193478
// weather.com rdar://139689157
bool Quirks::needsFormControlToBeMouseFocusable() const
{
#if PLATFORM(MAC)
return needsQuirks() && m_quirksData.needsFormControlToBeMouseFocusableQuirk;
#else
return false;
#endif // PLATFORM(MAC)
}
bool Quirks::needsAutoplayPlayPauseEvents() const
{
if (!needsQuirks())
return false;
Ref document = *m_document;
if (allowedAutoplayQuirks(document).contains(AutoplayQuirk::SynthesizedPauseEvents))
return true;
return allowedAutoplayQuirks(document->mainFrameDocument()).contains(AutoplayQuirk::SynthesizedPauseEvents);
}
// netflix.com https://bugs.webkit.org/show_bug.cgi?id=173030
// This quirk handles several scenarios:
// - Inserting / Removing Airpods
// - macOS w/ Touch Bar
// - iOS PiP
bool Quirks::needsSeekingSupportDisabled() const
{
return needsQuirks() && m_quirksData.needsSeekingSupportDisabledQuirk;
}
// netflix.com https://bugs.webkit.org/show_bug.cgi?id=193301
bool Quirks::needsPerDocumentAutoplayBehavior() const
{
#if PLATFORM(MAC)
Ref document = *m_document;
ASSERT(document->isTopDocument());
return needsQuirks() && allowedAutoplayQuirks(document).contains(AutoplayQuirk::PerDocumentAutoplayBehavior);
#else
return needsQuirks() && m_quirksData.isNetflix;
#endif
}
// zoom.com https://bugs.webkit.org/show_bug.cgi?id=223180
bool Quirks::shouldAutoplayWebAudioForArbitraryUserGesture() const
{
return needsQuirks() && m_quirksData.shouldAutoplayWebAudioForArbitraryUserGestureQuirk;
}
// youtube.com https://bugs.webkit.org/show_bug.cgi?id=195598
bool Quirks::hasBrokenEncryptedMediaAPISupportQuirk() const
{
#if ENABLE(THUNDER)
return false;
#else
return needsQuirks() && m_quirksData.hasBrokenEncryptedMediaAPISupportQuirk;
#endif
}
// docs.google.com https://bugs.webkit.org/show_bug.cgi?id=161984
bool Quirks::isTouchBarUpdateSuppressedForHiddenContentEditable() const
{
#if PLATFORM(MAC)
return needsQuirks() && m_quirksData.isTouchBarUpdateSuppressedForHiddenContentEditableQuirk;
#else
return false;
#endif
}
// icloud.com rdar://26013388
// trix-editor.org rdar://28242210
// onedrive.live.com rdar://26013388
// added in https://bugs.webkit.org/show_bug.cgi?id=161996
bool Quirks::isNeverRichlyEditableForTouchBar() const
{
#if PLATFORM(MAC)
return needsQuirks() && m_quirksData.isNeverRichlyEditableForTouchBarQuirk;
#else
return false;
#endif
}
// docs.google.com rdar://49864669
// FIXME https://bugs.webkit.org/show_bug.cgi?id=260698
bool Quirks::shouldSuppressAutocorrectionAndAutocapitalizationInHiddenEditableAreas() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.shouldSuppressAutocorrectionAndAutocapitalizationInHiddenEditableAreasQuirk;
#else
return false;
#endif
}
// weebly.com rdar://48003980
// medium.com rdar://50457837
bool Quirks::shouldDispatchSyntheticMouseEventsWhenModifyingSelection() const
{
if (m_document->settings().shouldDispatchSyntheticMouseEventsWhenModifyingSelection())
return true;
return needsQuirks() && m_quirksData.shouldDispatchSyntheticMouseEventsWhenModifyingSelectionQuirk;
}
// www.youtube.com rdar://52361019
bool Quirks::needsYouTubeMouseOutQuirk() const
{
#if PLATFORM(IOS_FAMILY)
if (m_document->settings().shouldDispatchSyntheticMouseOutAfterSyntheticClick())
return true;
return needsQuirks() && m_quirksData.needsYouTubeMouseOutQuirk;
#else
return false;
#endif
}
// safe.menlosecurity.com rdar://135114489
// FIXME (rdar://138585709): Remove this quirk for safe.menlosecurity.com once investigation into text corruption on the site is completed and the issue is resolved.
bool Quirks::shouldDisableWritingSuggestionsByDefault() const
{
return needsQuirks() && m_quirksData.shouldDisableWritingSuggestionsByDefaultQuirk;
}
void Quirks::updateStorageAccessUserAgentStringQuirks(HashMap<RegistrableDomain, String>&& userAgentStringQuirks)
{
auto& quirks = updatableStorageAccessUserAgentStringQuirks();
quirks.clear();
for (auto&& [domain, userAgent] : userAgentStringQuirks)
quirks.add(WTFMove(domain), WTFMove(userAgent));
}
String Quirks::storageAccessUserAgentStringQuirkForDomain(const URL& url)
{
if (!needsQuirks())
return { };
const auto& quirks = updatableStorageAccessUserAgentStringQuirks();
RegistrableDomain domain { url };
auto iterator = quirks.find(domain);
if (iterator == quirks.end())
return { };
if (domain == "live.com"_s && url.host() != "teams.live.com"_s)
return { };
return iterator->value;
}
bool Quirks::isYoutubeEmbedDomain() const
{
return isEmbedDomain("youtube.com"_s) || isEmbedDomain("youtube-nocookie.com"_s);
}
bool Quirks::shouldDisableElementFullscreenQuirk() const
{
#if PLATFORM(IOS_FAMILY)
if (!needsQuirks())
return false;
// Vimeo.com has incorrect layout on iOS on certain videos with wider
// aspect ratios than the device's screen in landscape mode.
// (Ref: rdar://116531089)
// Instagram.com stories flow under the notch and status bar
// (Ref: rdar://121014613)
// x.com (Twitter) video embeds have controls that are too tiny and
// show page behind fullscreen.
// (Ref: rdar://121473410)
// YouTube.com does not provide AirPlay controls in fullscreen
// (Ref: rdar://121471373)
if (!m_quirksData.shouldDisableElementFullscreen && !m_document->isTopDocument()) {
m_quirksData.shouldDisableElementFullscreen = isEmbedDomain("x.com"_s)
|| (PAL::currentUserInterfaceIdiomIsSmallScreen() && isYoutubeEmbedDomain());
}
return m_quirksData.shouldDisableElementFullscreen;
#else
return false;
#endif
}
#if ENABLE(TOUCH_EVENTS)
// rdar://49124313
// desmos.com rdar://47068176
// flipkart.com rdar://49648520
// soundcloud.com rdar://52915981
// naver.com rdar://48068610
// mybinder.org rdar://51770057
bool Quirks::shouldDispatchSimulatedMouseEvents(const EventTarget* target) const
{
if (m_document->settings().mouseEventsSimulationEnabled())
return true;
if (!needsQuirks())
return false;
auto doShouldDispatchChecks = [this] () -> QuirksData::ShouldDispatchSimulatedMouseEvents {
auto* loader = m_document->loader();
if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
return QuirksData::ShouldDispatchSimulatedMouseEvents::No;
if (m_quirksData.isAmazon)
return QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
if (m_quirksData.isGoogleMaps)
return QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
if (m_quirksData.isSoundCloud)
return QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
const URL& topDocumentURL = this->topDocumentURL();
const auto registrableDomainString = RegistrableDomain(topDocumentURL).string();
if (registrableDomainString == "wix.com"_s) {
// Disable simulated mouse dispatching for template selection.
return startsWithLettersIgnoringASCIICase(topDocumentURL.path(), "/website/templates/"_s) ? QuirksData::ShouldDispatchSimulatedMouseEvents::No : QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
}
if (registrableDomainString == "airtable.com"_s)
return QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
if (registrableDomainString == "flipkart.com"_s)
return QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
if (registrableDomainString == "mybinder.org"_s)
return QuirksData::ShouldDispatchSimulatedMouseEvents::DependingOnTargetFor_mybinder_org;
auto host = topDocumentURL.host();
if (host == "naver.com"_s)
return QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
if (host.endsWith(".naver.com"_s)) {
// Disable the quirk for tv.naver.com subdomain to be able to simulate hover on videos.
if (host == "tv.naver.com"_s)
return QuirksData::ShouldDispatchSimulatedMouseEvents::No;
// Disable the quirk for mail.naver.com subdomain to be able to tap on mail subjects.
if (host == "mail.naver.com"_s)
return QuirksData::ShouldDispatchSimulatedMouseEvents::No;
// Disable the quirk on the mobile site.
// FIXME: Maybe this quirk should be disabled for "m." subdomains on all sites? These are generally mobile sites that don't need mouse events.
if (host == "m.naver.com"_s)
return QuirksData::ShouldDispatchSimulatedMouseEvents::No;
return QuirksData::ShouldDispatchSimulatedMouseEvents::Yes;
}
return QuirksData::ShouldDispatchSimulatedMouseEvents::No;
};
if (m_quirksData.shouldDispatchSimulatedMouseEventsQuirk == QuirksData::ShouldDispatchSimulatedMouseEvents::Unknown)
m_quirksData.shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
switch (m_quirksData.shouldDispatchSimulatedMouseEventsQuirk) {
case QuirksData::ShouldDispatchSimulatedMouseEvents::Unknown:
ASSERT_NOT_REACHED();
return false;
case QuirksData::ShouldDispatchSimulatedMouseEvents::No:
return false;
case QuirksData::ShouldDispatchSimulatedMouseEvents::DependingOnTargetFor_mybinder_org:
for (RefPtr node = dynamicDowncast<Node>(target); node; node = node->parentNode()) {
// This uses auto* instead of RefPtr as otherwise GCC does not compile.
if (auto* element = dynamicDowncast<Element>(*node); element && element->hasClassName("lm-DockPanel-tabBar"_s))
return true;
}
return false;
case QuirksData::ShouldDispatchSimulatedMouseEvents::Yes:
return true;
}
ASSERT_NOT_REACHED();
return false;
}
// amazon.com rdar://49124529
// soundcloud.com rdar://52915981
bool Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented(EventTarget* target) const
{
if (!needsQuirks() || !shouldDispatchSimulatedMouseEvents(target))
return false;
if (!m_quirksData.shouldDispatchedSimulatedMouseEventsAssumeDefaultPreventedQuirk)
return false;
RefPtr element = dynamicDowncast<Element>(target);
if (!element)
return false;
if (m_quirksData.isAmazon) {
// When panning on an Amazon product image, we're either touching on the #magnifierLens element
// or its previous sibling.
if (element->getIdAttribute() == "magnifierLens"_s)
return true;
if (auto* sibling = element->nextElementSibling())
return sibling->getIdAttribute() == "magnifierLens"_s;
}
if (m_quirksData.isSoundCloud)
return element->hasClassName("sceneLayer"_s);
return false;
}
// sites.google.com rdar://58653069
bool Quirks::shouldPreventDispatchOfTouchEvent(const AtomString& touchEventType, EventTarget* target) const
{
if (!needsQuirks())
return false;
if (!m_quirksData.shouldPreventDispatchOfTouchEventQuirk)
return false;
if (RefPtr element = dynamicDowncast<Element>(target); element && touchEventType == eventNames().touchendEvent)
return element->hasClassName("DPvwYc"_s) && element->hasClassName("sm8sCf"_s);
return false;
}
#endif
// live.com rdar://52116170
// sharepoint.com rdar://52116170
// maps.google.com https://bugs.webkit.org/show_bug.cgi?id=214945
bool Quirks::shouldAvoidResizingWhenInputViewBoundsChange() const
{
return needsQuirks() && m_quirksData.shouldAvoidResizingWhenInputViewBoundsChangeQuirk;
}
// mailchimp.com rdar://47868965
bool Quirks::shouldDisablePointerEventsQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.shouldDisablePointerEventsQuirk;
#else
return false;
#endif
}
// docs.google.com https://bugs.webkit.org/show_bug.cgi?id=199587
bool Quirks::needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommand() const
{
#if PLATFORM(IOS_FAMILY)
if (m_document->settings().needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommandQuirk())
return true;
return needsQuirks() && m_quirksData.isGoogleDocs;
#else
return false;
#endif
}
// FIXME: Remove after the site is fixed, <rdar://problem/50374200>
// mail.google.com rdar://49403416
bool Quirks::needsGMailOverflowScrollQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsGMailOverflowScrollQuirk;
#else
return false;
#endif
}
// web.skype.com webkit.org/b/275941
bool Quirks::needsIPadSkypeOverflowScrollQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsIPadSkypeOverflowScrollQuirk;
#else
return false;
#endif
}
// FIXME: Remove after the site is fixed, <rdar://problem/50374311>
// youtube.com rdar://49582231
bool Quirks::needsYouTubeOverflowScrollQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsYouTubeOverflowScrollQuirk;
#else
return false;
#endif
}
// amazon.com rdar://128962002
bool Quirks::needsPrimeVideoUserSelectNoneQuirk() const
{
#if PLATFORM(MAC)
return needsQuirks() && m_quirksData.needsPrimeVideoUserSelectNoneQuirk;
#else
return false;
#endif
}
// facebook.com https://webkit.org/b/295071
// FIXME: https://webkit.org/b/295318
bool Quirks::needsFacebookRemoveNotSupportedQuirk() const
{
return needsQuirks() && m_quirksData.needsFacebookRemoveNotSupportedQuirk;
}
// youtube.com rdar://135886305
// NOTE: Also remove `BuilderConverter::convertScrollbarWidth` and related code when removing this quirk.
bool Quirks::needsScrollbarWidthThinDisabledQuirk() const
{
return needsQuirks() && m_quirksData.needsScrollbarWidthThinDisabledQuirk;
}
// spotify.com rdar://138918575
bool Quirks::needsBodyScrollbarWidthNoneDisabledQuirk() const
{
return needsQuirks() && m_quirksData.needsBodyScrollbarWidthNoneDisabledQuirk;
}
// gizmodo.com rdar://102227302
bool Quirks::needsFullscreenDisplayNoneQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsFullscreenDisplayNoneQuirk;
#else
return false;
#endif
}
// cnn.com rdar://119640248
bool Quirks::needsFullscreenObjectFitQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsFullscreenObjectFitQuirk;
#else
return false;
#endif
}
// FIXME: weChat <rdar://problem/74377902>
bool Quirks::needsWeChatScrollingQuirk() const
{
#if PLATFORM(IOS) || PLATFORM(VISION)
static bool shouldUseWeChatScrollingQuirk = !linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::NoWeChatScrollingQuirk) && WTF::IOSApplication::isWechat();
return needsQuirks() && shouldUseWeChatScrollingQuirk;
#else
return false;
#endif
}
// zomato.com <rdar://problem/128962778>
bool Quirks::needsZomatoEmailLoginLabelQuirk() const
{
#if PLATFORM(MAC)
return needsQuirks() && m_quirksData.needsZomatoEmailLoginLabelQuirk;
#else
return false;
#endif
}
// maps.google.com rdar://67358928
bool Quirks::needsGoogleMapsScrollingQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsGoogleMapsScrollingQuirk;
#else
return false;
#endif
}
// Kugou Music rdar://74602294
bool Quirks::shouldOmitHTMLDocumentSupportedPropertyNames()
{
#if PLATFORM(COCOA)
static bool shouldOmitHTMLDocumentSupportedPropertyNames = !linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::HTMLDocumentSupportedPropertyNames);
return shouldOmitHTMLDocumentSupportedPropertyNames;
#else
return false;
#endif
}
// rdar://110097836
bool Quirks::shouldSilenceResizeObservers() const
{
#if PLATFORM(IOS) || PLATFORM(VISION)
if (!needsQuirks())
return false;
// ResizeObservers are silenced on YouTube during the 'homing out' snapshout sequence to
// resolve rdar://109837319. This is due to a bug on the site that is causing unexpected
// content layout and can be removed when it is addressed.
auto* page = m_document->page();
if (!page || !page->isTakingSnapshotsForApplicationSuspension())
return false;
return m_quirksData.shouldSilenceResizeObservers;
#else
return false;
#endif
}
bool Quirks::shouldSilenceWindowResizeEventsDuringApplicationSnapshotting() const
{
#if PLATFORM(IOS) || PLATFORM(VISION)
if (!needsQuirks())
return false;
if (!m_quirksData.shouldSilenceWindowResizeEventsDuringApplicationSnapshotting)
return false;
// We silence window resize events during the 'homing out' snapshot sequence when on icloud.com/mail
// to address <rdar://131836301>, on nytimes.com to address <rdar://problem/59763843>, and on
// x.com (twitter) to address <rdar://problem/58804852> & <rdar://problem/61731801>.
auto* page = m_document->page();
if (!page || !page->isTakingSnapshotsForApplicationSuspension())
return false;
return true;
#else
return false;
#endif
}
bool Quirks::shouldSilenceMediaQueryListChangeEvents() const
{
#if PLATFORM(IOS) || PLATFORM(VISION)
if (!needsQuirks())
return false;
if (!m_quirksData.shouldSilenceMediaQueryListChangeEvents)
return false;
// We silence MediaQueryList's change events during the 'homing out' snapshot sequence when on x.com (twitter)
// to address <rdar://problem/58804852> & <rdar://problem/61731801>.
auto* page = m_document->page();
if (!page || !page->isTakingSnapshotsForApplicationSuspension())
return false;
return true;
#else
return false;
#endif
}
// zillow.com rdar://53103732
bool Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible() const
{
return needsQuirks() && m_quirksData.shouldAvoidScrollingWhenFocusedContentIsVisibleQuirk;
}
// att.com rdar://55185021
bool Quirks::shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation() const
{
return needsQuirks() && m_quirksData.shouldUseLegacySelectPopoverDismissalBehaviorInDataActivationQuirk;
}
// ralphlauren.com rdar://55629493
bool Quirks::shouldIgnoreAriaForFastPathContentObservationCheck() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.shouldIgnoreAriaForFastPathContentObservationCheckQuirk;
#else
return false;
#endif
}
// wikipedia.org https://webkit.org/b/247636
bool Quirks::shouldIgnoreViewportArgumentsToAvoidExcessiveZoom() const
{
#if ENABLE(META_VIEWPORT)
return needsQuirks() && m_quirksData.shouldIgnoreViewportArgumentsToAvoidExcessiveZoomQuirk;
#endif
return false;
}
// docs.google.com https://bugs.webkit.org/show_bug.cgi?id=199933
bool Quirks::shouldOpenAsAboutBlank(const String& stringToOpen) const
{
#if PLATFORM(IOS_FAMILY)
if (!needsQuirks())
return false;
auto openerURL = m_document->url();
if (openerURL.host() != "docs.google.com"_s)
return false;
if (!m_document->frame() || !m_document->frame()->loader().userAgent(openerURL).contains("Macintosh"_s))
return false;
URL urlToOpen { URL { }, stringToOpen };
if (!urlToOpen.protocolIsAbout())
return false;
return !equalLettersIgnoringASCIICase(urlToOpen.host(), "blank"_s) && !equalLettersIgnoringASCIICase(urlToOpen.host(), "srcdoc"_s);
#else
UNUSED_PARAM(stringToOpen);
return false;
#endif
}
// vimeo.com rdar://55759025
bool Quirks::needsPreloadAutoQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsPreloadAutoQuirk;
#else
return false;
#endif
}
// vimeo.com rdar://56996057
// docs.google.com rdar://59893415
// bing.com rdar://133223599
bool Quirks::shouldBypassBackForwardCache() const
{
if (!needsQuirks())
return false;
if (!m_quirksData.maybeBypassBackForwardCache)
return false;
RefPtr document = m_document.get();
// Vimeo.com used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS.
// We started caching such content in r250437 but the vimeo.com content unfortunately is not currently compatible
// because it changes the opacity of its body to 0 when navigating away and fails to restore the original opacity
// when coming back from the back/forward cache (e.g. in 'pageshow' event handler). See <rdar://problem/56996057>.
if (m_quirksData.isVimeo && topDocumentURL().protocolIs("https"_s)) {
if (auto* documentLoader = document->frame() ? document->frame()->loader().documentLoader() : nullptr)
return documentLoader->response().cacheControlContainsNoStore();
}
// Spinner issue from image search for bing.com.
if (m_quirksData.isBing) {
static MainThreadNeverDestroyed<const AtomString> imageSearchDialogID("sb_sbidialog"_s);
if (RefPtr element = document->getElementById(imageSearchDialogID.get()))
return element->renderer();
}
// Login issue on bankofamerica.com (rdar://104938789).
if (m_quirksData.isBankOfAmerica) {
if (RefPtr window = document->domWindow()) {
if (window->hasEventListeners(eventNames().unloadEvent)) {
static MainThreadNeverDestroyed<const AtomString> signInId("signIn"_s);
static MainThreadNeverDestroyed<const AtomString> loadingClass("loading"_s);
RefPtr signinButton = document->getElementById(signInId.get());
return signinButton && signinButton->hasClassName(loadingClass.get());
}
}
}
if (m_quirksData.isGoogleProperty) {
// Google Docs used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS.
// We started caching such content in r250437 but the Google Docs index page unfortunately is not currently compatible
// because it puts an overlay (with class "docs-homescreen-freeze-el-full") over the page when navigating away and fails
// to remove it when coming back from the back/forward cache (e.g. in 'pageshow' event handler). See <rdar://problem/57670064>.
// Note that this does not check for docs.google.com host because of hosted G Suite apps.
static MainThreadNeverDestroyed<const AtomString> googleDocsOverlayDivClass("docs-homescreen-freeze-el-full"_s);
auto* firstChildInBody = document->body() ? document->body()->firstChild() : nullptr;
if (RefPtr div = dynamicDowncast<HTMLDivElement>(firstChildInBody)) {
if (div->hasClassName(googleDocsOverlayDivClass))
return true;
}
}
return false;
}
// bungalow.com: rdar://61658940
// sfusd.edu: rdar://116292738
bool Quirks::shouldBypassAsyncScriptDeferring() const
{
// Deferring 'mapbox-gl.js' script on bungalow.com causes the script to get in a bad state (rdar://problem/61658940).
// Deferring the google maps script on sfusd.edu may get the page in a bad state (rdar://116292738).
return needsQuirks() && m_quirksData.shouldBypassAsyncScriptDeferring;
}
// smoothscroll JS library rdar://52712513
bool Quirks::shouldMakeEventListenerPassive(const EventTarget& eventTarget, const EventTypeInfo& eventType)
{
auto eventTargetIsRoot = [](const EventTarget& eventTarget) {
if (is<LocalDOMWindow>(eventTarget))
return true;
if (RefPtr node = dynamicDowncast<Node>(eventTarget)) {
return is<Document>(*node) || node->document().documentElement() == node || node->document().body() == node;
}
return false;
};
auto documentFromEventTarget = [](const EventTarget& eventTarget) -> Document* {
return downcast<Document>(eventTarget.scriptExecutionContext());
};
if (eventType.isInCategory(EventCategory::TouchScrollBlocking)) {
if (eventTargetIsRoot(eventTarget)) {
if (auto* document = documentFromEventTarget(eventTarget))
return document->settings().passiveTouchListenersAsDefaultOnDocument();
}
return false;
}
if (eventType.isInCategory(EventCategory::Wheel)) {
if (eventTargetIsRoot(eventTarget)) {
if (auto* document = documentFromEventTarget(eventTarget))
return document->settings().passiveWheelListenersAsDefaultOnDocument();
}
return false;
}
return false;
}
#if ENABLE(MEDIA_STREAM)
// warbyparker.com rdar://72839707
// baidu.com rdar://56421276
bool Quirks::shouldEnableLegacyGetUserMediaQuirk() const
{
return needsQuirks() && m_quirksData.shouldEnableLegacyGetUserMediaQuirk;
}
// zoom.us rdar://118185086
bool Quirks::shouldDisableImageCaptureQuirk() const
{
return needsQuirks() && m_quirksData.shouldDisableImageCaptureQuirk;
}
bool Quirks::shouldEnableSpeakerSelectionPermissionsPolicyQuirk() const
{
return needsQuirks() && m_quirksData.shouldEnableSpeakerSelectionPermissionsPolicyQuirk;
}
#endif
// hulu.com rdar://55041979
bool Quirks::needsCanPlayAfterSeekedQuirk() const
{
return needsQuirks() && m_quirksData.needsCanPlayAfterSeekedQuirk;
}
// wikipedia.org rdar://54856323
bool Quirks::shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints() const
{
// FIXME: We should consider replacing this with a heuristic to determine whether
// or not the edges of the page mostly lack content after shrinking to fit.
return needsQuirks() && m_quirksData.shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraintsQuirk;
}
// mail.yahoo.com rdar://63511613
bool Quirks::shouldAvoidPastingImagesAsWebContent() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.shouldAvoidPastingImagesAsWebContent;
#else
return false;
#endif
}
// kinja.com and related sites rdar://60601895
static bool isKinjaLoginAvatarElement(const Element& element)
{
// The click event handler has been found to trigger on a div or
// span with these class names, or the svg, or the svg's path.
if (element.hasClass()) {
auto& classNames = element.classNames();
if (classNames.contains("js_switch-to-burner-login"_s)
|| classNames.contains("js_header-userbutton"_s)
|| classNames.contains("sc-1il3uru-3"_s) || classNames.contains("cIhKfd"_s)
|| classNames.contains("iyvn34-0"_s) || classNames.contains("bYIjtl"_s))
return true;
}
const Element* svgElement = nullptr;
if (is<SVGSVGElement>(element))
svgElement = &element;
else if (is<SVGPathElement>(element) && is<SVGSVGElement>(element.parentElement()))
svgElement = element.parentElement();
if (svgElement && svgElement->hasAttributes()) {
auto ariaLabelAttr = svgElement->attributesMap().getNamedItem("aria-label"_s);
if (ariaLabelAttr && ariaLabelAttr->value() == "UserFilled icon"_s)
return true;
}
return false;
}
// teams.microsoft.com https://bugs.webkit.org/show_bug.cgi?id=219505
bool Quirks::isMicrosoftTeamsRedirectURL(const URL& url)
{
return url.host() == "teams.microsoft.com"_s && url.query().contains("Retried+3+times+without+success"_s);
}
static bool isStorageAccessQuirkDomainAndElement(const URL& url, const Element& element)
{
// Microsoft Teams login case.
// FIXME(218779): Remove this quirk once microsoft.com completes their login flow redesign.
if (url.host() == "www.microsoft.com"_s) {
return element.hasClass()
&& (element.classNames().contains("glyph_signIn_circle"_s)
|| element.classNames().contains("mectrl_headertext"_s)
|| element.classNames().contains("mectrl_header"_s));
}
// Sony Network Entertainment login case.
// FIXME(218760): Remove this quirk once playstation.com completes their login flow redesign.
if (url.host() == "www.playstation.com"_s || url.host() == "my.playstation.com"_s) {
return element.hasClass()
&& (element.classNames().contains("web-toolbar__signin-button"_s)
|| element.classNames().contains("web-toolbar__signin-button-label"_s)
|| element.classNames().contains("sb-signin-button"_s));
}
return false;
}
// playstation.com - rdar://72062985
bool Quirks::hasStorageAccessForAllLoginDomains(const HashSet<RegistrableDomain>& loginDomains, const RegistrableDomain& topFrameDomain)
{
for (auto& loginDomain : loginDomains) {
if (!ResourceLoadObserver::shared().hasCrossPageStorageAccess(loginDomain, topFrameDomain))
return false;
}
return true;
}
Quirks::StorageAccessResult Quirks::requestStorageAccessAndHandleClick(CompletionHandler<void(ShouldDispatchClick)>&& completionHandler) const
{
RefPtr document = m_document.get();
auto firstPartyDomain = RegistrableDomain(topDocumentURL());
auto domainsInNeedOfStorageAccess = NetworkStorageSession::subResourceDomainsInNeedOfStorageAccessForFirstParty(firstPartyDomain);
if (!domainsInNeedOfStorageAccess || domainsInNeedOfStorageAccess.value().isEmpty()) {
completionHandler(ShouldDispatchClick::No);
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
if (hasStorageAccessForAllLoginDomains(*domainsInNeedOfStorageAccess, firstPartyDomain)) {
completionHandler(ShouldDispatchClick::No);
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
auto domainInNeedOfStorageAccess = RegistrableDomain(*domainsInNeedOfStorageAccess.value().begin().get());
if (!document) {
completionHandler(ShouldDispatchClick::No);
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
document->addConsoleMessage(MessageSource::Other, MessageLevel::Info, makeString("requestStorageAccess is invoked on behalf of domain \""_s, domainInNeedOfStorageAccess.string(), "\""_s));
DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk(*document, WTFMove(domainInNeedOfStorageAccess), [firstPartyDomain, domainInNeedOfStorageAccess, completionHandler = WTFMove(completionHandler)](StorageAccessWasGranted storageAccessGranted) mutable {
if (storageAccessGranted == StorageAccessWasGranted::No) {
completionHandler(ShouldDispatchClick::Yes);
return;
}
ResourceLoadObserver::shared().setDomainsWithCrossPageStorageAccess({ { firstPartyDomain, Vector<RegistrableDomain> { domainInNeedOfStorageAccess } } }, [completionHandler = WTFMove(completionHandler)] () mutable {
completionHandler(ShouldDispatchClick::Yes);
});
});
return Quirks::StorageAccessResult::ShouldCancelEvent;
}
RefPtr<Document> Quirks::protectedDocument() const
{
return m_document.get();
}
void Quirks::triggerOptionalStorageAccessIframeQuirk(const URL& frameURL, CompletionHandler<void()>&& completionHandler) const
{
if (RefPtr document = m_document.get()) {
if (document->frame() && !m_document->frame()->isMainFrame()) {
auto& mainFrame = document->frame()->mainFrame();
if (auto* localMainFrame = dynamicDowncast<LocalFrame>(mainFrame); localMainFrame && localMainFrame->document()) {
localMainFrame->document()->quirks().triggerOptionalStorageAccessIframeQuirk(frameURL, WTFMove(completionHandler));
return;
}
}
bool isMSOLoginButNotMSTeams = document->url().hasQuery() && document->url().host() == "login.microsoftonline.com"_s && !document->url().query().contains("redirect_uri=https%3A%2F%2Fteams.microsoft.com"_s);
if (!isMSOLoginButNotMSTeams && subFrameDomainsForStorageAccessQuirk().contains(RegistrableDomain { frameURL })) {
return DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk(*document, RegistrableDomain { frameURL }, [completionHandler = WTFMove(completionHandler)](StorageAccessWasGranted) mutable {
completionHandler();
});
}
}
completionHandler();
}
// rdar://64549429
Quirks::StorageAccessResult Quirks::triggerOptionalStorageAccessQuirk(Element& element, const PlatformMouseEvent& platformEvent, const AtomString& eventType, int detail, Element* relatedTarget, bool isParentProcessAFullWebBrowser, IsSyntheticClick isSyntheticClick) const
{
if (!DeprecatedGlobalSettings::trackingPreventionEnabled() || !isParentProcessAFullWebBrowser)
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
if (!needsQuirks())
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
RegistrableDomain domain { m_document->url() };
static NeverDestroyed<UncheckedKeyHashSet<RegistrableDomain>> kinjaQuirks = [] {
UncheckedKeyHashSet<RegistrableDomain> set;
set.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("jalopnik.com"_s));
set.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("kotaku.com"_s));
set.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("theroot.com"_s));
set.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("theinventory.com"_s));
return set;
}();
static NeverDestroyed kinjaURL = URL { "https://kinja.com"_str };
static NeverDestroyed<RegistrableDomain> kinjaDomain { kinjaURL };
static NeverDestroyed<RegistrableDomain> youTubeDomain = RegistrableDomain::uncheckedCreateFromRegistrableDomainString("youtube.com"_s);
static NeverDestroyed<String> loginPopupWindowFeatureString = "toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=599,height=600,top=420,left=980.5"_s;
static NeverDestroyed<UserScript> kinjaLoginUserScript { "function triggerLoginForm() { let elements = document.getElementsByClassName('js_header-userbutton'); if (elements && elements[0]) { elements[0].click(); clearInterval(interval); } } let interval = setInterval(triggerLoginForm, 200);"_s, URL(aboutBlankURL()), Vector<String>(), Vector<String>(), UserScriptInjectionTime::DocumentEnd, UserContentInjectedFrames::InjectInTopFrameOnly, WaitForNotificationBeforeInjecting::Yes };
if (isAnyClick(eventType)) {
RefPtr document = m_document.get();
if (!document)
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
// Embedded YouTube case.
if (element.hasClass() && domain == youTubeDomain && !document->isTopDocument() && ResourceLoadObserver::shared().hasHadUserInteraction(youTubeDomain)) {
auto& classNames = element.classNames();
if (classNames.contains("ytp-watch-later-icon"_s) || classNames.contains("ytp-watch-later-icon"_s)) {
if (ResourceLoadObserver::shared().hasHadUserInteraction(youTubeDomain)) {
DocumentStorageAccess::requestStorageAccessForDocumentQuirk(*document, [](StorageAccessWasGranted) { });
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
}
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
// Kinja login case.
if (kinjaQuirks.get().contains(domain) && isKinjaLoginAvatarElement(element)) {
if (ResourceLoadObserver::shared().hasHadUserInteraction(kinjaDomain)) {
DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk(*document, kinjaDomain.get().isolatedCopy(), [](StorageAccessWasGranted) { });
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
RefPtr domWindow = document->domWindow();
if (!domWindow)
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
ExceptionOr<RefPtr<WindowProxy>> proxyOrException = domWindow->open(*domWindow, *domWindow, kinjaURL->string(), emptyAtom(), loginPopupWindowFeatureString);
if (proxyOrException.hasException())
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
auto proxy = proxyOrException.releaseReturnValue();
auto* abstractFrame = proxy->frame();
if (RefPtr frame = dynamicDowncast<LocalFrame>(abstractFrame)) {
auto world = ScriptController::createWorld("kinjaComQuirkWorld"_s, ScriptController::WorldType::User);
frame->addUserScriptAwaitingNotification(world.get(), kinjaLoginUserScript);
return Quirks::StorageAccessResult::ShouldCancelEvent;
}
}
// If the click is synthetic, the user has already gone through the storage access flow and we should not request again.
if (isStorageAccessQuirkDomainAndElement(document->url(), element) && isSyntheticClick == IsSyntheticClick::No) {
return requestStorageAccessAndHandleClick([element = WeakPtr { element }, platformEvent, eventType, detail, relatedTarget] (ShouldDispatchClick shouldDispatchClick) mutable {
RefPtr protectedElement { element.get() };
if (!protectedElement)
return;
if (shouldDispatchClick == ShouldDispatchClick::Yes)
protectedElement->dispatchMouseEvent(platformEvent, eventType, detail, relatedTarget, IsSyntheticClick::Yes);
});
}
}
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
// youtube.com rdar://66242343
bool Quirks::needsVP9FullRangeFlagQuirk() const
{
return needsQuirks() && m_quirksData.needsVP9FullRangeFlagQuirk;
}
// facebook.com: rdar://67273166
// forbes.com:
// reddit.com: rdar://80550715
// twitter.com: rdar://73369869
bool Quirks::requiresUserGestureToPauseInPictureInPicture() const
{
#if ENABLE(VIDEO_PRESENTATION_MODE)
// Facebook, X (twitter), and Reddit will naively pause a <video> element that has scrolled out of the viewport,
// regardless of whether that element is currently in PiP mode.
// We should remove the quirk once <rdar://problem/67273166>, <rdar://problem/73369869>, and <rdar://problem/80645747> have been fixed.
return needsQuirks() && m_quirksData.requiresUserGestureToPauseInPictureInPictureQuirk;
#else
return false;
#endif
}
// bbc.co.uk: rdar://126494734
bool Quirks::returnNullPictureInPictureElementDuringFullscreenChange() const
{
return needsQuirks() && m_quirksData.returnNullPictureInPictureElementDuringFullscreenChangeQuirk;
}
// twitter.com: rdar://73369869
bool Quirks::requiresUserGestureToLoadInPictureInPicture() const
{
#if ENABLE(VIDEO_PRESENTATION_MODE)
// X (Twitter) will remove the "src" attribute of a <video> element that has scrolled out of the viewport and
// load the <video> element with an empty "src" regardless of whether that element is currently in PiP mode.
// We should remove the quirk once <rdar://problem/73369869> has been fixed.
return needsQuirks() && m_quirksData.requiresUserGestureToLoadInPictureInPictureQuirk;
#else
return false;
#endif
}
// vimeo.com: rdar://problem/70788878
bool Quirks::blocksReturnToFullscreenFromPictureInPictureQuirk() const
{
#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_PRESENTATION_MODE)
// Some sites (e.g., vimeo.com) do not set element's styles properly when a video
// returns to fullscreen from picture-in-picture. This quirk disables the "return to fullscreen
// from picture-in-picture" feature for those sites. We should remove the quirk once
// rdar://problem/73167931 has been fixed.
return needsQuirks() && m_quirksData.blocksReturnToFullscreenFromPictureInPictureQuirk;
#else
return false;
#endif
}
// vimeo.com: rdar://107592139
bool Quirks::blocksEnteringStandardFullscreenFromPictureInPictureQuirk() const
{
#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_PRESENTATION_MODE)
// Vimeo enters fullscreen when starting playback from the inline play button while already in PIP.
// This behavior is revealing a bug in the fullscreen handling. See rdar://107592139.
return needsQuirks() && m_quirksData.blocksEnteringStandardFullscreenFromPictureInPictureQuirk;
#else
return false;
#endif
}
// espn.com: rdar://problem/73227900
// vimeo.com: rdar://problem/73227900
bool Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk() const
{
#if ENABLE(VIDEO_PRESENTATION_MODE)
// This quirk disables the "webkitendfullscreen" event when a video enters picture-in-picture
// from fullscreen for the sites which cannot handle the event properly in that case.
// We should remove once the quirks have been fixed.
// <rdar://90393832> vimeo.com
return needsQuirks() && m_quirksData.shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk;
#else
return false;
#endif
}
// teams.live.com rdar://88678598
// teams.microsoft.com rdar://90434296
bool Quirks::shouldAllowNavigationToCustomProtocolWithoutUserGesture(StringView protocol, const SecurityOriginData& requesterOrigin)
{
return protocol == "msteams"_s && (requesterOrigin.host() == "teams.live.com"_s || requesterOrigin.host() == "teams.microsoft.com"_s);
}
#if PLATFORM(IOS) || PLATFORM(VISION)
// espn.com: rdar://problem/95651814
bool Quirks::allowLayeredFullscreenVideos() const
{
return needsQuirks() && m_quirksData.allowLayeredFullscreenVideos;
}
#endif
#if PLATFORM(VISION)
// x.com: rdar://132850672
// FIXME (rdar://124579556): Remove once 'x.com' adjusts video handling for visionOS.
bool Quirks::shouldDisableFullscreenVideoAspectRatioAdaptiveSizing() const
{
return needsQuirks() && m_quirksData.shouldDisableFullscreenVideoAspectRatioAdaptiveSizingQuirk;
}
#endif
bool Quirks::shouldEnableApplicationCacheQuirk() const
{
// FIXME: Remove this when deleting ApplicationCache APIs.
return false;
}
// play.hbomax.com https://bugs.webkit.org/show_bug.cgi?id=244737
bool Quirks::shouldEnableFontLoadingAPIQuirk() const
{
if (!needsQuirks() || m_document->settings().downloadableBinaryFontTrustedTypes() == DownloadableBinaryFontTrustedTypes::Any)
return false;
return m_quirksData.shouldEnableFontLoadingAPIQuirk;
}
// hulu.com rdar://100199996
bool Quirks::needsVideoShouldMaintainAspectRatioQuirk() const
{
return needsQuirks() && m_quirksData.needsVideoShouldMaintainAspectRatioQuirk;
}
// Marcus: <rdar://101086391>.
// Pandora: <rdar://100243111>.
// Soundcloud: <rdar://102913500>.
bool Quirks::shouldExposeShowModalDialog() const
{
return needsQuirks() && m_quirksData.shouldExposeShowModalDialog;
}
// marcus.com rdar://102959860
bool Quirks::shouldNavigatorPluginsBeEmpty() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.shouldNavigatorPluginsBeEmpty;
#else
return false;
#endif
}
// Fix for the UNIQLO app (rdar://104519846).
bool Quirks::shouldDisableLazyIframeLoadingQuirk() const
{
return needsQuirks() && m_quirksData.shouldDisableLazyIframeLoadingQuirk;
}
// Breaks express checkout on victoriassecret.com (rdar://104818312).
bool Quirks::shouldDisableFetchMetadata() const
{
return needsQuirks() && m_quirksData.shouldDisableFetchMetadata;
}
// Push state file path restrictions break Mimeo Photo Plugin (rdar://112445672).
bool Quirks::shouldDisablePushStateFilePathRestrictions() const
{
return needsQuirks() && m_quirksData.shouldDisablePushStateFilePathRestrictions;
}
// ungap/@custom-elements polyfill (rdar://problem/111008826).
bool Quirks::needsConfigurableIndexedPropertiesQuirk() const
{
return needsQuirks() && m_needsConfigurableIndexedPropertiesQuirk;
}
// Canvas fingerprinting (rdar://107564162)
String Quirks::advancedPrivacyProtectionSubstituteDataURLForScriptWithFeatures(const String& lastDrawnText, int canvasWidth, int canvasHeight) const
{
if (!needsQuirks() || !m_document->settings().canvasFingerprintingQuirkEnabled() || !m_document->noiseInjectionHashSalt())
return { };
if ("<@nv45. F1n63r,Pr1n71n6!"_s != lastDrawnText || canvasWidth != 280 || canvasHeight != 60)
return { };
if (!m_document->globalObject())
return { };
auto& vm = m_document->globalObject()->vm();
auto* callFrame = vm.topCallFrame;
if (!callFrame)
return { };
bool sourceMatchesExpectedLength = false;
JSC::StackVisitor::visit(callFrame, vm, [&](auto& visitor) {
if (visitor->isImplementationVisibilityPrivate())
return IterationStatus::Continue;
auto* codeBlock = visitor->codeBlock();
if (!codeBlock)
return IterationStatus::Continue;
auto* scriptExecutable = codeBlock->ownerExecutable();
if (!scriptExecutable)
return IterationStatus::Continue;
RefPtr sourceProvider = scriptExecutable->source().provider();
if (!sourceProvider)
return IterationStatus::Continue;
auto sourceCodeLength = sourceProvider->source().length();
sourceMatchesExpectedLength = sourceCodeLength == 212053 || sourceCodeLength == 219192;
return IterationStatus::Done;
});
if (!sourceMatchesExpectedLength)
return { };
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAA8CAYAAAC9xKUYAAAAAXNSR0I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bF8pgvYf6AbNOf/H18IqQoy6QXfHY5njDOXI7DJJkvDi5RHoNG9BjHaH0uYfJNC/OwrsTL/yL44TINPwnqBtcNMOmO8ToZbeBdobZ47wYdPQiXwExo40DsGxvnruE+dtzGPuc2Le4JXVSxBGDhtd08XPiYmK7DWRGzHNLpsMrS4ztFT4anOqYxAJaL8KMAH0JkKUDX+7F8ebBiuS196Qb8WgDdcbIGJuSPUaulhEXG/h5MCbNWevLkI+Q2yhHO7oB2s8Jb2oUx4QCMTjyI47I5grZjCzv2YGBhefKGPzGT1Hc4ofF2z/DSIm8CvGMXqcLHdAHVHjdBWCZ1wnZMNjWhDXn1szSNrJTOcEfQo/ie4x5mED6VeaEQ/TFQ+Olf3p1pg9lpAtaFo02jhJgrJhtLoTRtPKbyHEsAU5mC7bOc3F//m+TMXiSWtC+8ZgswhcumKmKKMErLjx12AMOS2QZw+QO81f38AeqH8yTbldafoZZtAJI9+JqzLk7inwCfzPkIO8vYrkIcgan2MG1Wz5UfN7akY1ECHfZIZ0l7pZe1PRa5r7k8V4oFExGvHoYfYKhNv8cJy1vgbG0WCS/gvg++lL/AT3KvCH9wVkCa4zLIWjAFdyvvj/PPPBRH1oIpTkKVG59Al1UMQ/iAqj72Vtrha+A2GDxpMsk5gKPLP8D1mYFtb+wz1EyyAFO2frcAUzb5lXfuSlkiFcR0+EPC5YjjC5RvQ8gLtn+tBKwEjlkJJLZNd8w2zzJuJWAlUJUSsABTldK3dVsJHOcSsABznHewbZ6VQFVKwAJMVUrf1m0lcJxLwALMcd7BtnlWAlUpAQswVSl9W7eVwHEuAQswx3kH2+ZZCVSlBCzAVKX0bd1WAse5BCzAVLMOxhfn9sRhKfvEyq6UgrPZrASsBKwErASsBKwErASsBKwErASsBKwErASsBKwErASsBKwErASsBKwECpLA/wNiq9JJ3UFXngAAAABJRU5ErkJggg==A"_s;
}
// DOFUS Touch app (rdar://112679186)
bool Quirks::needsResettingTransitionCancelsRunningTransitionQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.needsResettingTransitionCancelsRunningTransitionQuirk;
#else
return false;
#endif
}
// Microsoft office online generates data URLs with incorrect padding on Safari only (rdar://114573089).
bool Quirks::shouldDisableDataURLPaddingValidation() const
{
return needsQuirks() && m_quirksData.shouldDisableDataURLPaddingValidation;
}
bool Quirks::needsDisableDOMPasteAccessQuirk() const
{
if (!needsQuirks())
return false;
if (m_quirksData.needsDisableDOMPasteAccessQuirk)
return *m_quirksData.needsDisableDOMPasteAccessQuirk;
m_quirksData.needsDisableDOMPasteAccessQuirk = [&] {
if (!m_document)
return false;
auto* globalObject = m_document->globalObject();
if (!globalObject)
return false;
Ref vm = globalObject->vm();
JSC::JSLockHolder lock(vm);
auto tableauPrepProperty = JSC::Identifier::fromString(vm, "tableauPrep"_s);
return globalObject->hasProperty(globalObject, tableauPrepProperty);
}();
return *m_quirksData.needsDisableDOMPasteAccessQuirk;
}
// rdar://133423460
bool Quirks::shouldPreventOrientationMediaQueryFromEvaluatingToLandscape() const
{
return needsQuirks() && m_quirksData.shouldPreventOrientationMediaQueryFromEvaluatingToLandscapeQuirk;
}
// rdar://133423460
bool Quirks::shouldFlipScreenDimensions() const
{
#if ENABLE(FLIP_SCREEN_DIMENSIONS_QUIRKS)
return needsQuirks() && m_quirksData.shouldFlipScreenDimensionsQuirk;
#else
return false;
#endif
}
// This section is dedicated to UA override for iPad. iPads (but iPad Mini) are sending a desktop user agent
// to websites. In some cases, the website breaks in some ways, not expecting a touch interface for the website.
// Controls not active or too small, form factor, etc. In this case it is better to send the iPad Mini UA.
// FIXME: find the reference radars and/or bugs.webkit.org issues on why these were added in the first place.
// FIXME: There is no check currently on needsQuirks(), this needs to be fixed so it makes it easier
// to deactivate them for testing.
bool Quirks::needsIPadMiniUserAgent(const URL& url)
{
auto host = url.host();
if (host == "huya.com"_s || host.endsWith(".huya.com"_s))
return true;
if (host == "cctv.com"_s || host.endsWith(".cctv.com"_s))
return true;
// FIXME: Remove this quirk when <rdar://problem/61733101> is complete.
if (host == "roblox.com"_s || host.endsWith(".roblox.com"_s))
return true;
// FIXME: Remove this quirk when <rdar://122481999> is complete.
if (host == "spotify.com"_s || host.endsWith(".spotify.com"_s) || host.endsWith(".spotifycdn.com"_s))
return true;
// FIXME: Remove this quirk if seatguru decides to adjust their site. See https://webkit.org/b/276947
if (host == "seatguru.com"_s || host.endsWith(".seatguru.com"_s))
return true;
// FIXME: Remove this quirk once <rdar://113978106> is no longer happening.
if (host == "www.indiatimes.com"_s)
return true;
return false;
}
bool Quirks::needsIPhoneUserAgent(const URL& url)
{
#if PLATFORM(IOS_FAMILY)
if (url.host() == "shopee.sg"_s && url.path() == "/payment/account-linking/landing"_s)
return true;
#else
UNUSED_PARAM(url);
#endif
return false;
}
bool Quirks::needsDesktopUserAgent(const URL& url)
{
return needsDesktopUserAgentInternal(url);
}
bool Quirks::needsPartitionedCookies(const ResourceRequest& request)
{
if (request.isTopSite())
return false;
return request.url().protocolIsInHTTPFamily() && request.url().host().endsWith(".billpaysite.com"_s);
}
// premierleague.com: rdar://123721211
bool Quirks::shouldIgnorePlaysInlineRequirementQuirk() const
{
#if PLATFORM(IOS_FAMILY)
return needsQuirks() && m_quirksData.shouldIgnorePlaysInlineRequirementQuirk;
#else
return false;
#endif
}
bool Quirks::shouldUseEphemeralPartitionedStorageForDOMCookies(const URL& url) const
{
if (!needsQuirks())
return false;
auto firstPartyDomain = RegistrableDomain(m_document->firstPartyForCookies()).string();
auto domain = RegistrableDomain(url).string();
// rdar://113830141
if (firstPartyDomain == "cagreatamerica.com"_s && domain == "queue-it.net"_s)
return true;
return false;
}
// rdar://127398734
bool Quirks::needsLaxSameSiteCookieQuirk(const URL& requestURL) const
{
if (!needsQuirks())
return false;
auto url = m_document->url();
return url.protocolIs("https"_s) && url.host() == "login.microsoftonline.com"_s && requestURL.protocolIs("https"_s) && requestURL.host() == "www.bing.com"_s;
}
#if ENABLE(TEXT_AUTOSIZING)
// news.ycombinator.com: rdar://127246368
bool Quirks::shouldIgnoreTextAutoSizing() const
{
return needsQuirks() && m_quirksData.shouldIgnoreTextAutoSizingQuirk;
}
#endif
std::optional<TargetedElementSelectors> Quirks::defaultVisibilityAdjustmentSelectors(const URL& requestURL)
{
#if ENABLE(VISIBILITY_ADJUSTMENT_QUIRKS)
return defaultVisibilityAdjustmentSelectorsInternal(requestURL);
#else
UNUSED_PARAM(requestURL);
return { };
#endif
}
String Quirks::scriptToEvaluateBeforeRunningScriptFromURL(const URL& scriptURL)
{
#if PLATFORM(IOS_FAMILY)
if (!needsQuirks())
return { };
if (!m_quirksData.needsScriptToEvaluateBeforeRunningScriptFromURLQuirk)
return { };
// player.anyclip.com rdar://138789765
if (UNLIKELY(m_quirksData.isThesaurus && scriptURL.lastPathComponent().endsWith("lre.js"_s)) && scriptURL.host() == "player.anyclip.com"_s)
return "(function() { let userAgent = navigator.userAgent; Object.defineProperty(navigator, 'userAgent', { get: () => { return userAgent + ' Chrome/130.0.0.0 Android/15.0'; }, configurable: true }); })();"_s;
#if ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
if (UNLIKELY(m_quirksData.isWebEx && scriptURL.lastPathComponent().startsWith("pushdownload."_s)))
return "Object.defineProperty(window, 'Touch', { get: () => undefined });"_s;
#endif
#else
UNUSED_PARAM(scriptURL);
#endif
return { };
}
// disneyplus: rdar://137613110
bool Quirks::shouldHideCoarsePointerCharacteristics() const
{
#if ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
return needsQuirks() && m_quirksData.shouldHideCoarsePointerCharacteristicsQuirk;
#else
return false;
#endif
}
// hulu.com rdar://126096361
bool Quirks::implicitMuteWhenVolumeSetToZero() const
{
return needsQuirks() && m_quirksData.implicitMuteWhenVolumeSetToZero;
}
#if ENABLE(TOUCH_EVENTS)
bool Quirks::shouldOmitTouchEventDOMAttributesForDesktopWebsite(const URL& requestURL)
{
return requestURL.host() == "secure.chase.com"_s;
}
// soylent.*; rdar://113314067
bool Quirks::shouldDispatchPointerOutAfterHandlingSyntheticClick() const
{
return needsQuirks() && m_quirksData.shouldDispatchPointerOutAfterHandlingSyntheticClick;
}
#endif // ENABLE(TOUCH_EVENTS)
// max.com: rdar://138424489
bool Quirks::needsZeroMaxTouchPointsQuirk() const
{
#if ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
return needsQuirks() && m_quirksData.needsZeroMaxTouchPointsQuirk;
#else
return false;
#endif
}
// imdb.com: rdar://137991466
bool Quirks::needsChromeMediaControlsPseudoElement() const
{
return needsQuirks() && m_quirksData.needsChromeMediaControlsPseudoElementQuirk;
}
#if PLATFORM(IOS_FAMILY)
// store.steampowered.com: rdar://142573562
bool Quirks::shouldTreatAddingMouseOutEventListenerAsContentChange() const
{
return needsQuirks() && m_quirksData.shouldTreatAddingMouseOutEventListenerAsContentChange;
}
// cbssports.com <rdar://139478801>.
// docs.google.com <rdar://59402637>.
bool Quirks::shouldSynthesizeTouchEventsAfterNonSyntheticClick(const Element& target) const
{
if (!needsQuirks())
return false;
if (!m_quirksData.shouldSynthesizeTouchEventsAfterNonSyntheticClickQuirk)
return false;
if (m_quirksData.isCBSSports)
return target.nodeName() == "AVIA-BUTTON"_s;
if (m_quirksData.isGoogleDocs) {
unsigned numberOfAncestorsToCheck = 3;
for (Ref ancestor : lineageOfType<HTMLElement>(target)) {
if (ancestor->hasClassName("docs-ml-promotion-action-container"_s))
return true;
if (!--numberOfAncestorsToCheck)
break;
}
}
return false;
}
static AccessibilityRole accessibilityRole(const Element& element)
{
return AccessibilityObject::ariaRoleToWebCoreRole(element.attributeWithoutSynchronization(HTMLNames::roleAttr));
}
// walmart.com: rdar://123734840
// live.outlook.com: rdar://152277211
bool Quirks::shouldIgnoreContentObservationForClick(const Node& targetNode) const
{
if (!needsQuirks())
return false;
if (!m_quirksData.mayNeedToIgnoreContentObservation)
return false;
RefPtr target = dynamicDowncast<Element>(targetNode);
if (m_quirksData.isOutlook) {
if (target && target->getIdAttribute().startsWith("swatchColorPicker"_s))
return true;
}
if (m_quirksData.isWalmart) {
if (!target || accessibilityRole(*target) != AccessibilityRole::Button)
return false;
RefPtr parent = target->parentElementInComposedTree();
if (!parent || accessibilityRole(*parent) != AccessibilityRole::ListItem)
return false;
}
return true;
}
#endif // PLATFORM(IOS_FAMILY)
// outlook.live.com: rdar://136624720
bool Quirks::needsMozillaFileTypeForDataTransfer() const
{
return needsQuirks() && m_quirksData.needsMozillaFileTypeForDataTransferQuirk;
}
// bing.com rdar://126573838
bool Quirks::needsBingGestureEventQuirk(EventTarget* target) const
{
if (!needsQuirks())
return false;
if (!m_quirksData.needsBingGestureEventQuirk)
return false;
if (RefPtr element = dynamicDowncast<Element>(target)) {
static MainThreadNeverDestroyed<const AtomString> mapClass("atlas-map-canvas"_s);
return element->hasClassName(mapClass.get());
}
return false;
}
// spotify.com rdar://140707449
bool Quirks::shouldAvoidStartingSelectionOnMouseDown(const Node& target) const
{
#if PLATFORM(MAC)
if (!needsQuirks())
return false;
if (!m_quirksData.shouldAvoidStartingSelectionOnMouseDown)
return false;
if (CheckedPtr style = target.renderStyle()) {
if (style->usedTouchActions().contains(TouchAction::None) && style->cursor() == CursorType::Pointer)
return true;
}
#else
UNUSED_PARAM(target);
#endif
return false;
}
bool Quirks::shouldReuseLiveRangeForSelectionUpdate() const
{
if (!needsQuirks())
return false;
if (!m_quirksData.needsReuseLiveRangeForSelectionUpdateQuirk)
m_quirksData.needsReuseLiveRangeForSelectionUpdateQuirk = isDomain("scribd.com"_s);
return *m_quirksData.needsReuseLiveRangeForSelectionUpdateQuirk;
}
#if PLATFORM(IOS_FAMILY)
bool Quirks::needsPointerTouchCompatibility(const Element& target) const
{
if (!needsQuirks())
return false;
if (WTF::IOSApplication::isFeedly()) {
RefPtr pageContainer = [&target] -> const HTMLElement* {
for (Ref ancestor : lineageOfType<HTMLElement>(target)) {
if (ancestor->hasClassName("PageContainer"_s))
return ancestor.ptr();
}
return nullptr;
}();
if (pageContainer) {
if (RefPtr article = descendantsOfType<HTMLArticleElement>(*pageContainer).first())
return article->hasClassName("MobileFullEntry"_s);
}
} else if (WTF::IOSApplication::isAmazon()) {
for (Ref ancestor : lineageOfType<HTMLElement>(target)) {
if (ancestor->hasClassName("a-gesture-horizontal"_s))
return true;
}
}
return false;
}
#endif
// facebook.com rdar://141103350
bool Quirks::needsFacebookStoriesCreationFormQuirk(const Element& element, const RenderStyle& computedStyle) const
{
#if PLATFORM(IOS_FAMILY)
if (!needsQuirks())
return false;
if (!m_quirksData.isFacebook)
return false;
if (!topDocumentURL().path().startsWith("/stories/create"_s)) {
m_facebookStoriesCreationFormContainer = { };
return false;
}
Ref document = element.document();
RefPtr loader = document->loader();
if (UNLIKELY(!loader))
return false;
if (loader->metaViewportPolicy() != MetaViewportPolicy::Ignore)
return false;
RefPtr view = document->view();
if (UNLIKELY(!view))
return false;
float width = view->sizeForCSSDefaultViewportUnits().width();
if (width < 800 || width > 900)
return false;
if (m_facebookStoriesCreationFormContainer)
return m_facebookStoriesCreationFormContainer.get() == &element;
if (computedStyle.display() != DisplayType::None)
return false;
if (accessibilityRole(element) != AccessibilityRole::LandmarkNavigation)
return false;
if (!descendantsOfType<HTMLTextAreaElement>(element).first())
return false;
m_facebookStoriesCreationFormContainer = element;
return true;
#else
UNUSED_PARAM(element);
UNUSED_PARAM(computedStyle);
return false;
#endif
}
// hotels.com rdar://126631968
bool Quirks::needsHotelsAnimationQuirk(Element& element, const RenderStyle& style) const
{
if (!needsQuirks() || !m_quirksData.needsHotelsAnimationQuirk)
return false;
if (!style.hasAnimations())
return false;
auto matches = Ref { element }->matches(".uitk-menu-mounted .uitk-menu-container.uitk-menu-container-autoposition.uitk-menu-container-has-intersection-root-el"_s);
return !matches.hasException() && matches.returnValue();
}
bool Quirks::needsLimitedMatroskaSupport() const
{
#if ENABLE(MEDIA_RECORDER) && ENABLE(ALTERNATE_WEBM_PLAYER)
return isDomain("zencastr.com"_s);
#else
return false;
#endif
}
bool Quirks::needsNowPlayingFullscreenSwapQuirk() const
{
return needsQuirks() && m_quirksData.needsNowPlayingFullscreenSwapQuirk;
}
bool Quirks::needsWebKitMediaTextTrackDisplayQuirk() const
{
return needsQuirks() && m_quirksData.needsWebKitMediaTextTrackDisplayQuirk;
}
// rdar://106770785
bool Quirks::shouldPreventKeyframeEffectAcceleration(const KeyframeEffect& effect) const
{
if (!needsQuirks() || !m_quirksData.isEA)
return false;
auto target = Ref { effect }->targetStyleable();
return target && Ref { target->element }->localName() == "ea-network-nav"_s;
}
URL Quirks::topDocumentURL() const
{
if (UNLIKELY(!m_topDocumentURLForTesting.isEmpty()))
return m_topDocumentURLForTesting;
return m_document->topURL();
}
void Quirks::setTopDocumentURLForTesting(URL&& url)
{
m_topDocumentURLForTesting = WTFMove(url);
determineRelevantQuirks();
}
// FIXME(rdar://141554467): The set of static functions below will be generated from a JSON file in a future patch. For now, we just move the logic
// for deciding if a particular quirk is needed to domain-specific functions below:
#if PLATFORM(IOS) || PLATFORM(VISION)
static void handle365ScoresQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "365scores.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// 365scores.com rdar://116491386
quirksData.shouldSilenceWindowResizeEventsDuringApplicationSnapshotting = true;
}
static void handleNYTimesQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "nytimes.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// nytimes.com: rdar://problem/5976384
quirksData.shouldSilenceWindowResizeEventsDuringApplicationSnapshotting = true;
}
#endif
#if PLATFORM(IOS_FAMILY)
static void handleASQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "as.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// as.com: rdar://121014613
quirksData.shouldDisableElementFullscreen = PAL::currentUserInterfaceIdiomIsSmallScreen();
}
static void handleATTQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "att.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// att.com rdar://55185021
quirksData.shouldUseLegacySelectPopoverDismissalBehaviorInDataActivationQuirk = true;
}
static void handleCBSSportsQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "cbssports.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isCBSSports = true;
// Remove this once rdar://139478801 is resolved.
quirksData.shouldSynthesizeTouchEventsAfterNonSyntheticClickQuirk = true;
}
static void handleSteamQuirks(QuirksData& quirksData, const URL& /* quirksURL */, const String& quirksDomainString, const URL& /* documentURL */)
{
if (quirksDomainString != "steampowered.com"_s)
return;
// Remove this once rdar://142573562 is resolved.
quirksData.shouldTreatAddingMouseOutEventListenerAsContentChange = true;
}
static void handleCNNQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "cnn.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// cnn.com rdar://119640248
quirksData.needsFullscreenObjectFitQuirk = true;
}
static void handleDigitalTrendsQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "digitaltrends.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// digitaltrends.com rdar://121014613
quirksData.shouldDisableElementFullscreen = PAL::currentUserInterfaceIdiomIsSmallScreen();
}
static void handleGizmodoQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "gizmodo.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// gizmodo.com rdar://102227302
quirksData.needsFullscreenDisplayNoneQuirk = true;
}
static void handleInstagramQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "instagram.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// instagram.com rdar://121014613
quirksData.shouldDisableElementFullscreen = true;
}
static void handleMailChimpQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "mailchimp.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// mailchimp.com rdar://47868965
quirksData.shouldDisablePointerEventsQuirk = true;
}
static void handleRalphLaurenQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "ralphlauren.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// ralphlauren.com rdar://55629493
quirksData.shouldIgnoreAriaForFastPathContentObservationCheckQuirk = true;
}
static void handleSkypeQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost != "web.skype.com"_s)
return;
// web.skype.com webkit.org/b/275941
quirksData.needsIPadSkypeOverflowScrollQuirk = true;
}
static void handleWalmartQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "walmart.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// walmart.com: rdar://123734840
quirksData.mayNeedToIgnoreContentObservation = true;
quirksData.isWalmart = true;
}
static void handleYahooQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(documentURL);
UNUSED_PARAM(quirksDomainString);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost.startsWith("mail."_s)) {
// mail.yahoo.com rdar://63511613
quirksData.shouldAvoidPastingImagesAsWebContent = true;
}
}
static void handleScriptToEvaluateBeforeRunningScriptFromURLQuirk(QuirksData& quirksData, const URL& quirksURL, const String& topDomain, const URL& documentURL)
{
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
if (topDomain == "thesaurus.com"_s) {
quirksData.isThesaurus = true;
quirksData.needsScriptToEvaluateBeforeRunningScriptFromURLQuirk = true;
}
#if ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
if (topDomain == "webex.com"_s) {
quirksData.isWebEx = true;
quirksData.needsScriptToEvaluateBeforeRunningScriptFromURLQuirk = true;
}
#endif
}
#endif
#if PLATFORM(IOS_FAMILY) || PLATFORM(MAC)
static void handleICloudQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "icloud.com"_s)
return;
UNUSED_PARAM(documentURL);
#if PLATFORM(IOS_FAMILY)
// icloud.com rdar://131836301
quirksData.shouldSilenceWindowResizeEventsDuringApplicationSnapshotting = quirksURL.path().contains("mail"_s) || quirksURL.fragmentIdentifier().contains("mail"_s);
#endif
#if PLATFORM(MAC)
// icloud.com rdar://26013388
quirksData.isNeverRichlyEditableForTouchBarQuirk = quirksURL.path().contains("notes"_s) || quirksURL.fragmentIdentifier().contains("notes"_s);
#endif
}
#endif
#if PLATFORM(MAC)
static void handleCEACStateGovQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(documentURL);
UNUSED_PARAM(quirksDomainString);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost == "ceac.state.gov"_s || topDocumentHost.endsWith(".ceac.state.gov"_s)) {
// ceac.state.gov https://bugs.webkit.org/show_bug.cgi?id=193478
quirksData.needsFormControlToBeMouseFocusableQuirk = true;
}
}
static void handleTrixEditorQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "trix-editor.org"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// trix-editor.org rdar://28242210
quirksData.isNeverRichlyEditableForTouchBarQuirk = true;
}
static void handleWeatherQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "weather.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// weather.com rdar://139689157
quirksData.needsFormControlToBeMouseFocusableQuirk = true;
}
#endif
#if ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
static void handleDisneyPlusQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "disneyplus.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// disneyplus rdar://137613110
quirksData.shouldHideCoarsePointerCharacteristicsQuirk = true;
}
static void handleMaxQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "max.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// max.com: rdar://138424489
quirksData.needsZeroMaxTouchPointsQuirk = true;
}
#endif
#if ENABLE(MEDIA_STREAM)
static void handleBaiduQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost != "www.baidu.com"_s)
return;
// baidu.com rdar://56421276
quirksData.shouldEnableLegacyGetUserMediaQuirk = true;
}
static void handleCodepenQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost != "codepen.io"_s)
return;
quirksData.shouldEnableSpeakerSelectionPermissionsPolicyQuirk = true;
}
static void handleWarbyParkerQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "warbyparker.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// warbyparker.com rdar://72839707
quirksData.shouldEnableLegacyGetUserMediaQuirk = true;
}
#endif
#if ENABLE(TEXT_AUTOSIZING)
static void handleYCombinatorQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost != "news.ycombinator.com"_s)
return;
// news.ycombinator.com: rdar://127246368
quirksData.shouldIgnoreTextAutoSizingQuirk = true;
}
#endif
#if ENABLE(TOUCH_EVENTS)
static void handleSoylentQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
// soylent.*: rdar://113314067
quirksData.shouldDispatchPointerOutAfterHandlingSyntheticClick = true;
}
#endif
static void handleFacebookQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "facebook.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isFacebook = true;
// facebook.com rdar://100871402
quirksData.needsFacebookRemoveNotSupportedQuirk = true;
#if ENABLE(VIDEO_PRESENTATION_MODE)
// facebook.com rdar://67273166
quirksData.requiresUserGestureToPauseInPictureInPictureQuirk = true;
#endif
}
#if ENABLE(VIDEO_PRESENTATION_MODE)
static void handleForbesQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "forbes.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// forbes.com rdar://67273166
quirksData.requiresUserGestureToPauseInPictureInPictureQuirk = true;
}
static void handleRedditQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "reddit.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// reddit.com: rdar://80550715
quirksData.requiresUserGestureToPauseInPictureInPictureQuirk = true;
}
#endif
static void handleAmazonQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isAmazon = true;
// amazon.com rdar://49124529
quirksData.shouldDispatchedSimulatedMouseEventsAssumeDefaultPreventedQuirk = true;
#if PLATFORM(MAC)
// amazon.com rdar://128962002
quirksData.needsPrimeVideoUserSelectNoneQuirk = true;
#endif
}
static void handleBBCQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
if (quirksDomainString == "bbc.co.uk"_s) {
// bbc.co.uk rdar://126494734
quirksData.returnNullPictureInPictureElementDuringFullscreenChangeQuirk = true;
}
}
static void handleBankOfAmericaQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "bankofamerica.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isBankOfAmerica = true;
// Login issue on bankofamerica.com (rdar://104938789).
quirksData.maybeBypassBackForwardCache = true;
}
static void handleBingQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "bing.com"_s)
return;
UNUSED_PARAM(documentURL);
quirksData.isBing = true;
// bing.com rdar://133223599
quirksData.maybeBypassBackForwardCache = true;
// bing.com rdar://126573838
auto topDocumentHost = quirksURL.host();
quirksData.needsBingGestureEventQuirk = topDocumentHost == "www.bing.com"_s && startsWithLettersIgnoringASCIICase(quirksURL.path(), "/maps"_s);
}
static void handleBungalowQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "bungalow.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// bungalow.com rdar://61658940
quirksData.shouldBypassAsyncScriptDeferring = true;
}
static void handleESPNQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "espn.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isESPN = true;
#if PLATFORM(IOS) || PLATFORM(VISION)
// espn.com rdar://problem/95651814
quirksData.allowLayeredFullscreenVideos = true;
#endif
#if ENABLE(VIDEO_PRESENTATION_MODE)
// espn.com rdar://problem/73227900
quirksData.shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk = true;
#endif
}
static void handleEAQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "ea.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isEA = true;
}
static void handleGoogleQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
quirksData.isGoogleProperty = true;
auto topDocumentHost = quirksURL.host();
if (startsWithLettersIgnoringASCIICase(quirksURL.path(), "/maps/"_s)) {
quirksData.isGoogleMaps = true;
#if PLATFORM(IOS_FAMILY)
// maps.google.com rdar://67358928
quirksData.needsGoogleMapsScrollingQuirk = true;
#endif
// maps.google.com https://bugs.webkit.org/show_bug.cgi?id=214945
quirksData.shouldAvoidResizingWhenInputViewBoundsChangeQuirk = true;
}
quirksData.isGoogleDocs = topDocumentHost == "docs.google.com"_s;
#if PLATFORM(IOS_FAMILY)
if (quirksData.isGoogleDocs) {
// docs.google.com rdar://49864669
quirksData.shouldSuppressAutocorrectionAndAutocapitalizationInHiddenEditableAreasQuirk = true;
// docs.google.com https://bugs.webkit.org/show_bug.cgi?id=199587
quirksData.needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommandQuirk = startsWithLettersIgnoringASCIICase(quirksURL.path(), "/spreadsheets/"_s);
} else if (topDocumentHost == "mail.google.com"_s) {
// mail.google.com rdar://49403416
quirksData.needsGMailOverflowScrollQuirk =true;
}
#endif
// docs.google.com rdar://59893415
quirksData.maybeBypassBackForwardCache = true;
#if ENABLE(TOUCH_EVENTS)
// sites.google.com rdar://58653069
quirksData.shouldPreventDispatchOfTouchEventQuirk = topDocumentHost == "sites.google.com"_s;
#endif
#if PLATFORM(MAC)
// docs.google.com https://bugs.webkit.org/show_bug.cgi?id=161984
quirksData.isTouchBarUpdateSuppressedForHiddenContentEditableQuirk = quirksData.isGoogleDocs;
#endif
}
static void handleHBOMaxQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "hbomax.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost != "play.hbomax.com"_s)
return;
// play.hbomax.com https://bugs.webkit.org/show_bug.cgi?id=244737
quirksData.shouldEnableFontLoadingAPIQuirk = true;
}
static void handleHotelsQuirks(QuirksData& quirksData, const URL&, const String& quirksDomainString, const URL&)
{
// hotels.com rdar://126631968
quirksData.needsHotelsAnimationQuirk = quirksDomainString == "hotels.com"_s;
}
static void handleHuluQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "hulu.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// hulu.com rdar://100199996
quirksData.needsVideoShouldMaintainAspectRatioQuirk = true;
// hulu.com rdar://126096361
quirksData.implicitMuteWhenVolumeSetToZero = true;
}
static void handleIMDBQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "imdb.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// imdb.com: rdar://137991466
quirksData.needsChromeMediaControlsPseudoElementQuirk = true;
}
static void handleLiveQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "live.com"_s)
return;
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
quirksData.isOutlook = topDocumentHost == "outlook.live.com"_s;
// outlook.live.com: rdar://136624720
quirksData.needsMozillaFileTypeForDataTransferQuirk = quirksData.isOutlook;
#if PLATFORM(IOS_FAMILY)
// outlook.live.com: rdar://152277211
quirksData.mayNeedToIgnoreContentObservation = quirksData.isOutlook;
#endif
// live.com rdar://52116170
quirksData.shouldAvoidResizingWhenInputViewBoundsChangeQuirk = true;
// Microsoft office online generates data URLs with incorrect padding on Safari only (rdar://114573089).
quirksData.shouldDisableDataURLPaddingValidation = topDocumentHost.endsWith("officeapps.live.com"_s) || topDocumentHost.endsWith("onedrive.live.com"_s);
#if PLATFORM(MAC)
// onedrive.live.com rdar://26013388
quirksData.isNeverRichlyEditableForTouchBarQuirk = topDocumentHost == "onedrive.live.com"_s;
#endif
}
static void handleMarcusQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "marcus.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// Marcus: <rdar://101086391>.
quirksData.shouldExposeShowModalDialog = true;
#if PLATFORM(IOS_FAMILY)
// marcus.com rdar://102959860
quirksData.shouldNavigatorPluginsBeEmpty = true;
#endif
}
static void handleMediumQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "medium.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// medium.com rdar://50457837
quirksData.shouldDispatchSyntheticMouseEventsWhenModifyingSelectionQuirk = true;
}
static void handleMenloSecurityQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost != "safe.menlosecurity.com"_s)
return;
// safe.menlosecurity.com rdar://135114489
quirksData.shouldDisableWritingSuggestionsByDefaultQuirk = true;
}
static void handleNHLQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "nhl.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.needsWebKitMediaTextTrackDisplayQuirk = true;
}
static void handleNetflixQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "netflix.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isNetflix = true;
// netflix.com https://bugs.webkit.org/show_bug.cgi?id=173030
quirksData.needsSeekingSupportDisabledQuirk = true;
#if PLATFORM(VISION)
quirksData.needsNowPlayingFullscreenSwapQuirk = true;
#endif
}
static void handlePandoraQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "pandora.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// Pandora: <rdar://100243111>.
quirksData.shouldExposeShowModalDialog = true;
}
static void handlePremierLeagueQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "premierleague.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// premierleague.com: rdar://123721211
quirksData.shouldIgnorePlaysInlineRequirementQuirk = true;
}
static void handleSFUSDQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "sfusd.edu"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// sfusd.edu: rdar://116292738
quirksData.shouldBypassAsyncScriptDeferring = true;
}
static void handleSharePointQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "sharepoint.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// sharepoint.com rdar://52116170
quirksData.shouldAvoidResizingWhenInputViewBoundsChangeQuirk = true;
}
static void handleSoundCloudQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "soundcloud.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isSoundCloud = true;
// soundcloud.com rdar://52915981
quirksData.shouldDispatchedSimulatedMouseEventsAssumeDefaultPreventedQuirk = true;
// Soundcloud: rdar://102913500
quirksData.shouldExposeShowModalDialog = true;
}
static void handleSpotifyQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
UNUSED_PARAM(quirksDomainString);
UNUSED_PARAM(documentURL);
auto topDocumentHost = quirksURL.host();
if (topDocumentHost != "open.spotify.com"_s)
return;
// spotify.com rdar://138918575
quirksData.needsBodyScrollbarWidthNoneDisabledQuirk = true;
#if PLATFORM(MAC)
quirksData.shouldAvoidStartingSelectionOnMouseDown = true;
#endif
}
static void handleVictoriasSecretQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "victoriassecret.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// Breaks express checkout on victoriassecret.com (rdar://104818312).
quirksData.shouldDisableFetchMetadata = true;
}
static void handleVimeoQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "vimeo.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isVimeo = true;
// vimeo.com rdar://56996057
quirksData.maybeBypassBackForwardCache = true;
#if PLATFORM(IOS_FAMILY)
// vimeo.com rdar://55759025
quirksData.needsPreloadAutoQuirk = true;
// Vimeo.com has incorrect layout on iOS on certain videos with wider
// aspect ratios than the device's screen in landscape mode.
// (Ref: rdar://116531089)
quirksData.shouldDisableElementFullscreen = true;
#endif
#if ENABLE(VIDEO_PRESENTATION_MODE)
// vimeo.com: rdar://problem/73227900
quirksData.shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk = true;
#endif
#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_PRESENTATION_MODE)
// vimeo.com: rdar://107592139
quirksData.blocksEnteringStandardFullscreenFromPictureInPictureQuirk = true;
// vimeo.com: rdar://problem/70788878
quirksData.blocksReturnToFullscreenFromPictureInPictureQuirk = true;
#endif
}
static void handleWeeblyQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "weebly.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// weebly.com rdar://48003980
quirksData.shouldDispatchSyntheticMouseEventsWhenModifyingSelectionQuirk = true;
}
static void handleWikipediaQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "wikipedia.org"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
// wikipedia.org rdar://54856323
quirksData.shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraintsQuirk = true;
#if ENABLE(META_VIEWPORT)
// wikipedia.org https://webkit.org/b/247636
quirksData.shouldIgnoreViewportArgumentsToAvoidExcessiveZoomQuirk = true;
#endif
}
static void handleTwitterXQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "x.com"_s)
return;
UNUSED_PARAM(quirksData);
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
#if PLATFORM(VISION)
// x.com: rdar://132850672
quirksData.shouldDisableFullscreenVideoAspectRatioAdaptiveSizingQuirk = true;
#endif
#if PLATFORM(IOS) || PLATFORM(VISION)
// Twitter.com video embeds have controls that are too tiny and
// show page behind fullscreen.
// (Ref: rdar://121473410)
quirksData.shouldSilenceMediaQueryListChangeEvents = true;
// twitter.com: rdar://problem/58804852 and rdar://problem/61731801
quirksData.shouldSilenceWindowResizeEventsDuringApplicationSnapshotting = true;
#endif
#if ENABLE(VIDEO_PRESENTATION_MODE)
// twitter.com: rdar://73369869
quirksData.requiresUserGestureToLoadInPictureInPictureQuirk = true;
// twitter.com: rdar://73369869
quirksData.requiresUserGestureToPauseInPictureInPictureQuirk = true;
#endif
}
static void handleYouTubeQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "youtube.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isYouTube = true;
// youtube.com https://bugs.webkit.org/show_bug.cgi?id=195598
quirksData.hasBrokenEncryptedMediaAPISupportQuirk = true;
// youtube.com rdar://135886305
quirksData.needsScrollbarWidthThinDisabledQuirk = true;
// youtube.com rdar://66242343
quirksData.needsVP9FullRangeFlagQuirk = true;
#if PLATFORM(IOS_FAMILY)
// YouTube.com does not provide AirPlay controls in fullscreen
// (Ref: rdar://121471373)
quirksData.shouldDisableElementFullscreen = PAL::currentUserInterfaceIdiomIsSmallScreen();
auto topDocumentHost = quirksURL.host();
if (topDocumentHost == "www.youtube.com"_s) {
// www.youtube.com rdar://52361019
quirksData.needsYouTubeMouseOutQuirk = true;
// youtube.com rdar://49582231
quirksData.needsYouTubeOverflowScrollQuirk = true;
}
#endif
#if PLATFORM(IOS) || PLATFORM(VISION)
// youtube.com: rdar://110097836
quirksData.shouldSilenceResizeObservers = true;
#endif
}
static void handleZillowQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "zillow.com"_s)
return;
UNUSED_PARAM(documentURL);
// zillow.com rdar://53103732
auto topDocumentHost = quirksURL.host();
quirksData.shouldAvoidScrollingWhenFocusedContentIsVisibleQuirk = topDocumentHost == "www.zillow.com"_s;
#if PLATFORM(IOS) || PLATFORM(VISION)
// rdar://110097836
quirksData.shouldSilenceResizeObservers = true;
#endif
}
#if PLATFORM(MAC)
static void handleZomatoQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "zomato.com"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.needsZomatoEmailLoginLabelQuirk = true;
}
#endif
static void handleZoomQuirks(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL)
{
if (quirksDomainString != "zoom.us"_s)
return;
UNUSED_PARAM(quirksURL);
UNUSED_PARAM(documentURL);
quirksData.isZoom = true;
// zoom.com https://bugs.webkit.org/show_bug.cgi?id=223180
quirksData.shouldAutoplayWebAudioForArbitraryUserGestureQuirk = true;
#if ENABLE(MEDIA_STREAM)
// zoom.us rdar://118185086
quirksData.shouldDisableImageCaptureQuirk = true;
#endif
}
void Quirks::determineRelevantQuirks()
{
RELEASE_ASSERT(m_document);
m_quirksData = { };
#if PLATFORM(IOS_FAMILY)
static const bool shouldDisableLazyIframeLoadingQuirk = !linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::NoUNIQLOLazyIframeLoadingQuirk) && WTF::IOSApplication::isUNIQLOApp();
static const bool needsResettingTransitionCancelsRunningTransitionQuirk = !linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::ResettingTransitionCancelsRunningTransitionQuirk) && WTF::IOSApplication::isDOFUSTouch();
m_quirksData.shouldDisableLazyIframeLoadingQuirk = shouldDisableLazyIframeLoadingQuirk;
// DOFUS Touch app (rdar://112679186)
m_quirksData.needsResettingTransitionCancelsRunningTransitionQuirk = needsResettingTransitionCancelsRunningTransitionQuirk;
#endif
#if PLATFORM(MAC)
// Push state file path restrictions break Mimeo Photo Plugin (rdar://112445672).
m_quirksData.shouldDisablePushStateFilePathRestrictions = WTF::MacApplication::isMimeoPhotoProject();
#endif
auto quirksURL = topDocumentURL();
if (quirksURL.isEmpty())
return;
auto quirksDomainString = RegistrableDomain(quirksURL).string();
auto quirkDomainWithoutPSL = PublicSuffixStore::singleton().domainWithoutPublicSuffix(quirksDomainString);
using QuirkHandler = void (*)(QuirksData& quirksData, const URL& quirksURL, const String& quirksDomainString, const URL& documentURL);
using DispatchMap = HashMap<String, QuirkHandler>;
static NeverDestroyed<DispatchMap> dispatchMap = DispatchMap({
#if PLATFORM(IOS) || PLATFORM(VISION)
{ "365scores"_s, &handle365ScoresQuirks },
#endif
{ "amazon"_s, &handleAmazonQuirks },
#if PLATFORM(IOS_FAMILY)
{ "as"_s, &handleASQuirks },
{ "att"_s, &handleATTQuirks },
#endif
{ "bbc"_s, &handleBBCQuirks },
#if ENABLE(MEDIA_STREAM)
{ "baidu"_s, &handleBaiduQuirks },
{ "codepen"_s, &handleCodepenQuirks },
#endif
{ "bankofamerica"_s, &handleBankOfAmericaQuirks },
{ "bing"_s, &handleBingQuirks },
{ "bungalow"_s, &handleBungalowQuirks },
#if PLATFORM(IOS_FAMILY)
{ "cbssports"_s, &handleCBSSportsQuirks },
{ "cnn"_s, &handleCNNQuirks },
{ "digitaltrends"_s, &handleDigitalTrendsQuirks },
{ "steampowered"_s, &handleSteamQuirks },
#endif
#if ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
{ "disneyplus"_s, &handleDisneyPlusQuirks },
#endif
{ "ea"_s, &handleEAQuirks },
{ "espn"_s, &handleESPNQuirks },
{ "facebook"_s, &handleFacebookQuirks },
#if ENABLE(VIDEO_PRESENTATION_MODE)
{ "forbes"_s, &handleForbesQuirks },
#endif
#if PLATFORM(IOS_FAMILY)
{ "gizmodo"_s, &handleGizmodoQuirks },
#endif
{ "google"_s, &handleGoogleQuirks },
{ "hbomax"_s, &handleHBOMaxQuirks },
{ "hotels"_s, &handleHotelsQuirks },
{ "hulu"_s, &handleHuluQuirks },
#if PLATFORM(IOS_FAMILY) || PLATFORM(MAC)
{ "icloud"_s, &handleICloudQuirks },
#endif
{ "imdb"_s, &handleIMDBQuirks },
#if PLATFORM(IOS_FAMILY)
{ "instagram"_s, &handleInstagramQuirks },
#endif
{ "live"_s, &handleLiveQuirks },
#if PLATFORM(IOS_FAMILY)
{ "mailchimp"_s, &handleMailChimpQuirks },
#endif
{ "marcus"_s, &handleMarcusQuirks },
#if ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
{ "max"_s, &handleMaxQuirks },
#endif
{ "medium"_s, &handleMediumQuirks },
{ "menlosecurity"_s, &handleMenloSecurityQuirks },
{ "netflix"_s, &handleNetflixQuirks },
{ "nhl"_s, &handleNHLQuirks },
#if PLATFORM(IOS) || PLATFORM(VISION)
{ "nytimes"_s, &handleNYTimesQuirks },
#endif
{ "pandora"_s, &handlePandoraQuirks },
{ "premierleague"_s, &handlePremierLeagueQuirks },
#if PLATFORM(IOS_FAMILY)
{ "ralphlauren"_s, &handleRalphLaurenQuirks },
#endif
#if ENABLE(VIDEO_PRESENTATION_MODE)
{ "reddit"_s, & handleRedditQuirks },
#endif
{ "sfusd"_s, &handleSFUSDQuirks },
{ "sharepoint"_s, &handleSharePointQuirks },
#if PLATFORM(IOS_FAMILY)
{ "skype"_s, &handleSkypeQuirks },
#endif
{ "soundcloud"_s, &handleSoundCloudQuirks },
#if ENABLE(TOUCH_EVENTS)
{ "soylent"_s, &handleSoylentQuirks },
#endif
{ "spotify"_s, &handleSpotifyQuirks },
#if PLATFORM(MAC)
{ "state"_s, &handleCEACStateGovQuirks },
#endif
#if PLATFORM(IOS_FAMILY)
{ "thesaurus"_s, &handleScriptToEvaluateBeforeRunningScriptFromURLQuirk },
#endif
#if PLATFORM(MAC)
{ "trix-editor"_s, &handleTrixEditorQuirks },
#endif
{ "victoriassecret"_s, &handleVictoriasSecretQuirks },
{ "vimeo"_s, &handleVimeoQuirks },
#if PLATFORM(IOS_FAMILY)
{ "walmart"_s, &handleWalmartQuirks },
#endif
{ "wikipedia"_s, &handleWikipediaQuirks },
#if ENABLE(MEDIA_STREAM)
{ "warbyparker"_s, &handleWarbyParkerQuirks },
#endif
#if PLATFORM(MAC)
{ "weather"_s, &handleWeatherQuirks },
#endif
#if PLATFORM(IOS_FAMILY) && ENABLE(DESKTOP_CONTENT_MODE_QUIRKS)
{ "webex"_s, &handleScriptToEvaluateBeforeRunningScriptFromURLQuirk },
#endif
{ "weebly"_s, &handleWeeblyQuirks },
{ "x"_s, &handleTwitterXQuirks },
#if PLATFORM(IOS_FAMILY)
{ "yahoo"_s, &handleYahooQuirks },
#endif
#if ENABLE(TEXT_AUTOSIZING)
{ "ycombinator"_s, &handleYCombinatorQuirks },
#endif
{ "youtube"_s, &handleYouTubeQuirks },
{ "zillow"_s, &handleZillowQuirks },
#if PLATFORM(MAC)
{ "zomato"_s, &handleZomatoQuirks },
#endif
{ "zoom"_s, &handleZoomQuirks },
});
auto findResult = dispatchMap->find(quirkDomainWithoutPSL);
if (findResult != dispatchMap->end())
(findResult->value)(m_quirksData, quirksURL, quirksDomainString, m_document->url());
// Note: `needsDisableDOMPasteAccessQuirk` needs a live document to assess
// Note: `shouldDisableElementFullscreen` needs a live document for embedded sites
// FIXME: The below quirks should be handled more efficiently in a
#if ENABLE(FLIP_SCREEN_DIMENSIONS_QUIRKS)
// rdar://133423460
m_quirksData.shouldFlipScreenDimensionsQuirk = shouldFlipScreenDimensionsInternal(quirksURL);
#endif
// rdar://133423460
m_quirksData.shouldPreventOrientationMediaQueryFromEvaluatingToLandscapeQuirk = shouldPreventOrientationMediaQueryFromEvaluatingToLandscapeInternal(quirksURL);
}
}
|