This commit is contained in:
Kyle Huey 2011-03-15 19:23:20 -04:00
Родитель 2659bcedf3 1b131060c3
Коммит 3ad44a5c4e
15 изменённых файлов: 259 добавлений и 216 удалений

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

@ -54,3 +54,4 @@ dba2abb7db57078c5a4810884834d3056a5d56c2 last-mozilla-central
2f83edbbeef0de7dd901411d270da61106c8afae bsmedberg-static-xpcom-registration-base
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R12
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R13
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R11_1_MU

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

@ -100,12 +100,12 @@ _TEST_FILES =\
test_keys.html \
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
test_nsIAccessible_selects.html \
test_nsIAccessible_focus.html \
test_nsIAccessibleDocument.html \
test_nsIAccessibleImage.html \
test_nsIAccessNode_utils.html \
test_nsOuterDocAccessible.html \
test_role_nsHyperTextAcc.html \
test_takeFocus.html \
test_text_caret.html \
test_textboxes.html \
test_textboxes.xul \

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

@ -1,144 +0,0 @@
<html>
<head>
<title>nsIAccessible::takeFocus testing</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="common.js"></script>
<script type="application/javascript"
src="events.js"></script>
<script type="application/javascript">
////////////////////////////////////////////////////////////////////////////
// Test
function doTest()
{
// focus ARIA link
var ID = "aria-link";
var linkAcc = getAccessible(ID);
gFocusManager.listenElement(linkAcc, ID, doTest2);
linkAcc.takeFocus();
}
function doTest2()
{
// focus first child of ARIA link
var ID = "aria-link2";
var linkAcc = getAccessible(ID);
gFocusManager.listenElement(linkAcc, ID, doTest3);
linkAcc.firstChild.takeFocus();
}
function doTest3()
{
// focus html:a
var ID = "link";
var linkAcc = getAccessible(ID);
gFocusManager.listenElement(linkAcc, ID, finishTest);
linkAcc.takeFocus();
}
function finishTest()
{
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
////////////////////////////////////////////////////////////////////////////
// Helpers
var gFocusManager =
{
// Public
listenElement: function listenElement(aAccOrID, aPrettyName, aCallback)
{
registerA11yEventListener(nsIAccessibleEvent.EVENT_FOCUS, this);
var elmObj = {};
this.mAcc = getAccessible(aAccOrID, null, elmObj);
this.mElm = elmObj.value;
this.mName = aPrettyName ? aPrettyName : aAccOrID;
this.mCallback = aCallback;
window.setTimeout(
function(aFocusMgr)
{
aFocusMgr.checkWasFocusHandled();
// Try to work around bug 573085 by using a timeout that's a lot
// bigger than our refresh driver period.
}, 100, this);
},
// Private
handleEvent: function handleEvent(aAccEvent)
{
var node = aAccEvent.DOMNode;
if (node == this.mElm)
this.mIsFocusHandled = true;
},
checkWasFocusHandled: function checkWasFocusHandled()
{
window.setTimeout(
function(aFocusMgr)
{
unregisterA11yEventListener(nsIAccessibleEvent.EVENT_FOCUS, this);
ok(aFocusMgr.mIsFocusHandled,
"Focus wasn't received for element with ID " + aFocusMgr.mName + ".");
var states = {}, extraStates = {};
aFocusMgr.mAcc.getState(states, extraStates);
// XXX see bug 455840. Only fails on aria-link, the other two are OK.
// When fixing this bug, remove the if statement and else block and "todo" statement.
if (states.value & nsIAccessibleStates.STATE_FOCUSED)
ok(states.value & nsIAccessibleStates.STATE_FOCUSED,
"No focused state for element with ID " + aFocusMgr.mName + ".");
else
todo(states.value & nsIAccessibleStates.STATE_FOCUSED,
"No focused state for element with ID " + aFocusMgr.mName + ".");
aFocusMgr.mCallback();
}, 0, this);
},
mAcc: null,
mElm: null,
mName: "",
mIsFocusHandled: false
};
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=452710"
title="nsIAccessible::takeFocus testing">
Mozilla Bug 452710
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<span id="aria-link" role="link" tabindex="0">link</span>
<span id="aria-link2" role="link" tabindex="0">link</span>
<a id="link" href="">link</span>
</body>
</html>

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

@ -0,0 +1,82 @@
<html>
<head>
<title>nsIAccessible::takeFocus testing</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="common.js"></script>
<script type="application/javascript"
src="states.js"></script>
<script type="application/javascript"
src="events.js"></script>
<script type="application/javascript">
////////////////////////////////////////////////////////////////////////////
// Test
var gQueue = null;
function takeFocusInvoker(aID)
{
this.accessible = getAccessible(aID);
this.eventSeq = [ new invokerChecker(EVENT_FOCUS, this.accessible) ];
this.invoke = function takeFocusInvoker_invoke()
{
this.accessible.takeFocus();
}
this.finalCheck = function takeFocusInvoker()
{
testStates(this.accessible, STATE_FOCUSED);
}
this.getID = function takeFocusInvoker_getID()
{
return "takeFocus for " + prettyName(aID);
}
}
function doTest()
{
gQueue = new eventQueue();
gQueue.push(new takeFocusInvoker("aria-link"));
gQueue.push(new takeFocusInvoker("aria-link2"));
gQueue.push(new takeFocusInvoker("link"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=452710"
title="nsIAccessible::takeFocus testing">
Mozilla Bug 452710
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<span id="aria-link" role="link" tabindex="0">link</span>
<span id="aria-link2" role="link" tabindex="0">link</span>
<a id="link" href="">link</span>
</body>
</html>

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

@ -26,6 +26,14 @@ function testCharacterCount(aIDs, aCount)
}
}
/**
* Test text between two given offsets
*
* @param aIDs [in] an array of accessible IDs to test
* @param aStartOffset [in] the start offset within the text to test
* @param aEndOffset [in] the end offset up to which the text is tested
* @param aText [in] the expected result from the test
*/
function testText(aIDs, aStartOffset, aEndOffset, aText)
{
for (var i = 0; i < aIDs.length; i++)
@ -43,6 +51,34 @@ function testText(aIDs, aStartOffset, aEndOffset, aText)
}
}
/**
* Test password text between two given offsets
*
* @param aIDs [in] an array of accessible IDs to test
* @param aStartOffset [in] the start offset within the text to test
* @param aEndOffset [in] the end offset up to which the text is tested
* @param aText [in] the expected result from the test
*
* @note All this function does is test that getText doe snot expose the
* password text itself, but something else.
*/
function testPasswordText(aIDs, aStartOffset, aEndOffset, aText)
{
for (var i = 0; i < aIDs.length; i++)
{
var acc = getAccessible(aIDs[i], nsIAccessibleText);
try {
isnot(acc.getText(aStartOffset, aEndOffset), aText,
"getText: plain text between start and end offsets '" + aStartOffset +
"', '" + aEndOffset + " for '" + prettyName(aIDs[i]) + "'");
} catch (e) {
ok(false,
"getText fails between start and end offsets '" + aStartOffset +
"', '" + aEndOffset + " for '" + prettyName(aIDs[i]) + "'");
}
}
}
/**
* Test getTextAtOffset for BOUNDARY_CHAR over different elements.
*

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

@ -49,6 +49,7 @@ _TEST_FILES = \
doc.html \
test_doc.html \
test_hypertext.html \
test_passwords.html \
test_singleline.html \
test_whitespaces.html \
test_words.html \

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

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<title>nsIAccessibleText getText related function tests for text and password inputs</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../text.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// regular text and password inputs
//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// characterCount and getText for regular text field
var IDs = [ "username" ];
testCharacterCount(IDs, 4);
testText(IDs, 0, 4, "test");
////////////////////////////////////////////////////////////////////////
// characterCount and getText for password field
IDs = [ "password" ];
testCharacterCount(IDs, 4);
testPasswordText(IDs, 0, 4, "test");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="mochitest for getText for password fields"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=415943">Mozilla Bug 415943</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<form action="post.php" method="post">
<label for="username">User name:</label>
<input id="username" value="test"><br />
<label for="password">Password:</label>
<input type="password" id="password" value="test"/>
</form>
</body>
</html>

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

@ -42,7 +42,7 @@
testAccessibleTree("txc3", accTree);
// timed textbox
testAccessibleTree("txc4", accTree);
testAccessibleTree("txc4_deprecated", accTree);
// password textbox
accTree = {
@ -122,7 +122,9 @@
<textbox id="txc1" value="hello"/>
<textbox id="txc2" type="number" value="44"/>
<textbox id="txc3" type="search" value="hello"/>
<textbox id="txc4" type="timed" value="hello"/>
<!-- This textbox triggers "Warning: Timed textboxes are deprecated. Consider using type="search" instead.".
Yet let's test it too as long as it's (still) supported. -->
<textbox id="txc4_deprecated" type="timed" value="hello"/>
<textbox id="txc5" type="password" value="hello"/>
<textbox id="txc6" multiline="true" value="hello"/>
<textbox id="txc7" type="autocomplete" value="hello"/>

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

@ -77,8 +77,8 @@ function checkState(tab) {
ok(!doc.getElementById("new-elem"), "new-elem should be removed.");
// Clean up after ourselves and finish the test.
tab.linkedBrowser.removeEventListener("popstate", arguments.callee, false);
tab.linkedBrowser.removeEventListener("load", arguments.callee, false);
tab.linkedBrowser.removeEventListener("popstate", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
gBrowser.removeTab(tab);
finish();
}

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

@ -22,63 +22,63 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=404320
SimpleTest.waitForExplicitFinish();
var win = document.getElementById("testIframe").contentWindow;
var doc = document.getElementById("testIframe").contentDocument;
function testFormatBlock(tag, withAngleBrackets, shouldSucceed)
{
win.getSelection().selectAllChildren(doc.body.firstChild);
doc.execCommand("FormatBlock", false,
withAngleBrackets ? tag : "<" + tag + ">");
var resultNode;
if (shouldSucceed && (tag == "dd" || tag == "dt")) {
is(doc.body.firstChild.tagName, "DL", "tag was changed");
resultNode = doc.body.firstChild.firstChild;
}
else {
resultNode = doc.body.firstChild;
}
is(resultNode.tagName, shouldSucceed ? tag.toUpperCase() : "P", "tag was changed");
}
function formatBlockTests(tags, shouldSucceed)
{
var html = "<p>Content</p>";
for (var i = 0; i < tags.length; ++i) {
var tag = tags[i];
var resultTag = tag.toUpperCase();
doc.body.innerHTML = html;
testFormatBlock(tag, false, shouldSucceed);
doc.body.innerHTML = html;
testFormatBlock(tag, true, shouldSucceed);
}
}
doc.designMode = "on";
var goodTags = [ "address",
"blockquote",
"dd",
"div",
"dl",
"dt",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"p",
"pre" ];
var badTags = [ "b",
"i",
"span",
"foo" ];
function runTests() {
var win = document.getElementById("testIframe").contentWindow;
var doc = document.getElementById("testIframe").contentDocument;
function testFormatBlock(tag, withAngleBrackets, shouldSucceed)
{
win.getSelection().selectAllChildren(doc.body.firstChild);
doc.execCommand("FormatBlock", false,
withAngleBrackets ? tag : "<" + tag + ">");
var resultNode;
if (shouldSucceed && (tag == "dd" || tag == "dt")) {
is(doc.body.firstChild.tagName, "DL", "tag was changed");
resultNode = doc.body.firstChild.firstChild;
}
else {
resultNode = doc.body.firstChild;
}
is(resultNode.tagName, shouldSucceed ? tag.toUpperCase() : "P", "tag was changed");
}
function formatBlockTests(tags, shouldSucceed)
{
var html = "<p>Content</p>";
for (var i = 0; i < tags.length; ++i) {
var tag = tags[i];
var resultTag = tag.toUpperCase();
doc.body.innerHTML = html;
testFormatBlock(tag, false, shouldSucceed);
doc.body.innerHTML = html;
testFormatBlock(tag, true, shouldSucceed);
}
}
doc.designMode = "on";
var goodTags = [ "address",
"blockquote",
"dd",
"div",
"dl",
"dt",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"p",
"pre" ];
var badTags = [ "b",
"i",
"span",
"foo" ];
formatBlockTests(goodTags, true);
formatBlockTests(badTags, false);
SimpleTest.finish();

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

@ -1,9 +1,12 @@
<html>
<html class="reftest-wait">
<head>
<script>
function boom() {
var iframe = document.getElementById('inner');
iframe.src = iframe.src;
iframe.addEventListener("load", function() {
document.documentElement.removeAttribute("class");
}, false);
iframe.src = "data:text/html,";
dump("Outer onload\n");
}
</script>

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

@ -100,14 +100,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
mEditor: null
};
var progress;
var progress, progressListener;
function runTest() {
var newEditorElement = document.getElementById("editor");
newEditorElement.makeEditable("html", true);
var docShell = newEditorElement.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell;
progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress);
var progressListener = new EditorContentListener(newEditorElement);
progressListener = new EditorContentListener(newEditorElement);
progress.addProgressListener(progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
newEditorElement.setAttribute("src", "data:text/html,");
}

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

@ -90,14 +90,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616590
mEditor: null
};
var progress;
var progress, progressListener;
function runTest() {
var editorElement = document.getElementById("editor");
editorElement.makeEditable("htmlmail", true);
var docShell = editorElement.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell;
progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress);
var progressListener = new EditorContentListener(editorElement);
progressListener = new EditorContentListener(editorElement);
progress.addProgressListener(progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
editorElement.setAttribute("src", "data:text/html,");
}

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

@ -112,9 +112,9 @@ nsMIMEInfoAndroid::GetMimeInfoForFileExt(const nsACString& aFileExt,
mozilla::AndroidBridge::Bridge()->
GetMimeTypeFromExtensions(aFileExt, mimeType);
nsresult rv = GetMimeInfoForMimeType(mimeType, aMimeInfo);
NS_ENSURE_SUCCESS(rv, rv);
return (*aMimeInfo)->SetPrimaryExtension(aFileExt);
PRBool found = GetMimeInfoForMimeType(mimeType, aMimeInfo);
(*aMimeInfo)->SetPrimaryExtension(aFileExt);
return found;
}
/**

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

@ -154,6 +154,7 @@ nsAppShell::Observe(nsISupports* aSubject,
// We need to ensure no observers stick around after XPCOM shuts down
// or we'll see crashes, as the app shell outlives XPConnect.
mObserversHash.Clear();
return nsBaseAppShell::Observe(aSubject, aTopic, aData);
} else if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) && (
!wcscmp((const wchar_t*)aData, L"intl.locale.matchOS") ||
!wcscmp((const wchar_t*)aData, L"general.useragent.locale"))) {
@ -171,8 +172,7 @@ nsAppShell::Observe(nsISupports* aSubject,
bridge->SetSelectedLocale(EmptyCString());
return NS_OK;
}
return nsBaseAppShell::Observe(aSubject, aTopic, aData);
return NS_OK;
}
void