changeset 4036:23c6f56490ca

RT-30835: WebEngine goes in State SUCCEEDED but Document is null
author Vasiliy Baranov <vasiliy.baranov@oracle.com>
date Mon, 24 Jun 2013 13:11:07 +0400
parents 07ee4aa067ee
children 7bf2396582c8
files webview/native/Source/WebCore/platform/java/FrameLoaderClientJava.cpp webview/test/html/RT30835.html webview/test/javafx/scene/web/MiscellaneousTest.java
diffstat 3 files changed, 47 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/webview/native/Source/WebCore/platform/java/FrameLoaderClientJava.cpp	Fri Jun 21 16:30:22 2013 -0700
+++ b/webview/native/Source/WebCore/platform/java/FrameLoaderClientJava.cpp	Mon Jun 24 13:11:07 2013 +0400
@@ -665,13 +665,6 @@
 // client-side redirection
 void FrameLoaderClientJava::dispatchWillPerformClientRedirect(const KURL& url, double, double)
 {
-    double progress = page()->progress()->estimatedProgress();
-    m_isPageRedirected = true;
-    postLoadEvent(frame(),
-                  com_sun_webkit_LoadListenerClient_PAGE_REDIRECTED,
-                  url.string(),
-                  String(), // content type
-                  progress);
 }
 
 void FrameLoaderClientJava::dispatchDidReceiveTitle(const StringWithDirection& title)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webview/test/html/RT30835.html	Mon Jun 24 13:11:07 2013 +0400
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Refresh" content="100; URL=ipsum.html" />
+</head>
+<body>
+</body>
+</html>
--- a/webview/test/javafx/scene/web/MiscellaneousTest.java	Fri Jun 21 16:30:22 2013 -0700
+++ b/webview/test/javafx/scene/web/MiscellaneousTest.java	Mon Jun 24 13:11:07 2013 +0400
@@ -3,13 +3,20 @@
  */
 package javafx.scene.web;
 
+import java.io.File;
 import static java.lang.String.format;
 import java.net.HttpURLConnection;
+import java.util.ArrayList;
 import java.util.Random;
 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.fail;
 import org.junit.Test;
+import org.w3c.dom.Document;
 
 public class MiscellaneousTest extends TestBase {
 
@@ -40,4 +47,36 @@
     private static final class DummyClass {
         private static int dummyField;
     }
+
+    @Test public void testRT30835() throws Exception {
+        class Record {
+            private final Document document;
+            private final String location;
+            public Record(Document document, String location) {
+                this.document = document;
+                this.location = location;
+            }
+        }
+        final ArrayList<Record> records = new ArrayList<Record>();
+        ChangeListener<State> listener = new ChangeListener<State>() {
+            public void changed(ObservableValue<? extends State> ov,
+                                State oldValue, State newValue)
+            {
+                if (newValue == State.SUCCEEDED) {
+                    records.add(new Record(
+                            getEngine().getDocument(),
+                            getEngine().getLocation()));
+                }
+            }
+        };
+        submit(new Runnable() { public void run() {
+            getEngine().getLoadWorker().stateProperty().addListener(listener);
+        }});
+        String location = new File("test/html/RT30835.html")
+                .toURI().toASCIIString().replaceAll("^file:/", "file:///");
+        load(location);
+        assertEquals(1, records.size());
+        assertNotNull(records.get(0).document);
+        assertEquals(location, records.get(0).location);
+    }
 }