Merge mozilla-central and inbound

This commit is contained in:
Ed Morley 2013-05-24 10:07:13 +01:00
commit 0f5153ca0a
39 changed files with 489 additions and 387 deletions

View File

@ -17,7 +17,7 @@
#
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 874640 touched webidl, so Windows needs to clobber
Bug 868047 - Adding a field to FrameMetrics affects ContainerLayer class size
Alternative to clobber is to run ./config.status from the objdir and to
touch the CLOBBER file in the objdir.

View File

@ -23,7 +23,6 @@ MOCHITEST_A11Y_FILES = \
test_passwords.html \
test_selection.html \
test_singleline.html \
test_whitespaces.html \
test_wordboundary.html \
test_words.html \
$(NULL)

View File

@ -33,22 +33,6 @@
////////////////////////////////////////////////////////////////////////
// getTextAfterOffset
// BOUNDARY_WORD_START
testTextAfterOffset(0, BOUNDARY_WORD_START, "two ", 9, 13, IDs);
testTextAfterOffset(8, BOUNDARY_WORD_START, "two ", 9, 13,
"div", kOk, kOk, kOk,
"divbr", kTodo, kTodo, kTodo,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kOk, kOk, kOk);
testTextAfterOffset(9, BOUNDARY_WORD_START, "words\n", 13, 19, IDs);
// BOUNDARY_WORD_END
testTextAfterOffset(0, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAfterOffset(6, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAfterOffset(7, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAfterOffset(8, BOUNDARY_WORD_END, " words", 12, 18, IDs);
// BOUNDARY_LINE_START
testTextAfterOffset(0, BOUNDARY_LINE_START, "\n", 8, 9,
"div", kTodo, kTodo, kTodo,
@ -122,40 +106,6 @@
////////////////////////////////////////////////////////////////////////
// getTextBeforeOffset
// BOUNDARY_WORD_START
testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(7, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(8, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(9, BOUNDARY_WORD_START, "oneword\n\n", 0, 9, IDs);
testTextBeforeOffset(13, BOUNDARY_WORD_START, "two ", 9, 13, IDs);
testTextBeforeOffset(18, BOUNDARY_WORD_START, "two ", 9, 13, IDs);
testTextBeforeOffset(19, BOUNDARY_WORD_START, "two ", 9, 13, IDs);
// BOUNDARY_WORD_END
testTextBeforeOffset(0, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(7, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(8, BOUNDARY_WORD_END, "oneword", 0, 7,
"div", kOk, kOk, kOk,
"divbr", kTodo, kOk, kTodo,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kOk, kTodo,
"textarea", kOk, kOk, kOk);
testTextBeforeOffset(9, BOUNDARY_WORD_END, "oneword", 0, 7,
"div", kOk, kOk, kOk,
"divbr", kTodo, kOk, kTodo,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kOk, kTodo,
"textarea", kOk, kOk, kOk);
testTextBeforeOffset(12, BOUNDARY_WORD_END, "oneword", 0, 7, IDs);
testTextBeforeOffset(13, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextBeforeOffset(18, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextBeforeOffset(19, BOUNDARY_WORD_END, " words", 12, 18,
"div", kOk, kOk, kOk,
"divbr", kTodo, kTodo, kTodo,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kOk, kOk, kOk);
// BOUNDARY_LINE_START
testTextBeforeOffset(0, BOUNDARY_LINE_START, "", 0, 0,
"div", kOk, kOk, kOk,
@ -229,29 +179,6 @@
////////////////////////////////////////////////////////////////////////
// getTextAtOffset
// BOUNDARY_WORD_START
testTextAtOffset(0, BOUNDARY_WORD_START, "oneword\n\n", 0, 9, IDs);
testTextAtOffset(8, BOUNDARY_WORD_START, "oneword\n\n", 0, 9,
"div", kOk, kOk, kOk,
"divbr", kTodo, kTodo, kTodo,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kOk, kOk, kOk);
testTextAtOffset(9, BOUNDARY_WORD_START, "two ", 9, 13, IDs);
testTextAtOffset(13, BOUNDARY_WORD_START, "words\n", 13, 19, IDs);
// BOUNDARY_WORD_END
testTextAtOffset(0, BOUNDARY_WORD_END, "oneword", 0, 7, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAtOffset(9, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAtOffset(12, BOUNDARY_WORD_END, " words", 12, 18, IDs);
testTextAtOffset(13, BOUNDARY_WORD_END, " words", 12, 18,
"div", kOk, kOk, kOk,
"divbr", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"editablebr", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
// BOUNDARY_LINE_START
testTextAtOffset(0, BOUNDARY_LINE_START, "oneword\n", 0, 8,
"div", kTodo, kOk, kTodo,

View File

@ -28,30 +28,6 @@
var IDs = [ "input", "div", "editable", "textarea" ];
var regularIDs = [ "input", "div", "editable" ];
// BOUNDARY_WORD_START
testTextAfterOffset(0, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextAfterOffset(1, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextAfterOffset(5, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextAfterOffset(6, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
testTextAfterOffset(7, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
testTextAfterOffset(8, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
testTextAfterOffset(9, BOUNDARY_WORD_START, "", 15, 15, IDs);
testTextAfterOffset(11, BOUNDARY_WORD_START, "", 15, 15, IDs);
testTextAfterOffset(14, BOUNDARY_WORD_START, "", 15, 15, IDs);
testTextAfterOffset(15, BOUNDARY_WORD_START, "", 15, 15, IDs);
// BOUNDARY_WORD_END
testTextAfterOffset(0, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAfterOffset(1, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAfterOffset(5, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAfterOffset(6, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAfterOffset(7, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAfterOffset(8, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAfterOffset(9, BOUNDARY_WORD_END, "", 15, 15, IDs);
testTextAfterOffset(11, BOUNDARY_WORD_END, "", 15, 15, IDs);
testTextAfterOffset(14, BOUNDARY_WORD_END, "", 15, 15, IDs);
testTextAfterOffset(15, BOUNDARY_WORD_END, "", 15, 15, IDs);
// BOUNDARY_LINE_START
testTextAfterOffset(0, BOUNDARY_LINE_START, "", 15, 15,
"input", kTodo, kTodo, kOk,
@ -101,30 +77,6 @@
var IDs = [ "input", "div", "editable", "textarea" ];
// BOUNDARY_WORD_START
testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(1, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(5, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(6, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
testTextBeforeOffset(7, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
testTextBeforeOffset(8, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
testTextBeforeOffset(9, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextBeforeOffset(10, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextBeforeOffset(14, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextBeforeOffset(15, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
// BOUNDARY_WORD_END
testTextBeforeOffset(0, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(1, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(5, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(6, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextBeforeOffset(7, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextBeforeOffset(8, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextBeforeOffset(9, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextBeforeOffset(10, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextBeforeOffset(14, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextBeforeOffset(15, BOUNDARY_WORD_END, " my", 5, 8, IDs);
// BOUNDARY_LINE_START
testTextBeforeOffset(0, BOUNDARY_LINE_START, "", 0, 0,
"input", kOk, kOk, kOk,
@ -171,30 +123,6 @@
IDs = [ "input", "div", "editable", "textarea" ];
regularIDs = [ "input", "div", "editable" ];
// BOUNDARY_WORD_START
testTextAtOffset(0, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
testTextAtOffset(1, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
testTextAtOffset(5, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
testTextAtOffset(6, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextAtOffset(7, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextAtOffset(8, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
testTextAtOffset(9, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
testTextAtOffset(10, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
testTextAtOffset(14, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
testTextAtOffset(15, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
// BOUNDARY_WORD_END
testTextAtOffset(0, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextAtOffset(1, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextAtOffset(5, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAtOffset(6, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAtOffset(7, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAtOffset(9, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAtOffset(10, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAtOffset(14, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAtOffset(15, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
// BOUNDARY_LINE_START
testTextAtOffset(0, BOUNDARY_LINE_START, "hello my friend", 0, 15, IDs);
testTextAtOffset(1, BOUNDARY_LINE_START, "hello my friend", 0, 15, IDs);

View File

@ -1,209 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>getText... methods tests on string with whitespaces for plain text containers</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<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()
{
// __B__r__a__v__e__ __S__i__r__ __ __R__o__b__i__n__ __ __ __r__a__n
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
////////////////////////////////////////////////////////////////////////
// getTextAfterOffset
var IDs = [ "input", "div", "editable", "textarea" ];
// BOUNDARY_WORD_START
testTextAfterOffset(0, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
testTextAfterOffset(5, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
testTextAfterOffset(6, BOUNDARY_WORD_START, "Robin ", 11, 19, IDs);
testTextAfterOffset(9, BOUNDARY_WORD_START, "Robin ", 11, 19, IDs);
testTextAfterOffset(10, BOUNDARY_WORD_START, "Robin ", 11, 19, IDs);
testTextAfterOffset(11, BOUNDARY_WORD_START, "ran", 19, 22, IDs);
testTextAfterOffset(16, BOUNDARY_WORD_START, "ran", 19, 22, IDs);
testTextAfterOffset(18, BOUNDARY_WORD_START, "ran", 19, 22, IDs);
testTextAfterOffset(19, BOUNDARY_WORD_START, "", 22, 22, IDs);
// BOUNDARY_WORD_END
testTextAfterOffset(0, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAfterOffset(4, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAfterOffset(5, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAfterOffset(6, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAfterOffset(8, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAfterOffset(9, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAfterOffset(10, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAfterOffset(11, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAfterOffset(15, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAfterOffset(16, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAfterOffset(17, BOUNDARY_WORD_END, "", 22, 22, IDs);
testTextAfterOffset(18, BOUNDARY_WORD_END, "", 22, 22, IDs);
testTextAfterOffset(19, BOUNDARY_WORD_END, "", 22, 22, IDs);
testTextAfterOffset(21, BOUNDARY_WORD_END, "", 22, 22, IDs);
testTextAfterOffset(22, BOUNDARY_WORD_END, "", 22, 22, IDs);
////////////////////////////////////////////////////////////////////////
// getTextBeforeOffset
var IDs = [ "input", "div", "editable", "textarea" ];
// BOUNDARY_WORD_START
testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(1, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(5, BOUNDARY_WORD_START, "", 0, 0, IDs);
testTextBeforeOffset(6, BOUNDARY_WORD_START, "Brave ", 0, 6, IDs);
testTextBeforeOffset(9, BOUNDARY_WORD_START, "Brave ", 0, 6, IDs);
testTextBeforeOffset(10, BOUNDARY_WORD_START, "Brave ", 0, 6, IDs);
testTextBeforeOffset(11, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
testTextBeforeOffset(15, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
testTextBeforeOffset(16, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
testTextBeforeOffset(17, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
testTextBeforeOffset(18, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
testTextBeforeOffset(19, BOUNDARY_WORD_START, "Robin ", 11, 19, IDs);
testTextBeforeOffset(20, BOUNDARY_WORD_START, "Robin ", 11, 19, IDs);
testTextBeforeOffset(21, BOUNDARY_WORD_START, "Robin ", 11, 19, IDs);
// BOUNDARY_WORD_END
testTextBeforeOffset(0, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(1, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(4, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(5, BOUNDARY_WORD_END, "", 0, 0, IDs);
testTextBeforeOffset(6, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextBeforeOffset(7, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextBeforeOffset(8, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextBeforeOffset(9, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextBeforeOffset(10, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextBeforeOffset(11, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextBeforeOffset(15, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextBeforeOffset(16, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextBeforeOffset(17, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextBeforeOffset(18, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextBeforeOffset(19, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextBeforeOffset(21, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextBeforeOffset(22, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
////////////////////////////////////////////////////////////////////////
// getTextAtOffset
// BOUNDARY_WORD_START
testTextAtOffset(0, BOUNDARY_WORD_START, "Brave ", 0, 6,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(5, BOUNDARY_WORD_START, "Brave ", 0, 6,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(6, BOUNDARY_WORD_START, "Sir ", 6, 11,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(8, BOUNDARY_WORD_START, "Sir ", 6, 11,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(9, BOUNDARY_WORD_START, "Sir ", 6, 11,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(10, BOUNDARY_WORD_START, "Sir ", 6, 11,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(11, BOUNDARY_WORD_START, "Robin ", 11, 19,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(15, BOUNDARY_WORD_START, "Robin ", 11, 19,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(16, BOUNDARY_WORD_START, "Robin ", 11, 19,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(17, BOUNDARY_WORD_START, "Robin ", 11, 19,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(18, BOUNDARY_WORD_START, "Robin ", 11, 19,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextAtOffset(19, BOUNDARY_WORD_START, "ran", 19, 22, IDs);
testTextAtOffset(21, BOUNDARY_WORD_START, "ran", 19, 22, IDs);
testTextAtOffset(22, BOUNDARY_WORD_START, "ran", 19, 22, IDs);
// BOUNDARY_WORD_END
testTextAtOffset(0, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextAtOffset(4, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextAtOffset(5, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAtOffset(6, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAtOffset(9, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(10, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(11, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(15, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(16, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(17, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(18, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(19, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(20, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(21, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(22, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="getText... methods tests on string with whitespaces for plain text containers"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=610568">
Bug 610568
</a>
<a target="_blank"
title="getTextAtOffset for word boundaries: beginning of a new life"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=853340">
Bug 853340
</a>
<a target="_blank"
title="getTextBeforeOffset for word boundaries: evolving"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=855732">
Bug 855732
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
<input id="input" value="Brave Sir Robin ran"/>
<div id="div">Brave Sir Robin ran</div>
<div id="editable" contenteditable="true">Brave Sir Robin ran</div>
<textarea id="textarea" cols="300">Brave Sir Robin ran</textarea>
</pre>
</body>
</html>

View File

@ -16,7 +16,9 @@
function doTest()
{
// "hello"
var ids = [ "i1", "d1", "e1" ];
// __h__e__l__l__o__
// 0 1 2 3 4 5
var ids = [ "i1", "d1", "e1", "t1" ];
testTextBeforeOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "", 0, 0 ] ]);
testTextBeforeOffset(ids, BOUNDARY_WORD_END,
@ -33,7 +35,9 @@
[ [ 0, 5, "", 5, 5 ] ]);
// "hello "
var ids = [ "i2", "d2", "e2" ];
// __h__e__l__l__o__ __
// 0 1 2 3 4 5 6
var ids = [ "i2", "d2", "e2", "t2" ];
testTextBeforeOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 6, "", 0, 0 ] ]);
testTextBeforeOffset(ids, BOUNDARY_WORD_END,
@ -63,7 +67,16 @@
]);
// "hello all"
ids = [ "i6", "d6", "e6" ];
// __h__e__l__l__o__ __a__l__l__
// 0 1 2 3 4 5 6 7 8 9
ids = [ "i6", "d6", "e6", "t6" ];
testTextBeforeOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "", 0, 0 ],
[ 6, 9, "hello ", 0, 6 ]]);
testTextBeforeOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 5, "", 0, 0 ],
[ 6, 9, "hello", 0, 5 ] ]);
testTextAtOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "hello ", 0, 6 ],
[ 6, 9, "all", 6, 9 ] ]);
@ -71,8 +84,26 @@
[ [ 0, 4, "hello", 0, 5 ],
[ 5, 9, " all", 5, 9 ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "all", 6, 9 ],
[ 6, 9, "", 9, 9 ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 5, " all", 5, 9 ],
[ 6, 9, "", 9, 9 ] ]);
// "hello my friend"
ids = [ "i7", "d7", "e7" ];
// __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ids = [ "i7", "d7", "e7", "t7" ];
testTextBeforeOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "", 0, 0 ],
[ 6, 8, "hello ", 0, 6 ],
[ 9, 15, "my ", 6, 9 ] ]);
testTextBeforeOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 5, "", 0, 0 ],
[ 6, 8, "hello", 0, 5 ],
[ 9, 15, " my", 5, 8 ] ]);
testTextAtOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "hello ", 0, 6 ],
[ 6, 8, "my ", 6, 9 ],
@ -82,6 +113,115 @@
[ 5, 7, " my", 5, 8 ],
[ 8, 15, " friend", 8, 15] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "my ", 6, 9 ],
[ 6, 8, "friend", 9, 15 ],
[ 9, 15, "", 15, 15 ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 5, " my", 5, 8 ],
[ 6, 8, " friend", 8, 15 ],
[ 9, 15, "", 15, 15 ] ]);
// "Brave Sir Robin ran"
// __B__r__a__v__e__ __S__i__r__ __ __R__o__b__i__n__ __ __ __r__a__n__
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
ids = [ "i8", "d8", "e8", "t8" ];
testTextBeforeOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "", 0, 0 ],
[ 6, 10, "Brave ", 0, 6 ],
[ 11, 18, "Sir ", 6, 11 ],
[ 19, 22, "Robin ", 11, 19 ] ]);
testTextBeforeOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 5, "", 0, 0 ],
[ 6, 9, "Brave", 0, 5 ],
[ 10, 16, " Sir", 5, 9 ],
[ 17, 22, " Robin", 9, 16 ] ]);
testTextAtOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "Brave ", 0, 6 ],
[ 6, 10, "Sir ", 6, 11 ],
[ 11, 18, "Robin ", 11, 19 ],
[ 19, 22, "ran", 19, 22 ] ]);
testTextAtOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 4, "Brave", 0, 5 ],
[ 5, 8, " Sir", 5, 9 ],
[ 9, 15, " Robin", 9, 16 ],
[ 16, 22, " ran", 16, 22 ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 5, "Sir ", 6, 11 ],
[ 6, 10, "Robin ", 11, 19 ],
[ 11, 18, "ran", 19, 22 ],
[ 19, 22, "", 22, 22 ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 5, " Sir", 5, 9 ],
[ 6, 9, " Robin", 9, 16 ],
[ 10, 16, " ran", 16, 22 ],
[ 17, 22, "", 22, 22 ] ]);
// 'oneword
// '
// 'two words
// '
// __o__n__e__w__o__r__d__\n
// 0 1 2 3 4 5 6 7
// __\n
// 8
// __t__w__o__ __w__o__r__d__s__\n__
// 9 10 11 12 13 14 15 16 17 18 19
ids = ["ml_div1", "ml_divbr1", "ml_ediv1", "ml_edivbr1", "ml_t1"];
testTextBeforeOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 8, "", 0, 0 ],
[ 9, 12, "oneword\n\n", 0, 9 ],
[ 13, 19, "two ", 9, 13 ] ]);
testTextBeforeOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 7, "", 0, 0 ],
[ 8, 12, "oneword", 0, 7,
[ [ 8, "ml_divbr1", kTodo, kOk, kTodo ],
[ 8, "ml_edivbr1", kTodo, kOk, kTodo ],
[ 9, "ml_divbr1", kTodo, kOk, kTodo ],
[ 9, "ml_edivbr1", kTodo, kOk, kTodo ] ] ],
[ 13, 18, "\n\ntwo", 7, 12 ],
[ 19, 19, " words", 12, 18,
[ [ 19, "ml_divbr1", kTodo, kTodo, kTodo, ],
[ 19, "ml_edivbr1", kTodo, kTodo, kTodo, ] ] ]
] );
testTextAtOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 8, "oneword\n\n", 0, 9,
[ [ 7, "ml_divbr1", kTodo, kTodo, kTodo ],
[ 7, "ml_edivbr1", kTodo, kTodo, kTodo ],
[ 8, "ml_divbr1", kTodo, kTodo, kTodo ],
[ 8, "ml_edivbr1", kTodo, kTodo, kTodo ] ] ],
[ 9, 12, "two ", 9, 13 ],
[ 13, 19, "words\n", 13, 19 ] ]);
testTextAtOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 6, "oneword", 0, 7 ],
[ 7, 11, "\n\ntwo", 7, 12 ],
[ 12, 17, " words", 12, 18 ],
[ 18, 19, "\n", 18, 19,
[ [ 18, "ml_divbr1", kTodo, kTodo, kOk ],
[ 18, "ml_edivbr1", kTodo, kTodo, kOk ],
[ 19, "ml_divbr1", kTodo, kTodo, kOk ],
[ 19, "ml_edivbr1", kTodo, kTodo, kOk ] ] ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 8, "two ", 9, 13,
[ [ 7, "ml_divbr1", kTodo, kTodo, kTodo ],
[ 7, "ml_edivbr1", kTodo, kTodo, kTodo ],
[ 8, "ml_divbr1", kTodo, kTodo, kTodo ],
[ 8, "ml_edivbr1", kTodo, kTodo, kTodo ] ] ],
[ 9, 12, "words\n", 13, 19 ],
[ 13, 19, "", 19, 19 ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 7, "\n\ntwo", 7, 12 ],
[ 8, 12, " words", 12, 18 ],
[ 13, 18, "\n", 18, 19,
[ [ 18, "ml_divbr1", kTodo, kTodo, kOk ],
[ 18, "ml_edivbr1", kTodo, kTodo, kOk ] ] ],
[ 19, 19, "", 19, 19 ] ]);
SimpleTest.finish();
}
@ -99,18 +239,46 @@
<input id="i1" value="hello"/>
<div id="d1">hello</div>
<div id="e1" contenteditable="true">hello</div>
<textarea id="t1">hello</textarea>
<input id="i2" value="hello "/>
<pre><div id="d2">hello </div></pre>
<div id="e2" contenteditable="true">hello </div>
<textarea id="t2">hello </textarea>
<input id="i6" value="hello all"/>
<div id="d6">hello all</div>
<div id="e6" contenteditable="true">hello all</div>
<textarea id="t6">hello all</textarea>
<input id="i7" value="hello my friend"/>
<div id="d7">hello my friend</div>
<div id="e7" contenteditable="true">hello my friend</div>
<textarea id="t7">hello my friend</textarea>
<input id="i8" value="Brave Sir Robin ran"/>
<pre>
<div id="d8">Brave Sir Robin ran</div>
<div id="e8" contenteditable="true">Brave Sir Robin ran</div>
</pre>
<textarea id="t8" cols="300">Brave Sir Robin ran</textarea>
<pre>
<div id="ml_div1">oneword
two words
</div>
<div id="ml_divbr1">oneword<br/><br/>two words<br/></div>
<div id="ml_ediv1" contenteditable="true">oneword
two words
</div>
<div id="ml_edivbr1" contenteditable="true">oneword<br/><br/>two words<br/></div>
<textarea id="ml_t1" cols="300">oneword
two words
</textarea>
</pre>
</body>
</html>

View File

@ -373,12 +373,6 @@ Attr::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
Attr::AppendChildTo(nsIContent* aKid, bool aNotify)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
Attr::RemoveChildAt(uint32_t aIndex, bool aNotify)
{

View File

@ -64,7 +64,6 @@ public:
virtual int32_t IndexOf(const nsINode* aPossibleChild) const MOZ_OVERRIDE;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, bool aNotify);
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual already_AddRefed<nsIURI> GetBaseURI() const;

View File

@ -3466,6 +3466,7 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
mResponseBody.Truncate();
mResponseText.Truncate();
mResultArrayBuffer = nullptr;
mArrayBufferBuilder.reset();
}
}

View File

@ -179,8 +179,8 @@ AudioChannelsDownMix(const nsTArray<const void*>& aChannelArray,
for (uint32_t s = 0; s < aDuration; ++s) {
// Reserve an extra junk channel at the end for the cases where we
// want an input channel to contribute to nothing
float outputChannels[CUSTOM_CHANNEL_LAYOUTS];
memset(outputChannels, 0, sizeof(float)*(CUSTOM_CHANNEL_LAYOUTS - 1));
float outputChannels[CUSTOM_CHANNEL_LAYOUTS + 1];
memset(outputChannels, 0, sizeof(float)*(CUSTOM_CHANNEL_LAYOUTS));
for (uint32_t c = 0; c < inputChannelCount; ++c) {
outputChannels[m.mInputDestination[c]] +=
m.mInputCoefficient[c]*(static_cast<const float*>(inputChannels[c]))[s];

View File

@ -394,13 +394,19 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
AudioSegment* segment = track->Get<AudioSegment>();
mLastChunks.SetLength(1);
mLastChunks[0].SetNull(0);
uint16_t outputCount = std::max(uint16_t(1), mEngine->OutputCount());
mLastChunks.SetLength(outputCount);
if (mInCycle) {
// XXX DelayNode not supported yet so just produce silence
mLastChunks[0].SetNull(WEBAUDIO_BLOCK_SIZE);
for (uint16_t i = 0; i < outputCount; ++i) {
mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
}
} else {
for (uint16_t i = 0; i < outputCount; ++i) {
mLastChunks[i].SetNull(0);
}
// We need to generate at least one input
uint16_t maxInputs = std::max(uint16_t(1), mEngine->InputCount());
OutputChunks inputChunks;

View File

@ -0,0 +1,11 @@
<script>
var Context0= new AudioContext()
var ChannelSplitter0=Context0.createChannelSplitter();
var BiquadFilter0=Context0.createBiquadFilter();
var WaveShaper0=Context0.createWaveShaper();
ChannelSplitter0.connect(BiquadFilter0,3,0);
ChannelSplitter0.connect(WaveShaper0);
BiquadFilter0.disconnect();
WaveShaper0.connect(ChannelSplitter0);
</script>

View File

@ -0,0 +1,81 @@
<script>
Logger = {}
Logger.error = function(e) {}
Logger.comment = function(e) {}
try { o0 = document.createElement('audio'); } catch(e) { Logger.error(Logger.comment(e)); }
try { (document.body || document.documentElement).appendChild(o0); } catch(e) { Logger.error(Logger.comment(e)); }
try { o1 = new AudioContext(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o2 = o1.createGain(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3 = o1.createBufferSource(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.buffer = function() { o4 = o1.createBuffer(1, 3, 52970);
o5 = o4.getChannelData(0);
for(var i=0; i<3; ++i) {
o5[i] = Math.sin(i * 63);
}
return o4;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.buffer = function() { o6 = o1.createBuffer(1, 15, 41218);
o7 = o6.getChannelData(0);
for(var i=0; i<15; ++i) {
o7[i] = Math.sin(i * 0);
}
return o6;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.buffer = function() { o8 = o1.createBuffer(1, 0, 49074);
o9 = o8.getChannelData(0);
for(var i=0; i<0; ++i) {
o9[i] = Math.sin(i * 0);
}
return o8;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.buffer = function() { o10 = o1.createBuffer(1, 31, 86527);
o11 = o10.getChannelData(0);
for(var i=0; i<31; ++i) {
o11[i] = Math.sin(i * 127);
}
return o10;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.noteOff(-1) } catch(e) { Logger.error(Logger.comment(e)); }
/* [Exception... "An attempt was made to use an object that is not, or is no longer, usable" code: "11" nsresult: "0x8053000b (InvalidStateError)" location: "file:///Users/cdiehl/dev/projects/peach/Peach/Utilities/JS/undefined.js Line: 602"] */
try { o3.channelCountMode = 'explicit'; } catch(e) { Logger.error(Logger.comment(e)); }
try { o12 = o1.createBiquadFilter(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.buffer = function() { o13 = o1.createBuffer(1, 63, 28347);
o14 = o13.getChannelData(0);
for(var i=0; i<63; ++i) {
o14[i] = Math.sin(i * 15);
}
return o13;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o12.channelCount = 1; } catch(e) { Logger.error(Logger.comment(e)); }
try { o12.connect(GainNode, 65536, 0) } catch(e) { Logger.error(Logger.comment(e)); }
/* TypeError: Value does not implement interface AudioNode. */
try { o3.buffer = function() { o15 = o1.createBuffer(1, 1, 72540);
o16 = o15.getChannelData(0);
for(var i=0; i<1; ++i) {
o16[i] = Math.sin(i * 7);
}
return o15;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o12.getFrequencyResponse(Float32Array(7), Float32Array(127), Float32Array(7)) } catch(e) { Logger.error(Logger.comment(e)); }
try { o12.getFrequencyResponse(Float32Array(15), Float32Array(127), Float32Array(7)) } catch(e) { Logger.error(Logger.comment(e)); }
try { o17 = document.createElement('audio'); } catch(e) { Logger.error(Logger.comment(e)); }
try { (document.body || document.documentElement).appendChild(o0); } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.buffer = function() { o18 = o1.createBuffer(1, 7, 91261);
o19 = o18.getChannelData(0);
for(var i=0; i<7; ++i) {
o19[i] = Math.sin(i * 7);
}
return o18;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
try { o12.getFrequencyResponse(Float32Array(31), Float32Array(31), Float32Array(127)) } catch(e) { Logger.error(Logger.comment(e)); }
try { o20 = o1.createChannelSplitter(1, 2, 4, 16, 32); } catch(e) { Logger.error(Logger.comment(e)); }
try { o12.channelCountMode = 'explicit'; } catch(e) { Logger.error(Logger.comment(e)); }
try { o3.buffer = function() { o21 = o1.createBuffer(1, 0, 14451);
o22 = o21.getChannelData(0);
for(var i=0; i<0; ++i) {
o22[i] = Math.sin(i * 63);
}
return o21;
}(); } catch(e) { Logger.error(Logger.comment(e)); }
</script>

View File

@ -18,3 +18,5 @@ load 852838.html
load 874869.html
load 874915.html
load 874934.html
load 874952.html
load 875144.html

View File

@ -136,8 +136,8 @@ AudioContext::CreateBuffer(JSContext* aJSContext, uint32_t aNumberOfChannels,
uint32_t aLength, float aSampleRate,
ErrorResult& aRv)
{
if (aSampleRate < 8000 || aSampleRate > 96000) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
if (aSampleRate < 8000 || aSampleRate > 96000 || !aLength) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}

View File

@ -37,12 +37,15 @@ addLoadEvent(function() {
}
expectException(function() {
context.createBuffer(2, 2048, 7999);
}, DOMException.SYNTAX_ERR);
}, DOMException.NOT_SUPPORTED_ERR);
expectException(function() {
context.createBuffer(2, 2048, 96001);
}, DOMException.SYNTAX_ERR);
}, DOMException.NOT_SUPPORTED_ERR);
context.createBuffer(2, 2048, 8000); // no exception
context.createBuffer(2, 2048, 96000); // no exception
expectException(function() {
context.createBuffer(2, 0, 48000);
}, DOMException.NOT_SUPPORTED_ERR);
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
});

View File

@ -14,15 +14,26 @@ var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var buffer = context.createBuffer(1, 0, context.sampleRate);
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
var source = context.createBufferSource();
source.buffer = buffer;
source.loop = true;
source.loopStart = source.loopEnd = 1 / context.sampleRate;
source.start(0);
return source;
},
createExpectedBuffers: function(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return buffer;
},
};
runTest();

View File

@ -11,7 +11,7 @@
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
var ctx = new AudioContext();
ctx.createBuffer(0, 0, ctx.sampleRate);
ctx.createBuffer(0, 1, ctx.sampleRate);
ok(true, "The test should not crash during CC");
SpecialPowers.clearUserPref("media.webaudio.enabled");

View File

@ -4037,9 +4037,16 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
if (aLoadFlags & LOAD_FLAGS_URI_IS_UTF8) {
fixupFlags |= nsIURIFixup::FIXUP_FLAG_USE_UTF8;
}
nsCOMPtr<nsIInputStream> fixupStream;
rv = sURIFixup->CreateFixupURI(uriString, fixupFlags,
getter_AddRefs(postStream),
getter_AddRefs(fixupStream),
getter_AddRefs(uri));
if (fixupStream) {
// CreateFixupURI only returns a post data stream if it succeeded
// and changed the URI, in which case we should override the
// passed-in post data.
postStream = fixupStream;
}
}
// else no fixup service so just use the URI we created and see
// what happens

View File

@ -69,6 +69,8 @@ MOCHITEST_BROWSER_FILES = \
file_bug234628-11-child.xhtml \
file_bug234628-11-child.xhtml^headers^ \
browser_search_notification.js \
browser_loadURI.js \
print_postdata.sjs \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,45 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const Cc = Components.classes;
const Ci = Components.interfaces;
const gPostData = "postdata=true";
function test() {
waitForExplicitFinish();
let tab = gBrowser.selectedTab = gBrowser.addTab();
registerCleanupFunction(function () {
gBrowser.removeTab(tab);
});
var dataStream = Cc["@mozilla.org/io/string-input-stream;1"].
createInstance(Ci.nsIStringInputStream);
dataStream.data = gPostData;
var postStream = Cc["@mozilla.org/network/mime-input-stream;1"].
createInstance(Ci.nsIMIMEInputStream);
postStream.addHeader("Content-Type", "application/x-www-form-urlencoded");
postStream.addContentLength = true;
postStream.setData(dataStream);
tab.linkedBrowser.loadURIWithFlags("http://mochi.test:8888/browser/docshell/test/browser/print_postdata.sjs", 0, null, null, postStream);
onTabLoad(tab, function (doc) {
var bodyText = doc.body.textContent;
is(bodyText, gPostData, "post data was submitted correctly");
finish();
});
}
function onTabLoad(tab, cb) {
tab.linkedBrowser.addEventListener("load", function listener(event) {
if (event.originalTarget != tab.linkedBrowser.contentDocument ||
event.target.location.href == "about:blank") {
info("skipping spurious load event");
return;
}
tab.linkedBrowser.removeEventListener("load", listener, true);
cb(tab.linkedBrowser.contentDocument);
}, true);
}

View File

@ -0,0 +1,22 @@
const CC = Components.Constructor;
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
"nsIBinaryInputStream",
"setInputStream");
function handleRequest(request, response) {
response.setHeader("Content-Type", "text/plain", false);
if (request.method == "GET") {
response.write(request.queryString);
} else {
var body = new BinaryInputStream(request.bodyInputStream);
var avail;
var bytes = [];
while ((avail = body.available()) > 0)
Array.prototype.push.apply(bytes, body.readByteArray(avail));
var data = String.fromCharCode.apply(null, bytes);
response.bodyOutputStream.write(data, data.length);
}
}

View File

@ -522,6 +522,21 @@ nsDOMWindowUtils::GetIsFirstPaint(bool *aIsFirstPaint)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetPresShellId(uint32_t *aPresShellId)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsIPresShell* presShell = GetPresShell();
if (presShell) {
*aPresShellId = presShell->GetPresShellId();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* static */
mozilla::widget::Modifiers
nsDOMWindowUtils::GetWidgetModifiers(int32_t aModifiers)

View File

@ -195,6 +195,8 @@ interface nsIDOMWindowUtils : nsISupports {
*/
attribute boolean isFirstPaint;
void getPresShellId(out uint32_t aPresShellId);
/**
* Following modifiers are for sent*Event() except sendNative*Event().
* NOTE: MODIFIER_ALT, MODIFIER_CONTROL, MODIFIER_SHIFT and MODIFIER_META

View File

@ -633,7 +633,7 @@ TabChild::HandlePossibleViewportChange()
// Force a repaint with these metrics. This, among other things, sets the
// displayport, so we start with async painting.
RecvUpdateFrame(metrics);
ProcessUpdateFrame(metrics);
}
nsresult
@ -1454,6 +1454,20 @@ ScrollWindowTo(nsIDOMWindow* aWindow, const mozilla::gfx::Point& aPoint)
bool
TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
{
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
uint32_t presShellId;
nsresult rv = utils->GetPresShellId(&presShellId);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv) && aFrameMetrics.mPresShellId != presShellId) {
return true;
}
return ProcessUpdateFrame(aFrameMetrics);
}
bool
TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
{
if (!mCx || !mTabChildGlobal) {
return true;
}

View File

@ -366,6 +366,7 @@ private:
bool InitRenderingState();
void DestroyWindow();
void SetProcessNameToAppName();
bool ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
void DoFakeShow();

View File

@ -10,7 +10,7 @@ load 812785.html
load 834100.html
load 836349.html
load 837324.html
load 855796.html
skip-if(Android) load 855796.html # bug 875640
load 860143.html
load 861958.html
load 863929.html

View File

@ -42,6 +42,7 @@ public:
, mZoom(1, 1)
, mDevPixelsPerCSSPixel(1)
, mMayHaveTouchListeners(false)
, mPresShellId(-1)
{}
// Default copy ctor and operator= are fine
@ -58,7 +59,8 @@ public:
mScrollableRect.IsEqualEdges(aOther.mScrollableRect) &&
mResolution == aOther.mResolution &&
mDevPixelsPerCSSPixel == aOther.mDevPixelsPerCSSPixel &&
mMayHaveTouchListeners == aOther.mMayHaveTouchListeners;
mMayHaveTouchListeners == aOther.mMayHaveTouchListeners &&
mPresShellId == aOther.mPresShellId;
}
bool operator!=(const FrameMetrics& aOther) const
{
@ -67,7 +69,10 @@ public:
bool IsDefault() const
{
return (FrameMetrics() == *this);
FrameMetrics def;
def.mPresShellId = mPresShellId;
return (def == *this);
}
bool IsRootScrollable() const
@ -241,6 +246,8 @@ public:
// Whether or not this frame may have touch listeners.
bool mMayHaveTouchListeners;
uint32_t mPresShellId;
};
}

View File

@ -1044,6 +1044,7 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aMsg, aParam.mZoom);
WriteParam(aMsg, aParam.mDevPixelsPerCSSPixel);
WriteParam(aMsg, aParam.mMayHaveTouchListeners);
WriteParam(aMsg, aParam.mPresShellId);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
@ -1059,7 +1060,8 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aMsg, aIter, &aResult->mResolution) &&
ReadParam(aMsg, aIter, &aResult->mZoom) &&
ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners));
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) &&
ReadParam(aMsg, aIter, &aResult->mPresShellId));
}
};

View File

@ -1064,7 +1064,9 @@ class ArrayBufferBuilder
}
JSObject* getArrayBuffer(JSContext *cx) {
if (capacity_ > length_) {
// we need to check for length_ == 0, because nothing may have been
// added
if (capacity_ > length_ || length_ == 0) {
if (!setCapacity(length_))
return NULL;
}

View File

@ -695,6 +695,8 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
widget->GetBounds(metrics.mCompositionBounds);
}
metrics.mPresShellId = presShell->GetPresShellId();
aRoot->SetFrameMetrics(metrics);
}

View File

@ -1229,6 +1229,8 @@ public:
*/
bool GetIsFirstPaint() const { return mIsFirstPaint; }
uint32_t GetPresShellId() { return mPresShellId; }
/**
* Dispatch a mouse move event based on the most recent mouse position if
* this PresShell is visible. This is used when the contents of the page
@ -1527,6 +1529,8 @@ protected:
bool mSuppressInterruptibleReflows : 1;
bool mScrollPositionClampingScrollPortSizeSet : 1;
uint32_t mPresShellId;
// List of subtrees rooted at style scope roots that need to be restyled.
// When a change to a scoped style sheet is made, we add the style scope
// root to this array rather than setting mStylesHaveChanged = true, since

View File

@ -687,6 +687,7 @@ nsIPresShell::FrameSelection()
//----------------------------------------------------------------------
static bool sSynthMouseMove = true;
static uint32_t sNextPresShellId;
PresShell::PresShell()
: mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE)
@ -713,6 +714,7 @@ PresShell::PresShell()
#else
mIsFirstPaint = true;
#endif
mPresShellId = sNextPresShellId++;
mFrozen = false;
#ifdef DEBUG
mPresArenaAllocCount = 0;

View File

@ -0,0 +1 @@
<a style="font: -2px Verdana;">

View File

@ -64,6 +64,7 @@ load 558943-1.xhtml
load 571105-1.xhtml
load 573127-1.html
load 580685.html
load 585185-1.html
load 592698-1.html
load 601437-1.html
load 601439-1.html

View File

@ -8610,7 +8610,8 @@ CSSParserImpl::ParseFont()
// Get mandatory font-size
nsCSSValue size;
if (! ParseVariant(size, VARIANT_KEYWORD | VARIANT_LP, nsCSSProps::kFontSizeKTable)) {
if (! ParseNonNegativeVariant(size, VARIANT_KEYWORD | VARIANT_LP,
nsCSSProps::kFontSizeKTable)) {
return false;
}

View File

@ -2403,7 +2403,7 @@ var gCSSProperties = {
// Gecko-specific system fonts
"-moz-window", "-moz-document", "-moz-desktop", "-moz-info", "-moz-dialog", "-moz-button", "-moz-pull-down-menu", "-moz-list", "-moz-field", "-moz-workspace",
],
invalid_values: [ "9 fantasy" ]
invalid_values: [ "9 fantasy", "-2px fantasy" ]
},
"font-family": {
domProp: "fontFamily",

View File

@ -38,6 +38,17 @@ const BackgroundPageThumbs = {
* seconds).
*/
capture: function (url, options={}) {
if (isPrivateBrowsingActive()) {
// There's only one, global private-browsing state shared by all private
// windows and the thumbnail browser. Just as if you log into a site in
// one private window you're logged in in all private windows, you're also
// logged in in the thumbnail browser. A crude way to avoid capturing
// sites in this situation is to refuse to capture at all when any private
// windows are open. See bug 870179.
if (options.onDone)
Services.tm.mainThread.dispatch(options.onDone.bind(options, url), 0);
return;
}
let cap = new Capture(url, this._onCaptureOrTimeout.bind(this), options);
this._captureQueue = this._captureQueue || [];
this._captureQueue.push(cap);
@ -297,3 +308,14 @@ function canHostBrowser(win) {
"allowXULXBL");
return permResult == Ci.nsIPermissionManager.ALLOW_ACTION;
}
/**
* Returns true if there are any private windows.
*/
function isPrivateBrowsingActive() {
let wins = Services.ww.getWindowEnumerator();
while (wins.hasMoreElements())
if (PrivateBrowsingUtils.isWindowPrivate(wins.getNext()))
return true;
return false;
}

View File

@ -180,6 +180,20 @@ let tests = [
isnot(imports.BackgroundPageThumbs._thumbBrowser, undefined,
"Thumb browser should exist immediately after capture.");
},
function privateBrowsingActive() {
let url = "http://example.com/";
let file = fileForURL(url);
ok(!file.exists(), "Thumbnail file should not already exist.");
let win = yield openPrivateWindow();
let capturedURL = yield capture(url);
is(capturedURL, url, "Captured URL should be URL passed to capture.");
ok(!file.exists(),
"Thumbnail file should not exist because a private window is open.");
win.close();
},
];
function capture(url, options) {
@ -210,3 +224,18 @@ function wait(ms) {
}, ms);
return deferred.promise;
}
function openPrivateWindow() {
let deferred = imports.Promise.defer();
// from OpenBrowserWindow in browser.js
let win = window.openDialog("chrome://browser/content/", "_blank",
"chrome,all,dialog=no,private",
"about:privatebrowsing");
win.addEventListener("load", function load(event) {
if (event.target == win.document) {
win.removeEventListener("load", load);
deferred.resolve(win);
}
});
return deferred.promise;
}