changeset 10467:9e024aac43ca

8179321: WebEngine.getDocument().getDocumentURI() no longer returns null for loading a String of HTML Reviewed-by: kcr, ghb
author arajkumar
date Thu, 27 Apr 2017 00:09:42 +0530
parents a3da54ae1f1f
children ac5a7cec7881
files modules/javafx.web/src/main/java-wrappers/com/sun/webkit/dom/DocumentImpl.java modules/javafx.web/src/main/native/Source/WebCore/bindings/scripts/CodeGeneratorJava.pm modules/javafx.web/src/main/native/Source/WebCore/dom/Document.idl modules/javafx.web/src/test/java/test/javafx/scene/web/DOMTest.java
diffstat 4 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.web/src/main/java-wrappers/com/sun/webkit/dom/DocumentImpl.java	Mon Apr 24 08:57:51 2017 -0700
+++ b/modules/javafx.web/src/main/java-wrappers/com/sun/webkit/dom/DocumentImpl.java	Thu Apr 27 00:09:42 2017 +0530
@@ -104,6 +104,11 @@
     }
     native static String getDocumentURIImpl(long peer);
 
+    public void setDocumentURI(String value) {
+        setDocumentURIImpl(getPeer(), value);
+    }
+    native static void setDocumentURIImpl(long peer, String value);
+
     public AbstractView getDefaultView() {
         return DOMWindowImpl.getImpl(getDefaultViewImpl(getPeer()));
     }
@@ -1379,8 +1384,5 @@
     public void normalizeDocument() {
         throw new UnsupportedOperationException("Not supported yet.");
     }
-    public void setDocumentURI(String documentURI) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
 }
 
--- a/modules/javafx.web/src/main/native/Source/WebCore/bindings/scripts/CodeGeneratorJava.pm	Mon Apr 24 08:57:51 2017 -0700
+++ b/modules/javafx.web/src/main/native/Source/WebCore/bindings/scripts/CodeGeneratorJava.pm	Thu Apr 27 00:09:42 2017 +0530
@@ -263,9 +263,6 @@
             "Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException",
             "DOMConfiguration getDomConfig()",
             "void normalizeDocument()",
-            # document.documentURI was writable in DOM3 Core, but is read-only in DOM4
-            # (see http://www.w3.org/TR/2011/WD-dom-20110915/#document).
-            "void setDocumentURI(String documentURI)"
         ],
         skip => {
             "webkitExitPointerLock" => 1,
--- a/modules/javafx.web/src/main/native/Source/WebCore/dom/Document.idl	Mon Apr 24 08:57:51 2017 -0700
+++ b/modules/javafx.web/src/main/native/Source/WebCore/dom/Document.idl	Thu Apr 27 00:09:42 2017 +0530
@@ -79,7 +79,7 @@
 
     [RaisesException] Node               adoptNode([Default=Undefined] optional Node source);
 
-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT || defined(LANGUAGE_JAVA) && LANGUAGE_JAVA
     // document.documentURI was writable in DOM3 Core, but is read-only in DOM4
     // (see http://www.w3.org/TR/2011/WD-dom-20110915/#document). We need to keep
     // the writable version around for Objective C clients, but are moving to
--- a/modules/javafx.web/src/test/java/test/javafx/scene/web/DOMTest.java	Mon Apr 24 08:57:51 2017 -0700
+++ b/modules/javafx.web/src/test/java/test/javafx/scene/web/DOMTest.java	Thu Apr 27 00:09:42 2017 +0530
@@ -27,10 +27,13 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import javafx.scene.web.WebEngine;
+
 import org.junit.Test;
 import org.w3c.dom.*;
 import org.w3c.dom.css.*;
@@ -397,6 +400,21 @@
         });
     }
 
+    // JDK-8179321
+    // Still we are supporting DOM3 interface, need to relook once we move to
+    // DOM4 spec.
+    @Test public void testDocumentURIForDOM3Compliance() {
+        // According to DOM3 spec, page loaded without base url(i.e as String)
+        // must have "document.documentURI" value as null.
+        loadContent("test");
+        submit(() -> {
+            final WebEngine webEngine = getEngine();
+            final Document document = webEngine.getDocument();
+            assertNotNull(document);
+            assertNull(document.getDocumentURI());
+        });
+    }
+
     // helper methods
 
     private void verifyChildRemoved(Node parent,