From: <asa...@us...> - 2017-08-08 10:29:57
|
Revision: 14775 http://sourceforge.net/p/htmlunit/code/14775 Author: asashour Date: 2017-08-08 10:29:55 +0000 (Tue, 08 Aug 2017) Log Message: ----------- Test cases pass, thanks to Ronald. Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-08-08 07:15:58 UTC (rev 14774) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-08-08 10:29:55 UTC (rev 14775) @@ -599,6 +599,10 @@ @BrowserFeature({CHROME, FF}) JS_ARRAY_FROM, + /** Indicates that the {@code Array} supports construction properties. */ + @BrowserFeature(FF) + JS_ARRAY_CONSTRUCTION_PROPERTIES, + /** firstChild and lastChild returns null for Attr (like IE does). */ @BrowserFeature({CHROME, FF}) JS_ATTR_FIRST_LAST_CHILD_RETURNS_NULL, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java 2017-08-08 07:15:58 UTC (rev 14774) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java 2017-08-08 10:29:55 UTC (rev 14775) @@ -15,6 +15,7 @@ package com.gargoylesoftware.htmlunit.javascript; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ARGUMENTS_READ_ONLY_ACCESSED_FROM_FUNCTION; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ARRAY_CONSTRUCTION_PROPERTIES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ENUM_NUMBERS_FIRST; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ERROR_STACK; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FUNCTION_DECLARED_FORWARD_IN_BLOCK; @@ -348,6 +349,8 @@ return browserVersion_.hasFeature(JS_PROPERTY_DESCRIPTOR_NAME); case Context.FEATURE_HTMLUNIT_MEMBERBOX_NEWLINE: return browserVersion_.hasFeature(JS_PROPERTY_DESCRIPTOR_NEW_LINE); + case Context.FEATURE_HTMLUNIT_ARRAY_PROPERTIES: + return browserVersion_.hasFeature(JS_ARRAY_CONSTRUCTION_PROPERTIES); default: return super.hasFeature(cx, featureIndex); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2017-08-08 07:15:58 UTC (rev 14774) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2017-08-08 10:29:55 UTC (rev 14775) @@ -829,7 +829,7 @@ if (ScriptRuntime.hasTopCall(cx)) { return function.call(cx, scope, thisObject, args); } - return ScriptRuntime.doTopCall(function, cx, scope, thisObject, args); + return ScriptRuntime.doTopCall(function, cx, scope, thisObject, args, cx.isStrictMode()); } @Override protected String getSourceCode(final Context cx) { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java 2017-08-08 07:15:58 UTC (rev 14774) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java 2017-08-08 10:29:55 UTC (rev 14775) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit.javascript; -import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.CHROME; import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF45; import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; @@ -444,7 +443,6 @@ */ @Test @Alerts({"undefined", "TypeError"}) - @NotYetImplemented public void findStatic() throws Exception { final String html = "<html>\n" @@ -517,7 +515,6 @@ */ @Test @Alerts({"undefined", "TypeError"}) - @NotYetImplemented public void findIndexStatic() throws Exception { final String html = "<html>\n" @@ -591,7 +588,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "20,17"}) - @NotYetImplemented public void filterStatic() throws Exception { final String html = "<html>\n" @@ -661,7 +657,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "1,2,3,4"}) - @NotYetImplemented public void mapStatic() throws Exception { final String html = "<html>\n" @@ -733,7 +728,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "false"}) - @NotYetImplemented public void everyStatic() throws Exception { final String html = "<html>\n" @@ -807,7 +801,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "true"}) - @NotYetImplemented public void someStatic() throws Exception { final String html = "<html>\n" @@ -877,7 +870,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "4", "7"}) - @NotYetImplemented({CHROME, IE}) public void forEachStatic() throws Exception { final String html = "<html>\n" @@ -949,7 +941,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "30"}) - @NotYetImplemented({CHROME, IE}) public void reduceStatic() throws Exception { final String html = "<html>\n" @@ -1023,7 +1014,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "2"}) - @NotYetImplemented({CHROME, IE}) public void reduceRightStatic() throws Exception { final String html = "<html>\n" @@ -1093,7 +1083,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "1,4,9,16"}) - @NotYetImplemented({CHROME, IE}) public void joinStatic() throws Exception { final String html = "<html>\n" @@ -1161,7 +1150,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "16,9,4,1"}) - @NotYetImplemented({CHROME, IE}) public void reverseStatic() throws Exception { final String html = "<html>\n" @@ -1229,7 +1217,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "1,16,4,9"}) - @NotYetImplemented({CHROME, IE}) public void sortStatic() throws Exception { final String html = "<html>\n" @@ -1299,7 +1286,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "6", "1,4,9,16,3,7"}) - @NotYetImplemented({CHROME, IE}) public void pushStatic() throws Exception { final String html = "<html>\n" @@ -1370,7 +1356,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "16", "1,4,9"}) - @NotYetImplemented({CHROME, IE}) public void popStatic() throws Exception { final String html = "<html>\n" @@ -1441,7 +1426,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "1", "4,9,16"}) - @NotYetImplemented({CHROME, IE}) public void shiftStatic() throws Exception { final String html = "<html>\n" @@ -1512,7 +1496,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "6", "3,7,1,4,9,16"}) - @NotYetImplemented({CHROME, IE}) public void unshiftStatic() throws Exception { final String html = "<html>\n" @@ -1583,7 +1566,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "4,9", "1,16"}) - @NotYetImplemented({CHROME, IE}) public void spliceStatic() throws Exception { final String html = "<html>\n" @@ -1654,7 +1636,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "1,4,9,16,1,2", "1,4,9,16"}) - @NotYetImplemented({CHROME, IE}) public void concatStatic() throws Exception { final String html = "<html>\n" @@ -1725,7 +1706,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "4", "1,4,9,16"}) - @NotYetImplemented({CHROME, IE}) public void sliceStatic() throws Exception { final String html = "<html>\n" @@ -1796,7 +1776,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "2", "1,4,9,16"}) - @NotYetImplemented({CHROME, IE}) public void indexOfStatic() throws Exception { final String html = "<html>\n" @@ -1867,7 +1846,6 @@ @Test @Alerts(DEFAULT = {"undefined", "TypeError"}, FF = {"function", "2", "1,4,9,16"}) - @NotYetImplemented({CHROME, IE}) public void lastIndexOfStatic() throws Exception { final String html = "<html>\n" |