From: <asa...@us...> - 2014-01-14 13:58:49
|
Revision: 8973 http://sourceforge.net/p/htmlunit/code/8973 Author: asashour Date: 2014-01-14 13:58:45 +0000 (Tue, 14 Jan 2014) Log Message: ----------- JavaScript: enumerating ordered numbers first (Chrome, FF and IE11). 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/HtmlUnitContextFactory.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-14 06:22:51 UTC (rev 8972) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-14 13:58:45 UTC (rev 8973) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="fix" dev="asashour"> + JavaScript: enumerating ordered numbers first (Chrome, FF and IE11). + </action> <action type="fix" dev="rbri" issue="1568"> Do not change the active element when the content of an iframe was changed. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-14 06:22:51 UTC (rev 8972) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-14 13:58:45 UTC (rev 8973) @@ -945,6 +945,10 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_ELEMENT_EXTENT_WITHOUT_PADDING, + /** Indicates that for(x in y) should enumerate the numbers first. */ + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 9) }) + JS_ENUM_NUMBERS_FIRST, + /** Indicates that 'exception' (technically NativeError) exposes "stack" property. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) JS_ERROR_STACK, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java 2014-01-14 06:22:51 UTC (rev 8972) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java 2014-01-14 13:58:45 UTC (rev 8973) @@ -343,6 +343,8 @@ return browserVersion_.hasFeature(BrowserVersionFeatures.JS_FUNCTION_DECLARED_FORWARD_IN_BLOCK); case Context.FEATURE_HTMLUNIT_PARSE_INT_RADIX_10: return browserVersion_.hasFeature(BrowserVersionFeatures.JS_PARSE_INT_RADIX_10); + case Context.FEATURE_HTMLUNIT_ENUM_NUMBERS_FIRST: + return browserVersion_.hasFeature(BrowserVersionFeatures.JS_ENUM_NUMBERS_FIRST); default: return super.hasFeature(cx, featureIndex); } Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java 2014-01-14 13:58:45 UTC (rev 8973) @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2014 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.javascript; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; + +/** + * Test for ScriptRuntime. + * + * @version $Revision$ + * @author Ahmed Ashour + */ +@RunWith(BrowserRunner.class) +public class ScriptRuntimeTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "0", "50", "100", "xxx", "zzz", "yyy" }, + IE8 = {"xxx", "50", "zzz", "100", "0", "yyy" }) + public void enumChangeObject() throws Exception { + final String html + = "<html><head><script>\n" + + "function test() {\n" + + " var value = {\n" + + " 'xxx': 'testxxx',\n" + + " '50': 'test50',\n" + + " 'zzz': 'testzzz',\n" + + " '100': 'test100',\n" + + " '0': 'test0',\n" + + " 'yyy': 'testyyy'\n" + + " };\n" + + " for (var x in value) {\n" + + " alert(x);\n" + + " };" + + "}\n" + + "</script></head><body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property |