зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to m-i
MozReview-Commit-ID: 9mGX3defFjK
This commit is contained in:
Коммит
d549af8fc6
|
@ -142,7 +142,6 @@
|
||||||
@RESPATH@/components/content_geckomediaplugins.xpt
|
@RESPATH@/components/content_geckomediaplugins.xpt
|
||||||
@RESPATH@/components/content_html.xpt
|
@RESPATH@/components/content_html.xpt
|
||||||
@RESPATH@/components/content_xslt.xpt
|
@RESPATH@/components/content_xslt.xpt
|
||||||
@RESPATH@/components/cookie.xpt
|
|
||||||
@RESPATH@/components/directory.xpt
|
@RESPATH@/components/directory.xpt
|
||||||
@RESPATH@/components/diskspacewatcher.xpt
|
@RESPATH@/components/diskspacewatcher.xpt
|
||||||
@RESPATH@/components/docshell.xpt
|
@RESPATH@/components/docshell.xpt
|
||||||
|
|
|
@ -281,11 +281,16 @@ const gXPInstallObserver = {
|
||||||
installInfo.install();
|
installInfo.install();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let secondaryAction = {
|
||||||
|
label: gNavigatorBundle.getString("xpinstallPromptMessage.dontAllow"),
|
||||||
|
accessKey: gNavigatorBundle.getString("xpinstallPromptMessage.dontAllow.accesskey"),
|
||||||
|
callback: () => {},
|
||||||
|
};
|
||||||
|
|
||||||
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED);
|
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED);
|
||||||
let popup = PopupNotifications.show(browser, notificationID,
|
let popup = PopupNotifications.show(browser, notificationID,
|
||||||
messageString, anchorID,
|
messageString, anchorID,
|
||||||
action, null, options);
|
action, [secondaryAction], options);
|
||||||
removeNotificationOnEnd(popup, installInfo.installs);
|
removeNotificationOnEnd(popup, installInfo.installs);
|
||||||
break; }
|
break; }
|
||||||
case "addon-install-started": {
|
case "addon-install-started": {
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"directory": [
|
||||||
|
{
|
||||||
|
"bgColor": "#ffffff",
|
||||||
|
"directoryId": 10000000,
|
||||||
|
"imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAIX0lEQVR4nO1afXDbZh1+sxbWsbGvsrLbuBt36766sR3sOEgiuU4kx2vTpFGKm0SKsyyOlI8laUZTulLojQEHx4CyAaNnt72yrivklo1YSpxcW7YVbKXHgCvduCvroDt6o6OtLSWN1MRWX/5I4imyJMu2bPNHnrvfSZbf6P09z+/jfV+3ACxhCUsoAEouNWGlMRLri5GuZwUSe1Ug8bcFEjsjUPgHAoX/UyCxkyKJjQoU/iOhCd8WJSvW/8vpXFFsx7PGeaJsVaytul+g8KMiic+IFA7NTNB/rggk/jeRcu26RGFris3JEqIUtkFsdo2KFK6kI52pCSR2UmirZgY9YFmxeaYg1uyqFSj8lMXI5mofRb3rOwEAJcXmDS72ex8QvO43skjv3MeT2DtRX2150cgLzVUDIonF8xBh64KQ2FWRwncPejyFK4tYq/Nmoa1mPE/pnZ1ILe4TFxpdd+SdvOhxrhabXaeLTVjfsHfzSj5K4V8QKfyjnGs3P2UiCt/v/1LeyAsNlXebkbeRSOZ/Q+JCrBH/Yt7IX+qlbhS96dM+Y+dJLC6S+BWRwmazFizf5AEAQPRtHLEhukqMwo8KTfg2oamy8t+e0uvUczwDwDWxhopHBBLvElrc+wUSm/r/IN9a3ZtrbYqUe9eHTc7PZDLvoAcsi/lq2wQSO1M88k93r7ayjzdI76sxEv/5hdryT+foRknM696q9qMg5AEAQHx83WhWtU5i56PtG1E7fYkO+B4SKNd7AoWLBSEv9G3Asol8zOs+ddFTeWc+fDrXgq2MNmEP5+PdKZB/XR4RvRnWe8tjJ8+1ECsL4mA+EQ+vcCg8gHHuPjjZvc5S6guU6/3/POG5rdi+24IEv+KwEgFQ4QFU/rAKTu90pal5fCY60PlQsf22BefHwfUKD2YVfl6ACIAKfx2UX0QNBYj6arqL7bdtSIQBnYy+2iIAzg49Cid9bm3qv11sn21FggeHUwSILGQCgIljd8Kpreq+4Koqts+2QuGBmBL9FLsFSj+sgAKFnyq2v7ZCDoO7dKOvvc7fS3vcW4rts61I8OBxXdI6/UCJADgVvmGVHfMSAelgfUA6VBeQDqmv2nuzZ3rf6Y2r3SM7DB1RwmCnOsLaiGuenbWD/JwAcqI+IEPCL8H6gAwX7omADIn5z/Wqe0Iz1sgI3edSv6EjcR78OEk4jQiJCNhnlwD1ATlBmDqdCUHzcYRf3mXoSCIMXjdK95SeEAbfslUAk4iaEc1EsLnx0vNmAhw3q3mNAFvtFCBd2i8i4bdWAgYCDBkLwIMJw8antTDos12ARSTNM8JK5Amd8URAPmosQAS8Zdr41N/lIQOS0Z2/pkZe0iWoS35+rIY8rPfLvzcWgAdDljMgAr5tlwCEWgArjUxnnJXSmX8eMnQkPrH8OasCJMJgfyEE0KZxMrJ+i2WgyZq6gHTQ0BGFv+abujs//ab4gV0CqEvAar1n0gQXizj9PUNHEmHgTSFt1At4O3eCH+8D0tW2YUmoMkKvfyQzwC/vMHREegN8Tpe4zjIY55fD14+X9tgiwC8mV2ZrHS/LGOGXRd3y8aeKVee/3GrqjBIGMcMsmL/GJu6AW4+1QZRl/mKHADmipD4gz1jJHCIgw9oXJ+8zfVsi/ImXU7bDquvfI2ugZ7wHoiwDUY6BTrbTWRie+ti0d7rGrHTU5UD45StpX5iILPMZrQTD4Q0QG+2GKMckzcF28AXgaYiv7ZNesdokCb90PO0LP2TBpxQezKpFkPmb4Q/ebFlEHOWYZBY8FtriKwDXFDAHhLvr/bJi9TzQtPeycQNUI3HihkML5M9NfB4+caRTl/jHRsvtb333gTzzTUHDPonNZFkkfjVl7Zfr+MRtiMID+McICqtDvfrE2cWfHRxz2j321K155pxE84HLLWb7BK0odX75TEYTBI43hB1ch0HE554h7GJhKrkn/4wPMjfliXMSO4alcsIvx/UanZE17pcGMppkU2iL2zDt9QSZtwqu66/Okdbb88Qd7PydVFYfkGVthLWHHk1JyOteuHRjxpNh3JNjRtE3EgDlGIiwzLlqrq/MbvKtLwkewi/PalPc8PyQPDdIP8lqQvdw92qEZWbNyBqJgnD0VTTI7H74Je/1uRL/8mDr7VWjfYeJkecgdfC/6c8JavPL0+6fitn3JtdIzxbdqLPqiNMmwtAxR7BzZ+mgL2MnHGzHPQhL/wzlmCsLc64PbYPU4Xd1zwN6WdCwT/p61uQXsH6sL5TS/dOUgY4QCZRlxsuD9EDZsM/x4KDnk5ppSsqGfHehw3QjytHfQVj6HaP+U8F1wZbhMf1Dkerzpr3Sn4Ad/5/Yc2T7TQ6OOW2YBWZimAsVRzlaRoL0DMLRV/WW19SVh05+v5nbAxsPCPpZ4Jclwj95b87kF+BgO+5Bg8yFFHKZZkO68XqimoyvGd0FqUNnU/pA1yvTdbaRXwDCtj2CsszFjFLfSjZoRbEiqEqoqtE+6H2VT5LfvPfydtvJJ0V4jb537QhzxjLRdMSsimIhq5q538DNgSnbfqs0FoHrusUd6j2ScdTNyGZTNovfHa8Z6/fmnbwaTq5r+1wj0ziZrjlmvIKYP3ew9Hvk+NOPFpT8AjxHd6ypGOl607Z+YDUL5s4iChpkdq8b7b22KOTVQIPtGxet3bmQtVA6eKhnyBP6hvnPW8UAwvpq1nIdoeS6bpWY0fK3aMfJTCMc/csqtuf+YvNMi68Mt38WDTJPoSx9DGHpmaxLI8hcqBzpCiDB9ibnM87lxeaVLUrKg+1fRVimby3LPItw9G9Rlj6Bssw/EI4+i3DM+0iQPomy9JiD69hdztI7SoPtTWWvddry7w5LWIIx/gdCuvcjoZqlLQAAAABJRU5ErkJggg==",
|
||||||
|
"type": "affiliate",
|
||||||
|
"title": "Google",
|
||||||
|
"url": "https://www.google.com/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bgColor": "#E62117",
|
||||||
|
"directoryId": 10000001,
|
||||||
|
"imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAACd0lEQVR4nO3av0tVYRzH8WOIBEVDUUIGCa32FwQ5OrS42NKeRUOTdGmoqUGiLVBqa5UG+7WUREGiEqhTDkVJEA2iYZBkxKvhHumo96o3uM9z0ucNZ7zn834+XO59znm+WZZIJBKJRCKRSGwCx3AWfbiIaxjEPYzgOd7gLWbwIb8WsFjjWrU9q3U+u1C4/0yeOZ47jOROg6jkrn25e3uji27NbzC9A9n/hWnVNbVut/hOTMZ1bSqT6Ky3+A58jOsXhE/o2Lj4FryILBaSF2gpFtAT2ygCPcUCHse2icDTtcW3YSW2TQRW0JahK7ZJRLoy9Ma2iEhvhoHYFhEZyDAU2yIiwxkeBgj6FSDjXxjN8CpA0A1cxucAWY0wkeFdgKBK/pe7H1fxNUDmTpjLMB8gqLJh631A9dF6IUD2Vsxn+BYgaF0BhSIO4WYgh1osZVgOEFSzgEIRh3EL3wO4FFnOAgVtWUChiKO4gx+BvJSqgEIRx3EXP5stVsoCCkWcxH1N3EeUuoBCEafwshlipS8AJzTxW1DaAnAEtzX5B7F0BeAgrmMphFhpClB9M3UFXwI5oQQFYB8u4H0gl3VE3QninOoxVyyWozwL4AxeB8jdjqWgT4M4jUcB8nbKfKj3AUN4gN8BshphLtQbobIyEeqdYFkZzTAc2yIiw+lcQDoZSmeDe/t0ON+gPIltE4Fnxa3pnp8QacFYbKOAjCnOCOUldKhOUO12Nk+JFUroxFRkwWYypd6cYKGEVvTbfZOil2w3KVqjjHZ047xqKRWbZ4XHVed2Z/2d5a0167vYgHC9z6/df9bWs8L9uXO3RmeFE4lEIpFIJPYKfwAcall+TY3q/wAAAABJRU5ErkJggg==",
|
||||||
|
"type": "affiliate",
|
||||||
|
"title": "YouTube",
|
||||||
|
"url": "https://www.youtube.com/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"directoryId": 10000002,
|
||||||
|
"imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAACT0lEQVR4nO3bzWsTQRgG8PlPHMVLqRVMoQiFehJyUBAFtRCFHspExaaSoFg8CMGPSg+R3kQhh3osIbOlMVrbGKtrsbYESTbB0gqNVGu1WCkWutnXg+ihQjqxi7Oz8w481533+V32iyGEEEIZ76Rho0SZ4ewOG+D3UMatXSx9nPwqb5ySPZC0dPMzhDJelD6IrDCjQijjtvRBJIWGeY3IHkJ2EED2ALKDALIHkB2lAJoujkIwnoNQwoQL96aha3AKQgkTTtyZhKM383D4+gQEoll/AQRiWbg1XILZ+VWwaw6IrE3bgZbejNoAe8+PwEC6DOsbm0Klt679lxQGCESzMD335Z+KKw+wrzcDpcVvOyqvNMCwubjj8soCnBx44Up5ZQGeFZf1BWi7/BhqjthtzpcAseRsQwVrjgNzS9/hZWUFJq3Pf6U5MqoWQHJ8Qbh8aqoKB688cWVfzwBMvP0kVN6srMCec+7t6xmAmfmvQgCRBzOu7usZgHJ1TQjgyI283gCHrj3VG6C9bwwBEAABEEAtgAPRR9A3VKibpdUfQgD9KWvba529+8pbAMF4TqicW+th/r3eAP0pS2+Anvtv9AY4dvu53gCtMfGfI74DWN+wG5rNdwDl6preAGOFj3oDJMcXvAfQHMlAKGHWTeWD2KPw1aFC3et0NPi9wDPvAq/fif0LDMZzru6LALKLIwACIAACIAACIAACIAACIAACIAACIAACIMD/BvDKwUkZAJRx2zNHZyUBFAntTp+WXV4iQCf5c3yecUsXAMq49bv8Txsl6ZCTabOAAAAAAElFTkSuQmCC",
|
||||||
|
"title": "Facebook",
|
||||||
|
"type": "affiliate",
|
||||||
|
"url": "https://www.facebook.com/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bgColor": "#ffffff",
|
||||||
|
"directoryId": 10000003,
|
||||||
|
"imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA/CAYAAABQHc7KAAAEyUlEQVRoge2abYhVRRjHf7veVqSFhIQwa7E3ojXNpSiNgl0S+tAHKUjohbQohUgqKKwMSXpbsATdqOgFU4zKpAzMioploxI/WFBZmhRlL/S2lbpsudvd24dzjve5c58558ycey9B84MB95x5/vM/d+bMzDNHCAQCgUAgEAgE/rf0AOd6lJmKVrdDfI8SfxawIKNcEscfa8TOzBFrlj6Aimd5XnmAbx01TD5xiL3IiH3Y8zm4DXgaGALGMip/DDwHDACXKQ9wA/AiMJyi8T3wAnCvEr841t9tiR2JY/uB443YC4BHgA3ApyntTxD90FuAlaaBU4EfLIHvKIZtnAT8ZtE5O6fGCiNuFJiTM7YNWKe0PQScmRV8ncX4+zkbT1hq0bkyZ/wyI+5ux/bPM+I/ACbnCSyhv8tloMvBQAnYr+h8mDP+PRHzGXCMQ9sA14j4ceAMl+A70HtvjaMJ22jqy4i70Kh/sWO7AO+K+Jdcg6cCh6k3/gfQ6aBTAr5UdN7OiHtL1H3NxXhMN9Fkl2jM89BgPXrv3eKoc71Fx2ZqvqhTJv+kKRkQGjs94gE4PTZgGt9DNMvmpQR8pehst9R/Q9TZ5OG7EzgkNK720DjKNvTeu9RRZ4miMUH9bnCeuH8EOMXD881C40egw0PjKL3oP8Cbjjq2FWGrUW+HuDfg6XmP0NA2W060GYKy97odtbQVoQzMiu+fL66PACd4+O0VGqPANA+NOm5CHwVPOeqUgH2Kzub4/uvi2gOeXrcU8GdlCtG7ZBr/C5juqHWtojMOXCX+HgaO8/B5YqyV6GjZpjf3oI+C+x11JgF7FZ1/xL/v9PS4WmgMempYsW2MfsdtYwTRsqT9mBXgANGIc6WD2lG60EMjk0fRTS931GkHPrdo3ejpbZHQ2B+30XC6iNZm0/Q3RBOcC7Yc4WRPb0NC43ZPjVxsRDe+yFHHHLJJWevhabaIP0z0ujaNWdQmGUn5yEPrPkVnBPe1+0kRv97DhzPb0UdBr6OObZv9kIOGnJzLRPlL0+lFN+6yPe5BH0kV4E/yD+PlIm6bQ/uF2Um98Qlgbs74V5V4WVbl0GgDvsB/BBbiCnTj2lG5yVyqvX+QaOSYOsNk7y8WiPo+c1Ah2tFPesbJTmFfEfX7qU2BZVmRoSPnkMU+D1EUW5L0WErMHKq9P0o149NeqZ+w7wq7qO77f02p11Qmo6/laWnoVlFvnbh+uaJTAW616Dwo6rjmIw3lLnTjminZ+38DM8Q92yv1HfUnOh3AL/H9I7hnpA1lKrXnb0nRkqSXxf0nFC3bK7XMqCdT6o2NeIiirEE3Lvfks6kesI6hf1m2nTt8TW2uIeeLhub8vsxAT5IOUB2+8qTm2RStlYqOnOV7xLXBRj5EUWxJ0hKic/2k98dJ367azh32Es0Tz4hrTcn5fZE9I8s+ajc6m20CgrUWrdVEK0yFJub8RRhEN56UMjk+TVO7xtuK6yFMS1hIuuk82+SETSk6h3A/hmsJ7egfPypEh555ej/hHOzZYktyfl9keiqLzzc+LUlqWc7vSyfRJ3Rpegw4zUOrj/ofoKU5vy/91Jp+vIDWLkPL/J9h/0mmAT9TXa58vvIkzKe6ydpQ3FogEAgEAoFAIBCI+Rf5q90lTPZHIwAAAABJRU5ErkJggg==",
|
||||||
|
"title": "Wikipedia",
|
||||||
|
"type": "affiliate",
|
||||||
|
"url": "https://www.wikipedia.org/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bgColor": "#400090",
|
||||||
|
"directoryId": 10000004,
|
||||||
|
"imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAD3ElEQVR4nO3bS4xecxjH8WmLBVVEx63JBIkEISkhJqURpAsZQioWqpeNSxraYlKpSwiDIRY0aSakqgS9qHRBIhKxYdFFFxWXIGkilYZEUCKj4zLzsfi/LN55zpiZc/lr+/6Ss3nfc57ze77n9r88/y7swxaswgLM7jpMhTlYiNWtnPd1Ga9RfIVtuB+L0J3b/FSFeejDQ9iBvRhrTzYCUKTv8RFewlrcgAtxQsYk5+Ii3IQHsBm78ONkk5oKgIn0Mz7BO3gBA7gHS3EtLsXZre1UnITj2pI5vvV7D85BL67DCvRjEJvwHj7HcBXGqwJwyKoDILeB3OoAyG0gt8oAGMYj0qdnJ17DY3i2vK1CPYmn8Cq2YwgP4rfpBix7BwwE3+aZ2F0ybqQPMSM439NlgpYFMILzAlO9glZXCf2F+cF5LsafZQJX8Q4oujKbK4j9j4aC+EdhT9nAVb0Ebw8MduNABbF/wMlB/LUVxK4MwE84JTC5uoLYK4O48/BrBbEr/Qy+XnCbfloi5h7MCuJurcSxagGMYWFg9qr/SbxQVTeEiq7Ym9OI9UYQ52ipJ1iZ6mgJ3h0Y7zG17usvOC2I01+12ToAHBCMIGHdFGKsCo4/QwJTqerqC2wMEjgGX0zi2KLH6JU6jNYFYBSXBElc/R/HjaE3OO4y1bYs/1WdvcFd4hbilgmOie6cGa1Ytaju7vDSIKHTxc9yUYtvWZ0G6wawH8cGSa0J9r0t2G92K0ZtamJA5PEgsfaOTNHjMlC3uSYADKMnSG6B9GIr6uqehYN1m2tqSGxre4KtJDdhfcF/O5ow1hSAMVweJNmNOcHvlbb3J1KTg6K7MTO62m3Jz1LBQMdk1fSo8IpJALizSUNNA/jWBNPvOFGahG1MOeYFnpgAwHNNm8kB4CDODJI/F380bSbXzNAzAYD1OYzkAjAYABjKYaQDIMdJxQDqnFMsVC4A6wIAgzmMdADkOKkYwKM5jOQCcFcAYCqjxpUpF4Bovu+IB3BfDiO5AIzrFWJlDiO5ACzpABgP4I4cRnIBWBwAWJLDSC4AfR0A4wHcksNILgCLAgB9OYzkAnDFkQ5gDZbj3ta2XCp5bVydYuncBnKrAyC3gdzqAMhtILfqBDCCb6SZ3velatGXsUFa5NC+vdjatrf2/QAfSyUyv9dlsgyAEXyGt/G8VBl+PS7A3PaGTllJCy7n40Zp8GQD3sWXSgCaDIBRqcBxGx7GYmll57hixlySaojPx83SuqW3pLXC0wKwX7oF+3GloILjUJE03X6NtAh8J76LAOzFRtwqKGY63CStX14mLen5+m9Vgqdbrd+9cgAAAABJRU5ErkJggg==",
|
||||||
|
"title": "Yahoo!",
|
||||||
|
"type": "affiliate",
|
||||||
|
"url": "https://www.yahoo.com/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"directoryId": 10000005,
|
||||||
|
"imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAJdklEQVR4nO1ba1QTZwL9iCY8hCDxDUpYOIUDBOVZAlJ5NQXRFlEQ8YGiRaqESlhxeRQ3FAWURRC6FYglqBHTEaI8Eg+CRMRatfKwLNL6oqer1h57XEWYbwJK9sdKixiSmRCCbrnn3D8w351770wy3zd8ADCJSUxiPMHhcPS3bdv2/tq1a9MWL16MODs7t5iamt4zMjLq0dfX76VSqU8sLCzueHt7S+3t7QtjYmLWJyYmzp1o32NGSUmJd0BAQLmRkVEPAEBOhCQS6bm3t7c0MjIyHACgMyEB1AGCILTY2NgUOzu7fwGCoUfj/Pnz/x0XF/fXgoICXW3nIYTs7Owlpqam94CGgo+ktbX1j4mJiY7azIQbMTExu3V0dF6AcQo/RF1dXYggSIj2kuFAfHx8Lhjn4ODVElCxWOygpXjKkZWVxQZaDD9EOp3eXV9fb6yVkKOho6Njgb6+fp8ig9pgfHx8gjZyjgYdX1/fhtHMqSKJRHpOJpNl6o4HAMidnJxatJJUEWpraz3xmBxOExOT30JDQ/+elpZmD14+26uqqubExcVFzJs3T53H5uCJEydMtZN4BKKiovKJmA0KChLu3bt3zmh6Bw4c0F+3bl0BEU0AgLygoCByXAKqgq2tbSdek0FBQTV4dZlM5kW8ugAAOZPJ/IeGIuHH9evXp+no6DzHa7K+vt4Lr3ZiYuIOvLoAALmnp6dQQ7HwIzc31xqvQRsbmy5AYC6fnJzsjlcbACD38/M7p5lUBBEeHp5lbm7+E4lEUnonREdHpxPRLSwsNFWmN5Kurq5XNZNITfj4+EwtLCw0dXFxcebz+UFhYWFbmExm6qZNm/IjIiKyampqDIjonTp1ajp4mwrQNP70BfD5/D9PAcXFxQZcLteOwWCw9u/f/3FwcHC6paVlOfg/K4CUlpbmEB0dvSEkJCTLxsamwtnZuXXmzJmPAACDgEBYRXxjC8jJyfFYtmzZYWNj48dgjCGV8Y0qICsryyQiIiKVTqf/BMYxNHgTC8jPz/+ISqU+AVoKDt6kAnbs2MGeMmXKANByePAmFBAbG5utyJi2OKEFJCcnx+MxqYizZs361d/fvyw9PX0bg8FgZWRk2FZVVc1pampaQERnwgoQi8VLVK0DRpJMJstWrlx5hMPhvMflckmKdN+amSDRdbuenl5fRkaGnyrdt6KAsrKyD4iYpFKpTy9cuPAuHu23ogAmk9lIxGRCQsLneLVLS0tnEdHWegFisXgu0b8ANTc3W+LVT0pKsiSirfUCDh06tJyIQSsrq5tE9PPy8jyI6Gu9gMDAQA5Bg9VE9Hfu3BlFRJ/BYHSMPRUBsNnsfUQMksnkciL6q1ev5hHRNzQ07AHa3D9A9N19QEAA7lfiAAAdOp3eTUQfACBHEMR87MlwgmgBZmZm9wHOK1RUVLSFiPYQd+/eHaOheKrB4XCyiBrk8XguqnTb29vNDAwMeolqAwDkCxcuvKbBiMoREhLyKVGDy5cvr1Cm2d3dPd3Ly+sCUd3h3LNnT7xGg46GoqKiQHUMbt68uZjL5VJG6qWkpPjS6fS76miO4Ivm5maVd9qYUV5ePlPdtb+FhUV3cHBwkbm5efrGjRvz7O3tr2og+O90dHRslUqlUxX5lkq5U7HmJEtUsnTxwG0kEJ7b4Cer32ArlXIVHq8ULBarVpPGNcng4GDP4V6xloxArNq3oq+M9hTlUeSvsfwvPxMuoKGhwWO8N0RRKBSM6Bg6nf4jgiC0zk6Egl3czsYQhxsKQ48g4QIAAMDf3//0eIWn0WiPjh075jx79uyHeMfY2dl1IAgyFwAAZA1rjqE8ihw9rPscrXRp7xO5lckaN6X0t+dt7m/LiYanPI+iPPLgmApoa2t75+W7fY2GX7RoUcvx48fpAAAgEom88NwJLBbr65ycnGlD3gZuli15VhfC6JZy9Ubzj1W6to6pAAAAEAgEDsbGxv/RVHh3d/ezEomEOvwcqamp6crGsNns/NHeLg0HPPOhV98Pf2ynQRHG+ZcFDKpdAAAAFBcX+6qzF3gkly5dqjCIVCrVs7e3v6RozKpVqw6q8idrybCFonfrUB5FDqsWfzv0c1jh2IHyKHIotL0J+lsyY7CqJXmyO4hamw/Ly8vnhIeH51Op1KdEQtNotN9WrFjxpVAodFOmv337dkMmk1k9NI5CoWCZmZk7EQSZouj4bilfT/ZtUjhW4yNCDxv0ozyKHJaZ9Mq+S1sDAACdnQgF8o1RlEeRy5picsDA3dPv9QnMHqI88iAUudYNdJV4q1NEXFyc7q5duzZ4eXmdtLKyukUikV6ZL1Cp1CeOjo6tHh4eRVwudwWfzx/1MzoSXC53alRUVCaLxapjs9kBio55fC3bGPvm0wRUQL/3yjc9n9Yz0HX090zolTSP//2OPIjdEVkDAAB42nmYJjsbWjo0CEMcfoCNkXvR5lh3BAlT2LQqhIWFTZFIJFSJRELdunUrWR0NVXhc/zdj9MxHa6B4qRAemfHasx6rYUnQjn8uGD5G9k3CHpRHkcvqQk+8Joh1lX2AHl9wf+RkAWtYvx9eSvaWSn2Iz5w0jId1O6fJLn8Wila6iVCe/oCiZ3sff8YT7CLnE6BgJQoRhxtoqcmz3l8vK9629+xW6Sx4dnUmLJv55DXxo3MeQ8ThDKxlfS77Pm8F1pxkqegkmsItSZxu75nAhf1NMZFY47ov4MlFzejLz69ClhrB/vObc3uuZM5QpIf9fM4K5VHk/W25sSpP3tdaaArPrBSgJbovlM6m+LQeWO13HqtwO4i1Zn0CRZ5+2Hf7bB5cK8a9P6hbytfDOgqsMJErC7vyWRw87VUERR5X0VJDiGc2h/IocljL+rr3Klfpv9pg9xttsLOrVIcfDtltEQOtcP0CFZg/wGvmjysyvQ8VmP8ChTa3McThBiZya8NEbm3YSUYXFNrcRgXmv8Ay2jOUp0tMd9gdidWHFsiuH2QQCqUOuFwuSXY5ZT1a6dyullkNEiKMLky6NaYTeX2JrRXILqcslIkDk2GFYyP6lSE27oGPzHiKVTiJZdV+qf2dh50mJPRo6Jby9bBLycvRSpcCeNLpe7SEovw7Aw+/MpDBUx5XsNqAbHgp2buzc4KutDp4dHGXEVq3xh02fbwFq2Htg5WuQljlcwFWLOqAJ97p7hOYPewTmD2EQuu76Emn67DauxmtdEawap8ceH5TNFofznxQs5XQBstJTGISk1AX/wUPVWOeSpK50AAAAABJRU5ErkJggg==",
|
||||||
|
"title": "Amazon",
|
||||||
|
"type": "affiliate",
|
||||||
|
"url": "https://www.amazon.com/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -260,6 +260,8 @@ var gPage = {
|
||||||
onPageVisibleAndLoaded() {
|
onPageVisibleAndLoaded() {
|
||||||
// Send the index of the last visible tile.
|
// Send the index of the last visible tile.
|
||||||
this.reportLastVisibleTileIndex();
|
this.reportLastVisibleTileIndex();
|
||||||
|
// Maybe tell the user they can undo an initial automigration
|
||||||
|
this.maybeShowAutoMigrationUndoNotification();
|
||||||
},
|
},
|
||||||
|
|
||||||
reportLastVisibleTileIndex() {
|
reportLastVisibleTileIndex() {
|
||||||
|
@ -287,5 +289,9 @@ var gPage = {
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryLinksProvider.reportSitesAction(sites, "view", lastIndex);
|
DirectoryLinksProvider.reportSitesAction(sites, "view", lastIndex);
|
||||||
}
|
},
|
||||||
|
|
||||||
|
maybeShowAutoMigrationUndoNotification() {
|
||||||
|
sendAsyncMessage("NewTab:MaybeShowAutoMigrationUndoNotification");
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"extends": [
|
||||||
|
"../../../../../testing/mochitest/browser.eslintrc.js"
|
||||||
|
]
|
||||||
|
};
|
|
@ -16,6 +16,7 @@ let hasContainers = Services.prefs.getBoolPref("privacy.userContext.enabled");
|
||||||
const example_base = "http://example.com/browser/browser/base/content/test/general/";
|
const example_base = "http://example.com/browser/browser/base/content/test/general/";
|
||||||
const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
|
const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
|
||||||
|
|
||||||
|
/* import-globals-from contextmenu_common.js */
|
||||||
Services.scriptloader.loadSubScript(chrome_base + "contextmenu_common.js", this);
|
Services.scriptloader.loadSubScript(chrome_base + "contextmenu_common.js", this);
|
||||||
|
|
||||||
// Below are test cases for XUL element
|
// Below are test cases for XUL element
|
||||||
|
|
|
@ -10,6 +10,7 @@ add_task(function* test_setup() {
|
||||||
|
|
||||||
const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
|
const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
|
||||||
const contextmenu_common = chrome_base + "contextmenu_common.js";
|
const contextmenu_common = chrome_base + "contextmenu_common.js";
|
||||||
|
/* import-globals-from contextmenu_common.js */
|
||||||
Services.scriptloader.loadSubScript(contextmenu_common, this);
|
Services.scriptloader.loadSubScript(contextmenu_common, this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,7 @@ function test() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
.getService(Ci.mozIJSSubScriptLoader)
|
.getService(Ci.mozIJSSubScriptLoader)
|
||||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||||
|
|
|
@ -8,6 +8,7 @@ const SAVE_PER_SITE_PREF = "browser.download.lastDir.savePerSite";
|
||||||
const ALWAYS_DOWNLOAD_DIR_PREF = "browser.download.useDownloadDir";
|
const ALWAYS_DOWNLOAD_DIR_PREF = "browser.download.useDownloadDir";
|
||||||
const UCT_URI = "chrome://mozapps/content/downloads/unknownContentType.xul";
|
const UCT_URI = "chrome://mozapps/content/downloads/unknownContentType.xul";
|
||||||
|
|
||||||
|
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
.getService(Ci.mozIJSSubScriptLoader)
|
.getService(Ci.mozIJSSubScriptLoader)
|
||||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||||
|
@ -170,4 +171,3 @@ function test() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ add_task(function* () {
|
||||||
yield BrowserTestUtils.closeWindow(privateWindow);
|
yield BrowserTestUtils.closeWindow(privateWindow);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
.getService(Ci.mozIJSSubScriptLoader)
|
.getService(Ci.mozIJSSubScriptLoader)
|
||||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||||
|
|
|
@ -70,7 +70,7 @@ add_task(function* () {
|
||||||
yield transferCompletePromise;
|
yield transferCompletePromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
.getService(Ci.mozIJSSubScriptLoader)
|
.getService(Ci.mozIJSSubScriptLoader)
|
||||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||||
|
|
|
@ -7,6 +7,7 @@ const VIDEO_URL = "http://mochi.test:8888/browser/browser/base/content/test/gene
|
||||||
* mockTransfer.js provides a utility that lets us mock out
|
* mockTransfer.js provides a utility that lets us mock out
|
||||||
* the "Save File" dialog.
|
* the "Save File" dialog.
|
||||||
*/
|
*/
|
||||||
|
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
.getService(Ci.mozIJSSubScriptLoader)
|
.getService(Ci.mozIJSSubScriptLoader)
|
||||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||||
|
|
|
@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462856
|
||||||
</div>
|
</div>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
<script class="testbody" type="text/javascript">
|
<script class="testbody" type="text/javascript">
|
||||||
|
/* import-globals-from offlineByDefault.js */
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
const Cc = SpecialPowers.Cc;
|
const Cc = SpecialPowers.Cc;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
||||||
"resource://gre/modules/PromiseUtils.jsm");
|
"resource://gre/modules/PromiseUtils.jsm");
|
||||||
|
|
||||||
|
// Various tests in this directory may define gTestBrowser, to use as the
|
||||||
|
// default browser under test in some of the functions below.
|
||||||
|
/* global gTestBrowser */
|
||||||
|
|
||||||
// The blocklist shim running in the content process does not initialize at
|
// The blocklist shim running in the content process does not initialize at
|
||||||
// start up, so it's not active until we load content that needs to do a
|
// start up, so it's not active until we load content that needs to do a
|
||||||
// check. This helper bypasses the delay to get the svc up and running
|
// check. This helper bypasses the delay to get the svc up and running
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"extends": [
|
||||||
|
"../../../../../testing/mochitest/browser.eslintrc.js"
|
||||||
|
]
|
||||||
|
};
|
|
@ -128,6 +128,7 @@ browser.jar:
|
||||||
* content/browser/newtab/newTab.js (content/newtab/newTab.js)
|
* content/browser/newtab/newTab.js (content/newtab/newTab.js)
|
||||||
content/browser/newtab/newTab.css (content/newtab/newTab.css)
|
content/browser/newtab/newTab.css (content/newtab/newTab.css)
|
||||||
content/browser/newtab/newTab.inadjacent.json (content/newtab/newTab.inadjacent.json)
|
content/browser/newtab/newTab.inadjacent.json (content/newtab/newTab.inadjacent.json)
|
||||||
|
content/browser/newtab/alternativeDefaultSites.json (content/newtab/alternativeDefaultSites.json)
|
||||||
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
|
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
|
||||||
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
|
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
|
||||||
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)
|
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)
|
||||||
|
|
|
@ -908,7 +908,7 @@ WebContentConverterRegistrarContent.prototype = {
|
||||||
.sort();
|
.sort();
|
||||||
|
|
||||||
// now register them
|
// now register them
|
||||||
for (num of nums) {
|
for (let num of nums) {
|
||||||
let branch = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + num + ".");
|
let branch = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + num + ".");
|
||||||
try {
|
try {
|
||||||
this._registerContentHandlerHavingBranch(branch);
|
this._registerContentHandlerHavingBranch(branch);
|
||||||
|
|
|
@ -16,7 +16,7 @@ const kAutoMigrateBrowserPref = "browser.migrate.automigrate.browser";
|
||||||
const kAutoMigrateLastUndoPromptDateMsPref = "browser.migrate.automigrate.lastUndoPromptDateMs";
|
const kAutoMigrateLastUndoPromptDateMsPref = "browser.migrate.automigrate.lastUndoPromptDateMs";
|
||||||
const kAutoMigrateDaysToOfferUndoPref = "browser.migrate.automigrate.daysToOfferUndo";
|
const kAutoMigrateDaysToOfferUndoPref = "browser.migrate.automigrate.daysToOfferUndo";
|
||||||
|
|
||||||
const kNotificationId = "abouthome-automigration-undo";
|
const kNotificationId = "automigration-undo";
|
||||||
|
|
||||||
Cu.import("resource:///modules/MigrationUtils.jsm");
|
Cu.import("resource:///modules/MigrationUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||||
|
@ -255,14 +255,15 @@ const AutoMigrate = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The tab might have navigated since we requested the undo state:
|
// The tab might have navigated since we requested the undo state:
|
||||||
if (target.currentURI.spec != "about:home" ||
|
let canUndoFromThisPage = ["about:home", "about:newtab"].includes(target.currentURI.spec);
|
||||||
|
if (!canUndoFromThisPage ||
|
||||||
!Preferences.get(kUndoUIEnabledPref, false)) {
|
!Preferences.get(kUndoUIEnabledPref, false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let win = target.ownerGlobal;
|
let win = target.ownerGlobal;
|
||||||
let notificationBox = win.gBrowser.getNotificationBox(target);
|
let notificationBox = win.gBrowser.getNotificationBox(target);
|
||||||
if (!notificationBox || notificationBox.getNotificationWithValue("abouthome-automigration-undo")) {
|
if (!notificationBox || notificationBox.getNotificationWithValue(kNotificationId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
|
||||||
|
|
||||||
MARIONETTE_UNIT_MANIFESTS += ['tests/marionette/manifest.ini']
|
MARIONETTE_UNIT_MANIFESTS += ['tests/marionette/manifest.ini']
|
||||||
|
|
||||||
|
BROWSER_CHROME_MANIFESTS += [ 'tests/browser/browser.ini']
|
||||||
|
|
||||||
JAR_MANIFESTS += ['jar.mn']
|
JAR_MANIFESTS += ['jar.mn']
|
||||||
|
|
||||||
XPIDL_SOURCES += [
|
XPIDL_SOURCES += [
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"extends": [
|
||||||
|
"../../../../../testing/mochitest/browser.eslintrc.js",
|
||||||
|
"../../../../../testing/mochitest/mochitest.eslintrc.js",
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
[browser_undo_notification.js]
|
|
@ -0,0 +1,60 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
let scope = {};
|
||||||
|
Cu.import("resource:///modules/AutoMigrate.jsm", scope);
|
||||||
|
let oldCanUndo = scope.AutoMigrate.canUndo;
|
||||||
|
let oldUndo = scope.AutoMigrate.undo;
|
||||||
|
registerCleanupFunction(function() {
|
||||||
|
Cu.reportError("Cleaning up");
|
||||||
|
scope.AutoMigrate.canUndo = oldCanUndo;
|
||||||
|
scope.AutoMigrate.undo = oldUndo;
|
||||||
|
Cu.reportError("Cleaned up");
|
||||||
|
});
|
||||||
|
|
||||||
|
const kExpectedNotificationId = "automigration-undo";
|
||||||
|
|
||||||
|
add_task(function* autoMigrationUndoNotificationShows() {
|
||||||
|
let getNotification = browser =>
|
||||||
|
gBrowser.getNotificationBox(browser).getNotificationWithValue(kExpectedNotificationId);
|
||||||
|
|
||||||
|
scope.AutoMigrate.canUndo = () => true;
|
||||||
|
let undoCalled;
|
||||||
|
scope.AutoMigrate.undo = () => { undoCalled = true };
|
||||||
|
for (let url of ["about:newtab", "about:home"]) {
|
||||||
|
undoCalled = false;
|
||||||
|
// Can't use pushPrefEnv because of bug 1323779
|
||||||
|
Services.prefs.setCharPref("browser.migrate.automigrate.browser", "someunknownbrowser");
|
||||||
|
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url, false);
|
||||||
|
let browser = tab.linkedBrowser;
|
||||||
|
if (!getNotification(browser)) {
|
||||||
|
info(`Notification for ${url} not immediately present, waiting for it.`);
|
||||||
|
yield BrowserTestUtils.waitForNotificationBar(gBrowser, browser, kExpectedNotificationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ok(true, `Got notification for ${url}`);
|
||||||
|
let notification = getNotification(browser);
|
||||||
|
let notificationBox = notification.parentNode;
|
||||||
|
notification.querySelector("button.notification-button-default").click();
|
||||||
|
ok(!undoCalled, "Undo should not be called when clicking the default button");
|
||||||
|
is(notification, notificationBox._closedNotification, "Notification should be closing");
|
||||||
|
yield BrowserTestUtils.removeTab(tab);
|
||||||
|
|
||||||
|
undoCalled = false;
|
||||||
|
Services.prefs.setCharPref("browser.migrate.automigrate.browser", "someunknownbrowser");
|
||||||
|
tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url, false);
|
||||||
|
browser = tab.linkedBrowser;
|
||||||
|
if (!getNotification(browser)) {
|
||||||
|
info(`Notification for ${url} not immediately present, waiting for it.`);
|
||||||
|
yield BrowserTestUtils.waitForNotificationBar(gBrowser, browser, kExpectedNotificationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ok(true, `Got notification for ${url}`);
|
||||||
|
notification = getNotification(browser);
|
||||||
|
notificationBox = notification.parentNode;
|
||||||
|
notification.querySelector("button:not(.notification-button-default)").click();
|
||||||
|
ok(undoCalled, "Undo should be called when clicking the non-default (Don't Keep) button");
|
||||||
|
is(notification, notificationBox._closedNotification, "Notification should be closing");
|
||||||
|
yield BrowserTestUtils.removeTab(tab);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||||
|
|
||||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
|
/* import-globals-from ../../../../../testing/modules/sinon-1.16.1.js */
|
||||||
Services.scriptloader.loadSubScript("resource://testing-common/sinon-1.16.1.js");
|
Services.scriptloader.loadSubScript("resource://testing-common/sinon-1.16.1.js");
|
||||||
|
|
||||||
const TEST_HOST = "example.com";
|
const TEST_HOST = "example.com";
|
||||||
|
|
|
@ -7,6 +7,7 @@ if (jar) {
|
||||||
let tmpdir = extractJarToTmp(jar);
|
let tmpdir = extractJarToTmp(jar);
|
||||||
rootDir = "file://" + tmpdir.path + '/';
|
rootDir = "file://" + tmpdir.path + '/';
|
||||||
}
|
}
|
||||||
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
|
|
|
@ -6,6 +6,7 @@ if (jar) {
|
||||||
let tmpdir = extractJarToTmp(jar);
|
let tmpdir = extractJarToTmp(jar);
|
||||||
rootDir = "file://" + tmpdir.path + '/';
|
rootDir = "file://" + tmpdir.path + '/';
|
||||||
}
|
}
|
||||||
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
|
|
|
@ -8,6 +8,7 @@ if (jar) {
|
||||||
let tmpdir = extractJarToTmp(jar);
|
let tmpdir = extractJarToTmp(jar);
|
||||||
rootDir = "file://" + tmpdir.path + '/';
|
rootDir = "file://" + tmpdir.path + '/';
|
||||||
}
|
}
|
||||||
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
|
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ if (jar) {
|
||||||
let tmpdir = extractJarToTmp(jar);
|
let tmpdir = extractJarToTmp(jar);
|
||||||
rootDir = "file://" + tmpdir.path + '/';
|
rootDir = "file://" + tmpdir.path + '/';
|
||||||
}
|
}
|
||||||
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
|
|
|
@ -6,6 +6,7 @@ if (jar) {
|
||||||
let tmpdir = extractJarToTmp(jar);
|
let tmpdir = extractJarToTmp(jar);
|
||||||
rootDir = "file://" + tmpdir.path + '/';
|
rootDir = "file://" + tmpdir.path + '/';
|
||||||
}
|
}
|
||||||
|
/* import-globals-from privacypane_tests_perwindow.js */
|
||||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||||
|
|
||||||
run_test_subset([
|
run_test_subset([
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// Imported via permissions.xul.
|
||||||
|
/* import-globals-from ../../../toolkit/content/treeUtils.js */
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// These globals are imported via placesOverlay.xul.
|
||||||
|
/* globals PlacesUIUtils, PlacesUtils, NS_ASSERT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SelectBookmarkDialog controls the user interface for the "Use Bookmark for
|
* SelectBookmarkDialog controls the user interface for the "Use Bookmark for
|
||||||
* Home Page" dialog.
|
* Home Page" dialog.
|
||||||
|
|
|
@ -185,7 +185,6 @@
|
||||||
@RESPATH@/components/content_webrtc.xpt
|
@RESPATH@/components/content_webrtc.xpt
|
||||||
#endif
|
#endif
|
||||||
@RESPATH@/components/content_xslt.xpt
|
@RESPATH@/components/content_xslt.xpt
|
||||||
@RESPATH@/components/cookie.xpt
|
|
||||||
@RESPATH@/components/directory.xpt
|
@RESPATH@/components/directory.xpt
|
||||||
@RESPATH@/components/docshell.xpt
|
@RESPATH@/components/docshell.xpt
|
||||||
@RESPATH@/components/dom.xpt
|
@RESPATH@/components/dom.xpt
|
||||||
|
|
|
@ -21,6 +21,8 @@ contextMenuSearch.accesskey=S
|
||||||
bookmarkAllTabsDefault=[Folder Name]
|
bookmarkAllTabsDefault=[Folder Name]
|
||||||
|
|
||||||
xpinstallPromptMessage=%S prevented this site from asking you to install software on your computer.
|
xpinstallPromptMessage=%S prevented this site from asking you to install software on your computer.
|
||||||
|
xpinstallPromptMessage.dontAllow=Don’t Allow
|
||||||
|
xpinstallPromptMessage.dontAllow.accesskey=D
|
||||||
xpinstallPromptAllowButton=Allow
|
xpinstallPromptAllowButton=Allow
|
||||||
# Accessibility Note:
|
# Accessibility Note:
|
||||||
# Be sure you do not choose an accesskey that is used elsewhere in the active context (e.g. main menu bar, submenu of the warning popup button)
|
# Be sure you do not choose an accesskey that is used elsewhere in the active context (e.g. main menu bar, submenu of the warning popup button)
|
||||||
|
|
|
@ -13,10 +13,12 @@ this.EXPORTED_SYMBOLS = [ "AboutNewTab" ];
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "RemotePages",
|
XPCOMUtils.defineLazyModuleGetter(this, "AutoMigrate",
|
||||||
"resource://gre/modules/RemotePageManager.jsm");
|
"resource:///modules/AutoMigrate.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
|
||||||
"resource://gre/modules/NewTabUtils.jsm");
|
"resource://gre/modules/NewTabUtils.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "RemotePages",
|
||||||
|
"resource://gre/modules/RemotePageManager.jsm");
|
||||||
|
|
||||||
var AboutNewTab = {
|
var AboutNewTab = {
|
||||||
|
|
||||||
|
@ -25,6 +27,8 @@ var AboutNewTab = {
|
||||||
init() {
|
init() {
|
||||||
this.pageListener = new RemotePages("about:newtab");
|
this.pageListener = new RemotePages("about:newtab");
|
||||||
this.pageListener.addMessageListener("NewTab:Customize", this.customize.bind(this));
|
this.pageListener.addMessageListener("NewTab:Customize", this.customize.bind(this));
|
||||||
|
this.pageListener.addMessageListener("NewTab:MaybeShowAutoMigrationUndoNotification",
|
||||||
|
(msg) => AutoMigrate.maybeShowUndoNotification(msg.target.browser));
|
||||||
},
|
},
|
||||||
|
|
||||||
customize(message) {
|
customize(message) {
|
||||||
|
|
|
@ -49,7 +49,10 @@ module.exports = createClass({
|
||||||
window.removeEventListener("keydown", this.onKeyDown, true);
|
window.removeEventListener("keydown", this.onKeyDown, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDeviceCheckboxClick({ target }) {
|
onDeviceCheckboxChange({ nativeEvent: { button }, target }) {
|
||||||
|
if (button !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
[target.value]: !this.state[target.value]
|
[target.value]: !this.state[target.value]
|
||||||
});
|
});
|
||||||
|
@ -154,7 +157,7 @@ module.exports = createClass({
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
value: device.name,
|
value: device.name,
|
||||||
checked: this.state[device.name],
|
checked: this.state[device.name],
|
||||||
onChange: this.onDeviceCheckboxClick,
|
onChange: this.onDeviceCheckboxChange,
|
||||||
}),
|
}),
|
||||||
device.name
|
device.name
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,6 +30,9 @@ const { changeDisplayPixelRatio } = require("./actions/display-pixel-ratio");
|
||||||
const { addViewport, resizeViewport } = require("./actions/viewports");
|
const { addViewport, resizeViewport } = require("./actions/viewports");
|
||||||
const { loadDevices } = require("./actions/devices");
|
const { loadDevices } = require("./actions/devices");
|
||||||
|
|
||||||
|
// Exposed for use by tests
|
||||||
|
window.require = require;
|
||||||
|
|
||||||
let bootstrap = {
|
let bootstrap = {
|
||||||
|
|
||||||
telemetry: new Telemetry(),
|
telemetry: new Telemetry(),
|
||||||
|
@ -44,7 +47,6 @@ let bootstrap = {
|
||||||
"agent");
|
"agent");
|
||||||
this.telemetry.toolOpened("responsive");
|
this.telemetry.toolOpened("responsive");
|
||||||
let store = this.store = Store();
|
let store = this.store = Store();
|
||||||
this.dispatch(loadDevices());
|
|
||||||
let provider = createElement(Provider, { store }, App());
|
let provider = createElement(Provider, { store }, App());
|
||||||
ReactDOM.render(provider, document.querySelector("#root"));
|
ReactDOM.render(provider, document.querySelector("#root"));
|
||||||
message.post(window, "init:done");
|
message.post(window, "init:done");
|
||||||
|
@ -76,6 +78,10 @@ let bootstrap = {
|
||||||
// manager.js sends a message to signal init
|
// manager.js sends a message to signal init
|
||||||
message.wait(window, "init").then(() => bootstrap.init());
|
message.wait(window, "init").then(() => bootstrap.init());
|
||||||
|
|
||||||
|
// manager.js sends a message to signal init is done, which can be used for delayed
|
||||||
|
// startup work that shouldn't block initial load
|
||||||
|
message.wait(window, "post-init").then(() => bootstrap.dispatch(loadDevices()));
|
||||||
|
|
||||||
window.addEventListener("unload", function onUnload() {
|
window.addEventListener("unload", function onUnload() {
|
||||||
window.removeEventListener("unload", onUnload);
|
window.removeEventListener("unload", onUnload);
|
||||||
bootstrap.destroy();
|
bootstrap.destroy();
|
||||||
|
|
|
@ -345,6 +345,9 @@ ResponsiveUI.prototype = {
|
||||||
|
|
||||||
// Get the protocol ready to speak with emulation actor
|
// Get the protocol ready to speak with emulation actor
|
||||||
yield this.connectToServer();
|
yield this.connectToServer();
|
||||||
|
|
||||||
|
// Non-blocking message to tool UI to start any delayed init activities
|
||||||
|
message.post(this.toolWindow, "post-init");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -114,8 +114,9 @@ addRDMTask(TEST_URL, function* ({ ui }) {
|
||||||
let { store, document } = ui.toolWindow;
|
let { store, document } = ui.toolWindow;
|
||||||
let select = document.querySelector(".viewport-device-selector");
|
let select = document.querySelector(".viewport-device-selector");
|
||||||
|
|
||||||
// Wait until the viewport has been added
|
// Wait until the viewport has been added and the device list has been loaded
|
||||||
yield waitUntilState(store, state => state.viewports.length == 1);
|
yield waitUntilState(store, state => state.viewports.length == 1
|
||||||
|
&& state.devices.listState == Types.deviceListState.LOADED);
|
||||||
|
|
||||||
openDeviceModal(ui);
|
openDeviceModal(ui);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,11 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
const TEST_URL = "data:text/html;charset=utf-8,";
|
const TEST_URL = "data:text/html;charset=utf-8,";
|
||||||
|
|
||||||
addRDMTask(TEST_URL, function* ({ ui, manager }) {
|
addRDMTask(TEST_URL, function* ({ ui, manager }) {
|
||||||
ok(ui, "An instance of the RDM should be attached to the tab.");
|
let store = ui.toolWindow.store;
|
||||||
|
|
||||||
|
// Wait until the viewport has been added
|
||||||
|
yield waitUntilState(store, state => state.viewports.length == 1);
|
||||||
|
|
||||||
yield setViewportSize(ui, manager, 300, 300);
|
yield setViewportSize(ui, manager, 300, 300);
|
||||||
|
|
||||||
// Do horizontal + vertical resize
|
// Do horizontal + vertical resize
|
||||||
|
|
|
@ -216,8 +216,10 @@ function* testViewportResize(ui, selector, moveBy,
|
||||||
`The y move of ${selector} is as expected`);
|
`The y move of ${selector} is as expected`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openDeviceModal({toolWindow}) {
|
function openDeviceModal({ toolWindow }) {
|
||||||
let { document } = toolWindow;
|
let { document } = toolWindow;
|
||||||
|
let React = toolWindow.require("devtools/client/shared/vendor/react");
|
||||||
|
let { Simulate } = React.addons.TestUtils;
|
||||||
let select = document.querySelector(".viewport-device-selector");
|
let select = document.querySelector(".viewport-device-selector");
|
||||||
let modal = document.querySelector("#device-modal-wrapper");
|
let modal = document.querySelector("#device-modal-wrapper");
|
||||||
|
|
||||||
|
@ -226,16 +228,8 @@ function openDeviceModal({toolWindow}) {
|
||||||
"The device modal is closed by default.");
|
"The device modal is closed by default.");
|
||||||
|
|
||||||
info("Opening device modal through device selector.");
|
info("Opening device modal through device selector.");
|
||||||
|
|
||||||
let event = new toolWindow.UIEvent("change", {
|
|
||||||
view: toolWindow,
|
|
||||||
bubbles: true,
|
|
||||||
cancelable: true
|
|
||||||
});
|
|
||||||
|
|
||||||
select.value = OPEN_DEVICE_MODAL_VALUE;
|
select.value = OPEN_DEVICE_MODAL_VALUE;
|
||||||
select.dispatchEvent(event);
|
Simulate.change(select);
|
||||||
|
|
||||||
ok(modal.classList.contains("opened") && !modal.classList.contains("closed"),
|
ok(modal.classList.contains("opened") && !modal.classList.contains("closed"),
|
||||||
"The device modal is displayed.");
|
"The device modal is displayed.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3651,16 +3651,6 @@ nsDocument::TryChannelCharset(nsIChannel *aChannel,
|
||||||
already_AddRefed<nsIPresShell>
|
already_AddRefed<nsIPresShell>
|
||||||
nsDocument::CreateShell(nsPresContext* aContext, nsViewManager* aViewManager,
|
nsDocument::CreateShell(nsPresContext* aContext, nsViewManager* aViewManager,
|
||||||
StyleSetHandle aStyleSet)
|
StyleSetHandle aStyleSet)
|
||||||
{
|
|
||||||
// Don't add anything here. Add it to |doCreateShell| instead.
|
|
||||||
// This exists so that subclasses can pass other values for the 4th
|
|
||||||
// parameter some of the time.
|
|
||||||
return doCreateShell(aContext, aViewManager, aStyleSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsIPresShell>
|
|
||||||
nsDocument::doCreateShell(nsPresContext* aContext,
|
|
||||||
nsViewManager* aViewManager, StyleSetHandle aStyleSet)
|
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!mPresShell, "We have a presshell already!");
|
NS_ASSERTION(!mPresShell, "We have a presshell already!");
|
||||||
|
|
||||||
|
|
|
@ -593,10 +593,10 @@ public:
|
||||||
* its presentation context (presentation contexts <b>must not</b> be
|
* its presentation context (presentation contexts <b>must not</b> be
|
||||||
* shared among multiple presentation shells).
|
* shared among multiple presentation shells).
|
||||||
*/
|
*/
|
||||||
virtual already_AddRefed<nsIPresShell> CreateShell(
|
already_AddRefed<nsIPresShell> CreateShell(nsPresContext* aContext,
|
||||||
nsPresContext* aContext,
|
nsViewManager* aViewManager,
|
||||||
nsViewManager* aViewManager,
|
mozilla::StyleSetHandle aStyleSet)
|
||||||
mozilla::StyleSetHandle aStyleSet) override;
|
final;
|
||||||
virtual void DeleteShell() override;
|
virtual void DeleteShell() override;
|
||||||
|
|
||||||
virtual nsresult GetAllowPlugins(bool* aAllowPlugins) override;
|
virtual nsresult GetAllowPlugins(bool* aAllowPlugins) override;
|
||||||
|
@ -1273,10 +1273,6 @@ public:
|
||||||
bool ContainsMSEContent();
|
bool ContainsMSEContent();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
already_AddRefed<nsIPresShell> doCreateShell(nsPresContext* aContext,
|
|
||||||
nsViewManager* aViewManager,
|
|
||||||
mozilla::StyleSetHandle aStyleSet);
|
|
||||||
|
|
||||||
void RemoveDocStyleSheetsFromStyleSets();
|
void RemoveDocStyleSheetsFromStyleSets();
|
||||||
void RemoveStyleSheetsFromStyleSets(
|
void RemoveStyleSheetsFromStyleSets(
|
||||||
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets,
|
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets,
|
||||||
|
|
|
@ -5,7 +5,7 @@ var {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||||
const BASE_URI = "http://mochi.test:8888/browser/dom/base/test/empty.html";
|
const BASE_URI = "http://mochi.test:8888/browser/dom/base/test/empty.html";
|
||||||
|
|
||||||
add_task(function* test_initialize() {
|
add_task(function* test_initialize() {
|
||||||
let tab = gBrowser.addTab(BASE_URI);
|
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, BASE_URI);
|
||||||
let browser = gBrowser.getBrowserForTab(tab);
|
let browser = gBrowser.getBrowserForTab(tab);
|
||||||
|
|
||||||
let blob = yield ContentTask.spawn(browser, null, function() {
|
let blob = yield ContentTask.spawn(browser, null, function() {
|
||||||
|
|
|
@ -267,14 +267,6 @@ nsHTMLDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
|
||||||
SetContentTypeInternal(nsDependentCString("text/html"));
|
SetContentTypeInternal(nsDependentCString("text/html"));
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIPresShell>
|
|
||||||
nsHTMLDocument::CreateShell(nsPresContext* aContext,
|
|
||||||
nsViewManager* aViewManager,
|
|
||||||
StyleSetHandle aStyleSet)
|
|
||||||
{
|
|
||||||
return doCreateShell(aContext, aViewManager, aStyleSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHTMLDocument::TryHintCharset(nsIContentViewer* aCv,
|
nsHTMLDocument::TryHintCharset(nsIContentViewer* aCv,
|
||||||
int32_t& aCharsetSource, nsACString& aCharset)
|
int32_t& aCharsetSource, nsACString& aCharset)
|
||||||
|
|
|
@ -54,11 +54,6 @@ public:
|
||||||
virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
|
virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
|
||||||
nsIPrincipal* aPrincipal) override;
|
nsIPrincipal* aPrincipal) override;
|
||||||
|
|
||||||
virtual already_AddRefed<nsIPresShell> CreateShell(
|
|
||||||
nsPresContext* aContext,
|
|
||||||
nsViewManager* aViewManager,
|
|
||||||
mozilla::StyleSetHandle aStyleSet) override;
|
|
||||||
|
|
||||||
virtual nsresult StartDocumentLoad(const char* aCommand,
|
virtual nsresult StartDocumentLoad(const char* aCommand,
|
||||||
nsIChannel* aChannel,
|
nsIChannel* aChannel,
|
||||||
nsILoadGroup* aLoadGroup,
|
nsILoadGroup* aLoadGroup,
|
||||||
|
|
|
@ -1595,14 +1595,18 @@ TabChild::RecvRealMouseButtonEvent(const WidgetMouseEvent& aEvent,
|
||||||
// actually go through the APZ code and so their mHandledByAPZ flag is false.
|
// actually go through the APZ code and so their mHandledByAPZ flag is false.
|
||||||
// Since thos events didn't go through APZ, we don't need to send notifications
|
// Since thos events didn't go through APZ, we don't need to send notifications
|
||||||
// for them.
|
// for them.
|
||||||
|
bool pendingLayerization = false;
|
||||||
if (aInputBlockId && aEvent.mFlags.mHandledByAPZ) {
|
if (aInputBlockId && aEvent.mFlags.mHandledByAPZ) {
|
||||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||||
APZCCallbackHelper::SendSetTargetAPZCNotification(
|
pendingLayerization = APZCCallbackHelper::SendSetTargetAPZCNotification(
|
||||||
mPuppetWidget, document, aEvent, aGuid, aInputBlockId);
|
mPuppetWidget, document, aEvent, aGuid, aInputBlockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEventStatus unused;
|
nsEventStatus unused;
|
||||||
InputAPZContext context(aGuid, aInputBlockId, unused);
|
InputAPZContext context(aGuid, aInputBlockId, unused);
|
||||||
|
if (pendingLayerization) {
|
||||||
|
context.SetPendingLayerization();
|
||||||
|
}
|
||||||
|
|
||||||
WidgetMouseEvent localEvent(aEvent);
|
WidgetMouseEvent localEvent(aEvent);
|
||||||
localEvent.mWidget = mPuppetWidget;
|
localEvent.mWidget = mPuppetWidget;
|
||||||
|
|
|
@ -1579,7 +1579,7 @@ nsPluginHost::RegisterFakePlugin(JS::Handle<JS::Value> aInitDictionary,
|
||||||
nsresult rv = nsFakePluginTag::Create(initDictionary, getter_AddRefs(newTag));
|
nsresult rv = nsFakePluginTag::Create(initDictionary, getter_AddRefs(newTag));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
for (auto existingTag : mFakePlugins) {
|
for (const auto& existingTag : mFakePlugins) {
|
||||||
if (newTag->HandlerURIMatches(existingTag->HandlerURI())) {
|
if (newTag->HandlerURIMatches(existingTag->HandlerURI())) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,9 @@
|
||||||
|
|
||||||
TEST_DIRS += ['test']
|
TEST_DIRS += ['test']
|
||||||
|
|
||||||
XPIDL_SOURCES += [
|
|
||||||
'nsICookieAcceptDialog.idl',
|
|
||||||
'nsICookiePromptService.idl',
|
|
||||||
]
|
|
||||||
|
|
||||||
XPIDL_MODULE = 'cookie'
|
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'nsCookieModule.cpp',
|
'nsCookieModule.cpp',
|
||||||
'nsCookiePermission.cpp',
|
'nsCookiePermission.cpp',
|
||||||
'nsCookiePromptService.cpp',
|
|
||||||
'nsPermission.cpp',
|
'nsPermission.cpp',
|
||||||
'nsPermissionManager.cpp',
|
'nsPermissionManager.cpp',
|
||||||
'nsPopupWindowManager.cpp',
|
'nsPopupWindowManager.cpp',
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "nsPermissionManager.h"
|
#include "nsPermissionManager.h"
|
||||||
#include "nsPopupWindowManager.h"
|
#include "nsPopupWindowManager.h"
|
||||||
#include "nsICategoryManager.h"
|
#include "nsICategoryManager.h"
|
||||||
#include "nsCookiePromptService.h"
|
|
||||||
#include "nsCookiePermission.h"
|
#include "nsCookiePermission.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
|
|
||||||
|
@ -18,18 +17,15 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPermissionManager,
|
||||||
nsPermissionManager::GetXPCOMSingleton)
|
nsPermissionManager::GetXPCOMSingleton)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPopupWindowManager, Init)
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPopupWindowManager, Init)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCookiePermission)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCookiePermission)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCookiePromptService)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID);
|
NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_POPUPWINDOWMANAGER_CID);
|
NS_DEFINE_NAMED_CID(NS_POPUPWINDOWMANAGER_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_COOKIEPROMPTSERVICE_CID);
|
|
||||||
NS_DEFINE_NAMED_CID(NS_COOKIEPERMISSION_CID);
|
NS_DEFINE_NAMED_CID(NS_COOKIEPERMISSION_CID);
|
||||||
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kCookieCIDs[] = {
|
static const mozilla::Module::CIDEntry kCookieCIDs[] = {
|
||||||
{ &kNS_PERMISSIONMANAGER_CID, false, nullptr, nsIPermissionManagerConstructor },
|
{ &kNS_PERMISSIONMANAGER_CID, false, nullptr, nsIPermissionManagerConstructor },
|
||||||
{ &kNS_POPUPWINDOWMANAGER_CID, false, nullptr, nsPopupWindowManagerConstructor },
|
{ &kNS_POPUPWINDOWMANAGER_CID, false, nullptr, nsPopupWindowManagerConstructor },
|
||||||
{ &kNS_COOKIEPROMPTSERVICE_CID, false, nullptr, nsCookiePromptServiceConstructor },
|
|
||||||
{ &kNS_COOKIEPERMISSION_CID, false, nullptr, nsCookiePermissionConstructor },
|
{ &kNS_COOKIEPERMISSION_CID, false, nullptr, nsCookiePermissionConstructor },
|
||||||
{ nullptr }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
@ -37,7 +33,6 @@ static const mozilla::Module::CIDEntry kCookieCIDs[] = {
|
||||||
static const mozilla::Module::ContractIDEntry kCookieContracts[] = {
|
static const mozilla::Module::ContractIDEntry kCookieContracts[] = {
|
||||||
{ NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID },
|
{ NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID },
|
||||||
{ NS_POPUPWINDOWMANAGER_CONTRACTID, &kNS_POPUPWINDOWMANAGER_CID },
|
{ NS_POPUPWINDOWMANAGER_CONTRACTID, &kNS_POPUPWINDOWMANAGER_CID },
|
||||||
{ NS_COOKIEPROMPTSERVICE_CONTRACTID, &kNS_COOKIEPROMPTSERVICE_CID },
|
|
||||||
{ NS_COOKIEPERMISSION_CONTRACTID, &kNS_COOKIEPERMISSION_CID },
|
{ NS_COOKIEPERMISSION_CONTRACTID, &kNS_COOKIEPERMISSION_CID },
|
||||||
{ nullptr }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "mozIThirdPartyUtil.h"
|
#include "mozIThirdPartyUtil.h"
|
||||||
#include "nsICookie2.h"
|
#include "nsICookie2.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsICookiePromptService.h"
|
|
||||||
#include "nsICookieManager2.h"
|
#include "nsICookieManager2.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
|
|
||||||
#include "nsCookiePromptService.h"
|
|
||||||
#include "nsICookie.h"
|
|
||||||
#include "nsICookieAcceptDialog.h"
|
|
||||||
#include "nsIDOMWindow.h"
|
|
||||||
#include "nsPIDOMWindow.h"
|
|
||||||
#include "nsIWindowWatcher.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsIDialogParamBlock.h"
|
|
||||||
#include "nsIMutableArray.h"
|
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
************************ nsCookiePromptService *****************
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsCookiePromptService, nsICookiePromptService)
|
|
||||||
|
|
||||||
nsCookiePromptService::nsCookiePromptService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCookiePromptService::~nsCookiePromptService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsCookiePromptService::CookieDialog(mozIDOMWindowProxy *aParent,
|
|
||||||
nsICookie *aCookie,
|
|
||||||
const nsACString &aHostname,
|
|
||||||
int32_t aCookiesFromHost,
|
|
||||||
bool aChangingCookie,
|
|
||||||
bool *aRememberDecision,
|
|
||||||
int32_t *aAccept)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDialogParamBlock> block = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID,&rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
block->SetInt(nsICookieAcceptDialog::ACCEPT_COOKIE, 1);
|
|
||||||
block->SetString(nsICookieAcceptDialog::HOSTNAME, NS_ConvertUTF8toUTF16(aHostname).get());
|
|
||||||
block->SetInt(nsICookieAcceptDialog::COOKIESFROMHOST, aCookiesFromHost);
|
|
||||||
block->SetInt(nsICookieAcceptDialog::CHANGINGCOOKIE, aChangingCookie ? 1 : 0);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMutableArray> objects =
|
|
||||||
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
rv = objects->AppendElement(aCookie, false);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
block->SetObjects(objects);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIWindowWatcher> wwatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> arguments = do_QueryInterface(block);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIDOMWindowProxy> parent(aParent);
|
|
||||||
if (!parent) // if no parent provided, consult the window watcher:
|
|
||||||
wwatcher->GetActiveWindow(getter_AddRefs(parent));
|
|
||||||
|
|
||||||
if (parent) {
|
|
||||||
auto* privateParent = nsPIDOMWindowOuter::From(parent);
|
|
||||||
if (privateParent)
|
|
||||||
privateParent = privateParent->GetPrivateRoot();
|
|
||||||
parent = privateParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We're opening a chrome window and passing in a nsIDialogParamBlock. Setting
|
|
||||||
// the nsIDialogParamBlock as the .arguments property on the chrome window
|
|
||||||
// requires system principals on the stack, so we use an AutoNoJSAPI for that.
|
|
||||||
mozilla::dom::AutoNoJSAPI nojsapi;
|
|
||||||
|
|
||||||
// The cookie dialog will be modal for the root chrome window rather than the
|
|
||||||
// tab containing the permission-requesting page. This removes confusion
|
|
||||||
// about which monitor is displaying the dialog (see bug 470356), but also
|
|
||||||
// avoids unwanted tab switches (see bug 405239).
|
|
||||||
nsCOMPtr<mozIDOMWindowProxy> dialog;
|
|
||||||
rv = wwatcher->OpenWindow(parent, "chrome://cookie/content/cookieAcceptDialog.xul", "_blank",
|
|
||||||
"centerscreen,chrome,modal,titlebar", arguments,
|
|
||||||
getter_AddRefs(dialog));
|
|
||||||
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
// get back output parameters
|
|
||||||
int32_t tempValue;
|
|
||||||
block->GetInt(nsICookieAcceptDialog::ACCEPT_COOKIE, &tempValue);
|
|
||||||
*aAccept = tempValue;
|
|
||||||
|
|
||||||
// GetInt returns a int32_t; we need to sanitize it into bool
|
|
||||||
block->GetInt(nsICookieAcceptDialog::REMEMBER_DECISION, &tempValue);
|
|
||||||
*aRememberDecision = (tempValue == 1);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef nsCookiePromptService_h__
|
|
||||||
#define nsCookiePromptService_h__
|
|
||||||
|
|
||||||
#include "nsICookiePromptService.h"
|
|
||||||
|
|
||||||
class nsCookiePromptService : public nsICookiePromptService {
|
|
||||||
|
|
||||||
virtual ~nsCookiePromptService();
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
nsCookiePromptService();
|
|
||||||
|
|
||||||
NS_DECL_NSICOOKIEPROMPTSERVICE
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// {CE002B28-92B7-4701-8621-CC925866FB87}
|
|
||||||
#define NS_COOKIEPROMPTSERVICE_CID \
|
|
||||||
{0xCE002B28, 0x92B7, 0x4701, {0x86, 0x21, 0xCC, 0x92, 0x58, 0x66, 0xFB, 0x87}}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,21 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
This file contains some constants for the cookie accept dialog
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
[scriptable, uuid(3F2F0D2C-BDEA-4B5A-AFC6-FCF18F66B97E)]
|
|
||||||
interface nsICookieAcceptDialog: nsISupports {
|
|
||||||
|
|
||||||
const short ACCEPT_COOKIE=0;
|
|
||||||
const short REMEMBER_DECISION=1;
|
|
||||||
const short HOSTNAME=2;
|
|
||||||
const short COOKIESFROMHOST=3;
|
|
||||||
const short CHANGINGCOOKIE=4;
|
|
||||||
};
|
|
|
@ -1,45 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An interface to open a dialog to ask to permission to accept the cookie.
|
|
||||||
*/
|
|
||||||
|
|
||||||
interface mozIDOMWindowProxy;
|
|
||||||
interface nsICookie;
|
|
||||||
|
|
||||||
[scriptable, uuid(65ca07c3-6241-4de1-bf41-3336470499db)]
|
|
||||||
interface nsICookiePromptService : nsISupports
|
|
||||||
{
|
|
||||||
const uint32_t DENY_COOKIE = 0;
|
|
||||||
const uint32_t ACCEPT_COOKIE = 1;
|
|
||||||
const uint32_t ACCEPT_SESSION_COOKIE = 2;
|
|
||||||
|
|
||||||
/* Open a dialog that asks for permission to accept a cookie
|
|
||||||
*
|
|
||||||
* @param parent
|
|
||||||
* @param cookie
|
|
||||||
* @param hostname the host that wants to set the cookie,
|
|
||||||
* not the domain: part of the cookie
|
|
||||||
* @param cookiesFromHost the number of cookies there are already for this host
|
|
||||||
* @param changingCookie are we changing this cookie?
|
|
||||||
* @param rememberDecision should we set the matching permission for this host?
|
|
||||||
* @returns 0 == deny cookie
|
|
||||||
* 1 == accept cookie
|
|
||||||
* 2 == accept cookie for current session
|
|
||||||
*/
|
|
||||||
|
|
||||||
long cookieDialog(in mozIDOMWindowProxy parent,
|
|
||||||
in nsICookie cookie,
|
|
||||||
in ACString hostname,
|
|
||||||
in long cookiesFromHost,
|
|
||||||
in boolean changingCookie,
|
|
||||||
out boolean rememberDecision);
|
|
||||||
};
|
|
||||||
|
|
||||||
%{C++
|
|
||||||
#define NS_COOKIEPROMPTSERVICE_CONTRACTID "@mozilla.org/embedcomp/cookieprompt-service;1"
|
|
||||||
%}
|
|
|
@ -1,22 +0,0 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
||||||
|
|
||||||
var Ci = Components.interfaces;
|
|
||||||
|
|
||||||
function CookiePromptService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
CookiePromptService.prototype = {
|
|
||||||
classID: Components.ID("{509b5540-c87c-11dd-ad8b-0800200c9a66}"),
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICookiePromptService]),
|
|
||||||
|
|
||||||
cookieDialog: function(parent, cookie, hostname,
|
|
||||||
cookiesFromHost, changingCookie,
|
|
||||||
rememberDecision) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CookiePromptService]);
|
|
|
@ -1,2 +0,0 @@
|
||||||
component {509b5540-c87c-11dd-ad8b-0800200c9a66} cookieprompt.js
|
|
||||||
contract @mozilla.org/embedcomp/cookieprompt-service;1 {509b5540-c87c-11dd-ad8b-0800200c9a66}
|
|
|
@ -2,9 +2,6 @@
|
||||||
head = head_cookies.js
|
head = head_cookies.js
|
||||||
tail =
|
tail =
|
||||||
skip-if = toolkit == 'android'
|
skip-if = toolkit == 'android'
|
||||||
support-files =
|
|
||||||
cookieprompt.js
|
|
||||||
cookieprompt.manifest
|
|
||||||
|
|
||||||
[test_bug526789.js]
|
[test_bug526789.js]
|
||||||
[test_bug650522.js]
|
[test_bug650522.js]
|
||||||
|
|
|
@ -746,7 +746,7 @@ SendSetTargetAPZCNotificationHelper(nsIWidget* aWidget,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
const WidgetGUIEvent& aEvent,
|
const WidgetGUIEvent& aEvent,
|
||||||
|
@ -754,7 +754,7 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
||||||
uint64_t aInputBlockId)
|
uint64_t aInputBlockId)
|
||||||
{
|
{
|
||||||
if (!aWidget || !aDocument) {
|
if (!aWidget || !aDocument) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (aInputBlockId == sLastTargetAPZCNotificationInputBlock) {
|
if (aInputBlockId == sLastTargetAPZCNotificationInputBlock) {
|
||||||
// We have already confirmed the target APZC for a previous event of this
|
// We have already confirmed the target APZC for a previous event of this
|
||||||
|
@ -763,7 +763,7 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
||||||
// race the original confirmation (which needs to go through a layers
|
// race the original confirmation (which needs to go through a layers
|
||||||
// transaction).
|
// transaction).
|
||||||
APZCCH_LOG("Not resending target APZC confirmation for input block %" PRIu64 "\n", aInputBlockId);
|
APZCCH_LOG("Not resending target APZC confirmation for input block %" PRIu64 "\n", aInputBlockId);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
sLastTargetAPZCNotificationInputBlock = aInputBlockId;
|
sLastTargetAPZCNotificationInputBlock = aInputBlockId;
|
||||||
if (nsIPresShell* shell = aDocument->GetShell()) {
|
if (nsIPresShell* shell = aDocument->GetShell()) {
|
||||||
|
@ -795,8 +795,11 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
||||||
Move(targets),
|
Move(targets),
|
||||||
waitForRefresh);
|
waitForRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return waitForRefresh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -139,8 +139,12 @@ public:
|
||||||
* sent to the compositor, which will then post a message back to APZ's
|
* sent to the compositor, which will then post a message back to APZ's
|
||||||
* controller thread. Otherwise, the provided widget's SetConfirmedTargetAPZC
|
* controller thread. Otherwise, the provided widget's SetConfirmedTargetAPZC
|
||||||
* method is invoked immediately.
|
* method is invoked immediately.
|
||||||
|
*
|
||||||
|
* Returns true if any displayports need to be set. (A caller may be
|
||||||
|
* interested to know this, because they may need to delay certain actions
|
||||||
|
* until after the displayport comes into effect.)
|
||||||
*/
|
*/
|
||||||
static void SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
static bool SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
const WidgetGUIEvent& aEvent,
|
const WidgetGUIEvent& aEvent,
|
||||||
const ScrollableLayerGuid& aGuid,
|
const ScrollableLayerGuid& aGuid,
|
||||||
|
|
|
@ -12,6 +12,7 @@ ScrollableLayerGuid InputAPZContext::sGuid;
|
||||||
uint64_t InputAPZContext::sBlockId = 0;
|
uint64_t InputAPZContext::sBlockId = 0;
|
||||||
nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eIgnore;
|
nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eIgnore;
|
||||||
bool InputAPZContext::sRoutedToChildProcess = false;
|
bool InputAPZContext::sRoutedToChildProcess = false;
|
||||||
|
bool InputAPZContext::sPendingLayerization = false;
|
||||||
|
|
||||||
/*static*/ ScrollableLayerGuid
|
/*static*/ ScrollableLayerGuid
|
||||||
InputAPZContext::GetTargetLayerGuid()
|
InputAPZContext::GetTargetLayerGuid()
|
||||||
|
@ -37,6 +38,12 @@ InputAPZContext::SetRoutedToChildProcess()
|
||||||
sRoutedToChildProcess = true;
|
sRoutedToChildProcess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*static*/ void
|
||||||
|
InputAPZContext::SetPendingLayerization()
|
||||||
|
{
|
||||||
|
sPendingLayerization = true;
|
||||||
|
}
|
||||||
|
|
||||||
InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
|
InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
|
||||||
const uint64_t& aBlockId,
|
const uint64_t& aBlockId,
|
||||||
const nsEventStatus& aApzResponse)
|
const nsEventStatus& aApzResponse)
|
||||||
|
@ -44,11 +51,13 @@ InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
|
||||||
, mOldBlockId(sBlockId)
|
, mOldBlockId(sBlockId)
|
||||||
, mOldApzResponse(sApzResponse)
|
, mOldApzResponse(sApzResponse)
|
||||||
, mOldRoutedToChildProcess(sRoutedToChildProcess)
|
, mOldRoutedToChildProcess(sRoutedToChildProcess)
|
||||||
|
, mOldPendingLayerization(sPendingLayerization)
|
||||||
{
|
{
|
||||||
sGuid = aGuid;
|
sGuid = aGuid;
|
||||||
sBlockId = aBlockId;
|
sBlockId = aBlockId;
|
||||||
sApzResponse = aApzResponse;
|
sApzResponse = aApzResponse;
|
||||||
sRoutedToChildProcess = false;
|
sRoutedToChildProcess = false;
|
||||||
|
sPendingLayerization = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputAPZContext::~InputAPZContext()
|
InputAPZContext::~InputAPZContext()
|
||||||
|
@ -57,13 +66,20 @@ InputAPZContext::~InputAPZContext()
|
||||||
sBlockId = mOldBlockId;
|
sBlockId = mOldBlockId;
|
||||||
sApzResponse = mOldApzResponse;
|
sApzResponse = mOldApzResponse;
|
||||||
sRoutedToChildProcess = mOldRoutedToChildProcess;
|
sRoutedToChildProcess = mOldRoutedToChildProcess;
|
||||||
|
sPendingLayerization = mOldPendingLayerization;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
/*static*/ bool
|
||||||
InputAPZContext::WasRoutedToChildProcess()
|
InputAPZContext::WasRoutedToChildProcess()
|
||||||
{
|
{
|
||||||
return sRoutedToChildProcess;
|
return sRoutedToChildProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*static*/ bool
|
||||||
|
InputAPZContext::HavePendingLayerization()
|
||||||
|
{
|
||||||
|
return sPendingLayerization;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -23,25 +23,29 @@ private:
|
||||||
static uint64_t sBlockId;
|
static uint64_t sBlockId;
|
||||||
static nsEventStatus sApzResponse;
|
static nsEventStatus sApzResponse;
|
||||||
static bool sRoutedToChildProcess;
|
static bool sRoutedToChildProcess;
|
||||||
|
static bool sPendingLayerization;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ScrollableLayerGuid GetTargetLayerGuid();
|
static ScrollableLayerGuid GetTargetLayerGuid();
|
||||||
static uint64_t GetInputBlockId();
|
static uint64_t GetInputBlockId();
|
||||||
static nsEventStatus GetApzResponse();
|
static nsEventStatus GetApzResponse();
|
||||||
static void SetRoutedToChildProcess();
|
static void SetRoutedToChildProcess();
|
||||||
|
static void SetPendingLayerization();
|
||||||
|
|
||||||
InputAPZContext(const ScrollableLayerGuid& aGuid,
|
InputAPZContext(const ScrollableLayerGuid& aGuid,
|
||||||
const uint64_t& aBlockId,
|
const uint64_t& aBlockId,
|
||||||
const nsEventStatus& aApzResponse);
|
const nsEventStatus& aApzResponse);
|
||||||
~InputAPZContext();
|
~InputAPZContext();
|
||||||
|
|
||||||
bool WasRoutedToChildProcess();
|
static bool WasRoutedToChildProcess();
|
||||||
|
static bool HavePendingLayerization();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ScrollableLayerGuid mOldGuid;
|
ScrollableLayerGuid mOldGuid;
|
||||||
uint64_t mOldBlockId;
|
uint64_t mOldBlockId;
|
||||||
nsEventStatus mOldApzResponse;
|
nsEventStatus mOldApzResponse;
|
||||||
bool mOldRoutedToChildProcess;
|
bool mOldRoutedToChildProcess;
|
||||||
|
bool mOldPendingLayerization;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "nsMathUtils.h" // for NS_round
|
#include "nsMathUtils.h" // for NS_round
|
||||||
#include "nsRenderingContext.h" // for nsRenderingContext
|
#include "nsRenderingContext.h" // for nsRenderingContext
|
||||||
#include "nsString.h" // for nsString
|
#include "nsString.h" // for nsString
|
||||||
#include "nsStyleConsts.h" // for NS_STYLE_HYPHENS_NONE
|
#include "nsStyleConsts.h" // for StyleHyphens::None
|
||||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT
|
||||||
#include "mozilla/UniquePtr.h" // for UniquePtr
|
#include "mozilla/UniquePtr.h" // for UniquePtr
|
||||||
|
|
||||||
|
@ -87,9 +87,9 @@ public:
|
||||||
bool* aBreakBefore) {
|
bool* aBreakBefore) {
|
||||||
NS_ERROR("This shouldn't be called because we never call BreakAndMeasureText");
|
NS_ERROR("This shouldn't be called because we never call BreakAndMeasureText");
|
||||||
}
|
}
|
||||||
virtual int8_t GetHyphensOption() {
|
virtual mozilla::StyleHyphens GetHyphensOption() {
|
||||||
NS_ERROR("This shouldn't be called because we never call BreakAndMeasureText");
|
NS_ERROR("This shouldn't be called because we never call BreakAndMeasureText");
|
||||||
return NS_STYLE_HYPHENS_NONE;
|
return mozilla::StyleHyphens::None;
|
||||||
}
|
}
|
||||||
virtual gfxFloat GetHyphenWidth() {
|
virtual gfxFloat GetHyphenWidth() {
|
||||||
NS_ERROR("This shouldn't be called because we never enable hyphens");
|
NS_ERROR("This shouldn't be called because we never enable hyphens");
|
||||||
|
|
|
@ -240,7 +240,7 @@ gfxTextRun::ComputeLigatureData(Range aPartRange,
|
||||||
NS_ASSERTION(aPartRange.start < aPartRange.end,
|
NS_ASSERTION(aPartRange.start < aPartRange.end,
|
||||||
"Computing ligature data for empty range");
|
"Computing ligature data for empty range");
|
||||||
NS_ASSERTION(aPartRange.end <= GetLength(), "Character length overflow");
|
NS_ASSERTION(aPartRange.end <= GetLength(), "Character length overflow");
|
||||||
|
|
||||||
LigatureData result;
|
LigatureData result;
|
||||||
const CompressedGlyph *charGlyphs = mCharacterGlyphs;
|
const CompressedGlyph *charGlyphs = mCharacterGlyphs;
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ gfxTextRun::ShrinkToLigatureBoundaries(Range* aRange) const
|
||||||
{
|
{
|
||||||
if (aRange->start >= aRange->end)
|
if (aRange->start >= aRange->end)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const CompressedGlyph *charGlyphs = mCharacterGlyphs;
|
const CompressedGlyph *charGlyphs = mCharacterGlyphs;
|
||||||
|
|
||||||
while (aRange->start < aRange->end &&
|
while (aRange->start < aRange->end &&
|
||||||
|
@ -436,7 +436,7 @@ ClipPartialLigature(const gfxTextRun* aTextRun,
|
||||||
} else {
|
} else {
|
||||||
*aEnd = std::min(*aEnd, endEdge);
|
*aEnd = std::min(*aEnd, endEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -785,7 +785,7 @@ gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont, Range aRange,
|
||||||
// ligature. Shift it left.
|
// ligature. Shift it left.
|
||||||
metrics.mBoundingBox.x -=
|
metrics.mBoundingBox.x -=
|
||||||
IsRightToLeft() ? metrics.mAdvanceWidth - (data.mPartAdvance + data.mPartWidth)
|
IsRightToLeft() ? metrics.mAdvanceWidth - (data.mPartAdvance + data.mPartWidth)
|
||||||
: data.mPartAdvance;
|
: data.mPartAdvance;
|
||||||
metrics.mAdvanceWidth = data.mPartWidth;
|
metrics.mAdvanceWidth = data.mPartWidth;
|
||||||
|
|
||||||
aMetrics->CombineWith(metrics, IsRightToLeft());
|
aMetrics->CombineWith(metrics, IsRightToLeft());
|
||||||
|
@ -862,8 +862,8 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||||
}
|
}
|
||||||
bool hyphenBuffer[MEASUREMENT_BUFFER_SIZE];
|
bool hyphenBuffer[MEASUREMENT_BUFFER_SIZE];
|
||||||
bool haveHyphenation = aProvider &&
|
bool haveHyphenation = aProvider &&
|
||||||
(aProvider->GetHyphensOption() == NS_STYLE_HYPHENS_AUTO ||
|
(aProvider->GetHyphensOption() == StyleHyphens::Auto ||
|
||||||
(aProvider->GetHyphensOption() == NS_STYLE_HYPHENS_MANUAL &&
|
(aProvider->GetHyphensOption() == StyleHyphens::Manual &&
|
||||||
(mFlags & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
|
(mFlags & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
|
||||||
if (haveHyphenation) {
|
if (haveHyphenation) {
|
||||||
aProvider->GetHyphenationBreaks(bufferRange, hyphenBuffer);
|
aProvider->GetHyphenationBreaks(bufferRange, hyphenBuffer);
|
||||||
|
@ -901,7 +901,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||||
}
|
}
|
||||||
|
|
||||||
// There can't be a word-wrap break opportunity at the beginning of the
|
// There can't be a word-wrap break opportunity at the beginning of the
|
||||||
// line: if the width is too small for even one character to fit, it
|
// line: if the width is too small for even one character to fit, it
|
||||||
// could be the first and last break opportunity on the line, and that
|
// could be the first and last break opportunity on the line, and that
|
||||||
// would trigger an infinite loop.
|
// would trigger an infinite loop.
|
||||||
if (aSuppressBreak != eSuppressAllBreaks &&
|
if (aSuppressBreak != eSuppressAllBreaks &&
|
||||||
|
@ -919,7 +919,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||||
if (atHyphenationBreak) {
|
if (atHyphenationBreak) {
|
||||||
hyphenatedAdvance += aProvider->GetHyphenWidth();
|
hyphenatedAdvance += aProvider->GetHyphenWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastBreak < 0 || width + hyphenatedAdvance - trimmableAdvance <= aWidth) {
|
if (lastBreak < 0 || width + hyphenatedAdvance - trimmableAdvance <= aWidth) {
|
||||||
// We can break here.
|
// We can break here.
|
||||||
lastBreak = i;
|
lastBreak = i;
|
||||||
|
@ -939,7 +939,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxFloat charAdvance;
|
gfxFloat charAdvance;
|
||||||
if (i >= ligatureRange.start && i < ligatureRange.end) {
|
if (i >= ligatureRange.start && i < ligatureRange.end) {
|
||||||
charAdvance = GetAdvanceForGlyphs(Range(i, i + 1));
|
charAdvance = GetAdvanceForGlyphs(Range(i, i + 1));
|
||||||
|
@ -952,7 +952,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||||
charAdvance =
|
charAdvance =
|
||||||
ComputePartialLigatureWidth(Range(i, i + 1), aProvider);
|
ComputePartialLigatureWidth(Range(i, i + 1), aProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
advance += charAdvance;
|
advance += charAdvance;
|
||||||
if (aTrimWhitespace || aWhitespaceCanHang) {
|
if (aTrimWhitespace || aWhitespaceCanHang) {
|
||||||
if (mCharacterGlyphs[i].CharIsSpace()) {
|
if (mCharacterGlyphs[i].CharIsSpace()) {
|
||||||
|
@ -1113,7 +1113,7 @@ gfxTextRun::AddGlyphRun(gfxFont *aFont, uint8_t aMatchType,
|
||||||
"mixed orientation should have been resolved");
|
"mixed orientation should have been resolved");
|
||||||
if (!aFont) {
|
if (!aFont) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
uint32_t numGlyphRuns = mGlyphRuns.Length();
|
uint32_t numGlyphRuns = mGlyphRuns.Length();
|
||||||
if (!aForceNewRun && numGlyphRuns > 0) {
|
if (!aForceNewRun && numGlyphRuns > 0) {
|
||||||
GlyphRun *lastGlyphRun = &mGlyphRuns[numGlyphRuns - 1];
|
GlyphRun *lastGlyphRun = &mGlyphRuns[numGlyphRuns - 1];
|
||||||
|
@ -1373,7 +1373,7 @@ gfxTextRun::SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
|
||||||
(GetFlags() & gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT) != 0;
|
(GetFlags() & gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT) != 0;
|
||||||
gfxShapedWord* sw = aFont->GetShapedWord(aDrawTarget,
|
gfxShapedWord* sw = aFont->GetShapedWord(aDrawTarget,
|
||||||
&space, 1,
|
&space, 1,
|
||||||
gfxShapedWord::HashMix(0, ' '),
|
gfxShapedWord::HashMix(0, ' '),
|
||||||
Script::LATIN,
|
Script::LATIN,
|
||||||
vertical,
|
vertical,
|
||||||
mAppUnitsPerDevUnit,
|
mAppUnitsPerDevUnit,
|
||||||
|
@ -1439,7 +1439,7 @@ gfxTextRun::FetchGlyphExtents(DrawTarget* aRefDrawTarget)
|
||||||
bool fontIsSetup = false;
|
bool fontIsSetup = false;
|
||||||
uint32_t j;
|
uint32_t j;
|
||||||
gfxGlyphExtents *extents = font->GetOrCreateGlyphExtents(mAppUnitsPerDevUnit);
|
gfxGlyphExtents *extents = font->GetOrCreateGlyphExtents(mAppUnitsPerDevUnit);
|
||||||
|
|
||||||
for (j = start; j < end; ++j) {
|
for (j = start; j < end; ++j) {
|
||||||
const gfxTextRun::CompressedGlyph *glyphData = &charGlyphs[j];
|
const gfxTextRun::CompressedGlyph *glyphData = &charGlyphs[j];
|
||||||
if (glyphData->IsSimpleGlyph()) {
|
if (glyphData->IsSimpleGlyph()) {
|
||||||
|
@ -1911,13 +1911,13 @@ gfxFontGroup::Copy(const gfxFontStyle *aStyle)
|
||||||
return fg;
|
return fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gfxFontGroup::IsInvalidChar(uint8_t ch)
|
gfxFontGroup::IsInvalidChar(uint8_t ch)
|
||||||
{
|
{
|
||||||
return ((ch & 0x7f) < 0x20 || ch == 0x7f);
|
return ((ch & 0x7f) < 0x20 || ch == 0x7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gfxFontGroup::IsInvalidChar(char16_t ch)
|
gfxFontGroup::IsInvalidChar(char16_t ch)
|
||||||
{
|
{
|
||||||
// All printable 7-bit ASCII values are OK
|
// All printable 7-bit ASCII values are OK
|
||||||
|
@ -3148,7 +3148,7 @@ already_AddRefed<gfxFont>
|
||||||
gfxFontGroup::WhichSystemFontSupportsChar(uint32_t aCh, uint32_t aNextCh,
|
gfxFontGroup::WhichSystemFontSupportsChar(uint32_t aCh, uint32_t aNextCh,
|
||||||
Script aRunScript)
|
Script aRunScript)
|
||||||
{
|
{
|
||||||
gfxFontEntry *fe =
|
gfxFontEntry *fe =
|
||||||
gfxPlatformFontList::PlatformFontList()->
|
gfxPlatformFontList::PlatformFontList()->
|
||||||
SystemFindFontForChar(aCh, aNextCh, aRunScript, &mStyle);
|
SystemFindFontForChar(aCh, aNextCh, aRunScript, &mStyle);
|
||||||
if (fe) {
|
if (fe) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ class gfxMissingFontRecorder;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class SVGContextPaint;
|
class SVGContextPaint;
|
||||||
|
enum class StyleHyphens : uint8_t;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +71,7 @@ struct gfxTextRunDrawCallbacks {
|
||||||
* of text. It stores runs of positioned glyph data, each run having a single
|
* of text. It stores runs of positioned glyph data, each run having a single
|
||||||
* gfxFont. The glyphs are associated with a string of source text, and the
|
* gfxFont. The glyphs are associated with a string of source text, and the
|
||||||
* gfxTextRun APIs take parameters that are offsets into that source text.
|
* gfxTextRun APIs take parameters that are offsets into that source text.
|
||||||
*
|
*
|
||||||
* gfxTextRuns are mostly immutable. The only things that can change are
|
* gfxTextRuns are mostly immutable. The only things that can change are
|
||||||
* inter-cluster spacing and line break placement. Spacing is always obtained
|
* inter-cluster spacing and line break placement. Spacing is always obtained
|
||||||
* lazily by methods that need it, it is not cached. Line breaks are stored
|
* lazily by methods that need it, it is not cached. Line breaks are stored
|
||||||
|
@ -78,7 +79,7 @@ struct gfxTextRunDrawCallbacks {
|
||||||
* not actually do anything to explicitly account for line breaks). Initially
|
* not actually do anything to explicitly account for line breaks). Initially
|
||||||
* there are no line breaks. The textrun can record line breaks before or after
|
* there are no line breaks. The textrun can record line breaks before or after
|
||||||
* any given cluster. (Line breaks specified inside clusters are ignored.)
|
* any given cluster. (Line breaks specified inside clusters are ignored.)
|
||||||
*
|
*
|
||||||
* It is important that zero-length substrings are handled correctly. This will
|
* It is important that zero-length substrings are handled correctly. This will
|
||||||
* be on the test!
|
* be on the test!
|
||||||
*/
|
*/
|
||||||
|
@ -163,11 +164,11 @@ public:
|
||||||
* Set the potential linebreaks for a substring of the textrun. These are
|
* Set the potential linebreaks for a substring of the textrun. These are
|
||||||
* the "allow break before" points. Initially, there are no potential
|
* the "allow break before" points. Initially, there are no potential
|
||||||
* linebreaks.
|
* linebreaks.
|
||||||
*
|
*
|
||||||
* This can change glyphs and/or geometry! Some textruns' shapes
|
* This can change glyphs and/or geometry! Some textruns' shapes
|
||||||
* depend on potential line breaks (e.g., title-case-converting textruns).
|
* depend on potential line breaks (e.g., title-case-converting textruns).
|
||||||
* This function is virtual so that those textruns can reshape themselves.
|
* This function is virtual so that those textruns can reshape themselves.
|
||||||
*
|
*
|
||||||
* @return true if this changed the linebreaks, false if the new line
|
* @return true if this changed the linebreaks, false if the new line
|
||||||
* breaks are the same as the old
|
* breaks are the same as the old
|
||||||
*/
|
*/
|
||||||
|
@ -179,7 +180,7 @@ public:
|
||||||
* potential line break points and computation of spacing. We pass the data
|
* potential line break points and computation of spacing. We pass the data
|
||||||
* this way to allow lazy data acquisition; for example BreakAndMeasureText
|
* this way to allow lazy data acquisition; for example BreakAndMeasureText
|
||||||
* will want to only ask for properties of text it's actually looking at.
|
* will want to only ask for properties of text it's actually looking at.
|
||||||
*
|
*
|
||||||
* NOTE that requested spacing may not actually be applied, if the textrun
|
* NOTE that requested spacing may not actually be applied, if the textrun
|
||||||
* is unable to apply it in some context. Exception: spacing around a
|
* is unable to apply it in some context. Exception: spacing around a
|
||||||
* whitespace character MUST always be applied.
|
* whitespace character MUST always be applied.
|
||||||
|
@ -192,8 +193,8 @@ public:
|
||||||
|
|
||||||
// Returns the provider's hyphenation setting, so callers can decide
|
// Returns the provider's hyphenation setting, so callers can decide
|
||||||
// whether it is necessary to call GetHyphenationBreaks.
|
// whether it is necessary to call GetHyphenationBreaks.
|
||||||
// Result is an NS_STYLE_HYPHENS_* value.
|
// Result is an StyleHyphens value.
|
||||||
virtual int8_t GetHyphensOption() = 0;
|
virtual mozilla::StyleHyphens GetHyphensOption() = 0;
|
||||||
|
|
||||||
// Returns the extra width that will be consumed by a hyphen. This should
|
// Returns the extra width that will be consumed by a hyphen. This should
|
||||||
// be constant for a given textrun.
|
// be constant for a given textrun.
|
||||||
|
@ -238,7 +239,7 @@ public:
|
||||||
* Draws a substring. Uses only GetSpacing from aBreakProvider.
|
* Draws a substring. Uses only GetSpacing from aBreakProvider.
|
||||||
* The provided point is the baseline origin on the left of the string
|
* The provided point is the baseline origin on the left of the string
|
||||||
* for LTR, on the right of the string for RTL.
|
* for LTR, on the right of the string for RTL.
|
||||||
*
|
*
|
||||||
* Drawing should respect advance widths in the sense that for LTR runs,
|
* Drawing should respect advance widths in the sense that for LTR runs,
|
||||||
* Draw(Range(start, middle), pt, ...) followed by
|
* Draw(Range(start, middle), pt, ...) followed by
|
||||||
* Draw(Range(middle, end), gfxPoint(pt.x + advance, pt.y), ...)
|
* Draw(Range(middle, end), gfxPoint(pt.x + advance, pt.y), ...)
|
||||||
|
@ -250,7 +251,7 @@ public:
|
||||||
* Draw(Range(start, middle), gfxPoint(pt.x + advance, pt.y), ...)
|
* Draw(Range(start, middle), gfxPoint(pt.x + advance, pt.y), ...)
|
||||||
* should have the same effect as
|
* should have the same effect as
|
||||||
* Draw(Range(start, end), pt, ...)
|
* Draw(Range(start, end), pt, ...)
|
||||||
*
|
*
|
||||||
* Glyphs should be drawn in logical content order, which can be significant
|
* Glyphs should be drawn in logical content order, which can be significant
|
||||||
* if they overlap (perhaps due to negative spacing).
|
* if they overlap (perhaps due to negative spacing).
|
||||||
*/
|
*/
|
||||||
|
@ -301,14 +302,14 @@ public:
|
||||||
* Clear all stored line breaks for the given range (both before and after),
|
* Clear all stored line breaks for the given range (both before and after),
|
||||||
* and then set the line-break state before aRange.start to aBreakBefore and
|
* and then set the line-break state before aRange.start to aBreakBefore and
|
||||||
* after the last cluster to aBreakAfter.
|
* after the last cluster to aBreakAfter.
|
||||||
*
|
*
|
||||||
* We require that before and after line breaks be consistent. For clusters
|
* We require that before and after line breaks be consistent. For clusters
|
||||||
* i and i+1, we require that if there is a break after cluster i, a break
|
* i and i+1, we require that if there is a break after cluster i, a break
|
||||||
* will be specified before cluster i+1. This may be temporarily violated
|
* will be specified before cluster i+1. This may be temporarily violated
|
||||||
* (e.g. after reflowing line L and before reflowing line L+1); to handle
|
* (e.g. after reflowing line L and before reflowing line L+1); to handle
|
||||||
* these temporary violations, we say that there is a break betwen i and i+1
|
* these temporary violations, we say that there is a break betwen i and i+1
|
||||||
* if a break is specified after i OR a break is specified before i+1.
|
* if a break is specified after i OR a break is specified before i+1.
|
||||||
*
|
*
|
||||||
* This can change textrun geometry! The existence of a linebreak can affect
|
* This can change textrun geometry! The existence of a linebreak can affect
|
||||||
* the advance width of the cluster before the break (when kerning) or the
|
* the advance width of the cluster before the break (when kerning) or the
|
||||||
* geometry of one cluster before the break or any number of clusters
|
* geometry of one cluster before the break or any number of clusters
|
||||||
|
@ -316,11 +317,11 @@ public:
|
||||||
* arbitrary; if some scripts require breaking it, then we need to
|
* arbitrary; if some scripts require breaking it, then we need to
|
||||||
* alter nsTextFrame::TrimTrailingWhitespace, perhaps drastically becase
|
* alter nsTextFrame::TrimTrailingWhitespace, perhaps drastically becase
|
||||||
* it could affect the layout of frames before it...)
|
* it could affect the layout of frames before it...)
|
||||||
*
|
*
|
||||||
* We return true if glyphs or geometry changed, false otherwise. This
|
* We return true if glyphs or geometry changed, false otherwise. This
|
||||||
* function is virtual so that gfxTextRun subclasses can reshape
|
* function is virtual so that gfxTextRun subclasses can reshape
|
||||||
* properly.
|
* properly.
|
||||||
*
|
*
|
||||||
* @param aAdvanceWidthDelta if non-null, returns the change in advance
|
* @param aAdvanceWidthDelta if non-null, returns the change in advance
|
||||||
* width of the given range.
|
* width of the given range.
|
||||||
*/
|
*/
|
||||||
|
@ -387,7 +388,7 @@ public:
|
||||||
* @param aBreakPriority in/out the priority of the break opportunity
|
* @param aBreakPriority in/out the priority of the break opportunity
|
||||||
* saved in the line. If we are prioritizing break opportunities, we will
|
* saved in the line. If we are prioritizing break opportunities, we will
|
||||||
* not set a break with a lower priority. @see gfxBreakPriority.
|
* not set a break with a lower priority. @see gfxBreakPriority.
|
||||||
*
|
*
|
||||||
* Note that negative advance widths are possible especially if negative
|
* Note that negative advance widths are possible especially if negative
|
||||||
* spacing is provided.
|
* spacing is provided.
|
||||||
*/
|
*/
|
||||||
|
@ -590,11 +591,11 @@ public:
|
||||||
// when the part is at the start of the ligature, and after-spacing
|
// when the part is at the start of the ligature, and after-spacing
|
||||||
// when the part is as the end of the ligature
|
// when the part is as the end of the ligature
|
||||||
gfxFloat mPartWidth;
|
gfxFloat mPartWidth;
|
||||||
|
|
||||||
bool mClipBeforePart;
|
bool mClipBeforePart;
|
||||||
bool mClipAfterPart;
|
bool mClipAfterPart;
|
||||||
};
|
};
|
||||||
|
|
||||||
// return storage used by this run, for memory reporter;
|
// return storage used by this run, for memory reporter;
|
||||||
// nsTransformedTextRun needs to override this as it holds additional data
|
// nsTransformedTextRun needs to override this as it holds additional data
|
||||||
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||||
|
@ -675,7 +676,7 @@ protected:
|
||||||
CompressedGlyph *mCharacterGlyphs;
|
CompressedGlyph *mCharacterGlyphs;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// **** general helpers ****
|
// **** general helpers ****
|
||||||
|
|
||||||
// Get the total advance for a range of glyphs.
|
// Get the total advance for a range of glyphs.
|
||||||
int32_t GetAdvanceForGlyphs(Range aRange) const;
|
int32_t GetAdvanceForGlyphs(Range aRange) const;
|
||||||
|
|
|
@ -127,7 +127,7 @@ struct TabWidthStore {
|
||||||
// been calculated yet but may be appended if needed later. It's a DOM
|
// been calculated yet but may be appended if needed later. It's a DOM
|
||||||
// offset relative to the current frame's offset.
|
// offset relative to the current frame's offset.
|
||||||
uint32_t mLimit;
|
uint32_t mLimit;
|
||||||
|
|
||||||
// Need to recalc tab offsets if frame content offset differs from this.
|
// Need to recalc tab offsets if frame content offset differs from this.
|
||||||
int32_t mValidForContentOffset;
|
int32_t mValidForContentOffset;
|
||||||
|
|
||||||
|
@ -216,12 +216,12 @@ static const nsFrameState TEXT_WHITESPACE_FLAGS =
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some general notes
|
* Some general notes
|
||||||
*
|
*
|
||||||
* Text frames delegate work to gfxTextRun objects. The gfxTextRun object
|
* Text frames delegate work to gfxTextRun objects. The gfxTextRun object
|
||||||
* transforms text to positioned glyphs. It can report the geometry of the
|
* transforms text to positioned glyphs. It can report the geometry of the
|
||||||
* glyphs and paint them. Text frames configure gfxTextRuns by providing text,
|
* glyphs and paint them. Text frames configure gfxTextRuns by providing text,
|
||||||
* spacing, language, and other information.
|
* spacing, language, and other information.
|
||||||
*
|
*
|
||||||
* A gfxTextRun can cover more than one DOM text node. This is necessary to
|
* A gfxTextRun can cover more than one DOM text node. This is necessary to
|
||||||
* get kerning, ligatures and shaping for text that spans multiple text nodes
|
* get kerning, ligatures and shaping for text that spans multiple text nodes
|
||||||
* but is all the same font.
|
* but is all the same font.
|
||||||
|
@ -279,7 +279,7 @@ struct SimpleTextRunUserData {
|
||||||
* text frames. Some sequence of its continuations are covered by the textrun.
|
* text frames. Some sequence of its continuations are covered by the textrun.
|
||||||
* A content textnode can have at most one TextRunMappedFlow associated with it
|
* A content textnode can have at most one TextRunMappedFlow associated with it
|
||||||
* for a given textrun.
|
* for a given textrun.
|
||||||
*
|
*
|
||||||
* mDOMOffsetToBeforeTransformOffset is added to DOM offsets for those frames to obtain
|
* mDOMOffsetToBeforeTransformOffset is added to DOM offsets for those frames to obtain
|
||||||
* the offset into the before-transformation text of the textrun. It can be
|
* the offset into the before-transformation text of the textrun. It can be
|
||||||
* positive (when a text node starts in the middle of a text run) or
|
* positive (when a text node starts in the middle of a text run) or
|
||||||
|
@ -738,7 +738,7 @@ int32_t nsTextFrame::GetInFlowContentLength() {
|
||||||
* mContentOffset but this frame is empty, logically it might be before the
|
* mContentOffset but this frame is empty, logically it might be before the
|
||||||
* start of the cached flow.
|
* start of the cached flow.
|
||||||
*/
|
*/
|
||||||
if (flowLength &&
|
if (flowLength &&
|
||||||
(flowLength->mStartOffset < mContentOffset ||
|
(flowLength->mStartOffset < mContentOffset ||
|
||||||
(flowLength->mStartOffset == mContentOffset && GetContentEnd() > mContentOffset)) &&
|
(flowLength->mStartOffset == mContentOffset && GetContentEnd() > mContentOffset)) &&
|
||||||
flowLength->mEndFlowOffset > mContentOffset) {
|
flowLength->mEndFlowOffset > mContentOffset) {
|
||||||
|
@ -802,7 +802,7 @@ IsCSSWordSpacingSpace(const nsTextFragment* aFrag, uint32_t aPos,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether the string aChars/aLength starts with space that's
|
// Check whether the string aChars/aLength starts with space that's
|
||||||
// trimmable according to CSS 'white-space:normal/nowrap'.
|
// trimmable according to CSS 'white-space:normal/nowrap'.
|
||||||
static bool IsTrimmableSpace(const char16_t* aChars, uint32_t aLength)
|
static bool IsTrimmableSpace(const char16_t* aChars, uint32_t aLength)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aLength > 0, "No text for IsSpace!");
|
NS_ASSERTION(aLength > 0, "No text for IsSpace!");
|
||||||
|
@ -1080,7 +1080,7 @@ public:
|
||||||
// ancestor of mStartFrame and the previous text frame, or null if there
|
// ancestor of mStartFrame and the previous text frame, or null if there
|
||||||
// was no previous text frame on this line.
|
// was no previous text frame on this line.
|
||||||
nsIFrame* mAncestorControllingInitialBreak;
|
nsIFrame* mAncestorControllingInitialBreak;
|
||||||
|
|
||||||
int32_t GetContentEnd() {
|
int32_t GetContentEnd() {
|
||||||
return mEndFrame ? mEndFrame->GetContentOffset()
|
return mEndFrame ? mEndFrame->GetContentOffset()
|
||||||
: mStartFrame->GetContent()->GetText()->GetLength();
|
: mStartFrame->GetContent()->GetText()->GetLength();
|
||||||
|
@ -1105,7 +1105,7 @@ public:
|
||||||
mTextRun->ClearFlagBits(nsTextFrameUtils::TEXT_NO_BREAKS);
|
mTextRun->ClearFlagBits(nsTextFrameUtils::TEXT_NO_BREAKS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetCapitalization(uint32_t aOffset, uint32_t aLength,
|
virtual void SetCapitalization(uint32_t aOffset, uint32_t aLength,
|
||||||
bool* aCapitalize) override {
|
bool* aCapitalize) override {
|
||||||
MOZ_ASSERT(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED,
|
MOZ_ASSERT(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED,
|
||||||
|
@ -1281,7 +1281,7 @@ CanTextCrossFrameBoundary(nsIFrame* aFrame, nsIAtom* aType)
|
||||||
result.mTextRunCanCrossFrameBoundary = false;
|
result.mTextRunCanCrossFrameBoundary = false;
|
||||||
result.mLineBreakerCanCrossFrameBoundary = false;
|
result.mLineBreakerCanCrossFrameBoundary = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1310,7 +1310,7 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
|
||||||
}
|
}
|
||||||
aState->mLastTextFrame = textFrame;
|
aState->mLastTextFrame = textFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFrame == aState->mStopAtFrame)
|
if (aFrame == aState->mStopAtFrame)
|
||||||
return FB_STOPPED_AT_STOP_FRAME;
|
return FB_STOPPED_AT_STOP_FRAME;
|
||||||
|
|
||||||
|
@ -1328,7 +1328,7 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
|
||||||
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
|
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FB_CONTINUE;
|
return FB_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTextTraversal traversal =
|
FrameTextTraversal traversal =
|
||||||
|
@ -1338,7 +1338,7 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
|
||||||
if (aState->mSeenSpaceForLineBreakingOnThisLine)
|
if (aState->mSeenSpaceForLineBreakingOnThisLine)
|
||||||
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
|
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (nsIFrame* f = traversal.NextFrameToScan(); f;
|
for (nsIFrame* f = traversal.NextFrameToScan(); f;
|
||||||
f = traversal.NextFrameToScan()) {
|
f = traversal.NextFrameToScan()) {
|
||||||
FindBoundaryResult result = FindBoundaries(f, aState);
|
FindBoundaryResult result = FindBoundaries(f, aState);
|
||||||
|
@ -1362,7 +1362,7 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
|
||||||
/**
|
/**
|
||||||
* General routine for building text runs. This is hairy because of the need
|
* General routine for building text runs. This is hairy because of the need
|
||||||
* to build text runs that span content nodes.
|
* to build text runs that span content nodes.
|
||||||
*
|
*
|
||||||
* @param aContext The gfxContext we're using to construct this text run.
|
* @param aContext The gfxContext we're using to construct this text run.
|
||||||
* @param aForFrame The nsTextFrame for which we're building this text run.
|
* @param aForFrame The nsTextFrame for which we're building this text run.
|
||||||
* @param aLineContainer the line container containing aForFrame; if null,
|
* @param aLineContainer the line container containing aForFrame; if null,
|
||||||
|
@ -1382,7 +1382,7 @@ BuildTextRuns(DrawTarget* aDrawTarget, nsTextFrame* aForFrame,
|
||||||
MOZ_ASSERT(aForFrame, "for no frame?");
|
MOZ_ASSERT(aForFrame, "for no frame?");
|
||||||
NS_ASSERTION(!aForFrameLine || aLineContainer,
|
NS_ASSERTION(!aForFrameLine || aLineContainer,
|
||||||
"line but no line container");
|
"line but no line container");
|
||||||
|
|
||||||
nsIFrame* lineContainerChild = aForFrame;
|
nsIFrame* lineContainerChild = aForFrame;
|
||||||
if (!aLineContainer) {
|
if (!aLineContainer) {
|
||||||
if (aForFrame->IsFloatingFirstLetterChild()) {
|
if (aForFrame->IsFloatingFirstLetterChild()) {
|
||||||
|
@ -1613,7 +1613,7 @@ void BuildTextRunsScanner::FlushFrames(bool aFlushLineBreaks, bool aSuppressTrai
|
||||||
if (!SetupLineBreakerContext(textRun)) {
|
if (!SetupLineBreakerContext(textRun)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update mNextRunContextInfo appropriately
|
// Update mNextRunContextInfo appropriately
|
||||||
mNextRunContextInfo = nsTextFrameUtils::INCOMING_NONE;
|
mNextRunContextInfo = nsTextFrameUtils::INCOMING_NONE;
|
||||||
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_TRAILING_WHITESPACE) {
|
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_TRAILING_WHITESPACE) {
|
||||||
|
@ -2138,10 +2138,10 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
||||||
}
|
}
|
||||||
nsIFrame* child = mLineContainer;
|
nsIFrame* child = mLineContainer;
|
||||||
uint8_t oldScriptLevel = 0;
|
uint8_t oldScriptLevel = 0;
|
||||||
while (parent &&
|
while (parent &&
|
||||||
child->HasAnyStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT)) {
|
child->HasAnyStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT)) {
|
||||||
// Reconstruct the script level ignoring any user overrides. It is
|
// Reconstruct the script level ignoring any user overrides. It is
|
||||||
// calculated this way instead of using scriptlevel to ensure the
|
// calculated this way instead of using scriptlevel to ensure the
|
||||||
// correct ssty font feature setting is used even if the user sets a
|
// correct ssty font feature setting is used even if the user sets a
|
||||||
// different (especially negative) scriptlevel.
|
// different (especially negative) scriptlevel.
|
||||||
nsIMathMLFrame* mathFrame= do_QueryFrame(parent);
|
nsIMathMLFrame* mathFrame= do_QueryFrame(parent);
|
||||||
|
@ -2276,7 +2276,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
||||||
gfxSkipCharsIterator iter(skipChars);
|
gfxSkipCharsIterator iter(skipChars);
|
||||||
AutoTArray<uint32_t,50> textBreakPointsAfterTransform;
|
AutoTArray<uint32_t,50> textBreakPointsAfterTransform;
|
||||||
for (uint32_t i = 0; i < textBreakPoints.Length(); ++i) {
|
for (uint32_t i = 0; i < textBreakPoints.Length(); ++i) {
|
||||||
nsTextFrameUtils::AppendLineBreakOffset(&textBreakPointsAfterTransform,
|
nsTextFrameUtils::AppendLineBreakOffset(&textBreakPointsAfterTransform,
|
||||||
iter.ConvertOriginalToSkipped(textBreakPoints[i]));
|
iter.ConvertOriginalToSkipped(textBreakPoints[i]));
|
||||||
}
|
}
|
||||||
if (mStartOfLine) {
|
if (mStartOfLine) {
|
||||||
|
@ -2599,7 +2599,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
||||||
if (textStyle->mTextTransform == NS_STYLE_TEXT_TRANSFORM_CAPITALIZE) {
|
if (textStyle->mTextTransform == NS_STYLE_TEXT_TRANSFORM_CAPITALIZE) {
|
||||||
flags |= nsLineBreaker::BREAK_NEED_CAPITALIZATION;
|
flags |= nsLineBreaker::BREAK_NEED_CAPITALIZATION;
|
||||||
}
|
}
|
||||||
if (textStyle->mHyphens == NS_STYLE_HYPHENS_AUTO) {
|
if (textStyle->mHyphens == StyleHyphens::Auto) {
|
||||||
flags |= nsLineBreaker::BREAK_USE_AUTO_HYPHENATION;
|
flags |= nsLineBreaker::BREAK_USE_AUTO_HYPHENATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2621,7 +2621,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
||||||
length, flags, sink);
|
length, flags, sink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iter = iterNext;
|
iter = iterNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3057,7 +3057,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Use this constructor for reflow, when we don't know what text is
|
* Use this constructor for reflow, when we don't know what text is
|
||||||
* really mapped by the frame and we have a lot of other data around.
|
* really mapped by the frame and we have a lot of other data around.
|
||||||
*
|
*
|
||||||
* @param aLength can be INT32_MAX to indicate we cover all the text
|
* @param aLength can be INT32_MAX to indicate we cover all the text
|
||||||
* associated with aFrame up to where its flow chain ends in the given
|
* associated with aFrame up to where its flow chain ends in the given
|
||||||
* textrun. If INT32_MAX is passed, justification and hyphen-related methods
|
* textrun. If INT32_MAX is passed, justification and hyphen-related methods
|
||||||
|
@ -3117,7 +3117,7 @@ public:
|
||||||
virtual void GetSpacing(Range aRange, Spacing* aSpacing);
|
virtual void GetSpacing(Range aRange, Spacing* aSpacing);
|
||||||
virtual gfxFloat GetHyphenWidth();
|
virtual gfxFloat GetHyphenWidth();
|
||||||
virtual void GetHyphenationBreaks(Range aRange, bool* aBreakBefore);
|
virtual void GetHyphenationBreaks(Range aRange, bool* aBreakBefore);
|
||||||
virtual int8_t GetHyphensOption() {
|
virtual StyleHyphens GetHyphensOption() {
|
||||||
return mTextStyle->mHyphens;
|
return mTextStyle->mHyphens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3186,7 +3186,7 @@ protected:
|
||||||
nsTextFrame* mFrame;
|
nsTextFrame* mFrame;
|
||||||
gfxSkipCharsIterator mStart; // Offset in original and transformed string
|
gfxSkipCharsIterator mStart; // Offset in original and transformed string
|
||||||
gfxSkipCharsIterator mTempIterator;
|
gfxSkipCharsIterator mTempIterator;
|
||||||
|
|
||||||
// Either null, or pointing to the frame's TabWidthProperty.
|
// Either null, or pointing to the frame's TabWidthProperty.
|
||||||
TabWidthStore* mTabWidths;
|
TabWidthStore* mTabWidths;
|
||||||
// How far we've done tab-width calculation; this is ONLY valid when
|
// How far we've done tab-width calculation; this is ONLY valid when
|
||||||
|
@ -3523,7 +3523,7 @@ PropertyProvider::CalcTabWidths(Range aRange, gfxFloat aTabWidth)
|
||||||
}
|
}
|
||||||
double nextTab = AdvanceToNextTab(mOffsetFromBlockOriginForTabs,
|
double nextTab = AdvanceToNextTab(mOffsetFromBlockOriginForTabs,
|
||||||
mFrame, mTextRun, aTabWidth);
|
mFrame, mTextRun, aTabWidth);
|
||||||
mTabWidths->mWidths.AppendElement(TabWidth(i - startOffset,
|
mTabWidths->mWidths.AppendElement(TabWidth(i - startOffset,
|
||||||
NSToIntRound(nextTab - mOffsetFromBlockOriginForTabs)));
|
NSToIntRound(nextTab - mOffsetFromBlockOriginForTabs)));
|
||||||
mOffsetFromBlockOriginForTabs = nextTab;
|
mOffsetFromBlockOriginForTabs = nextTab;
|
||||||
}
|
}
|
||||||
|
@ -3560,7 +3560,7 @@ PropertyProvider::GetHyphenationBreaks(Range aRange, bool* aBreakBefore)
|
||||||
NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
|
NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
|
||||||
|
|
||||||
if (!mTextStyle->WhiteSpaceCanWrap(mFrame) ||
|
if (!mTextStyle->WhiteSpaceCanWrap(mFrame) ||
|
||||||
mTextStyle->mHyphens == NS_STYLE_HYPHENS_NONE)
|
mTextStyle->mHyphens == StyleHyphens::None)
|
||||||
{
|
{
|
||||||
memset(aBreakBefore, false, aRange.Length() * sizeof(bool));
|
memset(aBreakBefore, false, aRange.Length() * sizeof(bool));
|
||||||
return;
|
return;
|
||||||
|
@ -3598,7 +3598,7 @@ PropertyProvider::GetHyphenationBreaks(Range aRange, bool* aBreakBefore)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTextStyle->mHyphens == NS_STYLE_HYPHENS_AUTO) {
|
if (mTextStyle->mHyphens == StyleHyphens::Auto) {
|
||||||
for (uint32_t i = 0; i < aRange.Length(); ++i) {
|
for (uint32_t i = 0; i < aRange.Length(); ++i) {
|
||||||
if (mTextRun->CanHyphenateBefore(aRange.start + i)) {
|
if (mTextRun->CanHyphenateBefore(aRange.start + i)) {
|
||||||
aBreakBefore[i] = true;
|
aBreakBefore[i] = true;
|
||||||
|
@ -3783,7 +3783,7 @@ nsTextPaintStyle::GetHighlightColors(nscolor* aForeColor,
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aForeColor, "aForeColor is null");
|
NS_ASSERTION(aForeColor, "aForeColor is null");
|
||||||
NS_ASSERTION(aBackColor, "aBackColor is null");
|
NS_ASSERTION(aBackColor, "aBackColor is null");
|
||||||
|
|
||||||
nscolor backColor =
|
nscolor backColor =
|
||||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightBackground);
|
LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightBackground);
|
||||||
nscolor foreColor =
|
nscolor foreColor =
|
||||||
|
@ -4310,7 +4310,7 @@ public:
|
||||||
InlineMinISizeData *aData) override;
|
InlineMinISizeData *aData) override;
|
||||||
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
|
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
|
||||||
InlinePrefISizeData *aData) override;
|
InlinePrefISizeData *aData) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit nsContinuingTextFrame(nsStyleContext* aContext) : nsTextFrame(aContext) {}
|
explicit nsContinuingTextFrame(nsStyleContext* aContext) : nsTextFrame(aContext) {}
|
||||||
nsIFrame* mPrevContinuation;
|
nsIFrame* mPrevContinuation;
|
||||||
|
@ -4482,7 +4482,7 @@ nsContinuingTextFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DestroySelectionDetails(SelectionDetails* aDetails)
|
DestroySelectionDetails(SelectionDetails* aDetails)
|
||||||
{
|
{
|
||||||
while (aDetails) {
|
while (aDetails) {
|
||||||
|
@ -5126,7 +5126,7 @@ nsTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
{
|
{
|
||||||
if (!IsVisibleForPainting(aBuilder))
|
if (!IsVisibleForPainting(aBuilder))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsTextFrame");
|
DO_GLOBAL_REFLOW_COUNT_DSP("nsTextFrame");
|
||||||
|
|
||||||
const nsStyleColor* sc = StyleColor();
|
const nsStyleColor* sc = StyleColor();
|
||||||
|
@ -5309,7 +5309,7 @@ nsTextFrame::GetTextDecorations(
|
||||||
|
|
||||||
if (!useOverride &&
|
if (!useOverride &&
|
||||||
(NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL & textDecorations)) {
|
(NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL & textDecorations)) {
|
||||||
// This handles the <a href="blah.html"><font color="green">La
|
// This handles the <a href="blah.html"><font color="green">La
|
||||||
// la la</font></a> case. The link underline should be green.
|
// la la</font></a> case. The link underline should be green.
|
||||||
useOverride = true;
|
useOverride = true;
|
||||||
overrideColor =
|
overrideColor =
|
||||||
|
@ -5887,7 +5887,7 @@ nsTextFrame::DrawSelectionDecorations(gfxContext* aContext,
|
||||||
// X: underline
|
// X: underline
|
||||||
//
|
//
|
||||||
// IME selection #1 IME selection #2 IME selection #3
|
// IME selection #1 IME selection #2 IME selection #3
|
||||||
// | | |
|
// | | |
|
||||||
// | XXXXXXXXXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXX
|
// | XXXXXXXXXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXX
|
||||||
// +---------------------+----------------------+--------------------
|
// +---------------------+----------------------+--------------------
|
||||||
// ^ ^ ^ ^ ^
|
// ^ ^ ^ ^ ^
|
||||||
|
@ -6109,10 +6109,10 @@ bool SelectionIterator::GetNextSegment(gfxFloat* aXOffset,
|
||||||
{
|
{
|
||||||
if (mIterator.GetOriginalOffset() >= int32_t(mOriginalRange.end))
|
if (mIterator.GetOriginalOffset() >= int32_t(mOriginalRange.end))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// save offset into transformed string now
|
// save offset into transformed string now
|
||||||
uint32_t runOffset = mIterator.GetSkippedOffset();
|
uint32_t runOffset = mIterator.GetSkippedOffset();
|
||||||
|
|
||||||
uint32_t index = mIterator.GetOriginalOffset() - mOriginalRange.start;
|
uint32_t index = mIterator.GetOriginalOffset() - mOriginalRange.start;
|
||||||
SelectionDetails* sdptr = mSelectionDetails[index];
|
SelectionDetails* sdptr = mSelectionDetails[index];
|
||||||
SelectionType selectionType =
|
SelectionType selectionType =
|
||||||
|
@ -7231,10 +7231,10 @@ nsTextFrame::IsVisibleInSelection(nsISelection* aSelection)
|
||||||
// Check the quick way first
|
// Check the quick way first
|
||||||
if (!GetContent()->IsSelectionDescendant())
|
if (!GetContent()->IsSelectionDescendant())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SelectionDetails* details = GetSelectionDetails();
|
SelectionDetails* details = GetSelectionDetails();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
// where are the selection points "really"
|
// where are the selection points "really"
|
||||||
SelectionDetails *sdptr = details;
|
SelectionDetails *sdptr = details;
|
||||||
while (sdptr) {
|
while (sdptr) {
|
||||||
|
@ -7749,7 +7749,7 @@ nsTextFrame::GetChildFrameContainingOffset(int32_t aContentOffset,
|
||||||
f = prev;
|
f = prev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*aOutOffset = aContentOffset - f->GetContentOffset();
|
*aOutOffset = aContentOffset - f->GetContentOffset();
|
||||||
*aOutFrame = f;
|
*aOutFrame = f;
|
||||||
|
|
||||||
|
@ -7905,7 +7905,7 @@ nsTextFrame::PeekOffsetCharacter(bool aForward, int32_t* aOffset,
|
||||||
}
|
}
|
||||||
*aOffset = contentLength;
|
*aOffset = contentLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CONTINUE;
|
return CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8162,7 +8162,7 @@ FindEndOfPunctuationRun(const nsTextFragment* aFrag,
|
||||||
*
|
*
|
||||||
* XXX :first-letter should be handled during frame construction
|
* XXX :first-letter should be handled during frame construction
|
||||||
* (and it has a good bit in common with nextBidi)
|
* (and it has a good bit in common with nextBidi)
|
||||||
*
|
*
|
||||||
* @param aLength an in/out parameter: on entry contains the maximum length to
|
* @param aLength an in/out parameter: on entry contains the maximum length to
|
||||||
* return, on exit returns length of the first-letter fragment (which may
|
* return, on exit returns length of the first-letter fragment (which may
|
||||||
* include leading and trailing punctuation, for example)
|
* include leading and trailing punctuation, for example)
|
||||||
|
@ -8179,7 +8179,7 @@ FindFirstLetterRange(const nsTextFragment* aFrag,
|
||||||
gfxSkipCharsIterator iter(aIter);
|
gfxSkipCharsIterator iter(aIter);
|
||||||
|
|
||||||
// skip leading whitespace, then consume clusters that start with punctuation
|
// skip leading whitespace, then consume clusters that start with punctuation
|
||||||
i = FindEndOfPunctuationRun(aFrag, aTextRun, &iter, aOffset,
|
i = FindEndOfPunctuationRun(aFrag, aTextRun, &iter, aOffset,
|
||||||
GetTrimmableWhitespaceCount(aFrag, aOffset, length, 1),
|
GetTrimmableWhitespaceCount(aFrag, aOffset, length, 1),
|
||||||
endOffset);
|
endOffset);
|
||||||
if (i == length)
|
if (i == length)
|
||||||
|
@ -8307,7 +8307,7 @@ nsTextFrame::SetFontSizeInflation(float aInflation)
|
||||||
Properties().Set(FontSizeInflationProperty(), aInflation);
|
Properties().Set(FontSizeInflationProperty(), aInflation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
void nsTextFrame::MarkIntrinsicISizesDirty()
|
void nsTextFrame::MarkIntrinsicISizesDirty()
|
||||||
{
|
{
|
||||||
ClearTextRuns();
|
ClearTextRuns();
|
||||||
|
@ -8338,8 +8338,8 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext,
|
||||||
// otherwise we can just pass INT32_MAX to mean "all the text"
|
// otherwise we can just pass INT32_MAX to mean "all the text"
|
||||||
int32_t len = INT32_MAX;
|
int32_t len = INT32_MAX;
|
||||||
bool hyphenating = frag->GetLength() > 0 &&
|
bool hyphenating = frag->GetLength() > 0 &&
|
||||||
(textStyle->mHyphens == NS_STYLE_HYPHENS_AUTO ||
|
(textStyle->mHyphens == StyleHyphens::Auto ||
|
||||||
(textStyle->mHyphens == NS_STYLE_HYPHENS_MANUAL &&
|
(textStyle->mHyphens == StyleHyphens::Manual &&
|
||||||
(textRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
|
(textRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
|
||||||
if (hyphenating) {
|
if (hyphenating) {
|
||||||
gfxSkipCharsIterator tmp(iter);
|
gfxSkipCharsIterator tmp(iter);
|
||||||
|
@ -8516,7 +8516,7 @@ nsTextFrame::AddInlinePrefISizeForFlow(nsRenderingContext *aRenderingContext,
|
||||||
|
|
||||||
// Pass null for the line container. This will disable tab spacing, but that's
|
// Pass null for the line container. This will disable tab spacing, but that's
|
||||||
// OK since we can't really handle tabs for intrinsic sizing anyway.
|
// OK since we can't really handle tabs for intrinsic sizing anyway.
|
||||||
|
|
||||||
const nsStyleText* textStyle = StyleText();
|
const nsStyleText* textStyle = StyleText();
|
||||||
const nsTextFragment* frag = mContent->GetText();
|
const nsTextFragment* frag = mContent->GetText();
|
||||||
PropertyProvider provider(textRun, textStyle, frag, this,
|
PropertyProvider provider(textRun, textStyle, frag, this,
|
||||||
|
@ -8787,7 +8787,7 @@ RemoveEmptyInFlows(nsTextFrame* aFrame, nsTextFrame* aFirstToNotRemove)
|
||||||
aFrame->GetPrevInFlow() &&
|
aFrame->GetPrevInFlow() &&
|
||||||
aFrame->GetPrevInFlow() != nullptr,
|
aFrame->GetPrevInFlow() != nullptr,
|
||||||
"aFrame should have a fluid prev continuation");
|
"aFrame should have a fluid prev continuation");
|
||||||
|
|
||||||
nsIFrame* prevContinuation = aFrame->GetPrevContinuation();
|
nsIFrame* prevContinuation = aFrame->GetPrevContinuation();
|
||||||
nsIFrame* lastRemoved = aFirstToNotRemove->GetPrevContinuation();
|
nsIFrame* lastRemoved = aFirstToNotRemove->GetPrevContinuation();
|
||||||
|
|
||||||
|
@ -9095,7 +9095,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||||
cachedNewlineOffset->mNewlineOffset >= offset)) {
|
cachedNewlineOffset->mNewlineOffset >= offset)) {
|
||||||
contentNewLineOffset = cachedNewlineOffset->mNewlineOffset;
|
contentNewLineOffset = cachedNewlineOffset->mNewlineOffset;
|
||||||
} else {
|
} else {
|
||||||
contentNewLineOffset = FindChar(frag, offset,
|
contentNewLineOffset = FindChar(frag, offset,
|
||||||
mContent->TextLength() - offset, '\n');
|
mContent->TextLength() - offset, '\n');
|
||||||
}
|
}
|
||||||
if (contentNewLineOffset < offset + length) {
|
if (contentNewLineOffset < offset + length) {
|
||||||
|
@ -9183,7 +9183,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||||
// Ensure that the textrun will be rebuilt
|
// Ensure that the textrun will be rebuilt
|
||||||
ClearTextRuns();
|
ClearTextRuns();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||||
|
@ -9225,7 +9225,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// See how much text should belong to this text frame, and measure it
|
// See how much text should belong to this text frame, and measure it
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
iter.SetOriginalOffset(offset);
|
iter.SetOriginalOffset(offset);
|
||||||
nscoord xOffsetForTabs = (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TAB) ?
|
nscoord xOffsetForTabs = (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TAB) ?
|
||||||
(aLineLayout.GetCurrentFrameInlineDistanceFromBlock() -
|
(aLineLayout.GetCurrentFrameInlineDistanceFromBlock() -
|
||||||
|
@ -9510,7 +9510,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||||
bool breakAfter = forceBreakAfter;
|
bool breakAfter = forceBreakAfter;
|
||||||
if (!shouldSuppressLineBreak) {
|
if (!shouldSuppressLineBreak) {
|
||||||
if (charsFit > 0 && charsFit == length &&
|
if (charsFit > 0 && charsFit == length &&
|
||||||
textStyle->mHyphens != NS_STYLE_HYPHENS_NONE &&
|
textStyle->mHyphens != StyleHyphens::None &&
|
||||||
HasSoftHyphenBefore(frag, mTextRun, offset, end)) {
|
HasSoftHyphenBefore(frag, mTextRun, offset, end)) {
|
||||||
bool fits =
|
bool fits =
|
||||||
textMetrics.mAdvanceWidth + provider.GetHyphenWidth() <= availWidth;
|
textMetrics.mAdvanceWidth + provider.GetHyphenWidth() <= availWidth;
|
||||||
|
@ -9636,7 +9636,7 @@ nsTextFrame::TrimTrailingWhiteSpace(DrawTarget* aDrawTarget)
|
||||||
const nsStyleText* textStyle = StyleText();
|
const nsStyleText* textStyle = StyleText();
|
||||||
gfxFloat delta = 0;
|
gfxFloat delta = 0;
|
||||||
uint32_t trimmedEnd = trimmedEndIter.ConvertOriginalToSkipped(trimmed.GetEnd());
|
uint32_t trimmedEnd = trimmedEndIter.ConvertOriginalToSkipped(trimmed.GetEnd());
|
||||||
|
|
||||||
if (!(GetStateBits() & TEXT_TRIMMED_TRAILING_WHITESPACE) &&
|
if (!(GetStateBits() & TEXT_TRIMMED_TRAILING_WHITESPACE) &&
|
||||||
trimmed.GetEnd() < GetContentEnd()) {
|
trimmed.GetEnd() < GetContentEnd()) {
|
||||||
gfxSkipCharsIterator end = trimmedEndIter;
|
gfxSkipCharsIterator end = trimmedEndIter;
|
||||||
|
@ -9955,7 +9955,7 @@ nsTextFrame::IsEmpty()
|
||||||
NS_ASSERTION(!(mState & TEXT_IS_ONLY_WHITESPACE) ||
|
NS_ASSERTION(!(mState & TEXT_IS_ONLY_WHITESPACE) ||
|
||||||
!(mState & TEXT_ISNOT_ONLY_WHITESPACE),
|
!(mState & TEXT_ISNOT_ONLY_WHITESPACE),
|
||||||
"Invalid state");
|
"Invalid state");
|
||||||
|
|
||||||
// XXXldb Should this check compatibility mode as well???
|
// XXXldb Should this check compatibility mode as well???
|
||||||
const nsStyleText* textStyle = StyleText();
|
const nsStyleText* textStyle = StyleText();
|
||||||
if (textStyle->WhiteSpaceIsSignificant()) {
|
if (textStyle->WhiteSpaceIsSignificant()) {
|
||||||
|
@ -10039,7 +10039,7 @@ nsTextFrame::List(FILE* out, const char* aPrefix, uint32_t aFlags) const
|
||||||
bool isComplete = uint32_t(GetContentEnd()) == GetContent()->TextLength();
|
bool isComplete = uint32_t(GetContentEnd()) == GetContent()->TextLength();
|
||||||
str += nsPrintfCString("[%d,%d,%c] ", GetContentOffset(), GetContentLength(),
|
str += nsPrintfCString("[%d,%d,%c] ", GetContentOffset(), GetContentLength(),
|
||||||
isComplete ? 'T':'F');
|
isComplete ? 'T':'F');
|
||||||
|
|
||||||
if (IsSelected()) {
|
if (IsSelected()) {
|
||||||
str += " SELECTED";
|
str += " SELECTED";
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ nsCSSProps::AddRefTable(void)
|
||||||
static bool prefObserversInited = false;
|
static bool prefObserversInited = false;
|
||||||
if (!prefObserversInited) {
|
if (!prefObserversInited) {
|
||||||
prefObserversInited = true;
|
prefObserversInited = true;
|
||||||
|
|
||||||
#define OBSERVE_PROP(pref_, id_) \
|
#define OBSERVE_PROP(pref_, id_) \
|
||||||
if (pref_[0]) { \
|
if (pref_[0]) { \
|
||||||
Preferences::AddBoolVarCache(&gPropertyEnabled[id_], \
|
Preferences::AddBoolVarCache(&gPropertyEnabled[id_], \
|
||||||
|
@ -1479,9 +1479,9 @@ const KTableEntry nsCSSProps::kFlexWrapKTable[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const KTableEntry nsCSSProps::kHyphensKTable[] = {
|
const KTableEntry nsCSSProps::kHyphensKTable[] = {
|
||||||
{ eCSSKeyword_none, NS_STYLE_HYPHENS_NONE },
|
{ eCSSKeyword_none, StyleHyphens::None },
|
||||||
{ eCSSKeyword_manual, NS_STYLE_HYPHENS_MANUAL },
|
{ eCSSKeyword_manual, StyleHyphens::Manual },
|
||||||
{ eCSSKeyword_auto, NS_STYLE_HYPHENS_AUTO },
|
{ eCSSKeyword_auto, StyleHyphens::Auto },
|
||||||
{ eCSSKeyword_UNKNOWN, -1 }
|
{ eCSSKeyword_UNKNOWN, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2873,7 +2873,7 @@ static const nsCSSPropertyID gFlexFlowSubpropTable[] = {
|
||||||
|
|
||||||
static const nsCSSPropertyID gGridTemplateSubpropTable[] = {
|
static const nsCSSPropertyID gGridTemplateSubpropTable[] = {
|
||||||
eCSSProperty_grid_template_areas,
|
eCSSProperty_grid_template_areas,
|
||||||
eCSSProperty_grid_template_rows,
|
eCSSProperty_grid_template_rows,
|
||||||
eCSSProperty_grid_template_columns,
|
eCSSProperty_grid_template_columns,
|
||||||
eCSSProperty_UNKNOWN
|
eCSSProperty_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
|
@ -1448,6 +1448,7 @@ struct SetEnumValueHelper
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
|
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None, InlineEnd)
|
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None, InlineEnd)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
|
DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
|
||||||
|
DEFINE_ENUM_CLASS_SETTER(StyleHyphens, None, Auto)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None, SelectMenu)
|
DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None, SelectMenu)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None, MozText)
|
DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None, MozText)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleUserInput, None, Auto)
|
DEFINE_ENUM_CLASS_SETTER(StyleUserInput, None, Auto)
|
||||||
|
@ -4932,7 +4933,7 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
|
||||||
SetValue(*aRuleData->ValueForHyphens(), text->mHyphens, conditions,
|
SetValue(*aRuleData->ValueForHyphens(), text->mHyphens, conditions,
|
||||||
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
|
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
|
||||||
parentText->mHyphens,
|
parentText->mHyphens,
|
||||||
NS_STYLE_HYPHENS_MANUAL);
|
StyleHyphens::Manual);
|
||||||
|
|
||||||
// ruby-align: enum, inherit, initial
|
// ruby-align: enum, inherit, initial
|
||||||
SetValue(*aRuleData->ValueForRubyAlign(),
|
SetValue(*aRuleData->ValueForRubyAlign(),
|
||||||
|
|
|
@ -165,6 +165,13 @@ enum class StyleFloatEdge : uint8_t {
|
||||||
MarginBox,
|
MarginBox,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Hyphens
|
||||||
|
enum class StyleHyphens : uint8_t {
|
||||||
|
None,
|
||||||
|
Manual,
|
||||||
|
Auto,
|
||||||
|
};
|
||||||
|
|
||||||
// shape-box for shape-outside
|
// shape-box for shape-outside
|
||||||
enum class StyleShapeOutsideShapeBox : uint8_t {
|
enum class StyleShapeOutsideShapeBox : uint8_t {
|
||||||
NoBox,
|
NoBox,
|
||||||
|
@ -971,11 +978,6 @@ enum class StyleDisplay : uint8_t {
|
||||||
#define NS_STYLE_OVERFLOWWRAP_NORMAL 0
|
#define NS_STYLE_OVERFLOWWRAP_NORMAL 0
|
||||||
#define NS_STYLE_OVERFLOWWRAP_BREAK_WORD 1
|
#define NS_STYLE_OVERFLOWWRAP_BREAK_WORD 1
|
||||||
|
|
||||||
// See nsStyleText
|
|
||||||
#define NS_STYLE_HYPHENS_NONE 0
|
|
||||||
#define NS_STYLE_HYPHENS_MANUAL 1
|
|
||||||
#define NS_STYLE_HYPHENS_AUTO 2
|
|
||||||
|
|
||||||
// ruby-align, see nsStyleText
|
// ruby-align, see nsStyleText
|
||||||
#define NS_STYLE_RUBY_ALIGN_START 0
|
#define NS_STYLE_RUBY_ALIGN_START 0
|
||||||
#define NS_STYLE_RUBY_ALIGN_CENTER 1
|
#define NS_STYLE_RUBY_ALIGN_CENTER 1
|
||||||
|
|
|
@ -3770,7 +3770,7 @@ nsStyleText::nsStyleText(const nsPresContext* aContext)
|
||||||
, mWhiteSpace(NS_STYLE_WHITESPACE_NORMAL)
|
, mWhiteSpace(NS_STYLE_WHITESPACE_NORMAL)
|
||||||
, mWordBreak(NS_STYLE_WORDBREAK_NORMAL)
|
, mWordBreak(NS_STYLE_WORDBREAK_NORMAL)
|
||||||
, mOverflowWrap(NS_STYLE_OVERFLOWWRAP_NORMAL)
|
, mOverflowWrap(NS_STYLE_OVERFLOWWRAP_NORMAL)
|
||||||
, mHyphens(NS_STYLE_HYPHENS_MANUAL)
|
, mHyphens(StyleHyphens::Manual)
|
||||||
, mRubyAlign(NS_STYLE_RUBY_ALIGN_SPACE_AROUND)
|
, mRubyAlign(NS_STYLE_RUBY_ALIGN_SPACE_AROUND)
|
||||||
, mRubyPosition(NS_STYLE_RUBY_POSITION_OVER)
|
, mRubyPosition(NS_STYLE_RUBY_POSITION_OVER)
|
||||||
, mTextSizeAdjust(NS_STYLE_TEXT_SIZE_ADJUST_AUTO)
|
, mTextSizeAdjust(NS_STYLE_TEXT_SIZE_ADJUST_AUTO)
|
||||||
|
|
|
@ -2081,7 +2081,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
|
||||||
uint8_t mWhiteSpace; // [inherited] see nsStyleConsts.h
|
uint8_t mWhiteSpace; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mWordBreak; // [inherited] see nsStyleConsts.h
|
uint8_t mWordBreak; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mOverflowWrap; // [inherited] see nsStyleConsts.h
|
uint8_t mOverflowWrap; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mHyphens; // [inherited] see nsStyleConsts.h
|
mozilla::StyleHyphens mHyphens; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mRubyAlign; // [inherited] see nsStyleConsts.h
|
uint8_t mRubyAlign; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mRubyPosition; // [inherited] see nsStyleConsts.h
|
uint8_t mRubyPosition; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mTextSizeAdjust; // [inherited] see nsStyleConsts.h
|
uint8_t mTextSizeAdjust; // [inherited] see nsStyleConsts.h
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsDisplayList.h"
|
#include "nsDisplayList.h"
|
||||||
|
#include "nsRefreshDriver.h" // for nsAPostRefreshObserver
|
||||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/LookAndFeel.h"
|
#include "mozilla/LookAndFeel.h"
|
||||||
|
@ -929,6 +930,43 @@ nsSliderMediator::HandleEvent(nsIDOMEvent* aEvent)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AsyncScrollbarDragStarter : public nsAPostRefreshObserver {
|
||||||
|
public:
|
||||||
|
AsyncScrollbarDragStarter(nsIPresShell* aPresShell,
|
||||||
|
nsIWidget* aWidget,
|
||||||
|
const AsyncDragMetrics& aDragMetrics)
|
||||||
|
: mPresShell(aPresShell)
|
||||||
|
, mWidget(aWidget)
|
||||||
|
, mDragMetrics(aDragMetrics)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~AsyncScrollbarDragStarter() {}
|
||||||
|
|
||||||
|
void DidRefresh() override {
|
||||||
|
if (!mPresShell) {
|
||||||
|
MOZ_ASSERT_UNREACHABLE("Post-refresh observer fired again after failed attempt at unregistering it");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mWidget->StartAsyncScrollbarDrag(mDragMetrics);
|
||||||
|
|
||||||
|
if (!mPresShell->RemovePostRefreshObserver(this)) {
|
||||||
|
MOZ_ASSERT_UNREACHABLE("Unable to unregister post-refresh observer! Leaking it instead of leaving garbage registered");
|
||||||
|
// Graceful handling, just in case...
|
||||||
|
mPresShell = nullptr;
|
||||||
|
mWidget = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
RefPtr<nsIPresShell> mPresShell;
|
||||||
|
RefPtr<nsIWidget> mWidget;
|
||||||
|
AsyncDragMetrics mDragMetrics;
|
||||||
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
|
nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
|
||||||
{
|
{
|
||||||
|
@ -974,8 +1012,9 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
|
||||||
scrollFrameAsScrollable->GetScrollPortRect().TopLeft();
|
scrollFrameAsScrollable->GetScrollPortRect().TopLeft();
|
||||||
CSSRect sliderTrackCSS = CSSRect::FromAppUnits(sliderTrack);
|
CSSRect sliderTrackCSS = CSSRect::FromAppUnits(sliderTrack);
|
||||||
|
|
||||||
|
nsIPresShell* shell = PresContext()->PresShell();
|
||||||
uint64_t inputblockId = InputAPZContext::GetInputBlockId();
|
uint64_t inputblockId = InputAPZContext::GetInputBlockId();
|
||||||
uint32_t presShellId = PresContext()->PresShell()->GetPresShellId();
|
uint32_t presShellId = shell->GetPresShellId();
|
||||||
AsyncDragMetrics dragMetrics(scrollTargetId, presShellId, inputblockId,
|
AsyncDragMetrics dragMetrics(scrollTargetId, presShellId, inputblockId,
|
||||||
NSAppUnitsToFloatPixels(mDragStart,
|
NSAppUnitsToFloatPixels(mDragStart,
|
||||||
float(AppUnitsPerCSSPixel())),
|
float(AppUnitsPerCSSPixel())),
|
||||||
|
@ -989,7 +1028,15 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
|
||||||
|
|
||||||
// When we start an APZ drag, we wont get mouse events for the drag.
|
// When we start an APZ drag, we wont get mouse events for the drag.
|
||||||
// APZ will consume them all and only notify us of the new scroll position.
|
// APZ will consume them all and only notify us of the new scroll position.
|
||||||
this->GetNearestWidget()->StartAsyncScrollbarDrag(dragMetrics);
|
bool waitForRefresh = InputAPZContext::HavePendingLayerization();
|
||||||
|
nsIWidget* widget = this->GetNearestWidget();
|
||||||
|
if (waitForRefresh) {
|
||||||
|
waitForRefresh = shell->AddPostRefreshObserver(
|
||||||
|
new AsyncScrollbarDragStarter(shell, widget, dragMetrics));
|
||||||
|
}
|
||||||
|
if (!waitForRefresh) {
|
||||||
|
widget->StartAsyncScrollbarDrag(dragMetrics);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -645,7 +645,7 @@ class IceTestPeer : public sigslot::has_slots<> {
|
||||||
std::vector<std::string> candidates = GetCandidates(stream);
|
std::vector<std::string> candidates = GetCandidates(stream);
|
||||||
|
|
||||||
int host_net = 0;
|
int host_net = 0;
|
||||||
for (auto c : candidates) {
|
for (const auto& c : candidates) {
|
||||||
if (c.find("typ host") != std::string::npos) {
|
if (c.find("typ host") != std::string::npos) {
|
||||||
nr_transport_addr addr;
|
nr_transport_addr addr;
|
||||||
std::vector<std::string> tokens = split(c, ' ');
|
std::vector<std::string> tokens = split(c, ' ');
|
||||||
|
@ -1629,7 +1629,7 @@ class WebRtcIceGatherTest : public StunTest {
|
||||||
std::cerr << "Candidates for stream " << stream << "->"
|
std::cerr << "Candidates for stream " << stream << "->"
|
||||||
<< candidates.size() << std::endl;
|
<< candidates.size() << std::endl;
|
||||||
|
|
||||||
for (auto c : candidates) {
|
for (const auto& c : candidates) {
|
||||||
std::cerr << "Candidate: " << c << std::endl;
|
std::cerr << "Candidate: " << c << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4223,4 +4223,879 @@ TEST_F(JsepSessionTest, TestNonDefaultProtocol)
|
||||||
parsedOffer->GetMediaSection(1).GetProtocol());
|
parsedOffer->GetMediaSection(1).GetProtocol());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferNoVideoStreamRecvVideo)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferNoAudioStreamRecvAudio)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferNoVideoStream)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferNoAudioStream)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(0U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferDontReceiveAudio)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(0U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferDontReceiveVideo)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferRemoveAudioTrack)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
|
||||||
|
|
||||||
|
RefPtr<JsepTrack> removedTrack = GetTrackOff(0, types.front());
|
||||||
|
ASSERT_TRUE(removedTrack);
|
||||||
|
ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(),
|
||||||
|
removedTrack->GetTrackId()));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferDontReceiveAudioRemoveAudioTrack)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(0U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
RefPtr<JsepTrack> removedTrack = GetTrackOff(0, types.front());
|
||||||
|
ASSERT_TRUE(removedTrack);
|
||||||
|
ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(),
|
||||||
|
removedTrack->GetTrackId()));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferDontReceiveVideoRemoveVideoTrack)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
|
||||||
|
|
||||||
|
RefPtr<JsepTrack> removedTrack = GetTrackOff(0, types.back());
|
||||||
|
ASSERT_TRUE(removedTrack);
|
||||||
|
ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(),
|
||||||
|
removedTrack->GetTrackId()));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string strSampleCandidate =
|
||||||
|
"a=candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host\r\n";
|
||||||
|
|
||||||
|
static const unsigned short nSamplelevel = 2;
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, CreateOfferAddCandidate)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
|
||||||
|
std::string mid;
|
||||||
|
bool skipped;
|
||||||
|
nsresult rv;
|
||||||
|
rv = mSessionOff.AddLocalIceCandidate(strSampleCandidate,
|
||||||
|
nSamplelevel, &mid, &skipped);
|
||||||
|
ASSERT_EQ(NS_OK, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, AddIceCandidateEarly)
|
||||||
|
{
|
||||||
|
std::string mid;
|
||||||
|
bool skipped;
|
||||||
|
nsresult rv;
|
||||||
|
rv = mSessionOff.AddLocalIceCandidate(strSampleCandidate,
|
||||||
|
nSamplelevel, &mid, &skipped);
|
||||||
|
|
||||||
|
// This can't succeed without a local description
|
||||||
|
ASSERT_NE(NS_OK, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, OfferAnswerDontAddAudioStreamOnAnswerNoOptions)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
AddTracks(mSessionAns, "video");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
std::string offer = CreateOffer(Some(options));
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
SetLocalAnswer(answer, CHECK_SUCCESS);
|
||||||
|
SetRemoteAnswer(answer, CHECK_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, OfferAnswerDontAddVideoStreamOnAnswerNoOptions)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
CreateOffer(Some(options));
|
||||||
|
std::string offer = CreateOffer(Some(options));
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
SetLocalAnswer(answer, CHECK_SUCCESS);
|
||||||
|
SetRemoteAnswer(answer, CHECK_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, OfferAnswerDontAddAudioVideoStreamsOnAnswerNoOptions)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
AddTracks(mSessionAns);
|
||||||
|
|
||||||
|
JsepOfferOptions options;
|
||||||
|
options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
|
||||||
|
options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
|
||||||
|
|
||||||
|
OfferAnswer();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, OfferAndAnswerWithExtraCodec)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
|
||||||
|
UniquePtr<Sdp> munge = Parse(answer);
|
||||||
|
SdpMediaSection& mediaSection = munge->GetMediaSection(0);
|
||||||
|
mediaSection.AddCodec("8", "PCMA", 8000, 1);
|
||||||
|
std::string sdpString = munge->ToString();
|
||||||
|
|
||||||
|
SetLocalAnswer(sdpString);
|
||||||
|
SetRemoteAnswer(answer);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, AddCandidateInHaveLocalOffer) {
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
std::string mid;
|
||||||
|
rv = mSessionOff.AddRemoteIceCandidate(strSampleCandidate,
|
||||||
|
mid, nSamplelevel);
|
||||||
|
ASSERT_EQ(NS_ERROR_UNEXPECTED, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetLocalWithoutCreateOffer) {
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
nsresult rv = mSessionAns.SetLocalDescription(kJsepSdpOffer, offer);
|
||||||
|
ASSERT_EQ(NS_ERROR_UNEXPECTED, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetLocalWithoutCreateAnswer) {
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
nsresult rv = mSessionAns.SetLocalDescription(kJsepSdpAnswer, offer);
|
||||||
|
ASSERT_EQ(NS_ERROR_UNEXPECTED, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test for Bug 843595
|
||||||
|
TEST_F(JsepSessionTest, missingUfrag)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
std::string ufrag = "ice-ufrag";
|
||||||
|
std::size_t pos = offer.find(ufrag);
|
||||||
|
ASSERT_NE(pos, std::string::npos);
|
||||||
|
offer.replace(pos, ufrag.length(), "ice-ufrog");
|
||||||
|
nsresult rv = mSessionAns.SetRemoteDescription(kJsepSdpOffer, offer);
|
||||||
|
ASSERT_EQ(NS_ERROR_INVALID_ARG, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, AudioOnlyCalleeNoRtcpMux)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
std::string rtcp_mux = "a=rtcp-mux\r\n";
|
||||||
|
std::size_t pos = offer.find(rtcp_mux);
|
||||||
|
ASSERT_NE(pos, std::string::npos);
|
||||||
|
offer.replace(pos, rtcp_mux.length(), "");
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
pos = answer.find(rtcp_mux);
|
||||||
|
ASSERT_EQ(pos, std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This test comes from Bug 810220
|
||||||
|
TEST_F(JsepSessionTest, AudioOnlyG711Call)
|
||||||
|
{
|
||||||
|
std::string offer =
|
||||||
|
"v=0\r\n"
|
||||||
|
"o=- 1 1 IN IP4 148.147.200.251\r\n"
|
||||||
|
"s=-\r\n"
|
||||||
|
"b=AS:64\r\n"
|
||||||
|
"t=0 0\r\n"
|
||||||
|
"a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
|
||||||
|
"7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
|
||||||
|
"m=audio 9000 UDP/TLS/RTP/SAVPF 0 8 126\r\n"
|
||||||
|
"c=IN IP4 148.147.200.251\r\n"
|
||||||
|
"b=TIAS:64000\r\n"
|
||||||
|
"a=rtpmap:0 PCMU/8000\r\n"
|
||||||
|
"a=rtpmap:8 PCMA/8000\r\n"
|
||||||
|
"a=rtpmap:126 telephone-event/8000\r\n"
|
||||||
|
"a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
|
||||||
|
"a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
|
||||||
|
"a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
|
||||||
|
"a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
|
||||||
|
"a=setup:active\r\n"
|
||||||
|
"a=sendrecv\r\n";
|
||||||
|
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
SetRemoteOffer(offer, CHECK_SUCCESS);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
|
||||||
|
// They didn't offer opus, so our answer shouldn't include it.
|
||||||
|
ASSERT_EQ(answer.find(" opus/"), std::string::npos);
|
||||||
|
|
||||||
|
// They also didn't offer video or application
|
||||||
|
ASSERT_EQ(answer.find("video"), std::string::npos);
|
||||||
|
ASSERT_EQ(answer.find("application"), std::string::npos);
|
||||||
|
|
||||||
|
// We should answer with PCMU and telephone-event
|
||||||
|
ASSERT_NE(answer.find(" PCMU/8000"), std::string::npos);
|
||||||
|
|
||||||
|
// Double-check the directionality
|
||||||
|
ASSERT_NE(answer.find("\r\na=sendrecv"), std::string::npos);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, AudioOnlyG722Only)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
|
||||||
|
std::string audio = "m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101\r\n";
|
||||||
|
std::size_t pos = offer.find(audio);
|
||||||
|
ASSERT_NE(pos, std::string::npos);
|
||||||
|
offer.replace(pos, audio.length(),
|
||||||
|
"m=audio 65375 UDP/TLS/RTP/SAVPF 9\r\n");
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
SetLocalAnswer(answer);
|
||||||
|
ASSERT_NE(mSessionAns.GetLocalDescription().find("UDP/TLS/RTP/SAVPF 9\r"),
|
||||||
|
std::string::npos);
|
||||||
|
ASSERT_NE(mSessionAns.GetLocalDescription().find("a=rtpmap:9 G722/8000"),
|
||||||
|
std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, AudioOnlyG722Rejected)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
|
||||||
|
std::string audio = "m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101\r\n";
|
||||||
|
std::size_t pos = offer.find(audio);
|
||||||
|
ASSERT_NE(pos, std::string::npos);
|
||||||
|
offer.replace(pos, audio.length(),
|
||||||
|
"m=audio 65375 UDP/TLS/RTP/SAVPF 0 8\r\n");
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
SetLocalAnswer(answer);
|
||||||
|
SetRemoteAnswer(answer);
|
||||||
|
|
||||||
|
// TODO(bug 814227): Use commented out code instead.
|
||||||
|
ASSERT_NE(mSessionAns.GetLocalDescription().find("UDP/TLS/RTP/SAVPF 0\r"),
|
||||||
|
std::string::npos);
|
||||||
|
// ASSERT_NE(mSessionAns.GetLocalDescription().find("UDP/TLS/RTP/SAVPF 0 8\r"), std::string::npos);
|
||||||
|
ASSERT_NE(mSessionAns.GetLocalDescription().find("a=rtpmap:0 PCMU/8000"), std::string::npos);
|
||||||
|
ASSERT_EQ(mSessionAns.GetLocalDescription().find("a=rtpmap:109 opus/48000/2"), std::string::npos);
|
||||||
|
ASSERT_EQ(mSessionAns.GetLocalDescription().find("a=rtpmap:9 G722/8000"), std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This test doesn't make sense for bundle
|
||||||
|
TEST_F(JsepSessionTest, DISABLED_FullCallAudioNoMuxVideoMux)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
AddTracks(mSessionAns, "audio,video");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
std::string rtcp_mux = "a=rtcp-mux\r\n";
|
||||||
|
std::size_t pos = offer.find(rtcp_mux);
|
||||||
|
ASSERT_NE(pos, std::string::npos);
|
||||||
|
offer.replace(pos, rtcp_mux.length(), "");
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
|
||||||
|
size_t match = mSessionAns.GetLocalDescription().find("\r\na=rtcp-mux");
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
match = mSessionAns.GetLocalDescription().find("\r\na=rtcp-mux", match + 1);
|
||||||
|
ASSERT_EQ(match, std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disabled pending resolution of bug 818640.
|
||||||
|
// Actually, this test is completely broken; you can't just call
|
||||||
|
// SetRemote/CreateAnswer over and over again.
|
||||||
|
TEST_F(JsepSessionTest, DISABLED_OfferAllDynamicTypes)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
|
||||||
|
std::string offer;
|
||||||
|
for (int i = 96; i < 128; i++)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << i;
|
||||||
|
std::cout << "Trying dynamic pt = " << i << std::endl;
|
||||||
|
offer =
|
||||||
|
"v=0\r\n"
|
||||||
|
"o=- 1 1 IN IP4 148.147.200.251\r\n"
|
||||||
|
"s=-\r\n"
|
||||||
|
"b=AS:64\r\n"
|
||||||
|
"t=0 0\r\n"
|
||||||
|
"a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
|
||||||
|
"7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
|
||||||
|
"m=audio 9000 RTP/AVP " + ss.str() + "\r\n"
|
||||||
|
"c=IN IP4 148.147.200.251\r\n"
|
||||||
|
"b=TIAS:64000\r\n"
|
||||||
|
"a=rtpmap:" + ss.str() +" opus/48000/2\r\n"
|
||||||
|
"a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
|
||||||
|
"a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
|
||||||
|
"a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
|
||||||
|
"a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
|
||||||
|
"a=sendrecv\r\n";
|
||||||
|
|
||||||
|
SetRemoteOffer(offer, CHECK_SUCCESS);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
ASSERT_NE(answer.find(ss.str() + " opus/"), std::string::npos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, ipAddrAnyOffer)
|
||||||
|
{
|
||||||
|
std::string offer =
|
||||||
|
"v=0\r\n"
|
||||||
|
"o=- 1 1 IN IP4 127.0.0.1\r\n"
|
||||||
|
"s=-\r\n"
|
||||||
|
"b=AS:64\r\n"
|
||||||
|
"t=0 0\r\n"
|
||||||
|
"a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
|
||||||
|
"7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
|
||||||
|
"m=audio 9000 UDP/TLS/RTP/SAVPF 99\r\n"
|
||||||
|
"c=IN IP4 0.0.0.0\r\n"
|
||||||
|
"a=rtpmap:99 opus/48000/2\r\n"
|
||||||
|
"a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
|
||||||
|
"a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
|
||||||
|
"a=setup:active\r\n"
|
||||||
|
"a=sendrecv\r\n";
|
||||||
|
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
SetRemoteOffer(offer, CHECK_SUCCESS);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
|
||||||
|
ASSERT_NE(answer.find("a=sendrecv"), std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CreateSDPForBigOTests(std::string& offer, const std::string& number) {
|
||||||
|
offer =
|
||||||
|
"v=0\r\n"
|
||||||
|
"o=- ";
|
||||||
|
offer += number;
|
||||||
|
offer += " ";
|
||||||
|
offer += number;
|
||||||
|
offer += " IN IP4 127.0.0.1\r\n"
|
||||||
|
"s=-\r\n"
|
||||||
|
"b=AS:64\r\n"
|
||||||
|
"t=0 0\r\n"
|
||||||
|
"a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
|
||||||
|
"7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
|
||||||
|
"m=audio 9000 RTP/AVP 99\r\n"
|
||||||
|
"c=IN IP4 0.0.0.0\r\n"
|
||||||
|
"a=rtpmap:99 opus/48000/2\r\n"
|
||||||
|
"a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
|
||||||
|
"a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
|
||||||
|
"a=setup:active\r\n"
|
||||||
|
"a=sendrecv\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, BigOValues)
|
||||||
|
{
|
||||||
|
std::string offer;
|
||||||
|
|
||||||
|
CreateSDPForBigOTests(offer, "12345678901234567");
|
||||||
|
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
SetRemoteOffer(offer, CHECK_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, BigOValuesExtraChars)
|
||||||
|
{
|
||||||
|
std::string offer;
|
||||||
|
|
||||||
|
CreateSDPForBigOTests(offer, "12345678901234567FOOBAR");
|
||||||
|
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
// The signaling state will remain "stable" because the unparsable
|
||||||
|
// SDP leads to a failure in SetRemoteDescription.
|
||||||
|
SetRemoteOffer(offer, NO_CHECKS);
|
||||||
|
ASSERT_EQ(kJsepStateStable, mSessionAns.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, BigOValuesTooBig)
|
||||||
|
{
|
||||||
|
std::string offer;
|
||||||
|
|
||||||
|
CreateSDPForBigOTests(offer, "18446744073709551615");
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
|
||||||
|
// The signaling state will remain "stable" because the unparsable
|
||||||
|
// SDP leads to a failure in SetRemoteDescription.
|
||||||
|
SetRemoteOffer(offer, NO_CHECKS);
|
||||||
|
ASSERT_EQ(kJsepStateStable, mSessionAns.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetLocalAnswerInStable)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
|
||||||
|
// The signaling state will remain "stable" because the
|
||||||
|
// SetLocalDescription call fails.
|
||||||
|
SetLocalAnswer(offer, NO_CHECKS);
|
||||||
|
ASSERT_EQ(kJsepStateStable, mSessionOff.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetRemoteAnswerInStable)
|
||||||
|
{
|
||||||
|
const std::string answer =
|
||||||
|
"v=0\r\n"
|
||||||
|
"o=Mozilla-SIPUA 4949 0 IN IP4 10.86.255.143\r\n"
|
||||||
|
"s=SIP Call\r\n"
|
||||||
|
"t=0 0\r\n"
|
||||||
|
"a=ice-ufrag:qkEP\r\n"
|
||||||
|
"a=ice-pwd:ed6f9GuHjLcoCN6sC/Eh7fVl\r\n"
|
||||||
|
"m=audio 16384 RTP/AVP 0 8 9 101\r\n"
|
||||||
|
"c=IN IP4 10.86.255.143\r\n"
|
||||||
|
"a=rtpmap:0 PCMU/8000\r\n"
|
||||||
|
"a=rtpmap:8 PCMA/8000\r\n"
|
||||||
|
"a=rtpmap:9 G722/8000\r\n"
|
||||||
|
"a=rtpmap:101 telephone-event/8000\r\n"
|
||||||
|
"a=fmtp:101 0-15\r\n"
|
||||||
|
"a=sendrecv\r\n"
|
||||||
|
"a=candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host\r\n"
|
||||||
|
"a=candidate:2 2 UDP 2130706431 192.168.2.2 50006 typ host\r\n"
|
||||||
|
"m=video 1024 RTP/AVP 97\r\n"
|
||||||
|
"c=IN IP4 10.86.255.143\r\n"
|
||||||
|
"a=rtpmap:120 VP8/90000\r\n"
|
||||||
|
"a=fmtp:97 profile-level-id=42E00C\r\n"
|
||||||
|
"a=sendrecv\r\n"
|
||||||
|
"a=candidate:1 1 UDP 2130706431 192.168.2.3 50007 typ host\r\n"
|
||||||
|
"a=candidate:2 2 UDP 2130706431 192.168.2.4 50008 typ host\r\n";
|
||||||
|
|
||||||
|
// The signaling state will remain "stable" because the
|
||||||
|
// SetRemoteDescription call fails.
|
||||||
|
nsresult rv = mSessionOff.SetRemoteDescription(kJsepSdpAnswer, answer);
|
||||||
|
ASSERT_NE(NS_OK, rv);
|
||||||
|
ASSERT_EQ(kJsepStateStable, mSessionOff.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetLocalAnswerInHaveLocalOffer)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
|
||||||
|
|
||||||
|
// The signaling state will remain "have-local-offer" because the
|
||||||
|
// SetLocalDescription call fails.
|
||||||
|
nsresult rv = mSessionOff.SetLocalDescription(kJsepSdpAnswer, offer);
|
||||||
|
ASSERT_NE(NS_OK, rv);
|
||||||
|
ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetRemoteOfferInHaveLocalOffer)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
|
||||||
|
|
||||||
|
// The signaling state will remain "have-local-offer" because the
|
||||||
|
// SetRemoteDescription call fails.
|
||||||
|
nsresult rv = mSessionOff.SetRemoteDescription(kJsepSdpOffer, offer);
|
||||||
|
ASSERT_NE(NS_OK, rv);
|
||||||
|
ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetLocalOfferInHaveRemoteOffer)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
|
||||||
|
|
||||||
|
// The signaling state will remain "have-remote-offer" because the
|
||||||
|
// SetLocalDescription call fails.
|
||||||
|
nsresult rv = mSessionAns.SetLocalDescription(kJsepSdpOffer, offer);
|
||||||
|
ASSERT_NE(NS_OK, rv);
|
||||||
|
ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, SetRemoteAnswerInHaveRemoteOffer)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
|
||||||
|
|
||||||
|
// The signaling state will remain "have-remote-offer" because the
|
||||||
|
// SetRemoteDescription call fails.
|
||||||
|
nsresult rv = mSessionAns.SetRemoteDescription(kJsepSdpAnswer, offer);
|
||||||
|
ASSERT_NE(NS_OK, rv);
|
||||||
|
|
||||||
|
ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(JsepSessionTest, RtcpFbInOffer)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
|
||||||
|
std::map<std::string, bool> expected;
|
||||||
|
expected["nack"] = false;
|
||||||
|
expected["nack pli"] = false;
|
||||||
|
expected["ccm fir"] = false;
|
||||||
|
|
||||||
|
size_t prev = 0;
|
||||||
|
size_t found = 0;
|
||||||
|
for(;;) {
|
||||||
|
found = offer.find('\n', found + 1);
|
||||||
|
if (found == std::string::npos)
|
||||||
|
break;
|
||||||
|
|
||||||
|
std::string line = offer.substr(prev, (found - prev));
|
||||||
|
|
||||||
|
// ensure no other rtcp-fb values are present
|
||||||
|
if (line.find("a=rtcp-fb:") != std::string::npos) {
|
||||||
|
size_t space = line.find(' ');
|
||||||
|
//strip trailing \r\n
|
||||||
|
std::string value = line.substr(space + 1, line.length() - space - 2);
|
||||||
|
std::map<std::string, bool>::iterator entry = expected.find(value);
|
||||||
|
ASSERT_NE(entry, expected.end());
|
||||||
|
entry->second = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
prev = found + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure all values are present
|
||||||
|
for (std::map<std::string, bool>::iterator it = expected.begin(); it != expected.end(); ++it) {
|
||||||
|
ASSERT_EQ(it->second, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this test we will change the offer SDP's a=setup value
|
||||||
|
// from actpass to passive. This will make the answer do active.
|
||||||
|
TEST_F(JsepSessionTest, AudioCallForceDtlsRoles)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
std::string actpass = "\r\na=setup:actpass";
|
||||||
|
size_t match = offer.find(actpass);
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
offer.replace(match, actpass.length(), "\r\na=setup:passive");
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
match = answer.find("\r\na=setup:active");
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this test we will change the offer SDP's a=setup value
|
||||||
|
// from actpass to active. This will make the answer do passive
|
||||||
|
TEST_F(JsepSessionTest, AudioCallReverseDtlsRoles)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
std::string actpass = "\r\na=setup:actpass";
|
||||||
|
size_t match = offer.find(actpass);
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
offer.replace(match, actpass.length(), "\r\na=setup:active");
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
match = answer.find("\r\na=setup:passive");
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this test we will change the answer SDP's a=setup value
|
||||||
|
// from active to passive. This will make both sides do
|
||||||
|
// active and should not connect.
|
||||||
|
TEST_F(JsepSessionTest, AudioCallMismatchDtlsRoles)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
std::string actpass = "\r\na=setup:actpass";
|
||||||
|
size_t match = offer.find(actpass);
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
std::string active = "\r\na=setup:active";
|
||||||
|
match = answer.find(active);
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
SetLocalAnswer(answer);
|
||||||
|
answer.replace(match, active.length(), "\r\na=setup:passive");
|
||||||
|
SetRemoteAnswer(answer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this test we will change the offer SDP's a=setup value
|
||||||
|
// from actpass to garbage. It should ignore the garbage value
|
||||||
|
// and respond with setup:active
|
||||||
|
TEST_F(JsepSessionTest, AudioCallGarbageSetup)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
std::string actpass = "\r\na=setup:actpass";
|
||||||
|
size_t match = offer.find(actpass);
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
offer.replace(match, actpass.length(), "\r\na=setup:G4rb4g3V4lu3");
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
match = answer.find("\r\na=setup:active");
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this test we will change the offer SDP to remove the
|
||||||
|
// a=setup line. Answer should respond with a=setup:active.
|
||||||
|
TEST_F(JsepSessionTest, AudioCallOfferNoSetupOrConnection)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
std::string actpass = "\r\na=setup:actpass";
|
||||||
|
size_t match = offer.find(actpass);
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
offer.replace(match, actpass.length(), "");
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
match = answer.find("\r\na=setup:active");
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this test we will change the answer SDP to remove the
|
||||||
|
// a=setup line. TODO: This used to be a signaling test so it also tested that
|
||||||
|
// ICE would still connect since active would be assumed.
|
||||||
|
TEST_F(JsepSessionTest, AudioCallAnswerNoSetupOrConnection)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
AddTracks(mSessionOff, "audio");
|
||||||
|
AddTracks(mSessionAns, "audio");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
size_t match = offer.find("\r\na=setup:actpass");
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
std::string active = "\r\na=setup:active";
|
||||||
|
match = answer.find(active);
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
answer.replace(match, active.length(), "");
|
||||||
|
SetLocalAnswer(answer);
|
||||||
|
SetRemoteAnswer(answer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove H.264 P1 and VP8 from offer, check answer negotiates H.264 P0
|
||||||
|
TEST_F(JsepSessionTest, OfferWithOnlyH264P0)
|
||||||
|
{
|
||||||
|
for (JsepCodecDescription* codec : mSessionOff.Codecs()) {
|
||||||
|
if (codec->mName != "H264" || codec->mDefaultPt == "126") {
|
||||||
|
codec->mEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
AddTracks(mSessionAns, "audio,video");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
|
||||||
|
ASSERT_EQ(offer.find("a=rtpmap:126 H264/90000"), std::string::npos);
|
||||||
|
ASSERT_EQ(offer.find("a=rtpmap:120 VP8/90000"), std::string::npos);
|
||||||
|
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
size_t match = answer.find("\r\na=setup:active");
|
||||||
|
ASSERT_NE(match, std::string::npos);
|
||||||
|
|
||||||
|
// validate answer SDP
|
||||||
|
ASSERT_NE(answer.find("a=rtpmap:97 H264/90000"), std::string::npos);
|
||||||
|
ASSERT_NE(answer.find("a=rtcp-fb:97 nack"), std::string::npos);
|
||||||
|
ASSERT_NE(answer.find("a=rtcp-fb:97 nack pli"), std::string::npos);
|
||||||
|
ASSERT_NE(answer.find("a=rtcp-fb:97 ccm fir"), std::string::npos);
|
||||||
|
// Ensure VP8 and P1 removed
|
||||||
|
ASSERT_EQ(answer.find("a=rtpmap:126 H264/90000"), std::string::npos);
|
||||||
|
ASSERT_EQ(answer.find("a=rtpmap:120 VP8/90000"), std::string::npos);
|
||||||
|
ASSERT_EQ(answer.find("a=rtcp-fb:120"), std::string::npos);
|
||||||
|
ASSERT_EQ(answer.find("a=rtcp-fb:126"), std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test negotiating an answer which has only H.264 P1
|
||||||
|
// Which means replace VP8 with H.264 P1 in answer
|
||||||
|
TEST_F(JsepSessionTest, AnswerWithoutVP8)
|
||||||
|
{
|
||||||
|
types.push_back(SdpMediaSection::kAudio);
|
||||||
|
types.push_back(SdpMediaSection::kVideo);
|
||||||
|
AddTracks(mSessionOff, "audio,video");
|
||||||
|
AddTracks(mSessionAns, "audio,video");
|
||||||
|
std::string offer = CreateOffer();
|
||||||
|
SetLocalOffer(offer);
|
||||||
|
SetRemoteOffer(offer);
|
||||||
|
|
||||||
|
for (JsepCodecDescription* codec : mSessionOff.Codecs()) {
|
||||||
|
if (codec->mName != "H264" || codec->mDefaultPt == "126") {
|
||||||
|
codec->mEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string answer = CreateAnswer();
|
||||||
|
|
||||||
|
SetLocalAnswer(answer);
|
||||||
|
SetRemoteAnswer(answer);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -22,6 +22,7 @@ import java.util.regex.Pattern;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||||
import org.mozilla.gecko.AppConstants.Versions;
|
import org.mozilla.gecko.AppConstants.Versions;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
@ -155,7 +156,8 @@ public final class ANRReporter extends BroadcastReceiver
|
||||||
.start();
|
.start();
|
||||||
try {
|
try {
|
||||||
BufferedReader buf = new BufferedReader(
|
BufferedReader buf = new BufferedReader(
|
||||||
new InputStreamReader(propProc.getInputStream()), TRACES_LINE_SIZE);
|
new InputStreamReader(
|
||||||
|
propProc.getInputStream(), StringUtils.UTF_8), TRACES_LINE_SIZE);
|
||||||
String propVal = buf.readLine();
|
String propVal = buf.readLine();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(LOGTAG, "getprop returned " + String.valueOf(propVal));
|
Log.d(LOGTAG, "getprop returned " + String.valueOf(propVal));
|
||||||
|
@ -218,7 +220,8 @@ public final class ANRReporter extends BroadcastReceiver
|
||||||
Log.d(LOGTAG, "trying to match package: " + pkgName);
|
Log.d(LOGTAG, "trying to match package: " + pkgName);
|
||||||
}
|
}
|
||||||
BufferedReader traces = new BufferedReader(
|
BufferedReader traces = new BufferedReader(
|
||||||
new FileReader(tracesFile), TRACES_BLOCK_SIZE);
|
new InputStreamReader(new FileInputStream(
|
||||||
|
tracesFile), StringUtils.UTF_8), TRACES_BLOCK_SIZE);
|
||||||
try {
|
try {
|
||||||
for (int count = 0; count < LINES_TO_IDENTIFY_TRACES; count++) {
|
for (int count = 0; count < LINES_TO_IDENTIFY_TRACES; count++) {
|
||||||
String line = traces.readLine();
|
String line = traces.readLine();
|
||||||
|
|
|
@ -2046,10 +2046,10 @@ public class BrowserApp extends GeckoApp
|
||||||
|
|
||||||
try {
|
try {
|
||||||
out = new ByteArrayOutputStream();
|
out = new ByteArrayOutputStream();
|
||||||
out.write("data:image/png;base64,".getBytes());
|
out.write("data:image/png;base64,".getBytes(StringUtils.UTF_8));
|
||||||
b64 = new Base64OutputStream(out, Base64.NO_WRAP);
|
b64 = new Base64OutputStream(out, Base64.NO_WRAP);
|
||||||
response.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, b64);
|
response.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, b64);
|
||||||
callback.sendSuccess(new String(out.toByteArray()));
|
callback.sendSuccess(new String(out.toByteArray(), StringUtils.UTF_8));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(LOGTAG, "Failed to convert to base64 data URI");
|
Log.w(LOGTAG, "Failed to convert to base64 data URI");
|
||||||
callback.sendError("Failed to convert favicon to a base64 data URI");
|
callback.sendError("Failed to convert favicon to a base64 data URI");
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.mozilla.gecko;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
@ -20,6 +21,7 @@ import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import org.mozilla.gecko.util.NetworkUtils;
|
import org.mozilla.gecko.util.NetworkUtils;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use network-based search suggestions.
|
* Use network-based search suggestions.
|
||||||
|
@ -134,7 +136,7 @@ public class SuggestClient {
|
||||||
|
|
||||||
private String convertStreamToString(java.io.InputStream is) {
|
private String convertStreamToString(java.io.InputStream is) {
|
||||||
try {
|
try {
|
||||||
return new java.util.Scanner(is).useDelimiter("\\A").next();
|
return new java.util.Scanner(new InputStreamReader(is, StringUtils.UTF_8)).useDelimiter("\\A").next();
|
||||||
} catch (java.util.NoSuchElementException e) {
|
} catch (java.util.NoSuchElementException e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.mozilla.gecko.db.BrowserContract.DeletedLogins;
|
||||||
import org.mozilla.gecko.db.BrowserContract.Logins;
|
import org.mozilla.gecko.db.BrowserContract.Logins;
|
||||||
import org.mozilla.gecko.db.BrowserContract.LoginsDisabledHosts;
|
import org.mozilla.gecko.db.BrowserContract.LoginsDisabledHosts;
|
||||||
import org.mozilla.gecko.sync.Utils;
|
import org.mozilla.gecko.sync.Utils;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
@ -507,7 +508,8 @@ public class LoginsProvider extends SharedBrowserDatabaseProvider {
|
||||||
private String decrypt(@NonNull String initialValue) {
|
private String decrypt(@NonNull String initialValue) {
|
||||||
try {
|
try {
|
||||||
final Cipher cipher = getCipher(Cipher.DECRYPT_MODE);
|
final Cipher cipher = getCipher(Cipher.DECRYPT_MODE);
|
||||||
return new String(cipher.doFinal(Base64.decode(initialValue.getBytes("UTF-8"), Base64.URL_SAFE)));
|
return new String(cipher.doFinal(Base64.decode(
|
||||||
|
initialValue.getBytes("UTF-8"), Base64.URL_SAFE)), StringUtils.UTF_8);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
debug("Decryption failed : " + e);
|
debug("Decryption failed : " + e);
|
||||||
throw new IllegalStateException("Logins decryption failed", e);
|
throw new IllegalStateException("Logins decryption failed", e);
|
||||||
|
|
|
@ -550,7 +550,8 @@ public class BrowserSearch extends HomeFragment
|
||||||
domains = new LinkedHashSet<String>(500);
|
domains = new LinkedHashSet<String>(500);
|
||||||
BufferedReader buf = null;
|
BufferedReader buf = null;
|
||||||
try {
|
try {
|
||||||
buf = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.topdomains)));
|
buf = new BufferedReader(new InputStreamReader(
|
||||||
|
getResources().openRawResource(R.raw.topdomains), StringUtils.UTF_8));
|
||||||
String res = null;
|
String res = null;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -29,6 +29,8 @@ import android.media.MediaDrmException;
|
||||||
import android.media.NotProvisionedException;
|
import android.media.NotProvisionedException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
protected final String LOGTAG;
|
protected final String LOGTAG;
|
||||||
private static final String INVALID_SESSION_ID = "Invalid";
|
private static final String INVALID_SESSION_ID = "Invalid";
|
||||||
|
@ -183,7 +185,8 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
request.getData());
|
request.getData());
|
||||||
mSessionMIMETypes.put(sessionId, initDataType);
|
mSessionMIMETypes.put(sessionId, initDataType);
|
||||||
mSessionIds.add(sessionId);
|
mSessionIds.add(sessionId);
|
||||||
if (DEBUG) Log.d(LOGTAG, " StringID : " + new String(sessionId.array()) + " is put into mSessionIds ");
|
if (DEBUG) Log.d(LOGTAG, " StringID : " + new String(
|
||||||
|
sessionId.array(), StringUtils.UTF_8) + " is put into mSessionIds ");
|
||||||
} catch (android.media.NotProvisionedException e) {
|
} catch (android.media.NotProvisionedException e) {
|
||||||
if (DEBUG) Log.d(LOGTAG, "Device not provisioned:" + e.getMessage());
|
if (DEBUG) Log.d(LOGTAG, "Device not provisioned:" + e.getMessage());
|
||||||
if (sessionId != null) {
|
if (sessionId != null) {
|
||||||
|
@ -207,7 +210,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes());
|
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes(StringUtils.UTF_8));
|
||||||
if (!sessionExists(session)) {
|
if (!sessionExists(session)) {
|
||||||
onRejectPromise(promiseId, "Invalid session during updateSession.");
|
onRejectPromise(promiseId, "Invalid session during updateSession.");
|
||||||
return;
|
return;
|
||||||
|
@ -242,7 +245,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes());
|
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes(StringUtils.UTF_8));
|
||||||
mSessionIds.remove(session);
|
mSessionIds.remove(session);
|
||||||
mDrm.closeSession(session.array());
|
mDrm.closeSession(session.array());
|
||||||
onSessionClosed(promiseId, session.array());
|
onSessionClosed(promiseId, session.array());
|
||||||
|
@ -388,10 +391,10 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
// No need to handle here if we're not in privacy mode.
|
// No need to handle here if we're not in privacy mode.
|
||||||
break;
|
break;
|
||||||
case MediaDrm.EVENT_KEY_EXPIRED:
|
case MediaDrm.EVENT_KEY_EXPIRED:
|
||||||
if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_KEY_EXPIRED, sessionId=" + new String(session.array()));
|
if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_KEY_EXPIRED, sessionId=" + new String(session.array(), StringUtils.UTF_8));
|
||||||
break;
|
break;
|
||||||
case MediaDrm.EVENT_VENDOR_DEFINED:
|
case MediaDrm.EVENT_VENDOR_DEFINED:
|
||||||
if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_VENDOR_DEFINED, sessionId=" + new String(session.array()));
|
if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_VENDOR_DEFINED, sessionId=" + new String(session.array(), StringUtils.UTF_8));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (DEBUG) Log.d(LOGTAG, "Invalid DRM event " + event);
|
if (DEBUG) Log.d(LOGTAG, "Invalid DRM event " + event);
|
||||||
|
@ -466,7 +469,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
int responseCode = urlConnection.getResponseCode();
|
int responseCode = urlConnection.getResponseCode();
|
||||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
BufferedReader in =
|
BufferedReader in =
|
||||||
new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), StringUtils.UTF_8));
|
||||||
String inputLine;
|
String inputLine;
|
||||||
StringBuffer response = new StringBuffer();
|
StringBuffer response = new StringBuffer();
|
||||||
|
|
||||||
|
@ -474,7 +477,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
response.append(inputLine);
|
response.append(inputLine);
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
mResponseBody = String.valueOf(response).getBytes();
|
mResponseBody = String.valueOf(response).getBytes(StringUtils.UTF_8);
|
||||||
if (DEBUG) Log.d(LOGTAG, "Provisioning, response received.");
|
if (DEBUG) Log.d(LOGTAG, "Provisioning, response received.");
|
||||||
if (mResponseBody != null) Log.d(LOGTAG, "response length=" + mResponseBody.length);
|
if (mResponseBody != null) Log.d(LOGTAG, "response length=" + mResponseBody.length);
|
||||||
} else {
|
} else {
|
||||||
|
@ -600,7 +603,8 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
|
||||||
final byte [] cryptoSessionId = mCryptoSessionId.array();
|
final byte [] cryptoSessionId = mCryptoSessionId.array();
|
||||||
mCrypto = new MediaCrypto(mSchemeUUID, cryptoSessionId);
|
mCrypto = new MediaCrypto(mSchemeUUID, cryptoSessionId);
|
||||||
mSessionIds.add(mCryptoSessionId);
|
mSessionIds.add(mCryptoSessionId);
|
||||||
if (DEBUG) Log.d(LOGTAG, "MediaCrypto successfully created! - SId " + INVALID_SESSION_ID + ", " + new String(cryptoSessionId));
|
if (DEBUG) Log.d(LOGTAG, "MediaCrypto successfully created! - SId " + INVALID_SESSION_ID +
|
||||||
|
", " + new String(cryptoSessionId, StringUtils.UTF_8));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) Log.d(LOGTAG, "Cannot create MediaCrypto for unsupported scheme.");
|
if (DEBUG) Log.d(LOGTAG, "Cannot create MediaCrypto for unsupported scheme.");
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.mozilla.gecko.util.FileUtils;
|
||||||
import org.mozilla.gecko.util.GeckoJarReader;
|
import org.mozilla.gecko.util.GeckoJarReader;
|
||||||
import org.mozilla.gecko.util.HardwareUtils;
|
import org.mozilla.gecko.util.HardwareUtils;
|
||||||
import org.mozilla.gecko.util.RawResource;
|
import org.mozilla.gecko.util.RawResource;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
@ -393,7 +394,7 @@ public class SearchEngineManager implements SharedPreferences.OnSharedPreference
|
||||||
urlConnection.setRequestMethod("POST");
|
urlConnection.setRequestMethod("POST");
|
||||||
urlConnection.setRequestProperty("User-Agent", USER_AGENT);
|
urlConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||||
urlConnection.setRequestProperty("Content-Type", "application/json");
|
urlConnection.setRequestProperty("Content-Type", "application/json");
|
||||||
urlConnection.setFixedLengthStreamingMode(message.getBytes().length);
|
urlConnection.setFixedLengthStreamingMode(message.getBytes(StringUtils.UTF_8).length);
|
||||||
|
|
||||||
final OutputStream out = urlConnection.getOutputStream();
|
final OutputStream out = urlConnection.getOutputStream();
|
||||||
out.write(message.getBytes());
|
out.write(message.getBytes());
|
||||||
|
|
|
@ -118,7 +118,7 @@ var WebcompatReporter = {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const WEBCOMPAT_ORIGIN = "https://webcompat.com";
|
const WEBCOMPAT_ORIGIN = "https://webcompat.com";
|
||||||
let url = tabData.tab.browser.currentURI.spec
|
let url = tabData.tab.browser.currentURI.spec
|
||||||
let webcompatURL = `${WEBCOMPAT_ORIGIN}/issues/new?url=${url}`;
|
let webcompatURL = `${WEBCOMPAT_ORIGIN}/issues/new?url=${url}&src=mobile-reporter`;
|
||||||
|
|
||||||
if (tabData.data && typeof tabData.data === "string") {
|
if (tabData.data && typeof tabData.data === "string") {
|
||||||
BrowserApp.deck.addEventListener("DOMContentLoaded", function sendDataToTab(event) {
|
BrowserApp.deck.addEventListener("DOMContentLoaded", function sendDataToTab(event) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.net.Uri;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -20,6 +21,12 @@ public class StringUtils {
|
||||||
private static final String FILTER_URL_PREFIX = "filter://";
|
private static final String FILTER_URL_PREFIX = "filter://";
|
||||||
private static final String USER_ENTERED_URL_PREFIX = "user-entered:";
|
private static final String USER_ENTERED_URL_PREFIX = "user-entered:";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The UTF-8 charset.
|
||||||
|
*/
|
||||||
|
public static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This method tries to guess if the given string could be a search query or URL,
|
* This method tries to guess if the given string could be a search query or URL,
|
||||||
* and returns a previous result if there is ambiguity
|
* and returns a previous result if there is ambiguity
|
||||||
|
|
|
@ -109,7 +109,6 @@
|
||||||
@BINPATH@/components/content_html.xpt
|
@BINPATH@/components/content_html.xpt
|
||||||
@BINPATH@/components/content_webrtc.xpt
|
@BINPATH@/components/content_webrtc.xpt
|
||||||
@BINPATH@/components/content_xslt.xpt
|
@BINPATH@/components/content_xslt.xpt
|
||||||
@BINPATH@/components/cookie.xpt
|
|
||||||
@BINPATH@/components/directory.xpt
|
@BINPATH@/components/directory.xpt
|
||||||
@BINPATH@/components/docshell.xpt
|
@BINPATH@/components/docshell.xpt
|
||||||
@BINPATH@/components/dom.xpt
|
@BINPATH@/components/dom.xpt
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
package org.mozilla.gecko.background.common.log;
|
package org.mozilla.gecko.background.common.log;
|
||||||
|
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -16,6 +17,7 @@ import org.mozilla.gecko.background.common.log.writers.LogWriter;
|
||||||
import org.mozilla.gecko.background.common.log.writers.PrintLogWriter;
|
import org.mozilla.gecko.background.common.log.writers.PrintLogWriter;
|
||||||
import org.mozilla.gecko.background.common.log.writers.SimpleTagLogWriter;
|
import org.mozilla.gecko.background.common.log.writers.SimpleTagLogWriter;
|
||||||
import org.mozilla.gecko.background.common.log.writers.ThreadLocalTagLogWriter;
|
import org.mozilla.gecko.background.common.log.writers.ThreadLocalTagLogWriter;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -126,7 +128,8 @@ public class Logger {
|
||||||
*/
|
*/
|
||||||
public static synchronized void startLoggingToConsole() {
|
public static synchronized void startLoggingToConsole() {
|
||||||
setThreadLogTag("Test");
|
setThreadLogTag("Test");
|
||||||
startLoggingTo(new PrintLogWriter(new PrintWriter(System.out, true)));
|
startLoggingTo(new PrintLogWriter(new PrintWriter(
|
||||||
|
new OutputStreamWriter(System.out, StringUtils.UTF_8), true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronized version for other classes to use.
|
// Synchronized version for other classes to use.
|
||||||
|
|
|
@ -149,8 +149,10 @@ public class JSONWebTokenUtils {
|
||||||
if (parts.length != 3) {
|
if (parts.length != 3) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String cHeader = new String(Base64.decodeBase64(parts[0]));
|
String cHeader = new String(Base64.decodeBase64(parts[0]),
|
||||||
String cPayload = new String(Base64.decodeBase64(parts[1]));
|
org.mozilla.gecko.util.StringUtils.UTF_8);
|
||||||
|
String cPayload = new String(Base64.decodeBase64(parts[1]),
|
||||||
|
org.mozilla.gecko.util.StringUtils.UTF_8);
|
||||||
String cSignature = Utils.byte2Hex(Base64.decodeBase64(parts[2]));
|
String cSignature = Utils.byte2Hex(Base64.decodeBase64(parts[2]));
|
||||||
ExtendedJSONObject o = new ExtendedJSONObject();
|
ExtendedJSONObject o = new ExtendedJSONObject();
|
||||||
o.put("header", new ExtendedJSONObject(cHeader));
|
o.put("header", new ExtendedJSONObject(cHeader));
|
||||||
|
@ -203,8 +205,10 @@ public class JSONWebTokenUtils {
|
||||||
if (parts.length != 3) {
|
if (parts.length != 3) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String aHeader = new String(Base64.decodeBase64(parts[0]));
|
String aHeader = new String(Base64.decodeBase64(parts[0]),
|
||||||
String aPayload = new String(Base64.decodeBase64(parts[1]));
|
org.mozilla.gecko.util.StringUtils.UTF_8);
|
||||||
|
String aPayload = new String(Base64.decodeBase64(parts[1]),
|
||||||
|
org.mozilla.gecko.util.StringUtils.UTF_8);
|
||||||
String aSignature = Utils.byte2Hex(Base64.decodeBase64(parts[2]));
|
String aSignature = Utils.byte2Hex(Base64.decodeBase64(parts[2]));
|
||||||
// We do all the assertion parsing *before* dumping the certificate in
|
// We do all the assertion parsing *before* dumping the certificate in
|
||||||
// case there's a malformed assertion.
|
// case there's a malformed assertion.
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.json.simple.JSONArray;
|
||||||
import org.mozilla.apache.commons.codec.binary.Base64;
|
import org.mozilla.apache.commons.codec.binary.Base64;
|
||||||
import org.mozilla.gecko.sync.crypto.CryptoException;
|
import org.mozilla.gecko.sync.crypto.CryptoException;
|
||||||
import org.mozilla.gecko.sync.crypto.KeyBundle;
|
import org.mozilla.gecko.sync.crypto.KeyBundle;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
public class CollectionKeys {
|
public class CollectionKeys {
|
||||||
private KeyBundle defaultKeyBundle = null;
|
private KeyBundle defaultKeyBundle = null;
|
||||||
|
@ -69,8 +70,8 @@ public class CollectionKeys {
|
||||||
private static JSONArray keyBundleToArray(KeyBundle bundle) {
|
private static JSONArray keyBundleToArray(KeyBundle bundle) {
|
||||||
// Generate JSON.
|
// Generate JSON.
|
||||||
JSONArray keysArray = new JSONArray();
|
JSONArray keysArray = new JSONArray();
|
||||||
keysArray.add(new String(Base64.encodeBase64(bundle.getEncryptionKey())));
|
keysArray.add(new String(Base64.encodeBase64(bundle.getEncryptionKey()), StringUtils.UTF_8));
|
||||||
keysArray.add(new String(Base64.encodeBase64(bundle.getHMACKey())));
|
keysArray.add(new String(Base64.encodeBase64(bundle.getHMACKey()), StringUtils.UTF_8));
|
||||||
return keysArray;
|
return keysArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.mozilla.gecko.sync.crypto.MissingCryptoInputException;
|
||||||
import org.mozilla.gecko.sync.crypto.NoKeyBundleException;
|
import org.mozilla.gecko.sync.crypto.NoKeyBundleException;
|
||||||
import org.mozilla.gecko.sync.repositories.domain.Record;
|
import org.mozilla.gecko.sync.repositories.domain.Record;
|
||||||
import org.mozilla.gecko.sync.repositories.domain.RecordParseException;
|
import org.mozilla.gecko.sync.repositories.domain.RecordParseException;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Sync crypto record has:
|
* A Sync crypto record has:
|
||||||
|
@ -204,7 +205,7 @@ public class CryptoRecord extends Record {
|
||||||
throw new NoKeyBundleException();
|
throw new NoKeyBundleException();
|
||||||
}
|
}
|
||||||
String cleartext = payload.toJSONString();
|
String cleartext = payload.toJSONString();
|
||||||
byte[] cleartextBytes = cleartext.getBytes("UTF-8");
|
byte[] cleartextBytes = cleartext.getBytes(StringUtils.UTF_8);
|
||||||
CryptoInfo info = CryptoInfo.encrypt(cleartextBytes, keyBundle);
|
CryptoInfo info = CryptoInfo.encrypt(cleartextBytes, keyBundle);
|
||||||
String message = new String(Base64.encodeBase64(info.getMessage()));
|
String message = new String(Base64.encodeBase64(info.getMessage()));
|
||||||
String iv = new String(Base64.encodeBase64(info.getIV()));
|
String iv = new String(Base64.encodeBase64(info.getIV()));
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.mozilla.apache.commons.codec.binary.Base64;
|
||||||
import org.mozilla.gecko.background.common.log.Logger;
|
import org.mozilla.gecko.background.common.log.Logger;
|
||||||
import org.mozilla.gecko.background.nativecode.NativeCrypto;
|
import org.mozilla.gecko.background.nativecode.NativeCrypto;
|
||||||
import org.mozilla.gecko.sync.setup.Constants;
|
import org.mozilla.gecko.sync.setup.Constants;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -47,7 +48,7 @@ public class Utils {
|
||||||
|
|
||||||
public static String generateGuid() {
|
public static String generateGuid() {
|
||||||
byte[] encodedBytes = Base64.encodeBase64(generateRandomBytes(9), false);
|
byte[] encodedBytes = Base64.encodeBase64(generateRandomBytes(9), false);
|
||||||
return new String(encodedBytes).replace("+", "-").replace("/", "_");
|
return new String(encodedBytes, StringUtils.UTF_8).replace("+", "-").replace("/", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -493,7 +494,7 @@ public class Utils {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fis = context.openFileInput(filename);
|
fis = context.openFileInput(filename);
|
||||||
isr = new InputStreamReader(fis);
|
isr = new InputStreamReader(fis, StringUtils.UTF_8);
|
||||||
br = new BufferedReader(isr);
|
br = new BufferedReader(isr);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String line;
|
String line;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.mozilla.gecko.background.common.log.Logger;
|
||||||
import org.mozilla.gecko.sync.ExtendedJSONObject;
|
import org.mozilla.gecko.sync.ExtendedJSONObject;
|
||||||
import org.mozilla.gecko.sync.NonArrayJSONException;
|
import org.mozilla.gecko.sync.NonArrayJSONException;
|
||||||
import org.mozilla.gecko.sync.NonObjectJSONException;
|
import org.mozilla.gecko.sync.NonObjectJSONException;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
import ch.boye.httpclientandroidlib.Header;
|
import ch.boye.httpclientandroidlib.Header;
|
||||||
import ch.boye.httpclientandroidlib.HttpEntity;
|
import ch.boye.httpclientandroidlib.HttpEntity;
|
||||||
|
@ -79,7 +80,7 @@ public class MozResponse {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStreamReader is = new InputStreamReader(entity.getContent());
|
InputStreamReader is = new InputStreamReader(entity.getContent(), StringUtils.UTF_8);
|
||||||
// Oh, Java, you are so evil.
|
// Oh, Java, you are so evil.
|
||||||
body = new Scanner(is).useDelimiter("\\A").next();
|
body = new Scanner(is).useDelimiter("\\A").next();
|
||||||
return body;
|
return body;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.io.InputStreamReader;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.mozilla.gecko.background.common.log.Logger;
|
import org.mozilla.gecko.background.common.log.Logger;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
import ch.boye.httpclientandroidlib.Header;
|
import ch.boye.httpclientandroidlib.Header;
|
||||||
import ch.boye.httpclientandroidlib.HttpEntity;
|
import ch.boye.httpclientandroidlib.HttpEntity;
|
||||||
|
@ -103,7 +104,7 @@ public class SyncStorageCollectionRequest extends SyncStorageRequest {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
try {
|
try {
|
||||||
content = entity.getContent();
|
content = entity.getContent();
|
||||||
br = new BufferedReader(new InputStreamReader(content), FETCH_BUFFER_SIZE);
|
br = new BufferedReader(new InputStreamReader(content, StringUtils.UTF_8), FETCH_BUFFER_SIZE);
|
||||||
String line;
|
String line;
|
||||||
|
|
||||||
// This relies on connection timeouts at the HTTP layer.
|
// This relies on connection timeouts at the HTTP layer.
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.mozilla.mozstumbler.service.stumblerthread.datahandling;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.mozilla.mozstumbler.service.AppGlobals;
|
import org.mozilla.mozstumbler.service.AppGlobals;
|
||||||
|
import org.mozilla.mozstumbler.service.utils.StringUtils;
|
||||||
import org.mozilla.mozstumbler.service.utils.Zipper;
|
import org.mozilla.mozstumbler.service.utils.Zipper;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -101,7 +103,7 @@ public class DataStorageManager {
|
||||||
|
|
||||||
if (mCurrentReports.reports.size() > 0) {
|
if (mCurrentReports.reports.size() > 0) {
|
||||||
try {
|
try {
|
||||||
bytes = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes()).length;
|
bytes = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes(StringUtils.UTF_8)).length;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Log.e(LOG_TAG, "Zip error in getQueuedCounts()", ex);
|
Log.e(LOG_TAG, "Zip error in getQueuedCounts()", ex);
|
||||||
}
|
}
|
||||||
|
@ -301,7 +303,7 @@ public class DataStorageManager {
|
||||||
|
|
||||||
if (currentReportsCount > 0) {
|
if (currentReportsCount > 0) {
|
||||||
final String filename = MEMORY_BUFFER_NAME;
|
final String filename = MEMORY_BUFFER_NAME;
|
||||||
final byte[] data = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes());
|
final byte[] data = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes(StringUtils.UTF_8));
|
||||||
final int wifiCount = mCurrentReports.wifiCount;
|
final int wifiCount = mCurrentReports.wifiCount;
|
||||||
final int cellCount = mCurrentReports.cellCount;
|
final int cellCount = mCurrentReports.cellCount;
|
||||||
clearCurrentReports();
|
clearCurrentReports();
|
||||||
|
@ -412,7 +414,7 @@ public class DataStorageManager {
|
||||||
if (mCurrentReports.reports.size() < 1) {
|
if (mCurrentReports.reports.size() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final byte[] bytes = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes());
|
final byte[] bytes = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes(StringUtils.UTF_8));
|
||||||
saveToDisk(bytes, mCurrentReports.reports.size(), mCurrentReports.wifiCount, mCurrentReports.cellCount);
|
saveToDisk(bytes, mCurrentReports.reports.size(), mCurrentReports.wifiCount, mCurrentReports.cellCount);
|
||||||
clearCurrentReports();
|
clearCurrentReports();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.mozstumbler.service.utils;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
public class StringUtils {
|
||||||
|
/**
|
||||||
|
* The UTF-8 charset.
|
||||||
|
*/
|
||||||
|
public static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||||
|
}
|
|
@ -33,7 +33,7 @@ public class Zipper {
|
||||||
final ByteArrayInputStream bs = new ByteArrayInputStream(data);
|
final ByteArrayInputStream bs = new ByteArrayInputStream(data);
|
||||||
GZIPInputStream gstream = new GZIPInputStream(bs);
|
GZIPInputStream gstream = new GZIPInputStream(bs);
|
||||||
try {
|
try {
|
||||||
InputStreamReader reader = new InputStreamReader(gstream);
|
InputStreamReader reader = new InputStreamReader(gstream, StringUtils.UTF_8);
|
||||||
BufferedReader in = new BufferedReader(reader);
|
BufferedReader in = new BufferedReader(reader);
|
||||||
String read;
|
String read;
|
||||||
while ((read = in.readLine()) != null) {
|
while ((read = in.readLine()) != null) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ stumbler_sources = [
|
||||||
'java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java',
|
'java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java',
|
||||||
'java/org/mozilla/mozstumbler/service/utils/NetworkUtils.java',
|
'java/org/mozilla/mozstumbler/service/utils/NetworkUtils.java',
|
||||||
'java/org/mozilla/mozstumbler/service/utils/PersistentIntentService.java',
|
'java/org/mozilla/mozstumbler/service/utils/PersistentIntentService.java',
|
||||||
|
'java/org/mozilla/mozstumbler/service/utils/StringUtils.java',
|
||||||
'java/org/mozilla/mozstumbler/service/utils/TelemetryWrapper.java',
|
'java/org/mozilla/mozstumbler/service/utils/TelemetryWrapper.java',
|
||||||
'java/org/mozilla/mozstumbler/service/utils/Zipper.java',
|
'java/org/mozilla/mozstumbler/service/utils/Zipper.java',
|
||||||
]
|
]
|
||||||
|
|
|
@ -495,7 +495,8 @@ NeckoParent::RecvPDataChannelConstructor(PDataChannelParent* actor,
|
||||||
const uint32_t& channelId)
|
const uint32_t& channelId)
|
||||||
{
|
{
|
||||||
DataChannelParent* p = static_cast<DataChannelParent*>(actor);
|
DataChannelParent* p = static_cast<DataChannelParent*>(actor);
|
||||||
MOZ_DIAGNOSTIC_ASSERT(p->Init(channelId));
|
DebugOnly<bool> rv = p->Init(channelId);
|
||||||
|
MOZ_ASSERT(rv);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ android-api-15/debug:
|
||||||
max-run-time: 7200
|
max-run-time: 7200
|
||||||
run:
|
run:
|
||||||
using: mozharness
|
using: mozharness
|
||||||
actions: [get-secrets build multi-l10n update]
|
actions: [get-secrets build generate-build-stats multi-l10n update]
|
||||||
config:
|
config:
|
||||||
- builds/releng_base_android_64_builds.py
|
- builds/releng_base_android_64_builds.py
|
||||||
- disable_signing.py
|
- disable_signing.py
|
||||||
|
@ -37,7 +37,7 @@ android-x86/opt:
|
||||||
max-run-time: 7200
|
max-run-time: 7200
|
||||||
run:
|
run:
|
||||||
using: mozharness
|
using: mozharness
|
||||||
actions: [get-secrets build multi-l10n update]
|
actions: [get-secrets build generate-build-stats multi-l10n update]
|
||||||
config:
|
config:
|
||||||
- builds/releng_base_android_64_builds.py
|
- builds/releng_base_android_64_builds.py
|
||||||
- disable_signing.py
|
- disable_signing.py
|
||||||
|
@ -62,7 +62,7 @@ android-api-15/opt:
|
||||||
max-run-time: 7200
|
max-run-time: 7200
|
||||||
run:
|
run:
|
||||||
using: mozharness
|
using: mozharness
|
||||||
actions: [get-secrets build multi-l10n update]
|
actions: [get-secrets build generate-build-stats multi-l10n update]
|
||||||
config:
|
config:
|
||||||
- builds/releng_base_android_64_builds.py
|
- builds/releng_base_android_64_builds.py
|
||||||
- disable_signing.py
|
- disable_signing.py
|
||||||
|
@ -89,7 +89,7 @@ android-api-15-nightly/opt:
|
||||||
max-run-time: 7200
|
max-run-time: 7200
|
||||||
run:
|
run:
|
||||||
using: mozharness
|
using: mozharness
|
||||||
actions: [get-secrets build multi-l10n update]
|
actions: [get-secrets build generate-build-stats multi-l10n update]
|
||||||
config:
|
config:
|
||||||
- builds/releng_base_android_64_builds.py
|
- builds/releng_base_android_64_builds.py
|
||||||
- disable_signing.py
|
- disable_signing.py
|
||||||
|
@ -129,7 +129,7 @@ android-api-15-gradle/opt:
|
||||||
type: directory
|
type: directory
|
||||||
run:
|
run:
|
||||||
using: mozharness
|
using: mozharness
|
||||||
actions: [get-secrets build multi-l10n update]
|
actions: [get-secrets build generate-build-stats multi-l10n update]
|
||||||
config:
|
config:
|
||||||
- builds/releng_base_android_64_builds.py
|
- builds/releng_base_android_64_builds.py
|
||||||
- disable_signing.py
|
- disable_signing.py
|
||||||
|
|
|
@ -14,6 +14,7 @@ module.exports = {
|
||||||
// All globals made available in the test environment.
|
// All globals made available in the test environment.
|
||||||
"globals": {
|
"globals": {
|
||||||
"add_task": false,
|
"add_task": false,
|
||||||
|
"addLoadEvent": false,
|
||||||
"Assert": false,
|
"Assert": false,
|
||||||
"BrowserTestUtils": false,
|
"BrowserTestUtils": false,
|
||||||
"content": false,
|
"content": false,
|
||||||
|
@ -34,6 +35,7 @@ module.exports = {
|
||||||
"is": false,
|
"is": false,
|
||||||
"isnot": false,
|
"isnot": false,
|
||||||
"ok": false,
|
"ok": false,
|
||||||
|
"privateNoteIntentionalCrash": false,
|
||||||
"registerCleanupFunction": false,
|
"registerCleanupFunction": false,
|
||||||
"requestLongerTimeout": false,
|
"requestLongerTimeout": false,
|
||||||
"SimpleTest": false,
|
"SimpleTest": false,
|
||||||
|
|
|
@ -12,6 +12,7 @@ module.exports = {
|
||||||
// All globals made available in the test environment.
|
// All globals made available in the test environment.
|
||||||
"globals": {
|
"globals": {
|
||||||
"add_task": false,
|
"add_task": false,
|
||||||
|
"addLoadEvent": false,
|
||||||
"Assert": false,
|
"Assert": false,
|
||||||
"EventUtils": false,
|
"EventUtils": false,
|
||||||
"executeSoon": false,
|
"executeSoon": false,
|
||||||
|
@ -24,6 +25,7 @@ module.exports = {
|
||||||
"is": false,
|
"is": false,
|
||||||
"isnot": false,
|
"isnot": false,
|
||||||
"ok": false,
|
"ok": false,
|
||||||
|
"privateNoteIntentionalCrash": false,
|
||||||
"promise": false,
|
"promise": false,
|
||||||
"registerCleanupFunction": false,
|
"registerCleanupFunction": false,
|
||||||
"requestLongerTimeout": false,
|
"requestLongerTimeout": false,
|
||||||
|
|
|
@ -280,7 +280,7 @@ class MachCommands(MachCommandBase):
|
||||||
description='Run any flavor of mochitest (integration test).',
|
description='Run any flavor of mochitest (integration test).',
|
||||||
parser=setup_argument_parser)
|
parser=setup_argument_parser)
|
||||||
def run_mochitest_general(self, flavor=None, test_objects=None, resolve_tests=True, **kwargs):
|
def run_mochitest_general(self, flavor=None, test_objects=None, resolve_tests=True, **kwargs):
|
||||||
from mochitest.mochitest_options import ALL_FLAVORS
|
from mochitest_options import ALL_FLAVORS
|
||||||
|
|
||||||
buildapp = None
|
buildapp = None
|
||||||
for app in SUPPORTED_APPS:
|
for app in SUPPORTED_APPS:
|
||||||
|
|
|
@ -15,6 +15,7 @@ module.exports = {
|
||||||
// $ is defined in SimpleTest.js
|
// $ is defined in SimpleTest.js
|
||||||
"$": false,
|
"$": false,
|
||||||
"add_task": false,
|
"add_task": false,
|
||||||
|
"addLoadEvent": false,
|
||||||
"Assert": false,
|
"Assert": false,
|
||||||
"EventUtils": false,
|
"EventUtils": false,
|
||||||
"executeSoon": false,
|
"executeSoon": false,
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче