Merge inbound to mozilla-central. a=merge

This commit is contained in:
Margareta Eliza Balazs 2018-08-29 12:43:37 +03:00
Родитель 7bc4b7b684 4b1be4ef6a
Коммит 2fe43133db
319 изменённых файлов: 2971 добавлений и 6412 удалений

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

@ -50,14 +50,6 @@ if (!MAC) {
todo(false, "Bug 746531 - timeouts of last three menulist tests on OS X");
}
var textentry = getAccessible("emenulist").firstChild;
gQueue.push(new synthFocus("emenulist", new focusChecker(textentry)));
gQueue.push(new synthDownKey(textentry, new nofocusChecker("eml_tangerine")));
gQueue.push(new synthUpKey(textentry, new focusChecker("eml_marmalade")));
gQueue.push(new synthEnterKey("eml_marmalade", new focusChecker(textentry)));
gQueue.push(new synthOpenComboboxKey("emenulist", new focusChecker("eml_marmalade")));
gQueue.push(new synthEscapeKey("eml_marmalade", new focusChecker(textentry)));
// no focus events for unfocused list controls when current item is
// changed.
gQueue.push(new synthFocus("emptyrichlistbox"));
@ -66,7 +58,6 @@ if (!MAC) {
if (!MAC) {
gQueue.push(new changeCurrentItem("menulist", WIN ? "ml_marmalade" : "ml_tangerine"));
}
gQueue.push(new changeCurrentItem("emenulist", "eml_tangerine"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -124,12 +115,6 @@ if (!MAC) {
<menuitem id="ml_strawberry" label="strawberry fields"/>
</menupopup>
</menulist>
<menulist id="emenulist" editable="true">
<menupopup>
<menuitem id="eml_tangerine" label="tangerine trees"/>
<menuitem id="eml_marmalade" label="marmalade skies"/>
</menupopup>
</menulist>
<vbox id="eventdump"/>
</vbox>

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

@ -54,48 +54,6 @@
testAccessibleTree("menulist", accTree);
//////////////////////////////////////////////////////////////////////////
// editable menulist
accTree = {
role: ROLE_COMBOBOX,
children: [
{
role: ROLE_ENTRY,
children: [
// no text leaf accessible for text node
]
},
{
role: ROLE_COMBOBOX_LIST, // context menu
children: []
},
{
role: ROLE_PUSHBUTTON, // dropmarker
children: []
},
{
role: ROLE_COMBOBOX_LIST, // option list
children: [
{
role: ROLE_COMBOBOX_OPTION,
children: []
},
{
role: ROLE_COMBOBOX_OPTION,
children: []
}
]
}
]
};
if (!MAC) {
testAccessibleTree("menulist2", accTree);
} else {
todo(false, "Make this test pass on OSX (bug 551957)");
}
//////////////////////////////////////////////////////////////////////////
// textbox@type=autocomplete #1 (history)
@ -195,13 +153,6 @@
</menupopup>
</menulist>
<menulist id="menulist2" editable="true">
<menupopup>
<menuitem label="item"/>
<menuitem label="item"/>
</menupopup>
</menulist>
<textbox id="autocomplete" type="autocomplete"
autocompletesearch="unifiedcomplete"
value="http://mochi.test:8888/redirect-a11y.html"/>

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

@ -32,13 +32,10 @@ XULComboboxAccessible::
else
mGenericTypes |= eCombobox;
// Both the XUL <textbox type="autocomplete"> and <menulist editable="true">
// widgets use XULComboboxAccessible. We need to walk the anonymous children
// for these so that the entry field is a child. Otherwise no XBL children.
if (!mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) &&
!mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::editable, nsGkAtoms::_true,
eIgnoreCase)) {
// The XUL <textbox type="autocomplete"> uses XULComboboxAccessible. We need
// to walk the anonymous children for these so that the entry field is a
// child. Otherwise no XBL children.
if (!mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL)) {
mStateFlags |= eNoXBLKids;
}
}

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

@ -985,6 +985,7 @@ function blockAllChromeURLs() {
ChromeURLBlockPolicy.contractID,
ChromeURLBlockPolicy);
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
cm.addCategoryEntry("content-policy", ChromeURLBlockPolicy.contractID, ChromeURLBlockPolicy.contractID, false, true);
Services.catMan.addCategoryEntry("content-policy",
ChromeURLBlockPolicy.contractID,
ChromeURLBlockPolicy.contractID, false, true);
}

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

@ -80,6 +80,11 @@ let PaymentFrameScript = {
return FormAutofillUtils.getAddressLabel(address, addressFields);
},
getCreditCardNetworks() {
let networks = FormAutofillUtils.getCreditCardNetworks();
return Cu.cloneInto(networks, waivedContent);
},
isCCNumber(value) {
return FormAutofillUtils.isCCNumber(value);
},

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

