MozReview-Commit-ID: 9mGX3defFjK
This commit is contained in:
Phil Ringnalda 2017-01-04 19:02:40 -08:00
Родитель 1c5b9be020 c83d1d7ce9
Коммит d549af8fc6
157 изменённых файлов: 1538 добавлений и 1949 удалений

Просмотреть файл

@ -142,7 +142,6 @@
@RESPATH@/components/content_geckomediaplugins.xpt
@RESPATH@/components/content_html.xpt
@RESPATH@/components/content_xslt.xpt
@RESPATH@/components/cookie.xpt
@RESPATH@/components/directory.xpt
@RESPATH@/components/diskspacewatcher.xpt
@RESPATH@/components/docshell.xpt

Просмотреть файл

@ -281,11 +281,16 @@ const gXPInstallObserver = {
installInfo.install();
}
};
let secondaryAction = {
label: gNavigatorBundle.getString("xpinstallPromptMessage.dontAllow"),
accessKey: gNavigatorBundle.getString("xpinstallPromptMessage.dontAllow.accesskey"),
callback: () => {},
};
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED);
let popup = PopupNotifications.show(browser, notificationID,
messageString, anchorID,
action, null, options);
action, [secondaryAction], options);
removeNotificationOnEnd(popup, installInfo.installs);
break; }
case "addon-install-started": {

Просмотреть файл

@ -0,0 +1,50 @@
{
"directory": [
{
"bgColor": "#ffffff",
"directoryId": 10000000,
"imageURI": "data:image/png;base64,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",
"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,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",
"title": "Amazon",
"type": "affiliate",
"url": "https://www.amazon.com/"
}
]
}

Просмотреть файл

@ -260,6 +260,8 @@ var gPage = {
onPageVisibleAndLoaded() {
// Send the index of the last visible tile.
this.reportLastVisibleTileIndex();
// Maybe tell the user they can undo an initial automigration
this.maybeShowAutoMigrationUndoNotification();
},
reportLastVisibleTileIndex() {
@ -287,5 +289,9 @@ var gPage = {
}
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 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);
// 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 contextmenu_common = chrome_base + "contextmenu_common.js";
/* import-globals-from contextmenu_common.js */
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"]
.getService(Ci.mozIJSSubScriptLoader)
.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 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"]
.getService(Ci.mozIJSSubScriptLoader)
.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);
});
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",

Просмотреть файл

@ -70,7 +70,7 @@ add_task(function* () {
yield transferCompletePromise;
});
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.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
* the "Save File" dialog.
*/
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.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>
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from offlineByDefault.js */
SimpleTest.waitForExplicitFinish();
const Cc = SpecialPowers.Cc;

Просмотреть файл

@ -7,6 +7,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
"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
// 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

Просмотреть файл

@ -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.css (content/newtab/newTab.css)
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.js (content/pageinfo/pageInfo.js)
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)

Просмотреть файл

