// Test that onEnumProperties returns the expected data // when passing `ignoreNonIndexedProperties` and `ignoreIndexedProperties` options // with various objects. (See Bug 1403065)
// Checks the result of enumProperties.
let response = await objClient.enumProperties({
ignoreNonIndexedProperties: true,
});
await check_enum_properties(response, expectedIndexedProperties);
function eval_code() { // Be sure to run debuggee code in its own HTML 'task', so that when we call // the onDebuggerStatement hook, the test's own microtasks don't get suspended // along with the debuggee's.
do_timeout(0, () => {
debuggee.eval(`
stopMe(${ typeof evaledObject === "string"
? evaledObject
: JSON.stringify(evaledObject)
});
`);
});
}
}
async function check_enum_properties(iterator, expected = []) {
equal(
iterator.count,
expected.length, "iterator.count has the expected value"
);
info("Check iterator.slice response for all properties"); const sliceResponse = await iterator.slice(0, iterator.count);
ok(
sliceResponse &&
Object.getOwnPropertyNames(sliceResponse).includes("ownProperties"), "The response object has an ownProperties property"
);
const { ownProperties } = sliceResponse; const names = Object.getOwnPropertyNames(ownProperties);
equal(
names.length,
expected.length, "The response has the expected number of properties"
); for (let i = 0; i < names.length; i++) { const name = names[i]; const [key, value] = expected[i];
equal(name, key, "Property has the expected name"); const property = ownProperties[name];
if (value === DO_NOT_CHECK_VALUE) { return;
}
if (value === undefined) {
equal(
property,
undefined,
`Response has no value for the "${key}" property`
);
} else { const propValue = property.hasOwnProperty("value")
? property.value
: property.getterValue;
equal(propValue, value, `Property "${key}" has the expected value`);
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.