@ -2,11 +2,6 @@
* 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/. */
/* Hide the message about autofill availability since it's not relevant */
#country-warning-message {
display: none;
}
.error-text:not(:empty) {
color: #fff;
background-color: #d70022;

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

@ -273,7 +273,7 @@ export default class AddressForm extends PaymentStateSubscriberMixin(PaymentRequ
if (field.localName == "button" || !container) {
continue;
}
let span = container.querySelector("span");
let span = container.querySelector(".label-text");
span.setAttribute("fieldRequiredSymbol", this.dataset.fieldRequiredSymbol);
let required = field.required && !field.disabled;
if (required) {

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

@ -84,6 +84,7 @@ export default class BasicCardForm extends PaymentStateSubscriberMixin(PaymentRe
}, record, addresses, {
isCCNumber: PaymentDialogUtils.isCCNumber,
getAddressLabel: PaymentDialogUtils.getAddressLabel,
getSupportedNetworks: PaymentDialogUtils.getCreditCardNetworks,
});
// The EditCreditCard constructor adds `input` event listeners on the same element,
@ -312,11 +313,11 @@ export default class BasicCardForm extends PaymentStateSubscriberMixin(PaymentRe
}
updateRequiredState() {
for (let formElement of this.form.elements) {
let container = formElement.closest("label") || formElement.closest("div");
let span = container.querySelector("span");
for (let field of this.form.elements) {
let container = field.closest(".container");
let span = container.querySelector(".label-text");
span.setAttribute("fieldRequiredSymbol", this.dataset.fieldRequiredSymbol);
let required = formElement.required && !formElement.disabled;
let required = field.required && !field.disabled;
if (required) {
container.setAttribute("required", "true");
} else {

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

@ -30,12 +30,52 @@ var PaymentDialogUtils = {
}
return `${address.name} (${address.guid})`;
},
getCreditCardNetworks(address) {
// Shim for list of known and supported credit card network ids as exposed by
// toolkit/modules/CreditCard.jsm
return [
"amex",
"cartebancaire",
"diners",
"discover",
"jcb",
"mastercard",
"mir",
"unionpay",
"visa",
];
},
isCCNumber(str) {
return !!str.replace(/[-\s]/g, "").match(/^\d{9,}$/);
},
DEFAULT_REGION: "US",
supportedCountries: ["US", "CA"],
supportedCountries: ["US", "CA", "DE"],
getFormFormat(country) {
if (country == "DE") {
return {
addressLevel1Label: "province",
postalCodeLabel: "postalCode",
fieldsOrder: [
{
fieldId: "name",
newLine: true,
},
{
fieldId: "organization",
newLine: true,
},
{
fieldId: "street-address",
newLine: true,
},
{fieldId: "postal-code"},
{fieldId: "address-level2"},
],
postalCodePattern: "\\d{5}",
};
}
return {
"addressLevel1Label": country == "US" ? "state" : "province",
"postalCodeLabel": country == "US" ? "zip" : "postalCode",

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

@ -482,12 +482,14 @@ var PaymentTestUtils = {
"cc-exp-year": (new Date()).getFullYear() + 9,
"cc-name": "John Doe",
"cc-number": "4111111111111111",
"cc-type": "visa",
},
JaneMasterCard: {
"cc-exp-month": 12,
"cc-exp-year": (new Date()).getFullYear() + 9,
"cc-name": "Jane McMaster-Card",
"cc-number": "5555555555554444",
"cc-type": "mastercard",
},
MissingFields: {
"cc-name": "Missy Fields",
@ -498,6 +500,7 @@ var PaymentTestUtils = {
"cc-exp-year": (new Date()).getFullYear() + 9,
"cc-name": "Temp Name",
"cc-number": "5105105105105100",
"cc-type": "mastercard",
},
},
};

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

@ -50,12 +50,15 @@ async function add_link(aOptions = {}) {
let cardOptions = Object.assign({}, {
checkboxSelector: "basic-card-form .persist-checkbox",
expectPersist: aOptions.expectCardPersist,
networkSelector: "basic-card-form #cc-type",
expectedNetwork: PTU.BasicCards.JaneMasterCard["cc-type"],
});
if (aOptions.hasOwnProperty("setCardPersistCheckedValue")) {
cardOptions.setPersistCheckedValue = aOptions.setCardPersistCheckedValue;
}
await fillInCardForm(frame, PTU.BasicCards.JaneMasterCard, cardOptions);
await verifyCardNetwork(frame, cardOptions);
await verifyPersistCheckbox(frame, cardOptions);
await spawnPaymentDialogTask(frame, async function checkBillingAddressPicker(testArgs = {}) {
@ -519,6 +522,67 @@ add_task(async function test_edit_link() {
}, args);
});
add_task(async function test_invalid_network_card_edit() {
// add an address and card linked to this address
let prefilledGuids = await setup([PTU.Addresses.TimBL]);
{
let card = Object.assign({}, PTU.BasicCards.JohnDoe,
{ billingAddressGUID: prefilledGuids.address1GUID });
// create a record with an unknown network id
card["cc-type"] = "asiv";
await addCardRecord(card);
}
const args = {
methodData: [PTU.MethodData.basicCard],
details: PTU.Details.total60USD,
};
await spawnInDialogForMerchantTask(PTU.ContentTasks.createAndShowRequest, async function check() {
let {
PaymentTestUtils: PTU,
} = ChromeUtils.import("resource://testing-common/PaymentTestUtils.jsm", {});
let editLink = content.document.querySelector("payment-method-picker .edit-link");
is(editLink.textContent, "Edit", "Edit link text");
editLink.click();
let state = await PTU.DialogContentUtils.waitForState(content, (state) => {
return state.page.id == "basic-card-page" && state["basic-card-page"].guid;
}, "Check edit page state");
state = await PTU.DialogContentUtils.waitForState(content, (state) => {
return Object.keys(state.savedBasicCards).length == 1 &&
Object.keys(state.savedAddresses).length == 1;
}, "Check card and address present at beginning of test");
let networkSelector = content.document.querySelector("basic-card-form #cc-type");
todo_is(Cu.waiveXrays(networkSelector).selectedIndex, 0,
"An invalid cc-type should result in the first option being selected");
is(Cu.waiveXrays(networkSelector).value, "",
"An invalid cc-type should result in an empty string as value");
content.document.querySelector("basic-card-form button.save-button").click();
// we expect that saving a card with an invalid network will result in the
// cc-type property being changed to undefined
state = await PTU.DialogContentUtils.waitForState(content, (state) => {
let cards = Object.entries(state.savedBasicCards);
return cards.length == 1 &&
cards[0][1]["cc-type"] == undefined;
}, "Check card was edited");
let cardGUIDs = Object.keys(state.savedBasicCards);
is(cardGUIDs.length, 1, "Check there is still one card");
let savedCard = state.savedBasicCards[cardGUIDs[0]];
ok(!savedCard["cc-type"], "We expect the cc-type value to be updated");
state = await PTU.DialogContentUtils.waitForState(content, (state) => {
return state.page.id == "payment-summary";
}, "Switched back to payment-summary");
}, args);
});
add_task(async function test_private_card_adding() {
await setup([PTU.Addresses.TimBL], [PTU.BasicCards.JohnDoe]);
let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
@ -591,3 +655,4 @@ add_task(async function test_private_card_adding() {
});
await BrowserTestUtils.closeWindow(privateWin);
});

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

@ -22,6 +22,7 @@ const {formAutofillStorage} = ChromeUtils.import(
"resource://formautofill/FormAutofillStorage.jsm", {});
const {PaymentTestUtils: PTU} = ChromeUtils.import(
"resource://testing-common/PaymentTestUtils.jsm", {});
ChromeUtils.import("resource://gre/modules/CreditCard.jsm");
function getPaymentRequests() {
return Array.from(paymentSrv.enumerate());
@ -357,6 +358,9 @@ add_task(async function setup_head() {
Services.prefs.clearUserPref(SAVE_CREDITCARD_DEFAULT_PREF);
Services.prefs.clearUserPref(SAVE_ADDRESS_DEFAULT_PREF);
SpecialPowers.postConsoleSentinel();
// CreditCard.jsm is imported into the global scope. It needs to be deleted
// else it outlives the test and is reported as a leak.
delete window.CreditCard;
});
});
@ -475,6 +479,25 @@ async function verifyPersistCheckbox(frame, aOptions = {}) {
}, {options: aOptions});
}
async function verifyCardNetwork(frame, aOptions = {}) {
aOptions.supportedNetworks = CreditCard.SUPPORTED_NETWORKS;
await spawnPaymentDialogTask(frame, async (args) => {
let {options = {}} = args;
// ensure the network picker is visible, has the right contents and expected value
let networkSelect = Cu.waiveXrays(
content.document.querySelector(options.networkSelector));
ok(content.isVisible(networkSelect),
"The network selector should always be visible");
is(networkSelect.childElementCount, options.supportedNetworks.length + 1,
"Should have one more than the number of supported networks");
is(networkSelect.children[0].value, "",
"The first option should be the blank/empty option");
is(networkSelect.value, options.expectedNetwork,
`The network picker should have the expected value`);
}, {options: aOptions});
}
async function submitAddressForm(frame, aAddress, aOptions = {}) {
await spawnPaymentDialogTask(frame, async (args) => {
let {options = {}} = args;

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

@ -42,6 +42,7 @@ function checkCCForm(customEl, expectedCard) {
"cc-name",
"cc-exp-month",
"cc-exp-year",
"cc-type",
];
for (let propName of CC_PROPERTY_NAMES) {
let expectedVal = expectedCard[propName] || "";
@ -110,6 +111,7 @@ add_task(async function test_saveButton() {
fillField(form.form.querySelector("#cc-exp-month"), "11");
let year = (new Date()).getFullYear().toString();
fillField(form.form.querySelector("#cc-exp-year"), year);
fillField(form.form.querySelector("#cc-type"), "visa");
form.saveButton.focus();
ok(!form.saveButton.disabled,
"Save button should be enabled since the required fields are filled");
@ -143,6 +145,7 @@ add_task(async function test_saveButton() {
"cc-exp-year": year,
"cc-name": "J. Smith",
"cc-number": "4111 1111-1111 1111",
"cc-type": "visa",
"billingAddressGUID": "",
"isTemporary": true,
},
@ -439,6 +442,37 @@ add_task(async function test_numberCustomValidityReset() {
form.remove();
});
add_task(async function test_noCardNetworkSelected() {
let form = new BasicCardForm();
await form.promiseReady;
display.appendChild(form);
await asyncElementRendered();
info("have an existing card in storage, with no network id");
let card1 = deepClone(PTU.BasicCards.JohnDoe);
card1.guid = "9864798564";
delete card1["cc-type"];
await form.requestStore.setState({
page: {
id: "basic-card-page",
},
"basic-card-page": {
guid: card1.guid,
},
savedBasicCards: {
[card1.guid]: deepClone(card1),
},
});
await asyncElementRendered();
checkCCForm(form, card1);
is(document.getElementById("cc-type").selectedIndex, 0, "Initial empty option is selected");
form.remove();
await form.requestStore.reset();
});
</script>
</body>

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

@ -20,7 +20,6 @@ ChromeUtils.defineModuleGetter(this, "CloudStorage",
"resource://gre/modules/CloudStorage.jsm");
XPCOMUtils.defineLazyServiceGetters(this, {
gCategoryManager: ["@mozilla.org/categorymanager;1", "nsICategoryManager"],
gHandlerService: ["@mozilla.org/uriloader/handler-service;1", "nsIHandlerService"],
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
});
@ -2850,7 +2849,7 @@ class HandlerInfoWrapper {
disabledPluginTypes.join(","));
// Update the category manager so existing browser windows update.
gCategoryManager.deleteCategoryEntry("Gecko-Content-Viewers",
Services.catMan.deleteCategoryEntry("Gecko-Content-Viewers",
this.type,
false);
}
@ -2865,7 +2864,7 @@ class HandlerInfoWrapper {
disabledPluginTypes.join(","));
// Update the category manager so existing browser windows update.
gCategoryManager.addCategoryEntry(
Services.catMan.addCategoryEntry(
"Gecko-Content-Viewers",
this.type,
"@mozilla.org/content/plugin/document-loader-factory;1",

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

@ -0,0 +1,15 @@
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
ac_add_options --disable-install-strip
ac_add_options --disable-elf-hack
ac_add_options --disable-sandbox
ac_add_options --disable-profiling
ac_add_options --disable-warnings-as-errors
ac_add_options --enable-coverage
export CFLAGS="--coverage"
export CXXFLAGS="--coverage"
export LDFLAGS="--coverage"
ac_add_options --enable-fuzzing

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

@ -1,20 +0,0 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/build/mozconfig.common"
ac_add_options --enable-dmd
. $topsrcdir/build/mozconfig.stylo
# Use Clang as specified in manifest
CC="$topsrcdir/clang/bin/clang"
CXX="$topsrcdir/clang/bin/clang++"
# Add the static checker
ac_add_options --enable-clang-plugin
. "$topsrcdir/build/unix/mozconfig.stdcxx"
. "$topsrcdir/build/mozconfig.common.override"

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

@ -14,6 +14,7 @@ export TUP=${TOOLTOOL_DIR}/tup/tup
ac_add_options --enable-build-backends=Tup
ac_add_options --disable-js-shell
unset ENABLE_CLANG_PLUGIN
# To enable the option to upload the tup database, uncomment the line below
# ac_add_options --upload-tup-db

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

@ -464,6 +464,11 @@ FormAutofillParent.prototype = {
}
};
// Remove invalid cc-type values
if (creditCard.record["cc-type"] && !CreditCard.isValidNetwork(creditCard.record["cc-type"])) {
delete creditCard.record["cc-type"];
}
// We'll show the credit card doorhanger if:
// - User applys autofill and changed
// - User fills form manually and the filling data is not duplicated to storage
@ -528,6 +533,7 @@ FormAutofillParent.prototype = {
number: creditCard.record["cc-number"] || creditCard.record["cc-number-decrypted"],
encryptedNumber: creditCard.record["cc-number-encrypted"],
name: creditCard.record["cc-name"],
network: creditCard.record["cc-type"],
});
const description = await card.getLabel();
const state = await FormAutofillDoorhanger.show(target,

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

@ -66,6 +66,7 @@
* cc-exp-month,
* cc-exp-year, // 2-digit year will be converted to 4 digits
* // upon saving
* cc-type, // Optional card network id (instrument type)
*
* // computed fields (These fields are computed based on the above fields
* // and are not allowed to be modified directly.)
@ -198,6 +199,7 @@ const VALID_CREDIT_CARD_FIELDS = [
"cc-number",
"cc-exp-month",
"cc-exp-year",
"cc-type",
];
const VALID_CREDIT_CARD_COMPUTED_FIELDS = [

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

@ -18,7 +18,7 @@ const EDIT_ADDRESS_KEYWORDS = [
"state", "province", "city", "country", "zip", "postalCode", "email", "tel",
];
const MANAGE_CREDITCARDS_KEYWORDS = ["manageCreditCardsTitle", "addNewCreditCardTitle", "showCreditCardsBtnLabel"];
const EDIT_CREDITCARD_KEYWORDS = ["cardNumber", "nameOnCard", "cardExpiresMonth", "cardExpiresYear"];
const EDIT_CREDITCARD_KEYWORDS = ["cardNumber", "nameOnCard", "cardExpiresMonth", "cardExpiresYear", "cardNetwork"];
const FIELD_STATES = {
NORMAL: "NORMAL",
AUTO_FILLED: "AUTO_FILLED",
@ -206,6 +206,7 @@ this.FormAutofillUtils = {
"cc-exp-month": "creditCard",
"cc-exp-year": "creditCard",
"cc-exp": "creditCard",
"cc-type": "creditCard",
},
_collators: {},
@ -224,6 +225,15 @@ this.FormAutofillUtils = {
return card.isValidNumber();
},
/**
* Get the array of credit card network ids ("types") we expect and offer as valid choices
*
* @returns {Array}
*/
getCreditCardNetworks() {
return CreditCard.SUPPORTED_NETWORKS;
},
getCategoryFromFieldName(fieldName) {
return this._fieldNameInfo[fieldName];
},
@ -702,6 +712,17 @@ this.FormAutofillUtils = {
}
break;
}
case "cc-type": {
let network = creditCard["cc-type"] || "";
for (let option of options) {
if ([option.text, option.label, option.value].some(
s => s.trim().toLowerCase() == network
)) {
return option;
}
}
break;
}
}
return null;

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

@ -13,5 +13,8 @@
// TODO: We only support the alternative name of US in MVP. We are going to support more countries in
// bug 1370193.
var addressDataExt = {
"data/US": {"alternative_names": ["US", "United States of America", "United States", "America", "U.S.", "USA", "U.S.A.", "U.S.A"]},
"data/US": {
alternative_names: ["US", "United States of America", "United States", "America", "U.S.", "USA", "U.S.A.", "U.S.A"],
fmt: "%N%n%A%n%C%S%n%Z%O",
},
};

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

@ -301,6 +301,7 @@ class EditCreditCard extends EditAutofillForm {
* @param {object} addresses in an object with guid keys for the billing address picker.
* @param {object} config
* @param {function} config.isCCNumber Function to determine if a string is a valid CC number.
* @param {function} config.getSupportedNetworks Function to get the list of card networks
*/
constructor(elements, record, addresses, config) {
super(elements);
@ -312,6 +313,7 @@ class EditCreditCard extends EditAutofillForm {
invalidCardNumberStringElement: this._elements.form.querySelector("#invalidCardNumberString"),
month: this._elements.form.querySelector("#cc-exp-month"),
year: this._elements.form.querySelector("#cc-exp-year"),
ccType: this._elements.form.querySelector("#cc-type"),
billingAddress: this._elements.form.querySelector("#billingAddressGUID"),
billingAddressRow: this._elements.form.querySelector(".billingAddressRow"),
});
@ -326,6 +328,8 @@ class EditCreditCard extends EditAutofillForm {
this._addresses = addresses;
this.generateBillingAddressOptions();
if (!preserveFieldValues) {
// Re-populating the networks will reset the selected option.
this.populateNetworks();
// Re-generating the years will reset the selected option.
this.generateYears();
super.loadRecord(record);
@ -363,6 +367,23 @@ class EditCreditCard extends EditAutofillForm {
}
}
populateNetworks() {
// Clear the list
this._elements.ccType.textContent = "";
let frag = document.createDocumentFragment();
// include an empty first option
frag.appendChild(new Option("", ""));
let supportedNetworks = this.getSupportedNetworks();
for (let id of supportedNetworks) {
let option = new Option();
option.value = id;
option.dataset.localization = "cardNetwork." + id;
frag.appendChild(option);
}
this._elements.ccType.appendChild(frag);
}
generateBillingAddressOptions() {
let billingAddressGUID = this._record && this._record.billingAddressGUID;

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

@ -22,63 +22,59 @@
The <span class="label-text" /> needs to be after the form field in the same element in
order to get proper label styling with :focus and :moz-ui-invalid.
-->
<div>
<div id="name-container">
<label id="given-name-container">
<input id="given-name" type="text" required="required"/>
<span data-localization="givenName" class="label-text"/>
</label>
<label id="additional-name-container">
<input id="additional-name" type="text"/>
<span data-localization="additionalName" class="label-text"/>
</label>
<label id="family-name-container">
<input id="family-name" type="text" required="required"/>
<span data-localization="familyName" class="label-text"/>
</label>
</div>
<label id="organization-container">
<input id="organization" type="text"/>
<span data-localization="organization2" class="label-text"/>
<div id="name-container" class="container">
<label id="given-name-container">
<input id="given-name" type="text" required="required"/>
<span data-localization="givenName" class="label-text"/>
</label>
<label id="street-address-container">
<textarea id="street-address" rows="3" required="required"/>
<span data-localization="streetAddress" class="label-text"/>
<label id="additional-name-container">
<input id="additional-name" type="text"/>
<span data-localization="additionalName" class="label-text"/>
</label>
<label id="address-level2-container">
<input id="address-level2" type="text" required="required"/>
<span data-localization="city" class="label-text"/>
</label>
<label id="address-level1-container">
<input id="address-level1" type="text" required="required"/>
<span class="label-text"/>
</label>
<label id="postal-code-container">
<input id="postal-code" type="text" required="required"/>
<span class="label-text"/>
</label>
<div id="country-container">
<label id="country-label">
<select id="country" required="required">
<option/>
</select>
<span data-localization="country" class="label-text"/>
</label>
<p id="country-warning-message" data-localization="countryWarningMessage2"/>
</div>
<label id="tel-container">
<input id="tel" type="tel"/>
<span data-localization="tel" class="label-text"/>
</label>
<label id="email-container">
<input id="email" type="email" required="required"/>
<span data-localization="email" class="label-text"/>
<label id="family-name-container">
<input id="family-name" type="text" required="required"/>
<span data-localization="familyName" class="label-text"/>
</label>
</div>
<label id="organization-container" class="container">
<input id="organization" type="text"/>
<span data-localization="organization2" class="label-text"/>
</label>
<label id="street-address-container" class="container">
<textarea id="street-address" rows="3" required="required"/>
<span data-localization="streetAddress" class="label-text"/>
</label>
<label id="address-level2-container" class="container">
<input id="address-level2" type="text" required="required"/>
<span data-localization="city" class="label-text"/>
</label>
<label id="address-level1-container" class="container">
<input id="address-level1" type="text" required="required"/>
<span class="label-text"/>
</label>
<label id="postal-code-container" class="container">
<input id="postal-code" type="text" required="required"/>
<span class="label-text"/>
</label>
<label id="country-container" class="container">
<select id="country" required="required">
<option/>
</select>
<span data-localization="country" class="label-text"/>
</label>
<label id="tel-container" class="container">
<input id="tel" type="tel"/>
<span data-localization="tel" class="label-text"/>
</label>
<label id="email-container" class="container">
<input id="email" type="email" required="required"/>
<span data-localization="email" class="label-text"/>
</label>
</form>
<div id="controls-container">
<button id="cancel" data-localization="cancelBtnLabel"/>
<button id="save" disabled="disabled" data-localization="saveBtnLabel"/>
<span id="country-warning-message" data-localization="countryWarningMessage2"/>
</div>
<script type="application/javascript"><![CDATA[
"use strict";

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

@ -22,16 +22,12 @@
The <span class="label-text" /> needs to be after the form field in the same element in
order to get proper label styling with :focus and :moz-ui-invalid.
-->
<label>
<label id="cc-number-container" class="container">
<span id="invalidCardNumberString" hidden="hidden" data-localization="invalidCardNumber"></span>
<input id="cc-number" type="text" required="required" minlength="9" pattern="[- 0-9]+"/>
<span data-localization="cardNumber" class="label-text"/>
</label>
<label>
<input id="cc-name" type="text" required="required"/>
<span data-localization="nameOnCard" class="label-text"/>
</label>
<label>
<label id="cc-exp-month-container" class="container">
<select id="cc-exp-month">
<option/>
<option value="1">01</option>
@ -49,13 +45,22 @@
</select>
<span data-localization="cardExpiresMonth" class="label-text"/>
</label>
<label>
<label id="cc-exp-year-container" class="container">
<select id="cc-exp-year">
<option/>
</select>
<span data-localization="cardExpiresYear" class="label-text"/>
</label>
<label class="billingAddressRow">
<label id="cc-name-container" class="container">
<input id="cc-name" type="text" required="required"/>
<span data-localization="nameOnCard" class="label-text"/>
</label>
<label id="cc-type-container" class="container">
<select id="cc-type">
</select>
<span data-localization="cardNetwork" class="label-text"/>
</label>
<label id="billingAddressGUID-container" class="billingAddressRow container">
<select id="billingAddressGUID">
</select>
<span data-localization="billingAddress" class="label-text"/>
@ -71,6 +76,7 @@
let {
getAddressLabel,
isCCNumber,
getCreditCardNetworks,
} = FormAutofillUtils;
let record = window.arguments && window.arguments[0];
let addresses = {};
@ -85,6 +91,7 @@
{
getAddressLabel: getAddressLabel.bind(FormAutofillUtils),
isCCNumber: isCCNumber.bind(FormAutofillUtils),
getSupportedNetworks: getCreditCardNetworks.bind(FormAutofillUtils),
});
/* import-globals-from editDialog.js */

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

@ -36,9 +36,8 @@ CONTENT_WIN.addEventListener("DOMContentLoaded", function onDCL(evt) {
}
case "childList": {
// We really only care about the <form>s appending inside pages.
if (!mutation.addedNodes || !mutation.target.classList ||
!mutation.target.classList.contains("page")) {
// We really only care about elements appending inside pages.
if (!mutation.addedNodes || !mutation.target.closest(".page")) {
break;
}
FormAutofillUtils.localizeMarkup(mutation.target);

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

@ -346,6 +346,7 @@ class ManageCreditCards extends ManageRecords {
encryptedNumber: creditCard["cc-number-encrypted"],
number: creditCard["cc-number"],
name: creditCard["cc-name"],
network: creditCard["cc-type"],
});
return cardObj.getLabel({showNumbers: showCreditCards});
}

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

@ -141,3 +141,15 @@ nameOnCard = Name on Card
cardExpiresMonth = Exp. Month
cardExpiresYear = Exp. Year
billingAddress = Billing Address
cardNetwork = Card Type
# LOCALIZATION NOTE: (cardNetwork.*): These are brand names and should only be translated when a locale-specific name for that brand is in common use
cardNetwork.amex = American Express
cardNetwork.cartebancaire = Carte Bancaire
cardNetwork.diners = Diners Club
cardNetwork.discover = Discover
cardNetwork.jcb = JCB
cardNetwork.mastercard = MasterCard
cardNetwork.mir = MIR
cardNetwork.unionpay = Union Pay
cardNetwork.visa = Visa

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

@ -2,30 +2,31 @@
* 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/. */
.editAddressForm input,
.editAddressForm select {
flex: 1 0 auto;
margin: 0;
}
#name-container,
:root[subdialog] form label,
:root[subdialog] form > p {
margin: 0 0 0.5em !important;
}
#given-name-container,
#additional-name-container,
#address-level1-container,
#postal-code-container,
#country-label,
#country-warning-message,
#family-name-container,
#organization-container,
#address-level2-container,
#tel-container {
.editAddressForm {
display: flex;
flex: 0 1 50%;
flex-wrap: wrap;
/* Use space-between so --grid-column-row-gap is in between the elements on a row */
justify-content: space-between;
}
:root:not([subdialog]) .editAddressForm {
margin-inline-start: calc(var(--grid-column-row-gap) / -2);
margin-inline-end: calc(var(--grid-column-row-gap) / -2);
}
.editAddressForm .container {
/* !important is needed to override preferences.css's generic label rule. */
margin-top: var(--grid-column-row-gap) !important;
margin-inline-start: calc(var(--grid-column-row-gap) / 2);
margin-inline-end: calc(var(--grid-column-row-gap) / 2);
flex-grow: 1;
}
#country-container {
/* The country dropdown has a different intrinsic (content) width than the
other fields which are <input>. */
flex-basis: calc(50% - var(--grid-column-row-gap));
flex-grow: 0;
}
@ -54,6 +55,9 @@
#additional-name-container,
#family-name-container {
display: flex;
/* The 3 pieces inside the name container don't have the .container class so
need to set flex-grow themselves. See `.editAddressForm .container` */
flex-grow: 1;
/* Remove the bottom margin from the name containers so that the outer
#name-container provides the margin on the outside */
margin-bottom: 0 !important;
@ -95,19 +99,12 @@
/* End name field rules */
#name-container,
#street-address-container,
#country-container,
#email-container {
#street-address-container {
/* Name and street address are always full-width */
flex: 0 1 100%;
}
#street-address,
#email {
flex: 1 0 auto;
}
#country-warning-message {
box-sizing: border-box;
font-size: 1rem;
@ -116,3 +113,7 @@
color: #737373;
padding-inline-start: 1em;
}
:root:not([subdialog]) #country-warning-message {
display: none;
}

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

@ -3,27 +3,46 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
.editCreditCardForm {
justify-content: center;
display: grid;
grid-template-areas:
"cc-number cc-exp-month cc-exp-year"
"cc-name cc-type cc-csc"
"billingAddressGUID billingAddressGUID billingAddressGUID";
grid-row-gap: var(--grid-column-row-gap);
grid-column-gap: var(--grid-column-row-gap);
}
.editCreditCardForm > label,
.editCreditCardForm > div {
flex: 1 0 100%;
align-self: center;
margin: 0 0 0.5em !important;
.editCreditCardForm label {
/* Remove the margin on these labels since they are styled on top of
the input/select element. */
margin-inline-start: 0;
margin-inline-end: 0;
}
.editCreditCardForm #billingAddressGUID,
.editCreditCardForm input {
flex: 1 0 auto;
.editCreditCardForm .container {
display: flex;
}
.editCreditCardForm select {
margin: 0;
margin-inline-end: 0.7em;
#cc-number-container {
grid-area: cc-number;
}
.editCreditCardForm label > span,
.editCreditCardForm div > span {
flex: 0 0 9.5em;
#cc-exp-month-container {
grid-area: cc-exp-month;
}
#cc-exp-year-container {
grid-area: cc-exp-year;
}
#cc-name-container {
grid-area: cc-name;
}
#cc-type-container {
grid-area: cc-type;
}
#billingAddressGUID-container {
grid-area: billingAddressGUID;
}

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

@ -4,6 +4,7 @@
:root {
--in-field-label-size: .8em;
--grid-column-row-gap: 8px;
/* Use the animation-easing-function that is defined in xul.css. */
--animation-easing-function: cubic-bezier(.07,.95,0,1);
}
@ -13,11 +14,14 @@
padding: 2px;
}
/* The overly specific input attributes are required to override
padding from common.css */
form input[type="email"],
form input[type="tel"],
form input[type="text"],
form textarea,
form select {
flex-grow: 1;
padding-top: calc(var(--in-field-label-size) + .4em);
}
@ -27,11 +31,11 @@ select {
}
form :-moz-any(label, div) {
/* Positioned so that the .label-text and .error-text children will be
positioned relative to this. */
position: relative;
display: block;
line-height: 1em;
margin-left: 0;
margin-right: 0;
}
form :-moz-any(label, div) > .label-text {
@ -65,6 +69,21 @@ form :-moz-any(label, div)[required] > .label-text::after {
content: attr(fieldRequiredSymbol);
}
.persist-checkbox label {
display: flex;
flex-direction: row;
align-items: center;
margin-top: var(--grid-column-row-gap);
margin-bottom: var(--grid-column-row-gap);
}
:root[subdialog] form {
/* Match the margin-inline-start of the #controls-container buttons
and provide enough padding at the top of the form so button outlines
don't get clipped. */
padding: 4px 4px 0;
}
#controls-container {
flex: 0 1 100%;
justify-content: end;

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

@ -60,6 +60,7 @@ add_task(async function test_submit_creditCard_saved() {
form.querySelector("#cc-number").setUserInput("5038146897157463");
form.querySelector("#cc-exp-month").setUserInput("12");
form.querySelector("#cc-exp-year").setUserInput("2017");
form.querySelector("#cc-type").value = "mastercard";
// Wait 1000ms before submission to make sure the input value applied
await new Promise(resolve => setTimeout(resolve, 1000));
@ -74,6 +75,7 @@ add_task(async function test_submit_creditCard_saved() {
let creditCards = await getCreditCards();
is(creditCards.length, 1, "1 credit card in storage");
is(creditCards[0]["cc-name"], "User 1", "Verify the name field");
is(creditCards[0]["cc-type"], "mastercard", "Verify the cc-type field");
is(SpecialPowers.getIntPref(CREDITCARDS_USED_STATUS_PREF), 2, "User has seen the doorhanger");
SpecialPowers.clearUserPref(CREDITCARDS_USED_STATUS_PREF);
await removeAllRecords();
@ -176,6 +178,7 @@ add_task(async function test_submit_duplicate_creditCard_form() {
form.querySelector("#cc-number").setUserInput("4111111111111111");
form.querySelector("#cc-exp-month").setUserInput("4");
form.querySelector("#cc-exp-year").setUserInput(new Date().getFullYear());
form.querySelector("#cc-type").value = "visa";
// Wait 1000ms before submission to make sure the input value applied
await new Promise(resolve => setTimeout(resolve, 1000));
@ -213,6 +216,7 @@ add_task(async function test_submit_unnormailzed_creditCard_form() {
form.querySelector("#cc-exp-month").setUserInput("4");
// Set unnormalized year
form.querySelector("#cc-exp-year").setUserInput(new Date().getFullYear().toString().substr(2, 2));
form.querySelector("#cc-type").value = "visa";
// Wait 1000ms before submission to make sure the input value applied
await new Promise(resolve => setTimeout(resolve, 1000));
@ -636,3 +640,39 @@ add_task(async function test_update_duplicate_autofill_form() {
SpecialPowers.clearUserPref(CREDITCARDS_USED_STATUS_PREF);
await removeAllRecords();
});
add_task(async function test_submit_creditCard_with_invalid_network() {
await BrowserTestUtils.withNewTab({gBrowser, url: CREDITCARD_FORM_URL},
async function(browser) {
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown");
await ContentTask.spawn(browser, null, async function() {
let form = content.document.getElementById("form");
let name = form.querySelector("#cc-name");
name.focus();
name.setUserInput("User 1");
form.querySelector("#cc-number").setUserInput("5038146897157463");
form.querySelector("#cc-exp-month").setUserInput("12");
form.querySelector("#cc-exp-year").setUserInput("2017");
form.querySelector("#cc-type").value = "gringotts";
// Wait 1000ms before submission to make sure the input value applied
await new Promise(resolve => setTimeout(resolve, 1000));
form.querySelector("input[type=submit]").click();
});
await promiseShown;
await clickDoorhangerButton(MAIN_BUTTON);
}
);
let creditCards = await getCreditCards();
is(creditCards.length, 1, "1 credit card in storage");
is(creditCards[0]["cc-name"], "User 1", "Verify the name field");
is(creditCards[0]["cc-type"], undefined, "Invalid network/cc-type was not saved");
SpecialPowers.clearUserPref(CREDITCARDS_USED_STATUS_PREF);
await removeAllRecords();
});

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

@ -62,8 +62,6 @@ add_task(async function test_saveAddress() {
"VK_TAB",
TEST_ADDRESS_1["family-name"],
"VK_TAB",
TEST_ADDRESS_1.organization,
"VK_TAB",
TEST_ADDRESS_1["street-address"],
"VK_TAB",
TEST_ADDRESS_1["address-level2"],
@ -72,6 +70,8 @@ add_task(async function test_saveAddress() {
"VK_TAB",
TEST_ADDRESS_1["postal-code"],
"VK_TAB",
TEST_ADDRESS_1.organization,
"VK_TAB",
TEST_ADDRESS_1.country,
"VK_TAB",
TEST_ADDRESS_1.tel,

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

@ -24,12 +24,14 @@ add_task(async function test_saveCreditCard() {
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-number"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("0" + TEST_CREDIT_CARD_1["cc-exp-month"].toString(), {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-exp-year"].toString(), {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-type"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
info("saving credit card");
@ -53,12 +55,14 @@ add_task(async function test_saveCreditCardWithMaxYear() {
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_2["cc-number"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_2["cc-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_2["cc-exp-month"].toString(), {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_2["cc-exp-year"].toString(), {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_2["cc-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-type"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
info("saving credit card");
@ -91,12 +95,14 @@ add_task(async function test_saveCreditCardWithBillingAddress() {
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD["cc-number"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD["cc-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD["cc-exp-month"].toString(), {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD["cc-exp-year"].toString(), {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD["cc-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_CREDIT_CARD["cc-type"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(billingAddress["given-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
@ -125,6 +131,8 @@ add_task(async function test_editCreditCard() {
let creditCards = await getCreditCards();
is(creditCards.length, 1, "only one credit card is in storage");
await testDialog(EDIT_CREDIT_CARD_DIALOG_URL, (win) => {
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_RIGHT", {}, win);
@ -153,6 +161,8 @@ add_task(async function test_editCreditCardWithMissingBillingAddress() {
is(creditCards[0].billingAddressGUID, TEST_CREDIT_CARD.billingAddressGUID,
"Check saved billingAddressGUID");
await testDialog(EDIT_CREDIT_CARD_DIALOG_URL, (win) => {
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_RIGHT", {}, win);
@ -180,6 +190,8 @@ add_task(async function test_addInvalidCreditCard() {
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("test", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("test name", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeMouseAtCenter(win.document.querySelector("#save"), {}, win);
@ -197,3 +209,35 @@ add_task(async function test_addInvalidCreditCard() {
is(creditCards.length, 0, "Credit card storage is empty");
});
add_task(async function test_editCardWithInvalidNetwork() {
const TEST_CREDIT_CARD = Object.assign({}, TEST_CREDIT_CARD_2, {
"cc-type": "asiv",
});
await saveCreditCard(TEST_CREDIT_CARD);
let creditCards = await getCreditCards();
is(creditCards.length, 1, "one credit card in storage");
is(creditCards[0]["cc-type"], TEST_CREDIT_CARD["cc-type"],
"Check saved cc-type");
await testDialog(EDIT_CREDIT_CARD_DIALOG_URL, (win) => {
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_RIGHT", {}, win);
EventUtils.synthesizeKey("test", {}, win);
win.document.querySelector("#save").click();
}, creditCards[0]);
ok(true, "Edit credit card dialog is closed");
creditCards = await getCreditCards();
is(creditCards.length, 1, "only one credit card is in storage");
is(creditCards[0]["cc-name"], TEST_CREDIT_CARD["cc-name"] + "test", "cc name changed");
is(creditCards[0]["cc-type"], undefined,
"unknown cc-type removed upon manual save");
await removeCreditCards([creditCards[0].guid]);
creditCards = await getCreditCards();
is(creditCards.length, 0, "Credit card storage is empty");
});

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

@ -104,6 +104,7 @@ const TEST_CREDIT_CARD_1 = {
"cc-number": "4111111111111111",
"cc-exp-month": 4,
"cc-exp-year": new Date().getFullYear(),
"cc-type": "visa",
};
const TEST_CREDIT_CARD_2 = {
@ -111,12 +112,14 @@ const TEST_CREDIT_CARD_2 = {
"cc-number": "4929001587121045",
"cc-exp-month": 12,
"cc-exp-year": new Date().getFullYear() + 10,
"cc-type": "visa",
};
const TEST_CREDIT_CARD_3 = {
"cc-number": "5103059495477870",
"cc-exp-month": 1,
"cc-exp-year": 2000,
"cc-type": "mastercard",
};
const MAIN_BUTTON = "button";

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

@ -12,6 +12,14 @@
<p><label>Expiration month: <input id="cc-exp-month" autocomplete="cc-exp-month"></label></p>
<p><label>Expiration year: <input id="cc-exp-year" autocomplete="cc-exp-year"></label></p>
<p><label>CSC: <input id="cc-csc" autocomplete="cc-csc"></label></p>
<p><label>Card Type: <select id="cc-type" autocomplete="cc-type">
<option></option>
<option value="discover">Discover</option>
<option value="jcb">JCB</option>
<option value="visa">Visa</option>
<option value="mastercard">MasterCard</option>
<option value="gringotts">Unknown card network</option>
</select></label></p>
<p>
<input type="submit" value="Submit">
<button type="reset">Reset</button>

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

@ -23,11 +23,13 @@ const MOCK_STORAGE = [{
"cc-number": "4929001587121045",
"cc-exp-month": 4,
"cc-exp-year": 2017,
"cc-type": "visa",
}, {
"cc-name": "Timothy Berners-Lee",
"cc-number": "5103059495477870",
"cc-exp-month": 12,
"cc-exp-year": 2022,
"cc-type": "mastercard",
}];
const reducedMockRecord = {
@ -197,6 +199,12 @@ add_task(async function check_form_autofill_resume() {
<p><label>Card Number: <input id="cc-number" autocomplete="cc-number"></label></p>
<p><label>Expiration month: <input id="cc-exp-month" autocomplete="cc-exp-month"></label></p>
<p><label>Expiration year: <input id="cc-exp-year" autocomplete="cc-exp-year"></label></p>
<p><label>Card Type: <select id="cc-type" autocomplete="cc-type">
<option value="discover">Discover</option>
<option value="jcb">JCB</option>
<option value="visa">Visa</option>
<option value="mastercard">MasterCard</option>
</select></label></p>
<p><label>CSC: <input id="cc-csc" autocomplete="cc-csc"></label></p>
</form>
</div>

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

@ -21,6 +21,7 @@ const TEST_CREDIT_CARD_1 = {
"cc-number": "4929001587121045",
"cc-exp-month": 4,
"cc-exp-year": 2017,
"cc-type": "visa",
};
const TEST_CREDIT_CARD_2 = {
@ -28,6 +29,7 @@ const TEST_CREDIT_CARD_2 = {
"cc-number": "5103059495477870",
"cc-exp-month": 12,
"cc-exp-year": 2022,
"cc-type": "mastercard",
};
const TEST_CREDIT_CARD_3 = {
@ -52,6 +54,7 @@ const TEST_CREDIT_CARD_WITH_EMPTY_FIELD = {
"cc-name": "",
"cc-number": "344060747836806",
"cc-exp-month": 1,
"cc-type": "",
};
const TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD = {
@ -86,6 +89,14 @@ const TEST_CREDIT_CARD_WITH_SPACES_BETWEEN_DIGITS = {
"cc-number": "5103 0594 9547 7870",
};
const TEST_CREDIT_CARD_WITH_INVALID_NETWORK = {
"cc-name": "John Doe",
"cc-number": "4929001587121045",
"cc-exp-month": 4,
"cc-exp-year": 2017,
"cc-type": "asiv",
};
const TEST_CREDIT_CARD_EMPTY_AFTER_NORMALIZE = {
"cc-exp-month": 13,
};
@ -398,6 +409,7 @@ add_task(async function test_update() {
creditCard = profileStorage.creditCards._data[0];
Assert.equal(creditCard["cc-exp-month"], TEST_CREDIT_CARD_WITH_EMPTY_FIELD["cc-exp-month"]);
Assert.equal(creditCard["cc-name"], undefined);
Assert.equal(creditCard["cc-type"], undefined);
Assert.equal(creditCard.billingAddressGUID, undefined);
// Empty computed fields shouldn't cause any problem.
@ -446,6 +458,7 @@ add_task(async function test_validate() {
profileStorage.creditCards.add(TEST_CREDIT_CARD_WITH_INVALID_EXPIRY_DATE);
profileStorage.creditCards.add(TEST_CREDIT_CARD_WITH_2_DIGITS_YEAR);
profileStorage.creditCards.add(TEST_CREDIT_CARD_WITH_SPACES_BETWEEN_DIGITS);
profileStorage.creditCards.add(TEST_CREDIT_CARD_WITH_INVALID_NETWORK);
let creditCards = profileStorage.creditCards.getAll();
@ -460,6 +473,10 @@ add_task(async function test_validate() {
Assert.equal(creditCards[1]["cc-exp"], year + "-" + month.toString().padStart(2, "0"));
Assert.equal(creditCards[2]["cc-number"].length, 16);
// dont enforce validity on the card network when storing a record,
// to avoid data loss when syncing records between different clients with different rules
Assert.equal(creditCards[3]["cc-type"], "asiv");
});
add_task(async function test_notifyUsed() {

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

@ -36,6 +36,7 @@ let TEST_CREDIT_CARD_1 = {
"cc-number": "4111111111111111",
"cc-exp-month": 4,
"cc-exp-year": 2017,
"cc-type": "visa",
};
let TEST_CREDIT_CARD_2 = {
@ -43,6 +44,7 @@ let TEST_CREDIT_CARD_2 = {
"cc-number": "4929001587121045",
"cc-exp-month": 2,
"cc-exp-year": 2017,
"cc-type": "visa",
};
let target = {

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

@ -192,9 +192,7 @@ var PdfJs = {
prefs.setCharPref(PREF_DISABLED_PLUGIN_TYPES, types.join(","));
// Update the category manager in case the plugins are already loaded.
let categoryManager = Cc["@mozilla.org/categorymanager;1"];
categoryManager.getService(Ci.nsICategoryManager).
deleteCategoryEntry("Gecko-Content-Viewers",
Services.catMan.deleteCategoryEntry("Gecko-Content-Viewers",
PDF_CONTENT_TYPE,
false);
},

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

@ -23,5 +23,6 @@ unset BINDGEN_CFLAGS
unset LLVM_CONFIG
unset WIN64_LINK
unset WIN64_LIB
unset ENABLE_CLANG_PLUGIN
unset MOZ_STDCXX_COMPAT

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

@ -13,6 +13,7 @@ if [ -n "$FORCE_GCC" -o -n "$MOZ_PGO" ]; then
else
CC="$TOOLTOOL_DIR/clang/bin/clang"
CXX="$TOOLTOOL_DIR/clang/bin/clang++"
export ENABLE_CLANG_PLUGIN=1
fi
# We want to make sure we use binutils and other binaries in the tooltool

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

@ -6,4 +6,10 @@ CFLAGS="$CFLAGS -march=pentium-m -msse -msse2 -mfpmath=sse"
CXXFLAGS="$CXXFLAGS -march=pentium-m -msse -msse2 -mfpmath=sse"
ac_add_options --target=i686-pc-linux
ac_add_options --host=i686-pc-linux
# The linux32 builds are effectively cross-compilations, and geckodriver
# is not enabled by default on cross-compilations, because in most cases,
# the target is not something we can run binaries of, and geckodriver
# is a target binary instead of a host binary. But for linux32, we actually
# can run the target binaries, so we can manually enable geckodriver.
ac_add_options --enable-geckodriver

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

@ -1,3 +1,4 @@
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
updateAppInfo({
name: "XPCShell",
@ -8,12 +9,9 @@ updateAppInfo({
registerManifests([do_get_file("data/test_abi.manifest")]);
const catman = Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager);
function is_registered(name) {
try {
var d = catman.getCategoryEntry("abitest", name);
var d = Services.catMan.getCategoryEntry("abitest", name);
return d == "found";
} catch (e) {
return false;

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

@ -4,10 +4,9 @@
"use strict";
const { PureComponent } = require("devtools/client/shared/vendor/react");
const { createRef, PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const ReactDOM = require("devtools/client/shared/vendor/react-dom");
const { KeyCodes } = require("devtools/client/shared/keycodes");
@ -26,6 +25,7 @@ class PauseResumeButton extends PureComponent {
super(props);
this.onKeyDown = this.onKeyDown.bind(this);
this.pauseResumeButtonRef = createRef();
this.state = {
isRunning: false,
@ -41,8 +41,8 @@ class PauseResumeButton extends PureComponent {
targetEl.addEventListener("keydown", this.onKeyDown);
}
componentWillReceiveProps(nextProps) {
this.updateState(nextProps);
componentDidUpdate() {
this.updateState();
}
componentWillUnount() {
@ -51,7 +51,7 @@ class PauseResumeButton extends PureComponent {
}
getKeyEventTarget() {
return ReactDOM.findDOMNode(this).closest("#animation-container");
return this.pauseResumeButtonRef.current.closest("#animation-container");
}
onToggleAnimationsPlayState(event) {
@ -63,13 +63,15 @@ class PauseResumeButton extends PureComponent {
}
onKeyDown(event) {
if (event.keyCode === KeyCodes.DOM_VK_SPACE) {
// Prevent to the duplicated call from the key listener and click listener.
if (event.keyCode === KeyCodes.DOM_VK_SPACE &&
event.target !== this.pauseResumeButtonRef.current) {
this.onToggleAnimationsPlayState(event);
}
}
updateState(props) {
const { animations } = props;
updateState() {
const { animations } = this.props;
const isRunning = hasRunningAnimation(animations);
this.setState({ isRunning });
}
@ -85,6 +87,7 @@ class PauseResumeButton extends PureComponent {
title: isRunning ?
getStr("timeline.resumedButtonTooltip") :
getStr("timeline.pausedButtonTooltip"),
ref: this.pauseResumeButtonRef,
}
);
}

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

@ -51,7 +51,7 @@ async function assertStates(animationInspector, panel, shouldRunning) {
"Current time scrubber position should change");
ok(!buttonEl.classList.contains("paused"),
"State of button should be running");
assertAnimationsRunning(animationInspector, panel);
assertAnimationsRunning(animationInspector);
} else {
is(previousLabelContent, currentLabelContent,
"Current time label Content should not change");
@ -59,6 +59,6 @@ async function assertStates(animationInspector, panel, shouldRunning) {
"Current time scrubber position should not change");
ok(buttonEl.classList.contains("paused"),
"State of button should be paused");
assertAnimationsPausing(animationInspector, panel);
assertAnimationsPausing(animationInspector);
}
}

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

@ -23,11 +23,11 @@ add_task(async function() {
info("Checking button makes animations to pause");
await clickOnPauseResumeButton(animationInspector, panel);
assertAnimationsPausing(animationInspector, panel);
assertAnimationsPausing(animationInspector);
ok(buttonEl.classList.contains("paused"), "State of button should be paused");
info("Checking button makes animations to resume");
await clickOnPauseResumeButton(animationInspector, panel);
assertAnimationsRunning(animationInspector, panel);
assertAnimationsRunning(animationInspector);
ok(!buttonEl.classList.contains("paused"), "State of button should be resumed");
});

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

@ -12,22 +12,30 @@ add_task(async function() {
const { animationInspector, panel } = await openAnimationInspector();
info("Checking spacebar makes animations to pause");
await sendSpaceKeyEvent(animationInspector, panel);
assertAnimationsPausing(animationInspector, panel);
await sendSpaceKeyEvent(animationInspector, panel);
assertAnimationsRunning(animationInspector, panel);
await testPauseAndResumeBySpacebar(animationInspector, panel);
info("Checking spacebar makes animations to pause when the button has the focus");
const pauseResumeButton = panel.querySelector(".pause-resume-button");
await testPauseAndResumeBySpacebar(animationInspector, pauseResumeButton);
info("Checking spacebar works with other UI components");
// To pause
await clickOnPauseResumeButton(animationInspector, panel);
// To resume
await sendSpaceKeyEvent(animationInspector, panel);
assertAnimationsRunning(animationInspector, panel);
assertAnimationsRunning(animationInspector);
// To pause
await clickOnCurrentTimeScrubberController(animationInspector, panel, 0.5);
// To resume
await clickOnPauseResumeButton(animationInspector, panel);
// To pause
await sendSpaceKeyEvent(animationInspector, panel);
assertAnimationsPausing(animationInspector, panel);
assertAnimationsPausing(animationInspector);
});
async function testPauseAndResumeBySpacebar(animationInspector, element) {
await sendSpaceKeyEvent(animationInspector, element);
assertAnimationsPausing(animationInspector);
await sendSpaceKeyEvent(animationInspector, element);
assertAnimationsRunning(animationInspector);
}

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

@ -22,11 +22,11 @@ add_task(async function() {
info("Checking rewind button makes animations to rewind to zero");
await clickOnRewindButton(animationInspector, panel);
assertAnimationsCurrentTime(animationInspector, 0);
assertAnimationsPausing(animationInspector, panel);
assertAnimationsPausing(animationInspector);
info("Checking rewind button makes animations after clicking scrubber");
await clickOnCurrentTimeScrubberController(animationInspector, panel, 0.5);
await clickOnRewindButton(animationInspector, panel);
assertAnimationsCurrentTime(animationInspector, 0);
assertAnimationsPausing(animationInspector, panel);
assertAnimationsPausing(animationInspector);
});

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

@ -441,12 +441,11 @@ const selectNodeAndWaitForAnimations = async function(data, inspector, reason =
* Send keyboard event of space to given panel.
*
* @param {AnimationInspector} animationInspector
* @param {DOMElement} panel
* #animation-container element.
* @param {DOMElement} target element.
*/
const sendSpaceKeyEvent = async function(animationInspector, panel) {
panel.focus();
EventUtils.sendKey("SPACE", panel.ownerGlobal);
const sendSpaceKeyEvent = async function(animationInspector, element) {
element.focus();
EventUtils.sendKey("SPACE", element.ownerGlobal);
await waitForSummaryAndDetail(animationInspector);
};
@ -633,22 +632,18 @@ function assertAnimationsCurrentTime(animationInspector, time) {
* Check whether the animations are pausing.
*
* @param {AnimationInspector} animationInspector
* @param {DOMElement} panel
* #animation-container element.
*/
function assertAnimationsPausing(animationInspector, panel) {
assertAnimationsPausingOrRunning(animationInspector, panel, true);
function assertAnimationsPausing(animationInspector) {
assertAnimationsPausingOrRunning(animationInspector, true);
}
/**
* Check whether the animations are pausing/running.
*
* @param {AnimationInspector} animationInspector
* @param {DOMElement} panel
* #animation-container element.
* @param {boolean} shouldPause
*/
function assertAnimationsPausingOrRunning(animationInspector, panel, shouldPause) {
function assertAnimationsPausingOrRunning(animationInspector, shouldPause) {
const hasRunningAnimation =
animationInspector.state.animations.some(({state}) => state.playState === "running");
@ -663,11 +658,9 @@ function assertAnimationsPausingOrRunning(animationInspector, panel, shouldPause
* Check whether the animations are running.
*
* @param {AnimationInspector} animationInspector
* @param {DOMElement} panel
* #animation-container element.
*/
function assertAnimationsRunning(animationInspector, panel) {
assertAnimationsPausingOrRunning(animationInspector, panel, false);
function assertAnimationsRunning(animationInspector) {
assertAnimationsPausingOrRunning(animationInspector, false);
}
/**

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

@ -175,9 +175,7 @@ ConverterObserver.prototype = {
JSON_SNIFFER_CLASS_DESCRIPTION,
JSON_SNIFFER_CONTRACT_ID,
JsonSnifferFactory);
const categoryManager = Cc["@mozilla.org/categorymanager;1"]
.getService(Ci.nsICategoryManager);
categoryManager.addCategoryEntry(CONTENT_SNIFFER_CATEGORY, JSON_VIEW_TYPE,
Services.catMan.addCategoryEntry(CONTENT_SNIFFER_CATEGORY, JSON_VIEW_TYPE,
JSON_SNIFFER_CONTRACT_ID, false, false);
}
@ -194,9 +192,7 @@ ConverterObserver.prototype = {
if (registrar.isCIDRegistered(JSON_SNIFFER_CLASS_ID)) {
registrar.unregisterFactory(JSON_SNIFFER_CLASS_ID, JsonSnifferFactory);
const categoryManager = Cc["@mozilla.org/categorymanager;1"]
.getService(Ci.nsICategoryManager);
categoryManager.deleteCategoryEntry(CONTENT_SNIFFER_CATEGORY,
Services.catMan.deleteCategoryEntry(CONTENT_SNIFFER_CATEGORY,
JSON_VIEW_TYPE, false);
}

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

@ -86,7 +86,7 @@ html|button, html|select {
.devtools-autocomplete-listbox .autocomplete-item {
width: 100%;
background-color: transparent;
color: var(--theme-arrowpanel-color);
color: var(--theme-popup-color);
padding: 1px var(--autocomplete-item-padding-inline);
cursor: default;
text-overflow: ellipsis;
@ -145,13 +145,13 @@ html|button, html|select {
.tooltip-panel.devtools-autocomplete-popup,
.CodeMirror-hints,
.CodeMirror-Tern-tooltip {
border: 1px solid var(--theme-arrowpanel-border-color);
background-color: var(--theme-arrowpanel-background);
color: var(--theme-arrowpanel-color);
border: 1px solid var(--theme-popup-border-color);
background-color: var(--theme-popup-background);
color: var(--theme-popup-color);
}
.devtools-autocomplete-listbox .autocomplete-item:hover {
background-color: var(--theme-arrowpanel-dimmed);
background-color: var(--theme-popup-dimmed);
}
.devtools-autocomplete-listbox .autocomplete-selected,

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

@ -15,6 +15,22 @@
--bezier-grid-color: rgba(0, 0, 0, 0.2);
--onboarding-link-color: var(--theme-highlight-blue);
--onboarding-link-active-color: var(--blue-40);
/* Tooltips */
--theme-tooltip-border: #434850;
--theme-tooltip-background: rgba(19, 28, 38, .9);
--theme-tooltip-shadow: rgba(25, 25, 25, 0.76);
/* Doorhangers */
/* These colors are based on the colors used for doorhangers elsewhere in
* Firefox. */
--theme-arrowpanel-background: var(--theme-popup-background);
--theme-arrowpanel-color: var(--theme-popup-color);
--theme-arrowpanel-border-color: var(--theme-popup-border-color);
--theme-arrowpanel-separator: rgba(249,249,250,.1);
--theme-arrowpanel-dimmed: var(--theme-popup-dimmed);
--theme-arrowpanel-dimmed-further: rgba(249,249,250,.15);
--theme-arrowpanel-disabled-color: rgba(249,249,250,.5);
}
.theme-light {
@ -22,6 +38,33 @@
--bezier-grid-color: rgba(0, 0, 0, 0.05);
--onboarding-link-color: var(--blue-60);
--onboarding-link-active-color: var(--blue-70);
/* Tooltips */
--theme-tooltip-border: #d9e1e8;
--theme-tooltip-background: rgba(255, 255, 255, .9);
--theme-tooltip-shadow: rgba(155, 155, 155, 0.26);
/* Doorhangers */
/* These colors are based on the colors used for doorhangers elsewhere in
* Firefox. */
--theme-arrowpanel-background: var(--theme-popup-background);
--theme-arrowpanel-color: var(--theme-popup-color);
--theme-arrowpanel-border-color: var(--theme-popup-border-color);
--theme-arrowpanel-separator: ThreeDShadow;
--theme-arrowpanel-dimmed: var(--theme-popup-dimmed);
--theme-arrowpanel-dimmed-further: hsla(0,0%,80%,.45);
--theme-arrowpanel-disabled-color: GrayText;
}
:root {
--theme-arrowpanel-border-radius: 0px;
}
:root[platform="mac"] {
--theme-arrowpanel-border-radius: 3.5px;
}
:root[platform="mac"].theme-light {
--theme-arrowpanel-separator: hsla(210,4%,10%,.14);
}
/* Tooltip: CSS variables tooltip */
@ -192,13 +235,6 @@
/* Tooltip : doorhanger style */
:root {
--theme-arrowpanel-border-radius: 0px;
}
:root[platform="mac"] {
--theme-arrowpanel-border-radius: 3.5px;
}
.tooltip-container[type="doorhanger"] > .tooltip-panel {
padding: 2px 0;
color: var(--theme-arrowpanel-color);

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

@ -86,21 +86,11 @@
/* Icon filters */
--theme-icon-checked-filter: url(chrome://devtools/skin/images/filters.svg#icon-checked-light);
/* Tooltips */
--theme-tooltip-border: #d9e1e8;
--theme-tooltip-background: rgba(255, 255, 255, .9);
--theme-tooltip-shadow: rgba(155, 155, 155, 0.26);
/* Doorhangers */
/* These colors are based on the colors used for doorhangers elsewhere in
* Firefox. */
--theme-arrowpanel-background: -moz-field;
--theme-arrowpanel-color: -moz-fieldText;
--theme-arrowpanel-border-color: ThreeDShadow;
--theme-arrowpanel-separator: ThreeDShadow;
--theme-arrowpanel-dimmed: hsla(0,0%,80%,.3);
--theme-arrowpanel-dimmed-further: hsla(0,0%,80%,.45);
--theme-arrowpanel-disabled-color: GrayText;
/* Common popup styles(used by HTMLTooltip and autocomplete) */
--theme-popup-background: -moz-field;
--theme-popup-color: -moz-fieldText;
--theme-popup-border-color: ThreeDShadow;
--theme-popup-dimmed: hsla(0,0%,80%,.3);
--theme-messageCloseButtonFilter: invert(0);
}
@ -110,10 +100,9 @@
* system colors.
*/
:root[platform="mac"].theme-light {
--theme-arrowpanel-background: hsla(0,0%,99%,.975);
--theme-arrowpanel-color: hsl(0,0%,10%);
--theme-arrowpanel-border-color: hsla(210,4%,10%,.05);
--theme-arrowpanel-separator: hsla(210,4%,10%,.14);
--theme-popup-background: hsla(0,0%,99%,.975);
--theme-popup-color: hsl(0,0%,10%);
--theme-popup-border-color: hsla(210,4%,10%,.05);
}
:root.theme-dark {
@ -188,21 +177,11 @@
/* Icon filters */
--theme-icon-checked-filter: url(chrome://devtools/skin/images/filters.svg#icon-checked-dark);
/* Tooltips */
--theme-tooltip-border: #434850;
--theme-tooltip-background: rgba(19, 28, 38, .9);
--theme-tooltip-shadow: rgba(25, 25, 25, 0.76);
/* Doorhangers */
/* These colors are based on the colors used for doorhangers elsewhere in
* Firefox. */
--theme-arrowpanel-background: var(--grey-60);
--theme-arrowpanel-color: rgb(249,249,250);
--theme-arrowpanel-border-color: #27272b;
--theme-arrowpanel-separator: rgba(249,249,250,.1);
--theme-arrowpanel-dimmed: rgba(249,249,250,.1);
--theme-arrowpanel-dimmed-further: rgba(249,249,250,.15);
--theme-arrowpanel-disabled-color: rgba(249,249,250,.5);
/* Common popup styles(used by HTMLTooltip and autocomplete) */
--theme-popup-background: var(--grey-60);
--theme-popup-color: rgb(249,249,250);
--theme-popup-border-color: #27272b;
--theme-popup-dimmed: rgba(249,249,250,.1);
--theme-messageCloseButtonFilter: invert(1);
}

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

@ -87,6 +87,8 @@ const ErrorDocs = {
JSMSG_BAD_INSTANCEOF_RHS: "invalid_right_hand_side_instanceof_operand",
JSMSG_EMPTY_ARRAY_REDUCE: "Reduce_of_empty_array_with_no_initial_value",
JSMSG_NOT_ITERABLE: "is_not_iterable",
JSMSG_PROPERTY_FAIL: "cant_access_property",
JSMSG_PROPERTY_FAIL_EXPR: "cant_access_property",
};
const MIXED_CONTENT_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/Mixed_content";

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

@ -7,6 +7,7 @@
const {Cc, Ci, Cm, Cr, components} = require("chrome");
const ChromeUtils = require("ChromeUtils");
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
const Services = require("Services");
/**
* This is a nsIChannelEventSink implementation that monitors channel redirects and
@ -63,7 +64,7 @@ ChannelEventSinkFactory.register = function() {
SINK_CONTRACT_ID,
ChannelEventSinkFactory);
XPCOMUtils.categoryManager.addCategoryEntry(SINK_CATEGORY_NAME, SINK_CONTRACT_ID,
Services.catMan.addCategoryEntry(SINK_CATEGORY_NAME, SINK_CONTRACT_ID,
SINK_CONTRACT_ID, false, true);
};
@ -71,7 +72,7 @@ ChannelEventSinkFactory.unregister = function() {
const registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(SINK_CLASS_ID, ChannelEventSinkFactory);
XPCOMUtils.categoryManager.deleteCategoryEntry(SINK_CATEGORY_NAME, SINK_CONTRACT_ID,
Services.catMan.deleteCategoryEntry(SINK_CATEGORY_NAME, SINK_CONTRACT_ID,
false);
};

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

@ -87,8 +87,7 @@ class DeserializedEdgeRange : public EdgeRange
auto& edge = node->edges[i];
auto referent = node->getEdgeReferent(edge);
currentEdge = Edge(edge.name
? NS_strdup(edge.name) : nullptr, referent);
currentEdge = Edge(edge.name ? NS_xstrdup(edge.name) : nullptr, referent);
front_ = &currentEdge;
}

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

@ -147,8 +147,8 @@ struct GetOrInternStringMatcher
size_t length = str->length() / sizeof(CharT);
auto tempString = reinterpret_cast<const CharT*>(str->data());
UniqueFreePtr<CharT[]> owned(NS_strndup(tempString, length));
if (!owned || !internedStrings.append(std::move(owned)))
UniqueFreePtr<CharT[]> owned(NS_xstrndup(tempString, length));
if (!internedStrings.append(std::move(owned)))
return nullptr;
return internedStrings.back().get();

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

@ -187,8 +187,7 @@ const char16_t Concrete<FakeNode>::concreteTypeName[] = u"FakeNode";
void AddEdge(FakeNode& node, FakeNode& referent, const char16_t* edgeName = nullptr) {
char16_t* ownedEdgeName = nullptr;
if (edgeName) {
ownedEdgeName = NS_strdup(edgeName);
ASSERT_NE(ownedEdgeName, nullptr);
ownedEdgeName = NS_xstrdup(edgeName);
}
JS::ubi::Edge edge(ownedEdgeName, &referent);

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

@ -14314,10 +14314,6 @@ nsDocShell::GetColorMatrix(uint32_t* aMatrixLen, float** aMatrix)
if (mColorMatrix) {
*aMatrix = (float*)moz_xmalloc(20 * sizeof(float));
if (!*aMatrix) {
return NS_ERROR_OUT_OF_MEMORY;
}
MOZ_ASSERT(20 * sizeof(float) == sizeof(mColorMatrix->components));
*aMatrixLen = 20;
memcpy(*aMatrix, mColorMatrix->components, 20 * sizeof(float));

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

@ -187,11 +187,8 @@ interface nsIWebNavigation : nsISupports
/**
* Prevent the owner principal from being inherited for this load.
* Note: Within Gecko we use the term principal rather than owners
* but some legacy addons might still rely on the outdated term.
*/
const unsigned long LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL = 0x40000;
const unsigned long LOAD_FLAGS_DISALLOW_INHERIT_OWNER = 0x40000;
/**
* Overwrite the returned error code with a specific result code

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

@ -76,14 +76,6 @@ interface nsISHistory: nsISupports
*/
nsISHEntry getEntryAtIndex(in long index, in boolean modifyIndex);
/**
* Load the entry at given index to root docshell directly in order to
* restore to an entry in grouped session history navigation or session
* restore case. This function will not notify nsISHistoryListener, as it's
* not considered a normal history navigation.
*/
void restoreToEntryAtIndex(in long index);
/**
* Called to purge older documents from history.
* Documents can be removed from session history for various

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

@ -650,8 +650,7 @@ nsSHistory::AddEntry(nsISHEntry* aSHEntry, bool aPersist)
return NS_OK;
}
nsCOMPtr<nsISHTransaction> txn(new nsSHTransaction());
nsCOMPtr<nsISHTransaction> txn = new nsSHTransaction();
nsCOMPtr<nsIURI> uri;
aSHEntry->GetURI(getter_AddRefs(uri));
NOTIFY_LISTENERS(OnHistoryNewEntry, (uri, currentIndex));
@ -1182,22 +1181,6 @@ nsSHistory::ReloadCurrentEntry()
return LoadEntry(mIndex, LOAD_HISTORY, HIST_CMD_RELOAD);
}
NS_IMETHODIMP
nsSHistory::RestoreToEntryAtIndex(int32_t aIndex)
{
mRequestedIndex = aIndex;
nsCOMPtr<nsISHEntry> nextEntry;
GetEntryAtIndex(mRequestedIndex, false, getter_AddRefs(nextEntry));
if (!nextEntry) {
mRequestedIndex = -1;
return NS_ERROR_FAILURE;
}
// XXX We may want to ensure docshell is currently holding about:blank
return InitiateLoad(nextEntry, mRootDocShell, LOAD_HISTORY);
}
void
nsSHistory::EvictOutOfRangeWindowContentViewers(int32_t aIndex)
{

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

@ -258,10 +258,6 @@ private:
// going to free it. We also need fallible alloc, so we can't just use
// ToNewCString().
char* copy = static_cast<char*>(moz_xmalloc(body.Length()));
if (!copy) {
NS_WARNING("Failed to copy File entry body.");
return false;
}
nsCString::const_iterator bodyIter, bodyEnd;
body.BeginReading(bodyIter);
body.EndReading(bodyEnd);

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

@ -35,7 +35,7 @@ JS::ubi::Concrete<nsINode>::edges(JSContext* cx, bool wantNames) const
if (get().GetParent()) {
char16_t* edgeName = nullptr;
if (wantNames) {
edgeName = NS_strdup(u"Parent Node");
edgeName = NS_xstrdup(u"Parent Node");
}
if (!range->addEdge(JS::ubi::Edge(edgeName, get().GetParent()))) {
return nullptr;
@ -44,7 +44,7 @@ JS::ubi::Concrete<nsINode>::edges(JSContext* cx, bool wantNames) const
for (auto curr = get().GetFirstChild(); curr; curr = curr->GetNextSibling()) {
char16_t* edgeName = nullptr;
if (wantNames) {
edgeName = NS_strdup(u"Child Node");
edgeName = NS_xstrdup(u"Child Node");
}
if (!range->addEdge(JS::ubi::Edge(edgeName, curr))) {
return nullptr;

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

@ -2126,8 +2126,7 @@ nsDOMWindowUtils::GetClassName(JS::Handle<JS::Value> aObject, JSContext* aCx,
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
*aName = NS_strdup(JS_GetClass(aObject.toObjectOrNull())->name);
MOZ_ASSERT(*aName, "NS_strdup should be infallible.");
*aName = NS_xstrdup(JS_GetClass(aObject.toObjectOrNull())->name);
return NS_OK;
}

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

@ -29,7 +29,9 @@
#include "nsIProtocolHandler.h"
#include "nsIScriptSecurityManager.h"
#include "xpcpublic.h"
#include "js/CompilationAndEvaluation.h"
#include "js/JSON.h"
#include "js/SourceBufferHolder.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/Preferences.h"

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

@ -14,6 +14,9 @@
#include "nsJSUtils.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/CompilationAndEvaluation.h"
#include "js/OffThreadScriptCompilation.h"
#include "js/SourceBufferHolder.h"
#include "nsIScriptContext.h"
#include "nsIScriptElement.h"
#include "nsIScriptGlobalObject.h"

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

@ -175,9 +175,6 @@ CryptoBuffer::ToNewUnsignedBuffer(uint8_t** aBuf, uint32_t* aBufLen) const
uint32_t dataLen = Length();
uint8_t* tmp = reinterpret_cast<uint8_t*>(moz_xmalloc(dataLen));
if (NS_WARN_IF(!tmp)) {
return false;
}
memcpy(tmp, Elements(), dataLen);
*aBuf = tmp;

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

@ -268,9 +268,7 @@ EventListenerService::GetEventTargetChainFor(EventTarget* aEventTarget,
}
*aOutArray =
static_cast<EventTarget**>(
moz_xmalloc(sizeof(EventTarget*) * count));
NS_ENSURE_TRUE(*aOutArray, NS_ERROR_OUT_OF_MEMORY);
static_cast<EventTarget**>(moz_xmalloc(sizeof(EventTarget*) * count));
for (int32_t i = 0; i < count; ++i) {
NS_ADDREF((*aOutArray)[i] = targets[i]);

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

@ -222,7 +222,6 @@ BlobURL::GetClassID(nsCID * *aClassID)
// Make sure to modify any subclasses as needed if this ever
// changes to not call the virtual GetClassIDNoAlloc.
*aClassID = (nsCID*) moz_xmalloc(sizeof(nsCID));
NS_ENSURE_TRUE(*aClassID, NS_ERROR_OUT_OF_MEMORY);
return GetClassIDNoAlloc(*aClassID);
}

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

@ -4029,9 +4029,6 @@ GetStringValueFromBundlePlist(const nsAString& aKey, nsAutoCString& aValue)
CFIndex maxLength =
CFStringGetMaximumSizeForEncoding(valueLength, kCFStringEncodingUTF8) + 1;
char* valueBuffer = static_cast<char*>(moz_xmalloc(maxLength));
if (!valueBuffer) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (!CFStringGetCString(value, valueBuffer, maxLength,
kCFStringEncodingUTF8)) {

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

@ -1165,8 +1165,6 @@ nsPluginHost::GetPluginTags(uint32_t* aPluginCount, nsIPluginTag*** aResults)
*aResults = static_cast<nsIPluginTag**>
(moz_xmalloc((fakeCount + count) * sizeof(**aResults)));
if (!*aResults)
return NS_ERROR_OUT_OF_MEMORY;
*aPluginCount = count + fakeCount;
@ -3643,8 +3641,7 @@ nsPluginHost::ParsePostBufferToFixHeaders(const char *inPostData, uint32_t inPos
int cntSingleLF = singleLF.Length();
newBufferLen += cntSingleLF;
if (!(*outPostData = p = (char*)moz_xmalloc(newBufferLen)))
return NS_ERROR_OUT_OF_MEMORY;
*outPostData = p = (char*)moz_xmalloc(newBufferLen);
// deal with single LF
const char *s = inPostData;
@ -3672,8 +3669,7 @@ nsPluginHost::ParsePostBufferToFixHeaders(const char *inPostData, uint32_t inPos
// to keep ContentLenHeader+value followed by data
uint32_t l = sizeof(ContentLenHeader) + sizeof(CRLFCRLF) + 32;
newBufferLen = dataLen + l;
if (!(*outPostData = p = (char*)moz_xmalloc(newBufferLen)))
return NS_ERROR_OUT_OF_MEMORY;
*outPostData = p = (char*)moz_xmalloc(newBufferLen);
headersLen = snprintf(p, l,"%s: %u%s", ContentLenHeader, dataLen, CRLFCRLF);
if (headersLen == l) { // if snprintf has ate all extra space consider this as an error
free(p);

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

@ -207,25 +207,15 @@ static void ParsePlistPluginInfo(nsPluginInfo& info, CFBundleRef bundle)
// Allocate memory for mime data
int mimeDataArraySize = mimeDictKeyCount * sizeof(char*);
info.fMimeTypeArray = static_cast<char**>(moz_xmalloc(mimeDataArraySize));
if (!info.fMimeTypeArray)
return;
memset(info.fMimeTypeArray, 0, mimeDataArraySize);
info.fExtensionArray = static_cast<char**>(moz_xmalloc(mimeDataArraySize));
if (!info.fExtensionArray)
return;
memset(info.fExtensionArray, 0, mimeDataArraySize);
info.fMimeDescriptionArray = static_cast<char**>(moz_xmalloc(mimeDataArraySize));
if (!info.fMimeDescriptionArray)
return;
memset(info.fMimeDescriptionArray, 0, mimeDataArraySize);
// Allocate memory for mime dictionary keys and values
mozilla::UniquePtr<CFTypeRef[]> keys(new CFTypeRef[mimeDictKeyCount]);
if (!keys)
return;
mozilla::UniquePtr<CFTypeRef[]> values(new CFTypeRef[mimeDictKeyCount]);
if (!values)
return;
info.fVariantCount = 0;
@ -334,10 +324,8 @@ static char* p2cstrdup(StringPtr pstr)
{
int len = pstr[0];
char* cstr = static_cast<char*>(moz_xmalloc(len + 1));
if (cstr) {
memmove(cstr, pstr + 1, len);
cstr[len] = '\0';
}
memmove(cstr, pstr + 1, len);
cstr[len] = '\0';
return cstr;
}
@ -447,15 +435,9 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
// Fill in the info struct based on the data in the BPSupportedMIMETypes struct
int variantCount = info.fVariantCount;
info.fMimeTypeArray = static_cast<char**>(moz_xmalloc(variantCount * sizeof(char*)));
if (!info.fMimeTypeArray)
return NS_ERROR_OUT_OF_MEMORY;
info.fExtensionArray = static_cast<char**>(moz_xmalloc(variantCount * sizeof(char*)));
if (!info.fExtensionArray)
return NS_ERROR_OUT_OF_MEMORY;
if (mi.infoStrings) {
info.fMimeDescriptionArray = static_cast<char**>(moz_xmalloc(variantCount * sizeof(char*)));
if (!info.fMimeDescriptionArray)
return NS_ERROR_OUT_OF_MEMORY;
}
short mimeIndex = 2;
short descriptionIndex = 2;

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

@ -224,9 +224,6 @@ PushData::Binary(uint32_t* aDataLen, uint8_t** aData)
}
uint32_t length = mData.Length();
uint8_t* data = static_cast<uint8_t*>(moz_xmalloc(length * sizeof(uint8_t)));
if (!data) {
return NS_ERROR_OUT_OF_MEMORY;
}
memcpy(data, mData.Elements(), length * sizeof(uint8_t));
*aDataLen = length;
*aData = data;

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

@ -14,6 +14,9 @@
#include "prsystem.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/CompilationAndEvaluation.h"
#include "js/OffThreadScriptCompilation.h"
#include "js/SourceBufferHolder.h"
#include "js/Utility.h"
#include "xpcpublic.h"
#include "nsCycleCollectionParticipant.h"

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

@ -18,7 +18,7 @@
#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "nsIFileStreams.h"
#include "nsISimpleEnumerator.h"
#include "nsIDirectoryEnumerator.h"
#include "nsStringStream.h"
#include "prio.h"
#include "SimpleDBCommon.h"
@ -1909,7 +1909,7 @@ QuotaClient::GetUsageForOrigin(PersistenceType aPersistenceType,
DebugOnly<bool> exists;
MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)) && exists);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;

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

@ -34,9 +34,6 @@ SDBResult::GetAsArray(uint32_t* aDataLen, uint8_t** aData)
uint32_t length = mData.Length();
uint8_t* data = static_cast<uint8_t*>(moz_xmalloc(length * sizeof(uint8_t)));
if (!data) {
return NS_ERROR_OUT_OF_MEMORY;
}
memcpy(data, mData.BeginReading(), length * sizeof(uint8_t));

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

@ -25,6 +25,8 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/CompilationAndEvaluation.h"
#include "js/SourceBufferHolder.h"
#include "nsError.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"

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

@ -6,8 +6,10 @@
#include "WorkerPrivate.h"
#include "js/CompilationAndEvaluation.h"
#include "js/LocaleSensitive.h"
#include "js/MemoryMetrics.h"
#include "js/SourceBufferHolder.h"
#include "MessageEventRunnable.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/StaticPrefs.h"

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

@ -19,6 +19,8 @@
#include "mozilla/dom/Response.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/ScriptLoader.h"
#include "js/CompilationAndEvaluation.h"
#include "js/SourceBufferHolder.h"
#include "nsIInputStreamPump.h"
#include "nsIThreadRetargetableRequest.h"
#include "nsNetUtil.h"

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

@ -34,7 +34,7 @@ nsXBLProtoImplField::nsXBLProtoImplField(const char16_t* aName, const char16_t*
mLineNumber(0)
{
MOZ_COUNT_CTOR(nsXBLProtoImplField);
mName = NS_strdup(aName); // XXXbz make more sense to use a stringbuffer?
mName = NS_xstrdup(aName); // XXXbz make more sense to use a stringbuffer?
mJSAttributes = JSPROP_ENUMERATE;
if (aReadOnly) {

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

@ -525,12 +525,8 @@ bool txNodeSet::ensureGrowSize(int32_t aSize)
newLength *= kTxNodeSetGrowFactor;
}
txXPathNode* newArr = static_cast<txXPathNode*>
(moz_xmalloc(newLength *
sizeof(txXPathNode)));
if (!newArr) {
return false;
}
txXPathNode* newArr =
static_cast<txXPathNode*>(moz_xmalloc(newLength * sizeof(txXPathNode)));
txXPathNode* dest = newArr;
if (mDirection == kReversed) {

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

@ -1474,11 +1474,6 @@ txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult)
nsISupports** values = static_cast<nsISupports**>(array);
RefPtr<txNodeSet> nodeSet = new txNodeSet(nullptr);
if (!nodeSet) {
NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY(count, values);
return NS_ERROR_OUT_OF_MEMORY;
}
uint32_t i;
for (i = 0; i < count; ++i) {

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

@ -86,6 +86,8 @@
#include "mozilla/Preferences.h"
#include "nsTextNode.h"
#include "nsJSUtils.h"
#include "js/CompilationAndEvaluation.h"
#include "js/SourceBufferHolder.h"
#include "mozilla/dom/URL.h"
#include "nsIContentPolicy.h"
#include "mozAutoDocUpdate.h"

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

@ -18,6 +18,8 @@
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/DeclarationBlock.h"
#include "js/CompilationAndEvaluation.h"
#include "js/SourceBufferHolder.h"
#include "nsFocusManager.h"
#include "nsHTMLStyleSheet.h"
#include "nsNameSpaceManager.h"

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

@ -585,8 +585,6 @@ EditorSpellCheck::GetDictionaryList(char16_t*** aDictionaryList,
tmpPtr = (char16_t **)moz_xmalloc(sizeof(char16_t *));
NS_ENSURE_TRUE(tmpPtr, NS_ERROR_OUT_OF_MEMORY);
*tmpPtr = 0;
*aDictionaryList = tmpPtr;
*aCount = 0;
@ -596,8 +594,6 @@ EditorSpellCheck::GetDictionaryList(char16_t*** aDictionaryList,
tmpPtr = (char16_t **)moz_xmalloc(sizeof(char16_t *) * dictList.Length());
NS_ENSURE_TRUE(tmpPtr, NS_ERROR_OUT_OF_MEMORY);
*aDictionaryList = tmpPtr;
*aCount = dictList.Length();

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

@ -516,7 +516,7 @@ nsAuthGSSAPI::GetNextToken(const void *inToken,
*outTokenLen = output_token.length;
if (output_token.length != 0)
*outToken = nsMemory::Clone(output_token.value, output_token.length);
*outToken = moz_xmemdup(output_token.value, output_token.length);
else
*outToken = nullptr;
@ -565,7 +565,7 @@ nsAuthGSSAPI::Unwrap(const void *inToken,
*outTokenLen = output_token.length;
if (output_token.length)
*outToken = nsMemory::Clone(output_token.value, output_token.length);
*outToken = moz_xmemdup(output_token.value, output_token.length);
else
*outToken = nullptr;
@ -607,7 +607,7 @@ nsAuthGSSAPI::Wrap(const void *inToken,
*outTokenLen = output_token.length;
/* it is not possible for output_token.length to be zero */
*outToken = nsMemory::Clone(output_token.value, output_token.length);
*outToken = moz_xmemdup(output_token.value, output_token.length);
gss_release_buffer_ptr(&minor_status, &output_token);
return NS_OK;

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

@ -105,10 +105,6 @@ nsAuthSASL::GetNextToken(const void *inToken,
NS_CopyUnicodeToNative(mUsername, userbuf);
messageLen = userbuf.Length() + 4 + 1;
message = (char *)moz_xmalloc(messageLen);
if (!message) {
Reset();
return NS_ERROR_OUT_OF_MEMORY;
}
message[0] = 0x01; // No security layer
message[1] = 0x00;
message[2] = 0x00;

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

@ -341,8 +341,6 @@ nsAuthSSPI::GetNextToken(const void *inToken,
mIsFirst = false;
mCertDERLength = inTokenLen;
mCertDERData = moz_xmalloc(inTokenLen);
if (!mCertDERData)
return NS_ERROR_OUT_OF_MEMORY;
memcpy(mCertDERData, inToken, inTokenLen);
// We are starting a new authentication sequence.
@ -385,9 +383,6 @@ nsAuthSSPI::GetNextToken(const void *inToken,
+ pendpoint_binding.dwApplicationDataOffset;
sspi_cbt = (char *) moz_xmalloc(ib[ibd.cBuffers].cbBuffer);
if (!sspi_cbt){
return NS_ERROR_OUT_OF_MEMORY;
}
// Helper to write in the memory block that stores the CBT
char* sspi_cbt_ptr = sspi_cbt;
@ -460,11 +455,6 @@ nsAuthSSPI::GetNextToken(const void *inToken,
ob.BufferType = SECBUFFER_TOKEN;
ob.cbBuffer = mMaxTokenLen;
ob.pvBuffer = moz_xmalloc(ob.cbBuffer);
if (!ob.pvBuffer){
if (sspi_cbt)
free(sspi_cbt);
return NS_ERROR_OUT_OF_MEMORY;
}
memset(ob.pvBuffer, 0, ob.cbBuffer);
NS_ConvertUTF8toUTF16 wSN(mServiceName);
@ -529,8 +519,6 @@ nsAuthSSPI::Unwrap(const void *inToken,
ib[0].BufferType = SECBUFFER_STREAM;
ib[0].cbBuffer = inTokenLen;
ib[0].pvBuffer = moz_xmalloc(ib[0].cbBuffer);
if (!ib[0].pvBuffer)
return NS_ERROR_OUT_OF_MEMORY;
memcpy(ib[0].pvBuffer, inToken, inTokenLen);
@ -554,10 +542,8 @@ nsAuthSSPI::Unwrap(const void *inToken,
*outToken = ib[1].pvBuffer;
}
else {
*outToken = nsMemory::Clone(ib[1].pvBuffer, ib[1].cbBuffer);
*outToken = moz_xmemdup(ib[1].pvBuffer, ib[1].cbBuffer);
free(ib[0].pvBuffer);
if (!*outToken)
return NS_ERROR_OUT_OF_MEMORY;
}
*outTokenLen = ib[1].cbBuffer;
}
@ -622,17 +608,11 @@ nsAuthSSPI::Wrap(const void *inToken,
bufs.ib[0].BufferType = SECBUFFER_TOKEN;
bufs.ib[0].pvBuffer = moz_xmalloc(sizes.cbSecurityTrailer);
if (!bufs.ib[0].pvBuffer)
return NS_ERROR_OUT_OF_MEMORY;
// APP Data
bufs.ib[1].BufferType = SECBUFFER_DATA;
bufs.ib[1].pvBuffer = moz_xmalloc(inTokenLen);
bufs.ib[1].cbBuffer = inTokenLen;
if (!bufs.ib[1].pvBuffer)
return NS_ERROR_OUT_OF_MEMORY;
memcpy(bufs.ib[1].pvBuffer, inToken, inTokenLen);
// SSPI
@ -640,9 +620,6 @@ nsAuthSSPI::Wrap(const void *inToken,
bufs.ib[2].cbBuffer = sizes.cbBlockSize;
bufs.ib[2].pvBuffer = moz_xmalloc(bufs.ib[2].cbBuffer);
if (!bufs.ib[2].pvBuffer)
return NS_ERROR_OUT_OF_MEMORY;
rc = (sspi->EncryptMessage)(&mCtxt,
confidential ? 0 : KERB_WRAP_NO_ENCRYPT,
&ibd, 0);
@ -651,9 +628,6 @@ nsAuthSSPI::Wrap(const void *inToken,
int len = bufs.ib[0].cbBuffer + bufs.ib[1].cbBuffer + bufs.ib[2].cbBuffer;
char *p = (char *) moz_xmalloc(len);
if (!p)
return NS_ERROR_OUT_OF_MEMORY;
*outToken = (void *) p;
*outTokenLen = len;

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

@ -235,9 +235,7 @@ nsAuthSambaNTLM::GetNextToken(const void *inToken,
{
if (!inToken) {
/* someone wants our initial message */
*outToken = nsMemory::Clone(mInitialMessage, mInitialMessageLen);
if (!*outToken)
return NS_ERROR_OUT_OF_MEMORY;
*outToken = moz_xmemdup(mInitialMessage, mInitialMessageLen);
*outTokenLen = mInitialMessageLen;
return NS_OK;
}
@ -266,11 +264,8 @@ nsAuthSambaNTLM::GetNextToken(const void *inToken,
uint8_t* buf = ExtractMessage(line, outTokenLen);
if (!buf)
return NS_ERROR_FAILURE;
*outToken = nsMemory::Clone(buf, *outTokenLen);
*outToken = moz_xmemdup(buf, *outTokenLen);
PR_Free(buf);
if (!*outToken) {
return NS_ERROR_OUT_OF_MEMORY;
}
// We're done. Close our file descriptors now and reap the helper
// process.

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

@ -583,10 +583,7 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne
// allocate a buffer sizeof("Negotiate" + " " + b64output_token + "\0")
const int bufsize = kNegotiateLen + 1 + strlen(encoded_token) + 1;
*creds = (char *) moz_xmalloc(bufsize);
if (MOZ_UNLIKELY(!*creds))
rv = NS_ERROR_OUT_OF_MEMORY;
else
snprintf(*creds, bufsize, "%s %s", kNegotiate, encoded_token);
snprintf(*creds, bufsize, "%s %s", kNegotiate, encoded_token);
PR_Free(encoded_token); // PL_Base64Encode() uses PR_Malloc().
return rv;

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

@ -471,52 +471,44 @@ mozHunspell::Suggest(const nsAString& aWord, char16_t*** aSuggestions,
if (*aSuggestionCount) {
*aSuggestions = (char16_t **)moz_xmalloc(*aSuggestionCount * sizeof(char16_t *));
if (*aSuggestions) {
uint32_t index = 0;
for (index = 0; index < *aSuggestionCount && NS_SUCCEEDED(rv); ++index) {
// If the IDL used an array of AString, we could use
// Encoding::DecodeWithoutBOMHandling() here.
// Convert the suggestion to utf16
Span<const char> charSrc(suggestions[index]);
auto src = AsBytes(charSrc);
CheckedInt<size_t> needed =
mDecoder->MaxUTF16BufferLength(src.Length());
if (!needed.isValid()) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
size_t dstLen = needed.value();
needed += 1;
needed *= sizeof(char16_t);
if (!needed.isValid()) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
(*aSuggestions)[index] = (char16_t*)moz_xmalloc(needed.value());
if (!((*aSuggestions)[index])) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
auto dst = MakeSpan((*aSuggestions)[index], dstLen);
uint32_t result;
size_t read;
size_t written;
bool hadErrors;
Tie(result, read, written, hadErrors) =
mDecoder->DecodeToUTF16(src, dst, true);
MOZ_ASSERT(result == kInputEmpty);
MOZ_ASSERT(read == src.Length());
MOZ_ASSERT(written <= dstLen);
Unused << hadErrors;
(*aSuggestions)[index][written] = 0;
mDecoder->Encoding()->NewDecoderWithoutBOMHandlingInto(*mDecoder);
uint32_t index = 0;
for (index = 0; index < *aSuggestionCount && NS_SUCCEEDED(rv); ++index) {
// If the IDL used an array of AString, we could use
// Encoding::DecodeWithoutBOMHandling() here.
// Convert the suggestion to utf16
Span<const char> charSrc(suggestions[index]);
auto src = AsBytes(charSrc);
CheckedInt<size_t> needed =
mDecoder->MaxUTF16BufferLength(src.Length());
if (!needed.isValid()) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
if (NS_FAILED(rv))
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(index, *aSuggestions); // free the char16_t strings up to the point at which the error occurred
size_t dstLen = needed.value();
needed += 1;
needed *= sizeof(char16_t);
if (!needed.isValid()) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
(*aSuggestions)[index] = (char16_t*)moz_xmalloc(needed.value());
auto dst = MakeSpan((*aSuggestions)[index], dstLen);
uint32_t result;
size_t read;
size_t written;
bool hadErrors;
Tie(result, read, written, hadErrors) =
mDecoder->DecodeToUTF16(src, dst, true);
MOZ_ASSERT(result == kInputEmpty);
MOZ_ASSERT(read == src.Length());
MOZ_ASSERT(written <= dstLen);
Unused << hadErrors;
(*aSuggestions)[index][written] = 0;
mDecoder->Encoding()->NewDecoderWithoutBOMHandlingInto(*mDecoder);
}
else // if (*aSuggestions)
rv = NS_ERROR_OUT_OF_MEMORY;
if (NS_FAILED(rv))
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(index, *aSuggestions); // free the char16_t strings up to the point at which the error occurred
}
return rv;

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

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

@ -57,7 +57,7 @@
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
#include "nsIDirectoryEnumerator.h"
#include "nsCharTraits.h"
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
@ -1877,7 +1877,7 @@ gfxMacPlatformFontList::ActivateFontsFromDir(nsIFile* aDir)
return;
}
nsCOMPtr<nsISimpleEnumerator> e;
nsCOMPtr<nsIDirectoryEnumerator> e;
if (NS_FAILED(aDir->GetDirectoryEntries(getter_AddRefs(e)))) {
return;
}

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

@ -1,40 +0,0 @@
diff --git a/gfx/ycbcr/yuv_convert.cpp b/gfx/ycbcr/yuv_convert.cpp
--- a/gfx/ycbcr/yuv_convert.cpp
+++ b/gfx/ycbcr/yuv_convert.cpp
@@ -337,16 +337,17 @@ void ScaleYCbCrToRGB32(const uint* yplan
source_dx_uv >> kFractionBits);
}
}
else {
ScaleYUVToRGB32Row_C(y_ptr, u_ptr, v_ptr,
dest_pixel, width, source_dx);
}
#else
+ (void)source_dx_uv;
ScaleYUVToRGB32Row(y_ptr, u_ptr, v_ptr,
dest_pixel, width, source_dx);
#endif
}
}
// MMX used for FastConvertYUVToRGB32Row and FilterRows requires emms.
if (has_mmx)
EMMS();
diff --git a/gfx/ycbcr/yuv_row.h b/gfx/ycbcr/yuv_row.h
--- a/gfx/ycbcr/yuv_row.h
+++ b/gfx/ycbcr/yuv_row.h
@@ -129,14 +129,14 @@ extern SIMD_ALIGNED(int16 kCoefficientsR
#if defined(ARCH_CPU_X86) && !defined(ARCH_CPU_X86_64)
#if defined(_MSC_VER)
#define EMMS() __asm emms
#pragma warning(disable: 4799)
#else
#define EMMS() asm("emms")
#endif
#else
-#define EMMS()
+#define EMMS() ((void)0)
#endif
} // extern "C"
#endif // MEDIA_BASE_YUV_ROW_H_

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

@ -4,28 +4,5 @@ http://code.google.com/chromium/
The code comes from svn revision 63840 on 2010-10-26.
If you just want to check out this individual directory, use:
svn co -r 63840 http://src.chromium.org/svn/trunk/src/media/base
The code was copied from a Chromium svn checkout using the 'update.sh' script which then applies patches for our build and to add dynamic CPU detection.
convert.patch contains the following changes:
* Change Chromium code to build using Mozilla build system.
* Add runtime CPU detection for MMX
* Move default C implementation to work on all platforms.
* Change Chromium code to allow a picture region.
* The YUV conversion will convert within this picture region only.
* Add YCbCr 4:4:4 support
* Bug 619178 - Update CPU detection in yuv_convert to new SSE.h interface.
* Bug 616778 - Split yuv_convert FilterRows vectorized code into separate files so it can
be properly guarded with cpuid() calls.
win64.patch: SSE2 optimization for Microsoft Visual C++ x64 version
TypeFromSize.patch: Bug 656185 - Add a method to detect YUVType from plane sizes.
QuellGccWarnings.patch: Bug 711895 - Avoid some GCC compilation warnings.
clang-cl-workaround.patch: Bug 1422368 - Work around a clang-cl unresolved symbol bug.
It has been superseded upstream by libyuv (which is spawned off it). Bug 791941 is about
trying to replace this code with libyuv.

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