@ -908,7 +908,7 @@ WebContentConverterRegistrarContent.prototype = {
.sort();
// now register them
for (num of nums) {
for (let num of nums) {
let branch = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + num + ".");
try {
this._registerContentHandlerHavingBranch(branch);

Просмотреть файл

@ -16,7 +16,7 @@ const kAutoMigrateBrowserPref = "browser.migrate.automigrate.browser";
const kAutoMigrateLastUndoPromptDateMsPref = "browser.migrate.automigrate.lastUndoPromptDateMs";
const kAutoMigrateDaysToOfferUndoPref = "browser.migrate.automigrate.daysToOfferUndo";
const kNotificationId = "abouthome-automigration-undo";
const kNotificationId = "automigration-undo";
Cu.import("resource:///modules/MigrationUtils.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:
if (target.currentURI.spec != "about:home" ||
let canUndoFromThisPage = ["about:home", "about:newtab"].includes(target.currentURI.spec);
if (!canUndoFromThisPage ||
!Preferences.get(kUndoUIEnabledPref, false)) {
return;
}
let win = target.ownerGlobal;
let notificationBox = win.gBrowser.getNotificationBox(target);
if (!notificationBox || notificationBox.getNotificationWithValue("abouthome-automigration-undo")) {
if (!notificationBox || notificationBox.getNotificationWithValue(kNotificationId)) {
return;
}

Просмотреть файл

@ -8,6 +8,8 @@ XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
MARIONETTE_UNIT_MANIFESTS += ['tests/marionette/manifest.ini']
BROWSER_CHROME_MANIFESTS += [ 'tests/browser/browser.ini']
JAR_MANIFESTS += ['jar.mn']
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;
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");
const TEST_HOST = "example.com";

Просмотреть файл

@ -7,6 +7,7 @@ if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
/* import-globals-from privacypane_tests_perwindow.js */
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([

Просмотреть файл

@ -6,6 +6,7 @@ if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
/* import-globals-from privacypane_tests_perwindow.js */
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([

Просмотреть файл

@ -8,6 +8,7 @@ if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
/* import-globals-from privacypane_tests_perwindow.js */
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);

Просмотреть файл

@ -6,6 +6,7 @@ if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
/* import-globals-from privacypane_tests_perwindow.js */
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([

Просмотреть файл

@ -6,6 +6,7 @@ if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
/* import-globals-from privacypane_tests_perwindow.js */
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([

Просмотреть файл

@ -2,6 +2,9 @@
* 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/. */
// Imported via permissions.xul.
/* import-globals-from ../../../toolkit/content/treeUtils.js */
Components.utils.import("resource://gre/modules/Services.jsm");
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;

Просмотреть файл

@ -3,6 +3,9 @@
* 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/. */
// These globals are imported via placesOverlay.xul.
/* globals PlacesUIUtils, PlacesUtils, NS_ASSERT */
/**
* SelectBookmarkDialog controls the user interface for the "Use Bookmark for
* Home Page" dialog.

Просмотреть файл

@ -185,7 +185,6 @@
@RESPATH@/components/content_webrtc.xpt
#endif
@RESPATH@/components/content_xslt.xpt
@RESPATH@/components/cookie.xpt
@RESPATH@/components/directory.xpt
@RESPATH@/components/docshell.xpt
@RESPATH@/components/dom.xpt

Просмотреть файл

@ -21,6 +21,8 @@ contextMenuSearch.accesskey=S
bookmarkAllTabsDefault=[Folder Name]
xpinstallPromptMessage=%S prevented this site from asking you to install software on your computer.
xpinstallPromptMessage.dontAllow=Dont Allow
xpinstallPromptMessage.dontAllow.accesskey=D
xpinstallPromptAllowButton=Allow
# 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)

Просмотреть файл

@ -13,10 +13,12 @@ this.EXPORTED_SYMBOLS = [ "AboutNewTab" ];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RemotePages",
"resource://gre/modules/RemotePageManager.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AutoMigrate",
"resource:///modules/AutoMigrate.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
"resource://gre/modules/NewTabUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RemotePages",
"resource://gre/modules/RemotePageManager.jsm");
var AboutNewTab = {
@ -25,6 +27,8 @@ var AboutNewTab = {
init() {
this.pageListener = new RemotePages("about:newtab");
this.pageListener.addMessageListener("NewTab:Customize", this.customize.bind(this));
this.pageListener.addMessageListener("NewTab:MaybeShowAutoMigrationUndoNotification",
(msg) => AutoMigrate.maybeShowUndoNotification(msg.target.browser));
},
customize(message) {

Просмотреть файл

@ -49,7 +49,10 @@ module.exports = createClass({
window.removeEventListener("keydown", this.onKeyDown, true);
},
onDeviceCheckboxClick({ target }) {
onDeviceCheckboxChange({ nativeEvent: { button }, target }) {
if (button !== 0) {
return;
}
this.setState({
[target.value]: !this.state[target.value]
});
@ -154,7 +157,7 @@ module.exports = createClass({
type: "checkbox",
value: device.name,
checked: this.state[device.name],
onChange: this.onDeviceCheckboxClick,
onChange: this.onDeviceCheckboxChange,
}),
device.name
);

Просмотреть файл

@ -30,6 +30,9 @@ const { changeDisplayPixelRatio } = require("./actions/display-pixel-ratio");
const { addViewport, resizeViewport } = require("./actions/viewports");
const { loadDevices } = require("./actions/devices");
// Exposed for use by tests
window.require = require;
let bootstrap = {
telemetry: new Telemetry(),
@ -44,7 +47,6 @@ let bootstrap = {
"agent");
this.telemetry.toolOpened("responsive");
let store = this.store = Store();
this.dispatch(loadDevices());
let provider = createElement(Provider, { store }, App());
ReactDOM.render(provider, document.querySelector("#root"));
message.post(window, "init:done");
@ -76,6 +78,10 @@ let bootstrap = {
// manager.js sends a message to signal 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.removeEventListener("unload", onUnload);
bootstrap.destroy();

Просмотреть файл

@ -345,6 +345,9 @@ ResponsiveUI.prototype = {
// Get the protocol ready to speak with emulation actor
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 select = document.querySelector(".viewport-device-selector");
// Wait until the viewport has been added
yield waitUntilState(store, state => state.viewports.length == 1);
// Wait until the viewport has been added and the device list has been loaded
yield waitUntilState(store, state => state.viewports.length == 1
&& state.devices.listState == Types.deviceListState.LOADED);
openDeviceModal(ui);

Просмотреть файл

@ -6,7 +6,11 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_URL = "data:text/html;charset=utf-8,";
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);
// Do horizontal + vertical resize

Просмотреть файл

@ -216,8 +216,10 @@ function* testViewportResize(ui, selector, moveBy,
`The y move of ${selector} is as expected`);
}
function openDeviceModal({toolWindow}) {
function openDeviceModal({ 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 modal = document.querySelector("#device-modal-wrapper");
@ -226,16 +228,8 @@ function openDeviceModal({toolWindow}) {
"The device modal is closed by default.");
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.dispatchEvent(event);
Simulate.change(select);
ok(modal.classList.contains("opened") && !modal.classList.contains("closed"),
"The device modal is displayed.");
}

Просмотреть файл

@ -3651,16 +3651,6 @@ nsDocument::TryChannelCharset(nsIChannel *aChannel,
already_AddRefed<nsIPresShell>
nsDocument::CreateShell(nsPresContext* aContext, nsViewManager* aViewManager,
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!");

Просмотреть файл

@ -593,10 +593,10 @@ public:
* its presentation context (presentation contexts <b>must not</b> be
* shared among multiple presentation shells).
*/
virtual already_AddRefed<nsIPresShell> CreateShell(
nsPresContext* aContext,
nsViewManager* aViewManager,
mozilla::StyleSetHandle aStyleSet) override;
already_AddRefed<nsIPresShell> CreateShell(nsPresContext* aContext,
nsViewManager* aViewManager,
mozilla::StyleSetHandle aStyleSet)
final;
virtual void DeleteShell() override;
virtual nsresult GetAllowPlugins(bool* aAllowPlugins) override;
@ -1273,10 +1273,6 @@ public:
bool ContainsMSEContent();
protected:
already_AddRefed<nsIPresShell> doCreateShell(nsPresContext* aContext,
nsViewManager* aViewManager,
mozilla::StyleSetHandle aStyleSet);
void RemoveDocStyleSheetsFromStyleSets();
void RemoveStyleSheetsFromStyleSets(
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";
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 blob = yield ContentTask.spawn(browser, null, function() {

Просмотреть файл

@ -267,14 +267,6 @@ nsHTMLDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
SetContentTypeInternal(nsDependentCString("text/html"));
}
already_AddRefed<nsIPresShell>
nsHTMLDocument::CreateShell(nsPresContext* aContext,
nsViewManager* aViewManager,
StyleSetHandle aStyleSet)
{
return doCreateShell(aContext, aViewManager, aStyleSet);
}
void
nsHTMLDocument::TryHintCharset(nsIContentViewer* aCv,
int32_t& aCharsetSource, nsACString& aCharset)

Просмотреть файл

@ -54,11 +54,6 @@ public:
virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
nsIPrincipal* aPrincipal) override;
virtual already_AddRefed<nsIPresShell> CreateShell(
nsPresContext* aContext,
nsViewManager* aViewManager,
mozilla::StyleSetHandle aStyleSet) override;
virtual nsresult StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,

Просмотреть файл

@ -1595,14 +1595,18 @@ TabChild::RecvRealMouseButtonEvent(const WidgetMouseEvent& aEvent,
// 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
// for them.
bool pendingLayerization = false;
if (aInputBlockId && aEvent.mFlags.mHandledByAPZ) {
nsCOMPtr<nsIDocument> document(GetDocument());
APZCCallbackHelper::SendSetTargetAPZCNotification(
pendingLayerization = APZCCallbackHelper::SendSetTargetAPZCNotification(
mPuppetWidget, document, aEvent, aGuid, aInputBlockId);
}
nsEventStatus unused;
InputAPZContext context(aGuid, aInputBlockId, unused);
if (pendingLayerization) {
context.SetPendingLayerization();
}
WidgetMouseEvent localEvent(aEvent);
localEvent.mWidget = mPuppetWidget;

Просмотреть файл

@ -1579,7 +1579,7 @@ nsPluginHost::RegisterFakePlugin(JS::Handle<JS::Value> aInitDictionary,
nsresult rv = nsFakePluginTag::Create(initDictionary, getter_AddRefs(newTag));
NS_ENSURE_SUCCESS(rv, rv);
for (auto existingTag : mFakePlugins) {
for (const auto& existingTag : mFakePlugins) {
if (newTag->HandlerURIMatches(existingTag->HandlerURI())) {
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -6,17 +6,9 @@
TEST_DIRS += ['test']
XPIDL_SOURCES += [
'nsICookieAcceptDialog.idl',
'nsICookiePromptService.idl',
]
XPIDL_MODULE = 'cookie'
UNIFIED_SOURCES += [
'nsCookieModule.cpp',
'nsCookiePermission.cpp',
'nsCookiePromptService.cpp',
'nsPermission.cpp',
'nsPermissionManager.cpp',
'nsPopupWindowManager.cpp',

Просмотреть файл

@ -9,7 +9,6 @@
#include "nsPermissionManager.h"
#include "nsPopupWindowManager.h"
#include "nsICategoryManager.h"
#include "nsCookiePromptService.h"
#include "nsCookiePermission.h"
#include "nsXPIDLString.h"
@ -18,18 +17,15 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPermissionManager,
nsPermissionManager::GetXPCOMSingleton)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPopupWindowManager, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCookiePermission)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCookiePromptService)
NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_POPUPWINDOWMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_COOKIEPROMPTSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_COOKIEPERMISSION_CID);
static const mozilla::Module::CIDEntry kCookieCIDs[] = {
{ &kNS_PERMISSIONMANAGER_CID, false, nullptr, nsIPermissionManagerConstructor },
{ &kNS_POPUPWINDOWMANAGER_CID, false, nullptr, nsPopupWindowManagerConstructor },
{ &kNS_COOKIEPROMPTSERVICE_CID, false, nullptr, nsCookiePromptServiceConstructor },
{ &kNS_COOKIEPERMISSION_CID, false, nullptr, nsCookiePermissionConstructor },
{ nullptr }
};
@ -37,7 +33,6 @@ static const mozilla::Module::CIDEntry kCookieCIDs[] = {
static const mozilla::Module::ContractIDEntry kCookieContracts[] = {
{ NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID },
{ NS_POPUPWINDOWMANAGER_CONTRACTID, &kNS_POPUPWINDOWMANAGER_CID },
{ NS_COOKIEPROMPTSERVICE_CONTRACTID, &kNS_COOKIEPROMPTSERVICE_CID },
{ NS_COOKIEPERMISSION_CONTRACTID, &kNS_COOKIEPERMISSION_CID },
{ nullptr }
};

Просмотреть файл

@ -9,7 +9,6 @@
#include "mozIThirdPartyUtil.h"
#include "nsICookie2.h"
#include "nsIServiceManager.h"
#include "nsICookiePromptService.h"
#include "nsICookieManager2.h"
#include "nsNetUtil.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
tail =
skip-if = toolkit == 'android'
support-files =
cookieprompt.js
cookieprompt.manifest
[test_bug526789.js]
[test_bug650522.js]

Просмотреть файл

@ -746,7 +746,7 @@ SendSetTargetAPZCNotificationHelper(nsIWidget* aWidget,
}
}
void
bool
APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
nsIDocument* aDocument,
const WidgetGUIEvent& aEvent,
@ -754,7 +754,7 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
uint64_t aInputBlockId)
{
if (!aWidget || !aDocument) {
return;
return false;
}
if (aInputBlockId == sLastTargetAPZCNotificationInputBlock) {
// 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
// transaction).
APZCCH_LOG("Not resending target APZC confirmation for input block %" PRIu64 "\n", aInputBlockId);
return;
return false;
}
sLastTargetAPZCNotificationInputBlock = aInputBlockId;
if (nsIPresShell* shell = aDocument->GetShell()) {
@ -795,8 +795,11 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
Move(targets),
waitForRefresh);
}
return waitForRefresh;
}
}
return false;
}
void

Просмотреть файл

@ -139,8 +139,12 @@ public:
* sent to the compositor, which will then post a message back to APZ's
* controller thread. Otherwise, the provided widget's SetConfirmedTargetAPZC
* 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,
const WidgetGUIEvent& aEvent,
const ScrollableLayerGuid& aGuid,

Просмотреть файл

@ -12,6 +12,7 @@ ScrollableLayerGuid InputAPZContext::sGuid;
uint64_t InputAPZContext::sBlockId = 0;
nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eIgnore;
bool InputAPZContext::sRoutedToChildProcess = false;
bool InputAPZContext::sPendingLayerization = false;
/*static*/ ScrollableLayerGuid
InputAPZContext::GetTargetLayerGuid()
@ -37,6 +38,12 @@ InputAPZContext::SetRoutedToChildProcess()
sRoutedToChildProcess = true;
}
/*static*/ void
InputAPZContext::SetPendingLayerization()
{
sPendingLayerization = true;
}
InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
const uint64_t& aBlockId,
const nsEventStatus& aApzResponse)
@ -44,11 +51,13 @@ InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
, mOldBlockId(sBlockId)
, mOldApzResponse(sApzResponse)
, mOldRoutedToChildProcess(sRoutedToChildProcess)
, mOldPendingLayerization(sPendingLayerization)
{
sGuid = aGuid;
sBlockId = aBlockId;
sApzResponse = aApzResponse;
sRoutedToChildProcess = false;
sPendingLayerization = false;
}
InputAPZContext::~InputAPZContext()
@ -57,13 +66,20 @@ InputAPZContext::~InputAPZContext()
sBlockId = mOldBlockId;
sApzResponse = mOldApzResponse;
sRoutedToChildProcess = mOldRoutedToChildProcess;
sPendingLayerization = mOldPendingLayerization;
}
bool
/*static*/ bool
InputAPZContext::WasRoutedToChildProcess()
{
return sRoutedToChildProcess;
}
/*static*/ bool
InputAPZContext::HavePendingLayerization()
{
return sPendingLayerization;
}
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -23,25 +23,29 @@ private:
static uint64_t sBlockId;
static nsEventStatus sApzResponse;
static bool sRoutedToChildProcess;
static bool sPendingLayerization;
public:
static ScrollableLayerGuid GetTargetLayerGuid();
static uint64_t GetInputBlockId();
static nsEventStatus GetApzResponse();
static void SetRoutedToChildProcess();
static void SetPendingLayerization();
InputAPZContext(const ScrollableLayerGuid& aGuid,
const uint64_t& aBlockId,
const nsEventStatus& aApzResponse);
~InputAPZContext();
bool WasRoutedToChildProcess();
static bool WasRoutedToChildProcess();
static bool HavePendingLayerization();
private:
ScrollableLayerGuid mOldGuid;
uint64_t mOldBlockId;
nsEventStatus mOldApzResponse;
bool mOldRoutedToChildProcess;
bool mOldPendingLayerization;
};
} // namespace layers

Просмотреть файл

@ -18,7 +18,7 @@
#include "nsMathUtils.h" // for NS_round
#include "nsRenderingContext.h" // for nsRenderingContext
#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/UniquePtr.h" // for UniquePtr
@ -87,9 +87,9 @@ public:
bool* aBreakBefore) {
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");
return NS_STYLE_HYPHENS_NONE;
return mozilla::StyleHyphens::None;
}
virtual gfxFloat GetHyphenWidth() {
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,
"Computing ligature data for empty range");
NS_ASSERTION(aPartRange.end <= GetLength(), "Character length overflow");
LigatureData result;
const CompressedGlyph *charGlyphs = mCharacterGlyphs;
@ -388,7 +388,7 @@ gfxTextRun::ShrinkToLigatureBoundaries(Range* aRange) const
{
if (aRange->start >= aRange->end)
return;
const CompressedGlyph *charGlyphs = mCharacterGlyphs;
while (aRange->start < aRange->end &&
@ -436,7 +436,7 @@ ClipPartialLigature(const gfxTextRun* aTextRun,
} else {
*aEnd = std::min(*aEnd, endEdge);
}
}
}
}
void
@ -785,7 +785,7 @@ gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont, Range aRange,
// ligature. Shift it left.
metrics.mBoundingBox.x -=
IsRightToLeft() ? metrics.mAdvanceWidth - (data.mPartAdvance + data.mPartWidth)
: data.mPartAdvance;
: data.mPartAdvance;
metrics.mAdvanceWidth = data.mPartWidth;
aMetrics->CombineWith(metrics, IsRightToLeft());
@ -862,8 +862,8 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
}
bool hyphenBuffer[MEASUREMENT_BUFFER_SIZE];
bool haveHyphenation = aProvider &&
(aProvider->GetHyphensOption() == NS_STYLE_HYPHENS_AUTO ||
(aProvider->GetHyphensOption() == NS_STYLE_HYPHENS_MANUAL &&
(aProvider->GetHyphensOption() == StyleHyphens::Auto ||
(aProvider->GetHyphensOption() == StyleHyphens::Manual &&
(mFlags & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
if (haveHyphenation) {
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
// 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
// would trigger an infinite loop.
if (aSuppressBreak != eSuppressAllBreaks &&
@ -919,7 +919,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
if (atHyphenationBreak) {
hyphenatedAdvance += aProvider->GetHyphenWidth();
}
if (lastBreak < 0 || width + hyphenatedAdvance - trimmableAdvance <= aWidth) {
// We can break here.
lastBreak = i;
@ -939,7 +939,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
}
}
}
gfxFloat charAdvance;
if (i >= ligatureRange.start && i < ligatureRange.end) {
charAdvance = GetAdvanceForGlyphs(Range(i, i + 1));
@ -952,7 +952,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
charAdvance =
ComputePartialLigatureWidth(Range(i, i + 1), aProvider);
}
advance += charAdvance;
if (aTrimWhitespace || aWhitespaceCanHang) {
if (mCharacterGlyphs[i].CharIsSpace()) {
@ -1113,7 +1113,7 @@ gfxTextRun::AddGlyphRun(gfxFont *aFont, uint8_t aMatchType,
"mixed orientation should have been resolved");
if (!aFont) {
return NS_OK;
}
}
uint32_t numGlyphRuns = mGlyphRuns.Length();
if (!aForceNewRun && numGlyphRuns > 0) {
GlyphRun *lastGlyphRun = &mGlyphRuns[numGlyphRuns - 1];
@ -1373,7 +1373,7 @@ gfxTextRun::SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
(GetFlags() & gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT) != 0;
gfxShapedWord* sw = aFont->GetShapedWord(aDrawTarget,
&space, 1,
gfxShapedWord::HashMix(0, ' '),
gfxShapedWord::HashMix(0, ' '),
Script::LATIN,
vertical,
mAppUnitsPerDevUnit,
@ -1439,7 +1439,7 @@ gfxTextRun::FetchGlyphExtents(DrawTarget* aRefDrawTarget)
bool fontIsSetup = false;
uint32_t j;
gfxGlyphExtents *extents = font->GetOrCreateGlyphExtents(mAppUnitsPerDevUnit);
for (j = start; j < end; ++j) {
const gfxTextRun::CompressedGlyph *glyphData = &charGlyphs[j];
if (glyphData->IsSimpleGlyph()) {
@ -1911,13 +1911,13 @@ gfxFontGroup::Copy(const gfxFontStyle *aStyle)
return fg;
}
bool
bool
gfxFontGroup::IsInvalidChar(uint8_t ch)
{
return ((ch & 0x7f) < 0x20 || ch == 0x7f);
}
bool
bool
gfxFontGroup::IsInvalidChar(char16_t ch)
{
// All printable 7-bit ASCII values are OK
@ -3148,7 +3148,7 @@ already_AddRefed<gfxFont>
gfxFontGroup::WhichSystemFontSupportsChar(uint32_t aCh, uint32_t aNextCh,
Script aRunScript)
{
gfxFontEntry *fe =
gfxFontEntry *fe =
gfxPlatformFontList::PlatformFontList()->
SystemFindFontForChar(aCh, aNextCh, aRunScript, &mStyle);
if (fe) {

Просмотреть файл

@ -35,6 +35,7 @@ class gfxMissingFontRecorder;
namespace mozilla {
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
* gfxFont. The glyphs are associated with a string of source text, and the
* gfxTextRun APIs take parameters that are offsets into that source text.
*
*
* gfxTextRuns are mostly immutable. The only things that can change are
* 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
@ -78,7 +79,7 @@ struct gfxTextRunDrawCallbacks {
* 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
* any given cluster. (Line breaks specified inside clusters are ignored.)
*
*
* It is important that zero-length substrings are handled correctly. This will
* be on the test!
*/
@ -163,11 +164,11 @@ public:
* Set the potential linebreaks for a substring of the textrun. These are
* the "allow break before" points. Initially, there are no potential
* linebreaks.
*
*
* This can change glyphs and/or geometry! Some textruns' shapes
* depend on potential line breaks (e.g., title-case-converting textruns).
* This function is virtual so that those textruns can reshape themselves.
*
*
* @return true if this changed the linebreaks, false if the new line
* breaks are the same as the old
*/
@ -179,7 +180,7 @@ public:
* potential line break points and computation of spacing. We pass the data
* this way to allow lazy data acquisition; for example BreakAndMeasureText
* 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
* is unable to apply it in some context. Exception: spacing around a
* whitespace character MUST always be applied.
@ -192,8 +193,8 @@ public:
// Returns the provider's hyphenation setting, so callers can decide
// whether it is necessary to call GetHyphenationBreaks.
// Result is an NS_STYLE_HYPHENS_* value.
virtual int8_t GetHyphensOption() = 0;
// Result is an StyleHyphens value.
virtual mozilla::StyleHyphens GetHyphensOption() = 0;
// Returns the extra width that will be consumed by a hyphen. This should
// be constant for a given textrun.
@ -238,7 +239,7 @@ public:
* Draws a substring. Uses only GetSpacing from aBreakProvider.
* The provided point is the baseline origin on the left of the string
* for LTR, on the right of the string for RTL.
*
*
* Drawing should respect advance widths in the sense that for LTR runs,
* Draw(Range(start, middle), pt, ...) followed by
* 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), ...)
* should have the same effect as
* Draw(Range(start, end), pt, ...)
*
*
* Glyphs should be drawn in logical content order, which can be significant
* 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),
* and then set the line-break state before aRange.start to aBreakBefore and
* after the last cluster to aBreakAfter.
*
*
* 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
* 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
* 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.
*
*
* 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
* 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
* alter nsTextFrame::TrimTrailingWhitespace, perhaps drastically becase
* it could affect the layout of frames before it...)
*
*
* We return true if glyphs or geometry changed, false otherwise. This
* function is virtual so that gfxTextRun subclasses can reshape
* properly.
*
*
* @param aAdvanceWidthDelta if non-null, returns the change in advance
* width of the given range.
*/
@ -387,7 +388,7 @@ public:
* @param aBreakPriority in/out the priority of the break opportunity
* saved in the line. If we are prioritizing break opportunities, we will
* not set a break with a lower priority. @see gfxBreakPriority.
*
*
* Note that negative advance widths are possible especially if negative
* 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 as the end of the ligature
gfxFloat mPartWidth;
bool mClipBeforePart;
bool mClipAfterPart;
};
// return storage used by this run, for memory reporter;
// nsTransformedTextRun needs to override this as it holds additional data
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
@ -675,7 +676,7 @@ protected:
CompressedGlyph *mCharacterGlyphs;
private:
// **** general helpers ****
// **** general helpers ****
// Get the total advance for a range of glyphs.
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
// offset relative to the current frame's offset.
uint32_t mLimit;
// Need to recalc tab offsets if frame content offset differs from this.
int32_t mValidForContentOffset;
@ -216,12 +216,12 @@ static const nsFrameState TEXT_WHITESPACE_FLAGS =
/*
* Some general notes
*
*
* Text frames delegate work to gfxTextRun objects. The gfxTextRun object
* transforms text to positioned glyphs. It can report the geometry of the
* glyphs and paint them. Text frames configure gfxTextRuns by providing text,
* spacing, language, and other information.
*
*
* 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
* but is all the same font.
@ -279,7 +279,7 @@ struct SimpleTextRunUserData {
* text frames. Some sequence of its continuations are covered by the textrun.
* A content textnode can have at most one TextRunMappedFlow associated with it
* for a given textrun.
*
*
* mDOMOffsetToBeforeTransformOffset is added to DOM offsets for those frames to obtain
* 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
@ -738,7 +738,7 @@ int32_t nsTextFrame::GetInFlowContentLength() {
* mContentOffset but this frame is empty, logically it might be before the
* start of the cached flow.
*/
if (flowLength &&
if (flowLength &&
(flowLength->mStartOffset < mContentOffset ||
(flowLength->mStartOffset == mContentOffset && GetContentEnd() > 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
// 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)
{
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
// was no previous text frame on this line.
nsIFrame* mAncestorControllingInitialBreak;
int32_t GetContentEnd() {
return mEndFrame ? mEndFrame->GetContentOffset()
: mStartFrame->GetContent()->GetText()->GetLength();
@ -1105,7 +1105,7 @@ public:
mTextRun->ClearFlagBits(nsTextFrameUtils::TEXT_NO_BREAKS);
}
}
virtual void SetCapitalization(uint32_t aOffset, uint32_t aLength,
bool* aCapitalize) override {
MOZ_ASSERT(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED,
@ -1281,7 +1281,7 @@ CanTextCrossFrameBoundary(nsIFrame* aFrame, nsIAtom* aType)
result.mTextRunCanCrossFrameBoundary = false;
result.mLineBreakerCanCrossFrameBoundary = false;
}
}
}
return result;
}
@ -1310,7 +1310,7 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
}
aState->mLastTextFrame = textFrame;
}
if (aFrame == aState->mStopAtFrame)
return FB_STOPPED_AT_STOP_FRAME;
@ -1328,7 +1328,7 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
}
}
return FB_CONTINUE;
return FB_CONTINUE;
}
FrameTextTraversal traversal =
@ -1338,7 +1338,7 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
if (aState->mSeenSpaceForLineBreakingOnThisLine)
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
}
for (nsIFrame* f = traversal.NextFrameToScan(); f;
f = traversal.NextFrameToScan()) {
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
* to build text runs that span content nodes.
*
*
* @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 aLineContainer the line container containing aForFrame; if null,
@ -1382,7 +1382,7 @@ BuildTextRuns(DrawTarget* aDrawTarget, nsTextFrame* aForFrame,
MOZ_ASSERT(aForFrame, "for no frame?");
NS_ASSERTION(!aForFrameLine || aLineContainer,
"line but no line container");
nsIFrame* lineContainerChild = aForFrame;
if (!aLineContainer) {
if (aForFrame->IsFloatingFirstLetterChild()) {
@ -1613,7 +1613,7 @@ void BuildTextRunsScanner::FlushFrames(bool aFlushLineBreaks, bool aSuppressTrai
if (!SetupLineBreakerContext(textRun)) {
return;
}
// Update mNextRunContextInfo appropriately
mNextRunContextInfo = nsTextFrameUtils::INCOMING_NONE;
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_TRAILING_WHITESPACE) {
@ -2138,10 +2138,10 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
}
nsIFrame* child = mLineContainer;
uint8_t oldScriptLevel = 0;
while (parent &&
while (parent &&
child->HasAnyStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT)) {
// 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
// different (especially negative) scriptlevel.
nsIMathMLFrame* mathFrame= do_QueryFrame(parent);
@ -2276,7 +2276,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
gfxSkipCharsIterator iter(skipChars);
AutoTArray<uint32_t,50> textBreakPointsAfterTransform;
for (uint32_t i = 0; i < textBreakPoints.Length(); ++i) {
nsTextFrameUtils::AppendLineBreakOffset(&textBreakPointsAfterTransform,
nsTextFrameUtils::AppendLineBreakOffset(&textBreakPointsAfterTransform,
iter.ConvertOriginalToSkipped(textBreakPoints[i]));
}
if (mStartOfLine) {
@ -2599,7 +2599,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
if (textStyle->mTextTransform == NS_STYLE_TEXT_TRANSFORM_CAPITALIZE) {
flags |= nsLineBreaker::BREAK_NEED_CAPITALIZATION;
}
if (textStyle->mHyphens == NS_STYLE_HYPHENS_AUTO) {
if (textStyle->mHyphens == StyleHyphens::Auto) {
flags |= nsLineBreaker::BREAK_USE_AUTO_HYPHENATION;
}
@ -2621,7 +2621,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
length, flags, sink);
}
}
iter = iterNext;
}
}
@ -3057,7 +3057,7 @@ public:
/**
* 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.
*
*
* @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
* textrun. If INT32_MAX is passed, justification and hyphen-related methods
@ -3117,7 +3117,7 @@ public:
virtual void GetSpacing(Range aRange, Spacing* aSpacing);
virtual gfxFloat GetHyphenWidth();
virtual void GetHyphenationBreaks(Range aRange, bool* aBreakBefore);
virtual int8_t GetHyphensOption() {
virtual StyleHyphens GetHyphensOption() {
return mTextStyle->mHyphens;
}
@ -3186,7 +3186,7 @@ protected:
nsTextFrame* mFrame;
gfxSkipCharsIterator mStart; // Offset in original and transformed string
gfxSkipCharsIterator mTempIterator;
// Either null, or pointing to the frame's TabWidthProperty.
TabWidthStore* mTabWidths;
// 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,
mFrame, mTextRun, aTabWidth);
mTabWidths->mWidths.AppendElement(TabWidth(i - startOffset,
mTabWidths->mWidths.AppendElement(TabWidth(i - startOffset,
NSToIntRound(nextTab - mOffsetFromBlockOriginForTabs)));
mOffsetFromBlockOriginForTabs = nextTab;
}
@ -3560,7 +3560,7 @@ PropertyProvider::GetHyphenationBreaks(Range aRange, bool* aBreakBefore)
NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
if (!mTextStyle->WhiteSpaceCanWrap(mFrame) ||
mTextStyle->mHyphens == NS_STYLE_HYPHENS_NONE)
mTextStyle->mHyphens == StyleHyphens::None)
{
memset(aBreakBefore, false, aRange.Length() * sizeof(bool));
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) {
if (mTextRun->CanHyphenateBefore(aRange.start + i)) {
aBreakBefore[i] = true;
@ -3783,7 +3783,7 @@ nsTextPaintStyle::GetHighlightColors(nscolor* aForeColor,
{
NS_ASSERTION(aForeColor, "aForeColor is null");
NS_ASSERTION(aBackColor, "aBackColor is null");
nscolor backColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightBackground);
nscolor foreColor =
@ -4310,7 +4310,7 @@ public:
InlineMinISizeData *aData) override;
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
InlinePrefISizeData *aData) override;
protected:
explicit nsContinuingTextFrame(nsStyleContext* aContext) : nsTextFrame(aContext) {}
nsIFrame* mPrevContinuation;
@ -4482,7 +4482,7 @@ nsContinuingTextFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
return;
}
static void
static void
DestroySelectionDetails(SelectionDetails* aDetails)
{
while (aDetails) {
@ -5126,7 +5126,7 @@ nsTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
{
if (!IsVisibleForPainting(aBuilder))
return;
DO_GLOBAL_REFLOW_COUNT_DSP("nsTextFrame");
const nsStyleColor* sc = StyleColor();
@ -5309,7 +5309,7 @@ nsTextFrame::GetTextDecorations(
if (!useOverride &&
(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.
useOverride = true;
overrideColor =
@ -5887,7 +5887,7 @@ nsTextFrame::DrawSelectionDecorations(gfxContext* aContext,
// X: underline
//
// IME selection #1 IME selection #2 IME selection #3
// | | |
// | | |
// | XXXXXXXXXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXX
// +---------------------+----------------------+--------------------
// ^ ^ ^ ^ ^
@ -6109,10 +6109,10 @@ bool SelectionIterator::GetNextSegment(gfxFloat* aXOffset,
{
if (mIterator.GetOriginalOffset() >= int32_t(mOriginalRange.end))
return false;
// save offset into transformed string now
uint32_t runOffset = mIterator.GetSkippedOffset();
uint32_t index = mIterator.GetOriginalOffset() - mOriginalRange.start;
SelectionDetails* sdptr = mSelectionDetails[index];
SelectionType selectionType =
@ -7231,10 +7231,10 @@ nsTextFrame::IsVisibleInSelection(nsISelection* aSelection)
// Check the quick way first
if (!GetContent()->IsSelectionDescendant())
return false;
SelectionDetails* details = GetSelectionDetails();
bool found = false;
// where are the selection points "really"
SelectionDetails *sdptr = details;
while (sdptr) {
@ -7749,7 +7749,7 @@ nsTextFrame::GetChildFrameContainingOffset(int32_t aContentOffset,
f = prev;
}
}
*aOutOffset = aContentOffset - f->GetContentOffset();
*aOutFrame = f;
@ -7905,7 +7905,7 @@ nsTextFrame::PeekOffsetCharacter(bool aForward, int32_t* aOffset,
}
*aOffset = contentLength;
}
return CONTINUE;
}
@ -8162,7 +8162,7 @@ FindEndOfPunctuationRun(const nsTextFragment* aFrag,
*
* XXX :first-letter should be handled during frame construction
* (and it has a good bit in common with nextBidi)
*
*
* @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
* include leading and trailing punctuation, for example)
@ -8179,7 +8179,7 @@ FindFirstLetterRange(const nsTextFragment* aFrag,
gfxSkipCharsIterator iter(aIter);
// 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),
endOffset);
if (i == length)
@ -8307,7 +8307,7 @@ nsTextFrame::SetFontSizeInflation(float aInflation)
Properties().Set(FontSizeInflationProperty(), aInflation);
}
/* virtual */
/* virtual */
void nsTextFrame::MarkIntrinsicISizesDirty()
{
ClearTextRuns();
@ -8338,8 +8338,8 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext,
// otherwise we can just pass INT32_MAX to mean "all the text"
int32_t len = INT32_MAX;
bool hyphenating = frag->GetLength() > 0 &&
(textStyle->mHyphens == NS_STYLE_HYPHENS_AUTO ||
(textStyle->mHyphens == NS_STYLE_HYPHENS_MANUAL &&
(textStyle->mHyphens == StyleHyphens::Auto ||
(textStyle->mHyphens == StyleHyphens::Manual &&
(textRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
if (hyphenating) {
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
// OK since we can't really handle tabs for intrinsic sizing anyway.
const nsStyleText* textStyle = StyleText();
const nsTextFragment* frag = mContent->GetText();
PropertyProvider provider(textRun, textStyle, frag, this,
@ -8787,7 +8787,7 @@ RemoveEmptyInFlows(nsTextFrame* aFrame, nsTextFrame* aFirstToNotRemove)
aFrame->GetPrevInFlow() &&
aFrame->GetPrevInFlow() != nullptr,
"aFrame should have a fluid prev continuation");
nsIFrame* prevContinuation = aFrame->GetPrevContinuation();
nsIFrame* lastRemoved = aFirstToNotRemove->GetPrevContinuation();
@ -9095,7 +9095,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
cachedNewlineOffset->mNewlineOffset >= offset)) {
contentNewLineOffset = cachedNewlineOffset->mNewlineOffset;
} else {
contentNewLineOffset = FindChar(frag, offset,
contentNewLineOffset = FindChar(frag, offset,
mContent->TextLength() - offset, '\n');
}
if (contentNewLineOffset < offset + length) {
@ -9183,7 +9183,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
// Ensure that the textrun will be rebuilt
ClearTextRuns();
}
}
}
}
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
/////////////////////////////////////////////////////////////////////
iter.SetOriginalOffset(offset);
nscoord xOffsetForTabs = (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TAB) ?
(aLineLayout.GetCurrentFrameInlineDistanceFromBlock() -
@ -9510,7 +9510,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
bool breakAfter = forceBreakAfter;
if (!shouldSuppressLineBreak) {
if (charsFit > 0 && charsFit == length &&
textStyle->mHyphens != NS_STYLE_HYPHENS_NONE &&
textStyle->mHyphens != StyleHyphens::None &&
HasSoftHyphenBefore(frag, mTextRun, offset, end)) {
bool fits =
textMetrics.mAdvanceWidth + provider.GetHyphenWidth() <= availWidth;
@ -9636,7 +9636,7 @@ nsTextFrame::TrimTrailingWhiteSpace(DrawTarget* aDrawTarget)
const nsStyleText* textStyle = StyleText();
gfxFloat delta = 0;
uint32_t trimmedEnd = trimmedEndIter.ConvertOriginalToSkipped(trimmed.GetEnd());
if (!(GetStateBits() & TEXT_TRIMMED_TRAILING_WHITESPACE) &&
trimmed.GetEnd() < GetContentEnd()) {
gfxSkipCharsIterator end = trimmedEndIter;
@ -9955,7 +9955,7 @@ nsTextFrame::IsEmpty()
NS_ASSERTION(!(mState & TEXT_IS_ONLY_WHITESPACE) ||
!(mState & TEXT_ISNOT_ONLY_WHITESPACE),
"Invalid state");
// XXXldb Should this check compatibility mode as well???
const nsStyleText* textStyle = StyleText();
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();
str += nsPrintfCString("[%d,%d,%c] ", GetContentOffset(), GetContentLength(),
isComplete ? 'T':'F');
if (IsSelected()) {
str += " SELECTED";
}

Просмотреть файл

@ -206,7 +206,7 @@ nsCSSProps::AddRefTable(void)
static bool prefObserversInited = false;
if (!prefObserversInited) {
prefObserversInited = true;
#define OBSERVE_PROP(pref_, id_) \
if (pref_[0]) { \
Preferences::AddBoolVarCache(&gPropertyEnabled[id_], \
@ -1479,9 +1479,9 @@ const KTableEntry nsCSSProps::kFlexWrapKTable[] = {
};
const KTableEntry nsCSSProps::kHyphensKTable[] = {
{ eCSSKeyword_none, NS_STYLE_HYPHENS_NONE },
{ eCSSKeyword_manual, NS_STYLE_HYPHENS_MANUAL },
{ eCSSKeyword_auto, NS_STYLE_HYPHENS_AUTO },
{ eCSSKeyword_none, StyleHyphens::None },
{ eCSSKeyword_manual, StyleHyphens::Manual },
{ eCSSKeyword_auto, StyleHyphens::Auto },
{ eCSSKeyword_UNKNOWN, -1 }
};
@ -2873,7 +2873,7 @@ static const nsCSSPropertyID gFlexFlowSubpropTable[] = {
static const nsCSSPropertyID gGridTemplateSubpropTable[] = {
eCSSProperty_grid_template_areas,
eCSSProperty_grid_template_rows,
eCSSProperty_grid_template_rows,
eCSSProperty_grid_template_columns,
eCSSProperty_UNKNOWN
};

Просмотреть файл

@ -1448,6 +1448,7 @@ struct SetEnumValueHelper
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None, InlineEnd)
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(StyleUserSelect, None, MozText)
DEFINE_ENUM_CLASS_SETTER(StyleUserInput, None, Auto)
@ -4932,7 +4933,7 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
SetValue(*aRuleData->ValueForHyphens(), text->mHyphens, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
parentText->mHyphens,
NS_STYLE_HYPHENS_MANUAL);
StyleHyphens::Manual);
// ruby-align: enum, inherit, initial
SetValue(*aRuleData->ValueForRubyAlign(),

Просмотреть файл

@ -165,6 +165,13 @@ enum class StyleFloatEdge : uint8_t {
MarginBox,
};
// Hyphens
enum class StyleHyphens : uint8_t {
None,
Manual,
Auto,
};
// shape-box for shape-outside
enum class StyleShapeOutsideShapeBox : uint8_t {
NoBox,
@ -971,11 +978,6 @@ enum class StyleDisplay : uint8_t {
#define NS_STYLE_OVERFLOWWRAP_NORMAL 0
#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
#define NS_STYLE_RUBY_ALIGN_START 0
#define NS_STYLE_RUBY_ALIGN_CENTER 1

Просмотреть файл

@ -3770,7 +3770,7 @@ nsStyleText::nsStyleText(const nsPresContext* aContext)
, mWhiteSpace(NS_STYLE_WHITESPACE_NORMAL)
, mWordBreak(NS_STYLE_WORDBREAK_NORMAL)
, mOverflowWrap(NS_STYLE_OVERFLOWWRAP_NORMAL)
, mHyphens(NS_STYLE_HYPHENS_MANUAL)
, mHyphens(StyleHyphens::Manual)
, mRubyAlign(NS_STYLE_RUBY_ALIGN_SPACE_AROUND)
, mRubyPosition(NS_STYLE_RUBY_POSITION_OVER)
, 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 mWordBreak; // [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 mRubyPosition; // [inherited] see nsStyleConsts.h
uint8_t mTextSizeAdjust; // [inherited] see nsStyleConsts.h

Просмотреть файл

@ -37,6 +37,7 @@
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsRefreshDriver.h" // for nsAPostRefreshObserver
#include "mozilla/Assertions.h" // for MOZ_ASSERT
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
@ -929,6 +930,43 @@ nsSliderMediator::HandleEvent(nsIDOMEvent* aEvent)
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
nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
{
@ -974,8 +1012,9 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
scrollFrameAsScrollable->GetScrollPortRect().TopLeft();
CSSRect sliderTrackCSS = CSSRect::FromAppUnits(sliderTrack);
nsIPresShell* shell = PresContext()->PresShell();
uint64_t inputblockId = InputAPZContext::GetInputBlockId();
uint32_t presShellId = PresContext()->PresShell()->GetPresShellId();
uint32_t presShellId = shell->GetPresShellId();
AsyncDragMetrics dragMetrics(scrollTargetId, presShellId, inputblockId,
NSAppUnitsToFloatPixels(mDragStart,
float(AppUnitsPerCSSPixel())),
@ -989,7 +1028,15 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
// 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.
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;
}

Просмотреть файл

@ -645,7 +645,7 @@ class IceTestPeer : public sigslot::has_slots<> {
std::vector<std::string> candidates = GetCandidates(stream);
int host_net = 0;
for (auto c : candidates) {
for (const auto& c : candidates) {
if (c.find("typ host") != std::string::npos) {
nr_transport_addr addr;
std::vector<std::string> tokens = split(c, ' ');
@ -1629,7 +1629,7 @@ class WebRtcIceGatherTest : public StunTest {
std::cerr << "Candidates for stream " << stream << "->"
<< candidates.size() << std::endl;
for (auto c : candidates) {
for (const auto& c : candidates) {
std::cerr << "Candidate: " << c << std::endl;
}
}

Просмотреть файл

@ -4223,4 +4223,879 @@ TEST_F(JsepSessionTest, TestNonDefaultProtocol)
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

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -22,6 +22,7 @@ import java.util.regex.Pattern;
import org.json.JSONObject;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.ThreadUtils;
import android.content.BroadcastReceiver;
@ -155,7 +156,8 @@ public final class ANRReporter extends BroadcastReceiver
.start();
try {
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();
if (DEBUG) {
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);
}
BufferedReader traces = new BufferedReader(
new FileReader(tracesFile), TRACES_BLOCK_SIZE);
new InputStreamReader(new FileInputStream(
tracesFile), StringUtils.UTF_8), TRACES_BLOCK_SIZE);
try {
for (int count = 0; count < LINES_TO_IDENTIFY_TRACES; count++) {
String line = traces.readLine();

Просмотреть файл

@ -2046,10 +2046,10 @@ public class BrowserApp extends GeckoApp
try {
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);
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) {
Log.w(LOGTAG, "Failed to convert to 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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
@ -20,6 +21,7 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import org.mozilla.gecko.util.NetworkUtils;
import org.mozilla.gecko.util.StringUtils;
/**
* Use network-based search suggestions.
@ -134,7 +136,7 @@ public class SuggestClient {
private String convertStreamToString(java.io.InputStream is) {
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) {
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.LoginsDisabledHosts;
import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.util.StringUtils;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
@ -507,7 +508,8 @@ public class LoginsProvider extends SharedBrowserDatabaseProvider {
private String decrypt(@NonNull String initialValue) {
try {
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) {
debug("Decryption failed : " + e);
throw new IllegalStateException("Logins decryption failed", e);

Просмотреть файл

@ -550,7 +550,8 @@ public class BrowserSearch extends HomeFragment
domains = new LinkedHashSet<String>(500);
BufferedReader buf = null;
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;
do {

Просмотреть файл

@ -29,6 +29,8 @@ import android.media.MediaDrmException;
import android.media.NotProvisionedException;
import android.util.Log;
import org.mozilla.gecko.util.StringUtils;
public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
protected final String LOGTAG;
private static final String INVALID_SESSION_ID = "Invalid";
@ -183,7 +185,8 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
request.getData());
mSessionMIMETypes.put(sessionId, initDataType);
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) {
if (DEBUG) Log.d(LOGTAG, "Device not provisioned:" + e.getMessage());
if (sessionId != null) {
@ -207,7 +210,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
return;
}
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes());
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes(StringUtils.UTF_8));
if (!sessionExists(session)) {
onRejectPromise(promiseId, "Invalid session during updateSession.");
return;
@ -242,7 +245,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
return;
}
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes());
ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes(StringUtils.UTF_8));
mSessionIds.remove(session);
mDrm.closeSession(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.
break;
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;
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;
default:
if (DEBUG) Log.d(LOGTAG, "Invalid DRM event " + event);
@ -466,7 +469,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
int responseCode = urlConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in =
new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), StringUtils.UTF_8));
String inputLine;
StringBuffer response = new StringBuffer();
@ -474,7 +477,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
response.append(inputLine);
}
in.close();
mResponseBody = String.valueOf(response).getBytes();
mResponseBody = String.valueOf(response).getBytes(StringUtils.UTF_8);
if (DEBUG) Log.d(LOGTAG, "Provisioning, response received.");
if (mResponseBody != null) Log.d(LOGTAG, "response length=" + mResponseBody.length);
} else {
@ -600,7 +603,8 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
final byte [] cryptoSessionId = mCryptoSessionId.array();
mCrypto = new MediaCrypto(mSchemeUUID, cryptoSessionId);
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;
} else {
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.HardwareUtils;
import org.mozilla.gecko.util.RawResource;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.ThreadUtils;
import org.xmlpull.v1.XmlPullParserException;
@ -393,7 +394,7 @@ public class SearchEngineManager implements SharedPreferences.OnSharedPreference
urlConnection.setRequestMethod("POST");
urlConnection.setRequestProperty("User-Agent", USER_AGENT);
urlConnection.setRequestProperty("Content-Type", "application/json");
urlConnection.setFixedLengthStreamingMode(message.getBytes().length);
urlConnection.setFixedLengthStreamingMode(message.getBytes(StringUtils.UTF_8).length);
final OutputStream out = urlConnection.getOutputStream();
out.write(message.getBytes());

Просмотреть файл

@ -118,7 +118,7 @@ var WebcompatReporter = {
return new Promise((resolve) => {
const WEBCOMPAT_ORIGIN = "https://webcompat.com";
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") {
BrowserApp.deck.addEventListener("DOMContentLoaded", function sendDataToTab(event) {

Просмотреть файл

@ -9,6 +9,7 @@ import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
@ -20,6 +21,12 @@ public class StringUtils {
private static final String FILTER_URL_PREFIX = "filter://";
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,
* and returns a previous result if there is ambiguity

Просмотреть файл

@ -109,7 +109,6 @@
@BINPATH@/components/content_html.xpt
@BINPATH@/components/content_webrtc.xpt
@BINPATH@/components/content_xslt.xpt
@BINPATH@/components/cookie.xpt
@BINPATH@/components/directory.xpt
@BINPATH@/components/docshell.xpt
@BINPATH@/components/dom.xpt

Просмотреть файл

@ -4,6 +4,7 @@
package org.mozilla.gecko.background.common.log;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Iterator;
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.SimpleTagLogWriter;
import org.mozilla.gecko.background.common.log.writers.ThreadLocalTagLogWriter;
import org.mozilla.gecko.util.StringUtils;
import android.util.Log;
@ -126,7 +128,8 @@ public class Logger {
*/
public static synchronized void startLoggingToConsole() {
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.

Просмотреть файл

@ -149,8 +149,10 @@ public class JSONWebTokenUtils {
if (parts.length != 3) {
return null;
}
String cHeader = new String(Base64.decodeBase64(parts[0]));
String cPayload = new String(Base64.decodeBase64(parts[1]));
String cHeader = new String(Base64.decodeBase64(parts[0]),
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]));
ExtendedJSONObject o = new ExtendedJSONObject();
o.put("header", new ExtendedJSONObject(cHeader));
@ -203,8 +205,10 @@ public class JSONWebTokenUtils {
if (parts.length != 3) {
return null;
}
String aHeader = new String(Base64.decodeBase64(parts[0]));
String aPayload = new String(Base64.decodeBase64(parts[1]));
String aHeader = new String(Base64.decodeBase64(parts[0]),
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]));
// We do all the assertion parsing *before* dumping the certificate in
// 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.gecko.sync.crypto.CryptoException;
import org.mozilla.gecko.sync.crypto.KeyBundle;
import org.mozilla.gecko.util.StringUtils;
public class CollectionKeys {
private KeyBundle defaultKeyBundle = null;
@ -69,8 +70,8 @@ public class CollectionKeys {
private static JSONArray keyBundleToArray(KeyBundle bundle) {
// Generate JSON.
JSONArray keysArray = new JSONArray();
keysArray.add(new String(Base64.encodeBase64(bundle.getEncryptionKey())));
keysArray.add(new String(Base64.encodeBase64(bundle.getHMACKey())));
keysArray.add(new String(Base64.encodeBase64(bundle.getEncryptionKey()), StringUtils.UTF_8));
keysArray.add(new String(Base64.encodeBase64(bundle.getHMACKey()), StringUtils.UTF_8));
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.repositories.domain.Record;
import org.mozilla.gecko.sync.repositories.domain.RecordParseException;
import org.mozilla.gecko.util.StringUtils;
/**
* A Sync crypto record has:
@ -204,7 +205,7 @@ public class CryptoRecord extends Record {
throw new NoKeyBundleException();
}
String cleartext = payload.toJSONString();
byte[] cleartextBytes = cleartext.getBytes("UTF-8");
byte[] cleartextBytes = cleartext.getBytes(StringUtils.UTF_8);
CryptoInfo info = CryptoInfo.encrypt(cleartextBytes, keyBundle);
String message = new String(Base64.encodeBase64(info.getMessage()));
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.nativecode.NativeCrypto;
import org.mozilla.gecko.sync.setup.Constants;
import org.mozilla.gecko.util.StringUtils;
import android.content.Context;
import android.content.SharedPreferences;
@ -47,7 +48,7 @@ public class Utils {
public static String generateGuid() {
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 {
fis = context.openFileInput(filename);
isr = new InputStreamReader(fis);
isr = new InputStreamReader(fis, StringUtils.UTF_8);
br = new BufferedReader(isr);
StringBuilder sb = new StringBuilder();
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.NonArrayJSONException;
import org.mozilla.gecko.sync.NonObjectJSONException;
import org.mozilla.gecko.util.StringUtils;
import ch.boye.httpclientandroidlib.Header;
import ch.boye.httpclientandroidlib.HttpEntity;
@ -79,7 +80,7 @@ public class MozResponse {
return null;
}
InputStreamReader is = new InputStreamReader(entity.getContent());
InputStreamReader is = new InputStreamReader(entity.getContent(), StringUtils.UTF_8);
// Oh, Java, you are so evil.
body = new Scanner(is).useDelimiter("\\A").next();
return body;

Просмотреть файл

@ -11,6 +11,7 @@ import java.io.InputStreamReader;
import java.net.URI;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.util.StringUtils;
import ch.boye.httpclientandroidlib.Header;
import ch.boye.httpclientandroidlib.HttpEntity;
@ -103,7 +104,7 @@ public class SyncStorageCollectionRequest extends SyncStorageRequest {
BufferedReader br = null;
try {
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;
// 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.util.Log;
import org.mozilla.mozstumbler.service.AppGlobals;
import org.mozilla.mozstumbler.service.utils.StringUtils;
import org.mozilla.mozstumbler.service.utils.Zipper;
import java.io.File;
import java.io.FileInputStream;
@ -101,7 +103,7 @@ public class DataStorageManager {
if (mCurrentReports.reports.size() > 0) {
try {
bytes = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes()).length;
bytes = Zipper.zipData(finalizeReports(mCurrentReports.reports).getBytes(StringUtils.UTF_8)).length;
} catch (IOException ex) {
Log.e(LOG_TAG, "Zip error in getQueuedCounts()", ex);
}
@ -301,7 +303,7 @@ public class DataStorageManager {
if (currentReportsCount > 0) {
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 cellCount = mCurrentReports.cellCount;
clearCurrentReports();
@ -412,7 +414,7 @@ public class DataStorageManager {
if (mCurrentReports.reports.size() < 1) {
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);
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);
GZIPInputStream gstream = new GZIPInputStream(bs);
try {
InputStreamReader reader = new InputStreamReader(gstream);
InputStreamReader reader = new InputStreamReader(gstream, StringUtils.UTF_8);
BufferedReader in = new BufferedReader(reader);
String read;
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/NetworkUtils.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/Zipper.java',
]

Просмотреть файл

@ -495,7 +495,8 @@ NeckoParent::RecvPDataChannelConstructor(PDataChannelParent* actor,
const uint32_t& channelId)
{
DataChannelParent* p = static_cast<DataChannelParent*>(actor);
MOZ_DIAGNOSTIC_ASSERT(p->Init(channelId));
DebugOnly<bool> rv = p->Init(channelId);
MOZ_ASSERT(rv);
return IPC_OK();
}

Просмотреть файл

@ -12,7 +12,7 @@ android-api-15/debug:
max-run-time: 7200
run:
using: mozharness
actions: [get-secrets build multi-l10n update]
actions: [get-secrets build generate-build-stats multi-l10n update]
config:
- builds/releng_base_android_64_builds.py
- disable_signing.py
@ -37,7 +37,7 @@ android-x86/opt:
max-run-time: 7200
run:
using: mozharness
actions: [get-secrets build multi-l10n update]
actions: [get-secrets build generate-build-stats multi-l10n update]
config:
- builds/releng_base_android_64_builds.py
- disable_signing.py
@ -62,7 +62,7 @@ android-api-15/opt:
max-run-time: 7200
run:
using: mozharness
actions: [get-secrets build multi-l10n update]
actions: [get-secrets build generate-build-stats multi-l10n update]
config:
- builds/releng_base_android_64_builds.py
- disable_signing.py
@ -89,7 +89,7 @@ android-api-15-nightly/opt:
max-run-time: 7200
run:
using: mozharness
actions: [get-secrets build multi-l10n update]
actions: [get-secrets build generate-build-stats multi-l10n update]
config:
- builds/releng_base_android_64_builds.py
- disable_signing.py
@ -129,7 +129,7 @@ android-api-15-gradle/opt:
type: directory
run:
using: mozharness
actions: [get-secrets build multi-l10n update]
actions: [get-secrets build generate-build-stats multi-l10n update]
config:
- builds/releng_base_android_64_builds.py
- disable_signing.py

Просмотреть файл

@ -14,6 +14,7 @@ module.exports = {
// All globals made available in the test environment.
"globals": {
"add_task": false,
"addLoadEvent": false,
"Assert": false,
"BrowserTestUtils": false,
"content": false,
@ -34,6 +35,7 @@ module.exports = {
"is": false,
"isnot": false,
"ok": false,
"privateNoteIntentionalCrash": false,
"registerCleanupFunction": false,
"requestLongerTimeout": false,
"SimpleTest": false,

Просмотреть файл

@ -12,6 +12,7 @@ module.exports = {
// All globals made available in the test environment.
"globals": {
"add_task": false,
"addLoadEvent": false,
"Assert": false,
"EventUtils": false,
"executeSoon": false,
@ -24,6 +25,7 @@ module.exports = {
"is": false,
"isnot": false,
"ok": false,
"privateNoteIntentionalCrash": false,
"promise": false,
"registerCleanupFunction": false,
"requestLongerTimeout": false,

Просмотреть файл

@ -280,7 +280,7 @@ class MachCommands(MachCommandBase):
description='Run any flavor of mochitest (integration test).',
parser=setup_argument_parser)
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
for app in SUPPORTED_APPS:

Просмотреть файл

@ -15,6 +15,7 @@ module.exports = {
// $ is defined in SimpleTest.js
"$": false,
"add_task": false,
"addLoadEvent": false,
"Assert": false,
"EventUtils": false,
"executeSoon": false,

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше