[prev in list] [next in list] [prev in thread] [next in thread]
List: htmlunit-develop
Subject: [HtmlUnit] SVN: [11950] trunk/htmlunit/src
From: asashour () users ! sourceforge ! net
Date: 2016-02-29 19:02:16
Message-ID: E1aaT5H-0006Ft-Hh () sfs-ml-3 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 11950
http://sourceforge.net/p/htmlunit/code/11950
Author: asashour
Date: 2016-02-29 19:02:16 +0000 (Mon, 29 Feb 2016)
Log Message:
-----------
JavaScript: fix PopStateEvent.state to be clone (Chrome and IE)
Modified Paths:
--------------
trunk/htmlunit/src/changes/changes.xml
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PopStateEvent.java
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java
Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2016-02-29 18:44:36 UTC (rev 11949)
+++ trunk/htmlunit/src/changes/changes.xml 2016-02-29 19:02:16 UTC (rev 11950)
@@ -9,6 +9,9 @@
<body>
<release version="2.21" date="???" description="Bugfixes">
<action type="fix" dev="asashour">
+ JavaScript: fix PopStateEvent.state to be clone (Chrome and IE).
+ </action>
+ <action type="fix" dev="asashour">
JavaScript: fix Selection.rangeCount for Chrome.
</action>
<action type="fix" dev="asashour">
Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2016-02-29 \
18:44:36 UTC (rev 11949)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2016-02-29 \
19:02:16 UTC (rev 11950) @@ -21,6 +21,7 @@
import com.gargoylesoftware.htmlunit.javascript.configuration.BrowserFeature;
import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser;
+import com.gargoylesoftware.htmlunit.javascript.host.event.PopStateEvent;
/**
* Constants of various features of each {@link BrowserVersion}.
@@ -1098,8 +1099,7 @@
JS_PARENT_PROTO_PROPERTIES,
/** Indicates that parseInt() should have radix 10 by default. */
- @BrowserFeature({ @WebBrowser(IE), @WebBrowser(FF),
- @WebBrowser(CHROME) })
+ @BrowserFeature
JS_PARSE_INT_RADIX_10,
/** Indicates that HTMLPhraseElements returning 'HTMLElement'
@@ -1107,6 +1107,10 @@
@BrowserFeature(@WebBrowser(FF))
JS_PHRASE_COMMON_CLASS_NAME,
+ /** Indicates that the {@link PopStateEvent}.{@code state} is cloned. */
+ @BrowserFeature({ @WebBrowser(CHROME), @WebBrowser(IE) })
+ JS_POP_STATE_EVENT_CLONE_STATE,
+
/** Indicates that the {@code pre.width} is string. */
@BrowserFeature(@WebBrowser(IE))
JS_PRE_WIDTH_STRING,
Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PopStateEvent.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PopStateEvent.java 2016-02-29 \
18:44:36 UTC (rev 11949)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PopStateEvent.java 2016-02-29 \
19:02:16 UTC (rev 11950) @@ -14,6 +14,7 @@
*/
package com.gargoylesoftware.htmlunit.javascript.host.event;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_POP_STATE_EVENT_CLONE_STATE;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.EDGE;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF;
@@ -25,6 +26,7 @@
import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser;
import net.sourceforge.htmlunit.corejs.javascript.Context;
+import net.sourceforge.htmlunit.corejs.javascript.NativeObject;
import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;
/**
@@ -68,7 +70,18 @@
*/
public PopStateEvent(final SimpleScriptable scriptable, final String type, final \
Object state) { super(scriptable, type);
- state_ = state;
+ if (state instanceof NativeObject && \
getBrowserVersion().hasFeature(JS_POP_STATE_EVENT_CLONE_STATE)) { + final \
NativeObject old = (NativeObject) state; + final NativeObject newState = \
new NativeObject(); + for (final Object o : \
ScriptableObject.getPropertyIds(old)) { + final String property = \
Context.toString(o); + newState.defineProperty(property, \
ScriptableObject.getProperty(old, property), ScriptableObject.EMPTY); + }
+ state_ = newState;
+ }
+ else {
+ state_ = state;
+ }
}
/**
Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java 2016-02-29 \
18:44:36 UTC (rev 11949)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java 2016-02-29 \
19:02:16 UTC (rev 11950) @@ -14,9 +14,6 @@
*/
package com.gargoylesoftware.htmlunit.javascript.host;
-import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.CHROME;
-import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
@@ -25,7 +22,6 @@
import com.gargoylesoftware.htmlunit.BrowserRunner;
import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts;
-import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented;
import com.gargoylesoftware.htmlunit.WebDriverTestCase;
/**
@@ -212,7 +208,6 @@
"[object PopStateEvent]", "{\"hi\":\"there\"}", "false",
"[object PopStateEvent]", "{\"hi2\":\"there2\"}", "false",
"[object PopStateEvent]", "{\"hi2\":\"there2\"}", "false" })
- @NotYetImplemented({CHROME, IE})
public void pushStateClone() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
@@ -445,7 +440,6 @@
"[object PopStateEvent]", "null", "true",
"[object PopStateEvent]", "{\"hi2\":\"there2\"}", "false",
"[object PopStateEvent]", "{\"hi2\":\"there2\"}", "false" })
- @NotYetImplemented({CHROME, IE})
public void replaceStateClone() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic