Bug 1515591 - Remove support for the newlines attribute from the textbox binding r=dao

Differential Revision: https://phabricator.services.mozilla.com/D46620

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexander Surkov 2019-09-20 17:21:20 +00:00
parent 1ea5f188a8
commit bd7c7db7eb
4 changed files with 0 additions and 165 deletions

View File

@ -66,7 +66,6 @@ skip-if = (verify && (os == 'win')) || (debug && (os == 'win') && (bits == 32))
[test_autocomplete_with_composition_on_input.html]
[test_autocomplete_placehold_last_complete.xul]
[test_browser_drop.xul]
[test_bug253481.xul]
tags = clipboard
[test_bug263683.xul]
skip-if = debug && (os == 'win' || os == 'linux')
@ -93,7 +92,6 @@ support-files = bug451540_window.xul
[test_bug509732.xul]
[test_bug557987.xul]
[test_bug562554.xul]
[test_bug570192.xul]
[test_bug624329.xul]
[test_bug792324.xul]
[test_bug1048178.xul]

View File

@ -1,90 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet
href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=253481
-->
<window title="Mozilla Bug 253481"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=253481">Mozilla Bug 253481</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
</body>
<description>
Tests pasting of multi-line content into a single-line xul:textbox.
</description>
<vbox>
<textbox id="pasteintact" newlines="pasteintact"/>
<textbox id="pastetofirst" newlines="pastetofirst"/>
<textbox id="replacewithspaces" newlines="replacewithspaces"/>
<textbox id="strip" newlines="strip"/>
<textbox id="replacewithcommas" newlines="replacewithcommas"/>
<textbox id="stripsurroundingwhitespace" newlines="stripsurroundingwhitespace"/>
</vbox>
<script class="testbody" type="application/javascript">
<![CDATA[
/** Test for Bug 253481 **/
function testPaste(name, element, expected) {
element.value = "";
element.focus();
synthesizeKey("v", { accelKey: true });
is(element.value, expected, name);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
setTimeout(function() {
var testString = "\n hello hello \n world\nworld \n";
var expectedResults = {
// even "pasteintact" strips leading/trailing newlines
"pasteintact": testString.replace(/^\n/, '').replace(/\n$/, ''),
// "pastetofirst" strips leading newlines
"pastetofirst": testString.replace(/^\n/, '').split(/\n/)[0],
// "replacewithspaces" strips trailing newlines first - bug 432415
"replacewithspaces": testString.replace(/\n$/, '').replace(/\n/g,' '),
// "strip" is pretty straightforward
"strip": testString.replace(/\n/g,''),
// "replacewithcommas" strips leading and trailing newlines first
"replacewithcommas": testString.replace(/^\n/, '').replace(/\n$/, '').replace(/\n/g,','),
// "stripsurroundingwhitespace" strips all newlines and whitespace around them
"stripsurroundingwhitespace": testString.replace(/\s*\n\s*/g,'')
};
// Put a multi-line string in the clipboard
SimpleTest.waitForClipboard(testString, function() {
var clip = Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
clip.copyString(testString);
}, function() {
for (let [item, expected] of Object.entries(expectedResults)) {
testPaste(item, $(item), expected);
}
SimpleTest.finish();
}, function() {
ok(false, "Could not copy the string to clipboard, giving up");
SimpleTest.finish();
});
}, 0);
});
]]>
</script>
</window>

View File

@ -1,53 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet
href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=570192
-->
<window title="Mozilla Bug 558406"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript"
src="RegisterUnregisterChrome.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=570192">
Mozilla Bug 570192
</a>
<p id="display">
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<script type="application/javascript">
<![CDATA[
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
addLoadEvent(function() {
try {
var content = document.getElementById("content");
let textbox = document.createElementNS(XUL_NS, "textbox");
textbox.setAttribute("newlines", "pasteintact");
content.appendChild(textbox);
ok(content.firstChild, "created the textbox");
ok(!content.firstChild.editor, "do we have an editor?");
} catch (e) {
ok(false, "Got an exception: " + e);
}
SimpleTest.finish();
});
SimpleTest.waitForExplicitFinish();
]]>
</script>
</window>

View File

@ -129,24 +129,6 @@
</body>
</method>
<method name="_setNewlineHandling">
<body><![CDATA[
var str = this.getAttribute("newlines");
if (str && this.editor) {
const nsIPlaintextEditor = Ci.nsIPlaintextEditor;
for (var x in nsIPlaintextEditor) {
if (/^eNewlines/.test(x)) {
if (str == RegExp.rightContext.toLowerCase()) {
this.editor.QueryInterface(nsIPlaintextEditor)
.newlineHandling = nsIPlaintextEditor[x];
break;
}
}
}
}
]]></body>
</method>
<constructor><![CDATA[
var str = this._cachedInputFieldValue;
if (str) {
@ -154,8 +136,6 @@
delete this._cachedInputFieldValue;
}
this._setNewlineHandling();
if (this.hasAttribute("emptytext"))
this.placeholder = this.getAttribute("emptytext");
]]></constructor>