--- old/modules/web/src/main/native/Source/WebCore/platform/java/PasteboardJava.cpp 2015-12-09 02:29:09.180389915 +0530 +++ new/modules/web/src/main/native/Source/WebCore/platform/java/PasteboardJava.cpp 2015-12-09 02:29:09.084389439 +0530 @@ -206,7 +206,8 @@ { // Use single shared data instance for all copy'n'paste pasteboards. static RefPtr data = DataObjectJava::create(); - + //Todo : setURL, setFiles, setData, setHtml (needs URL) + data->setPlainText(jGetPlainText()); return adoptPtr(new Pasteboard(data, true)); } --- old/modules/web/src/test/java/javafx/scene/web/MiscellaneousTest.java 2015-12-09 02:29:09.500391502 +0530 +++ new/modules/web/src/test/java/javafx/scene/web/MiscellaneousTest.java 2015-12-09 02:29:09.404391026 +0530 @@ -31,15 +31,23 @@ import java.util.ArrayList; import java.util.Random; import java.util.concurrent.Callable; +import com.sun.javafx.PlatformUtil; import javafx.application.Platform; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.concurrent.Worker.State; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static javafx.concurrent.Worker.State.SUCCEEDED; +import javafx.event.Event; +import javafx.scene.input.Clipboard; +import javafx.scene.input.ClipboardContent; +import javafx.scene.input.KeyCode; import org.junit.Test; import org.w3c.dom.Document; +import org.w3c.dom.html.HTMLInputElement; public class MiscellaneousTest extends TestBase { @@ -109,8 +117,50 @@ "}\n" + ""); } + @Test public void testJDK8143894() { + loadContent("" + + ""); + + assertTrue("Load task completed successfully", getLoadState() == SUCCEEDED); + + submit(() -> { + String clipboardData = "Clipboard content"; + ClipboardContent content = new ClipboardContent(); + content.putString(clipboardData); + Clipboard.getSystemClipboard().setContent(content); + //paste the ClipboardConent to first inputText input element + //from javascript capture this paste and copy to pasteInputtext input element + javafx.scene.input.KeyEvent kv = new javafx.scene.input.KeyEvent(null, + getView(), // EventTarget + javafx.scene.input.KeyEvent.KEY_PRESSED, // eventType + "", // Character (unused unless evtType == KEY_TYPED) + "", // text + KeyCode.V, // KeyCode + false, // shiftDown + PlatformUtil.isMac() ? false : true, // ctrlDown + false, // altDown + PlatformUtil.isMac() ? true : false // metaDown + ); + Event.fireEvent(getView(), kv); + + Document doc = getEngine().getDocument(); + HTMLInputElement el = (HTMLInputElement)doc.getElementById("inputText"); + assertNotNull("HTMLInputElement Not Null", el); + assertEquals("Default value", "Default text", el.getDefaultValue()); + assertEquals("Paste value", clipboardData, el.getValue()); + + HTMLInputElement pl = (HTMLInputElement)doc.getElementById("pasteInputText"); + assertEquals("Paste value", clipboardData, pl.getValue()); + }); + } private WebEngine createWebEngine() { return submit(() -> new WebEngine()); } + + private State getLoadState() { + return submit(() -> getEngine().getLoadWorker().getState()); + } }