CVS Commit: src/xdocs: Fill frame windows with about:blank when the

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CVS Commit: src/xdocs: Fill frame windows with about:blank when the

mguillem
Log Message:
-----------
Fill frame windows with about:blank when the declaring tag is found to allow JavaScript to run on it before the real content is loaded.

Modified Files:
--------------
    htmlunit/src/java/com/gargoylesoftware/htmlunit/html:
        BaseFrame.java
        (http://cvs.sourceforge.net/viewcvs.py/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/BaseFrame.java)
        HtmlPage.java
        (http://cvs.sourceforge.net/viewcvs.py/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java)
    htmlunit/src/xdocs:
        changes.xml
        (http://cvs.sourceforge.net/viewcvs.py/htmlunit/htmlunit/src/xdocs/changes.xml)
    htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html:
        HtmlFrameSetTest.java
        (http://cvs.sourceforge.net/viewcvs.py/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java)

Revision Data
-------------
Index: changes.xml
===================================================================
RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v
retrieving revision 1.448
retrieving revision 1.449
diff -Lsrc/xdocs/changes.xml -Lsrc/xdocs/changes.xml -u -d -r1.448 -r1.449
--- src/xdocs/changes.xml
+++ src/xdocs/changes.xml
@@ -7,11 +7,15 @@
 
     <body>
         <release version="NextRelease" date="Unknown">
+            <action type="update" dev="mguillem" id="1239285">
+                Fill frame windows with about:blank when the declaring tag is found
+                to allow JavaScript to run on it before the real content is loaded.
+            </action>
             <action type="update" dev="yourgod">
                 Upgraded commons-httpclient to version 3.0rc4 in ant as well.
                 Made HtmlForm.submit(SubmittableElement) public to simulate
                 keyboard submits (more to come later).
-            </action>        
+            </action>
             <action type="update" dev="mguillem">
                 JavaScript: XMLHttpRequest.send now accepts null as parameter
  and fails when simulating Mozilla if called with no parameter like the browser does.
Index: HtmlPage.java
===================================================================
RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java,v
retrieving revision 1.121
retrieving revision 1.122
diff -Lsrc/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java -Lsrc/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java -u -d -r1.121 -r1.122
--- src/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java
+++ src/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java
@@ -154,8 +154,8 @@
      * @throws IOException If an IO problem occurs.
      */
     public void initialize() throws IOException {
-        getDocumentElement().setReadyState(READY_STATE_COMPLETE);
         loadFrames();
+        getDocumentElement().setReadyState(READY_STATE_COMPLETE);
         executeOnLoadHandlersIfNeeded();
         executeRefreshIfNeeded();
     }
Index: BaseFrame.java
===================================================================
RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/BaseFrame.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lsrc/java/com/gargoylesoftware/htmlunit/html/BaseFrame.java -Lsrc/java/com/gargoylesoftware/htmlunit/html/BaseFrame.java -u -d -r1.8 -r1.9
--- src/java/com/gargoylesoftware/htmlunit/html/BaseFrame.java
+++ src/java/com/gargoylesoftware/htmlunit/html/BaseFrame.java
@@ -190,6 +190,20 @@
 
         final WebClient webClient = page.getWebClient();
         webClient.registerWebWindow(enclosedWindow_);
+
+        try {
+            // put about:blank in the window to allow JS to run on this frame before the
+            // real content is loaded
+            getPage().getWebClient().pushClearFirstWindow();
+            getPage().getWebClient().getPage(enclosedWindow_, new WebRequestSettings(WebClient.URL_ABOUT_BLANK));
+            getPage().getWebClient().popFirstWindow();
+        }
+        catch (final FailingHttpStatusCodeException e) {
+            // should never occur
+        }
+        catch (final IOException e) {
+            // should never occur
+        }
     }
 
 
Index: HtmlFrameSetTest.java
===================================================================
RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lsrc/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java -Lsrc/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java -u -d -r1.13 -r1.14
--- src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java
+++ src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java
@@ -218,10 +218,6 @@
     public void testFrameOnloadAccessOtherFrame()
         throws Exception {
 
-        if (notYetImplemented()) {
-            return;
-        }
-
         final String framesContent
             = "<html><head><title>Main</title>"
             + "</head>"


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop