Skip to content

Commit

Permalink
Bug 1859588 - Re-enable test_addressDataLoader test and skip test_loa…
Browse files Browse the repository at this point in the history
…dDataState sub-test r=sgalich

Previously we disabled test_addressDataLoader in Bug 1859590 because
loading a non-existent resource could potentially cause a crash.

This patch re-enables the test and only disables the sub-test that
caused a crash.

Differential Revision: https://phabricator.services.mozilla.com/D198008
  • Loading branch information
DimiDL committed Jan 10, 2024
1 parent 554096c commit 05cf749
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ add_task(async function test_initalState() {
Assert.equal(AddressDataLoader._dataLoaded.level1.size, 0);
});

add_task(async function test_loadDataState() {
add_task(async function test_loadDataCountry() {
sinon.spy(AddressDataLoader, "_loadScripts");
let metadata = FormAutofillUtils.getCountryAddressData("US");
Assert.ok(AddressDataLoader._addressData, "addressData exists");
Expand All @@ -57,7 +57,15 @@ add_task(async function test_loadDataState() {
"metadata should be US if country is not specified"
);
AddressDataLoader._loadScripts.resetHistory();
});

// This test is currently Disable!
// This is because - Loading a non-existent resource could potentially cause a crash
// (See Bug 1859588). To address this issue, We can check for the file's existence
// before attempting to load the script. However, given that we are not using
// state data, just keep the solution simple by disabling the test.
add_task(async function test_loadDataState() {
sinon.spy(AddressDataLoader, "_loadScripts");
// Load level 1 data that does not exist
let undefinedMetadata = FormAutofillUtils.getCountryAddressData("US", "CA");
// _loadScripts should be called
Expand All @@ -74,7 +82,7 @@ add_task(async function test_loadDataState() {
Assert.equal(undefinedMetadata, undefined, "metadata should be undefined");
// _loadScripts should not be called
sinon.assert.notCalled(AddressDataLoader._loadScripts);
});
}).skip();

SUPPORT_COUNTRIES_TESTCASES.forEach(testcase => {
add_task(async function test_support_country() {
Expand Down
1 change: 0 additions & 1 deletion browser/extensions/formautofill/test/unit/xpcshell.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ head = "head_addressComponent.js"
head = "head_addressComponent.js"

["test_addressDataLoader.js"]
skip-if = ["true"] # bug 1859588

["test_addressRecords.js"]
skip-if = ["apple_silicon"] # bug 1729554
Expand Down

0 comments on commit 05cf749

Please sign in to comment.