Add a test that confirms there's no crash on accessing properties of...

Add a test that confirms there's no crash on accessing properties of AccesibilityObject at the initial state

BUG=351195

Review URL: https://codereview.chromium.org/216343002

git-svn-id: svn://svn.chromium.org/blink/trunk@170340 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ea67eb70
This tests that there's no crash when accessising any properties at the initial state.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="body">
<script>
description("This tests that there's no crash when accessising any properties at the initial state.");
function enumelateProperties(value) {
if (typeof(value) !== 'object')
return;
for (var key in value)
enumelateProperties(value[key]);
}
if (window.accessibilityController)
enumelateProperties(window.accessibilityController);
</script>
</body>
</html>
...@@ -20,10 +20,15 @@ function emitExpectedResult(path, expected) ...@@ -20,10 +20,15 @@ function emitExpectedResult(path, expected)
if (path[0] == 'internals' if (path[0] == 'internals'
|| path[0] == 'propertiesToVerify' // Skip the list we're building... || path[0] == 'propertiesToVerify' // Skip the list we're building...
|| path[0] == 'clientInformation' // Just an alias for navigator. || path[0] == 'clientInformation' // Just an alias for navigator.
// Skip testRunner since they are only for testing. || path[0] == 'testRunner' // Skip testRunner since they are only for testing.
|| path[0] == 'testRunner' || path[0] == 'layoutTestController' // Just an alias for testRunner.
|| path[0] == 'eventSender' // Skip eventSender since they are only for testing. || path[0] == 'eventSender') { // Skip eventSender since they are only for testing.
|| path[0] == 'layoutTestController') { // Just an alias for testRunner. return;
}
// Skip the properties which are hard to expect a stable result.
if (path[0] == 'accessibilityController' // we can hardly estimate the states of the cached WebAXObjects.
|| path[0] == 'localStorage') { // local storage is not reliably cleared between tests.
return; return;
} }
...@@ -75,16 +80,6 @@ function collectPropertiesHelper(object, path) ...@@ -75,16 +80,6 @@ function collectPropertiesHelper(object, path)
throw 'Error: probably looping'; throw 'Error: probably looping';
for (var property in object) { for (var property in object) {
// Skip the properties which are hard to expect a stable result.
// As for 'accessibilityController', we can hardly estimate the states
// of the cached WebAXObjects.
// FIXME: We can't access accessibilityController's properties here
// because some property accesses might crash (crbug/351195).
if (property == 'accessibilityController')
continue;
// As for 'localStorage', local storage is not reliably cleared between tests.
if (property == 'localStorage')
continue;
path.push(property); path.push(property);
var type = typeof(object[property]); var type = typeof(object[property]);
if (type == "object") { if (type == "object") {
......
...@@ -797,7 +797,8 @@ String AXRenderObject::text() const ...@@ -797,7 +797,8 @@ String AXRenderObject::text() const
int AXRenderObject::textLength() const int AXRenderObject::textLength() const
{ {
ASSERT(isTextControl()); if (!isTextControl())
return -1;
if (isPasswordField()) if (isPasswordField())
return -1; // need to return something distinct from 0 return -1; // need to return something distinct from 0
...@@ -1568,7 +1569,8 @@ Widget* AXRenderObject::widgetForAttachmentView() const ...@@ -1568,7 +1569,8 @@ Widget* AXRenderObject::widgetForAttachmentView() const
AXObject::PlainTextRange AXRenderObject::selectedTextRange() const AXObject::PlainTextRange AXRenderObject::selectedTextRange() const
{ {
ASSERT(isTextControl()); if (!isTextControl())
return PlainTextRange();
if (isPasswordField()) if (isPasswordField())
return PlainTextRange(); return PlainTextRange();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment