Bug 527935 - Part 4: Make sure that the input event after paste operations; r=roc a=blocking-final+
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 17 Dec 2010 14:47:11 -0800
changeset 59463 4f03895d544b32b1919de8a0ab4a06402ec6bda7
parent 59462 d52d8f50d2cfebf0b77cc976fab1d7525eaff2b1
child 59464 9bb6c33a5ad1adb502919c704808d9cfd6b643b7
push id17632
push usereakhgari@mozilla.com
push dateSat, 18 Dec 2010 07:39:11 +0000
treeherdermozilla-central@4f03895d544b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, blocking-final
bugs527935
milestone2.0b9pre
first release with
nightly linux32
4f03895d544b / 4.0b9pre / 20101218030347 / files
nightly linux64
4f03895d544b / 4.0b9pre / 20101218030347 / files
nightly mac
4f03895d544b / 4.0b9pre / 20101218030347 / files
nightly win32
4f03895d544b / 4.0b9pre / 20101218030347 / files
nightly win64
4f03895d544b / 4.0b9pre / 20101218044921 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 527935 - Part 4: Make sure that the input event after paste operations; r=roc a=blocking-final+
editor/libeditor/text/nsPlaintextDataTransfer.cpp
editor/libeditor/text/tests/test_bug596001.html
--- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp
+++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp
@@ -425,19 +425,25 @@ NS_IMETHODIMP nsPlaintextEditor::Paste(P
     if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable())
     {
       // handle transferable hooks
       nsCOMPtr<nsIDOMDocument> domdoc;
       GetDocument(getter_AddRefs(domdoc));
       if (!nsEditorHookUtils::DoInsertionHook(domdoc, nsnull, trans))
         return NS_OK;
 
+      // Make sure to issue an input event for paste operations
+      NS_ASSERTION(mLastKeypressEventWasTrusted == eTriUnset, "How come our status is not clear?");
+      mLastKeypressEventWasTrusted = eTriTrue;
+
       // Beware! This may flush notifications via synchronous
       // ScrollSelectionIntoView.
       rv = InsertTextFromTransferable(trans, nsnull, nsnull, PR_TRUE);
+
+      mLastKeypressEventWasTrusted = eTriUnset;
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP nsPlaintextEditor::PasteTransferable(nsITransferable *aTransferable)
 {
--- a/editor/libeditor/text/tests/test_bug596001.html
+++ b/editor/libeditor/text/tests/test_bug596001.html
@@ -29,17 +29,20 @@ function testTab(prefix, callback) {
   src.focus();
   src.select();
   SimpleTest.waitForClipboard("a\tb",
     function() {
       synthesizeKey("c", {accelKey: true});
     },
     function() {
       dst.focus();
+      var inputReceived = false;
+      dst.addEventListener("input", function() inputReceived = true, false);
       synthesizeKey("v", {accelKey: true});
+      ok(inputReceived, "An input event should be raised");
       is(dst.value, prefix + src.value, "The value should be pasted verbatim");
       callback();
     },
     callback
   );
 }
 
 testTab("", function() {