From: <rb...@us...> - 2013-10-24 20:25:05
|
Revision: 8683 http://sourceforge.net/p/htmlunit/code/8683 Author: rbri Date: 2013-10-24 20:25:00 +0000 (Thu, 24 Oct 2013) Log Message: ----------- first IE10 fixes (patch from Frank Danek) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollectionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElementTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -63,8 +63,9 @@ * @author Sudhan Moghe * @author Ronald Brill * @author Chuck Dumont + * @author Frank Danek */ -@JsxClass(browsers = @WebBrowser(FF)) +@JsxClass(browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 10) }) public class XMLDocument extends Document { private static final Log LOG = LogFactory.getLog(XMLDocument.class); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -87,14 +87,16 @@ @Test @Browsers(IE) @Alerts(DEFAULT = { "1", "title" }, - IE10 = "") + IE10 = "exception") public void selectNodes() throws Exception { final String html = "<html><head><title>foo</title><script>\n" + " function test() {\n" + " var doc = " + XMLDocumentTest.callLoadXMLDocumentFromFile("'" + URL_SECOND + "'") + ";\n" - + " var nodes = doc.documentElement.selectNodes('//title');\n" - + " alert(nodes.length);\n" - + " alert(nodes[0].tagName);\n" + + " try {\n" + + " var nodes = doc.documentElement.selectNodes('//title');\n" + + " alert(nodes.length);\n" + + " alert(nodes[0].tagName);\n" + + " } catch (e) { alert('exception'); }\n" + " }\n" + XMLDocumentTest.LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION + "</script></head><body onload='test()'>\n" @@ -193,15 +195,17 @@ @Test @Browsers(IE) @Alerts(DEFAULT = { "book", "0", "1" }, - IE10 = "book") + IE10 = { "book", "exception" }) public void selectNode_root() throws Exception { final String html = "<html><head><title>foo</title><script>\n" + " function test() {\n" + " var doc = " + XMLDocumentTest.callLoadXMLDocumentFromFile("'" + URL_SECOND + "'") + ";\n" + " var child = doc.documentElement.firstChild;\n" + " alert(child.tagName);\n" - + " alert(child.selectNodes('/title').length);\n" - + " alert(child.selectNodes('title').length);\n" + + " try {\n" + + " alert(child.selectNodes('/title').length);\n" + + " alert(child.selectNodes('title').length);\n" + + " } catch (e) { alert('exception'); }\n" + " }\n" + XMLDocumentTest.LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION + "</script></head><body onload='test()'>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -50,11 +50,13 @@ private static List<String> IE9_; private static List<String> IE10_; private static List<String> FF17_; + private static List<String> FF24_; private static List<String> IE8_SIMULATED_; private static List<String> IE9_SIMULATED_; private static List<String> IE10_SIMULATED_; private static List<String> FF17_SIMULATED_; + private static List<String> FF24_SIMULATED_; private final String name_; private final BrowserVersion browserVersion_; @@ -70,23 +72,28 @@ IE9_ = getObjects(BrowserVersion.INTERNET_EXPLORER_9); IE10_ = getObjects(BrowserVersion.INTERNET_EXPLORER_10); FF17_ = getObjects(BrowserVersion.FIREFOX_17); + FF24_ = getObjects(BrowserVersion.FIREFOX_24); Assert.assertEquals(IE8_.size(), IE9_.size()); Assert.assertEquals(IE8_.size(), IE10_.size()); Assert.assertEquals(IE8_.size(), FF17_.size()); + Assert.assertEquals(IE8_.size(), FF24_.size()); IE8_SIMULATED_ = getSimulatedObjects(BrowserVersion.INTERNET_EXPLORER_8); IE9_SIMULATED_ = getSimulatedObjects(BrowserVersion.INTERNET_EXPLORER_9); IE10_SIMULATED_ = getSimulatedObjects(BrowserVersion.INTERNET_EXPLORER_10); FF17_SIMULATED_ = getSimulatedObjects(BrowserVersion.FIREFOX_17); + FF24_SIMULATED_ = getSimulatedObjects(BrowserVersion.FIREFOX_24); Assert.assertEquals(IE8_SIMULATED_.size(), IE9_SIMULATED_.size()); Assert.assertEquals(IE8_SIMULATED_.size(), IE10_SIMULATED_.size()); Assert.assertEquals(IE8_SIMULATED_.size(), FF17_SIMULATED_.size()); + Assert.assertEquals(IE8_SIMULATED_.size(), FF24_SIMULATED_.size()); final Collection<Object[]> list = new ArrayList<Object[]>(); for (final String line : IE8_) { final String name = line.substring(0, line.indexOf(':')); -// list.add(new Object[] {name, BrowserVersion.INTERNET_EXPLORER_8}); + list.add(new Object[] {name, BrowserVersion.INTERNET_EXPLORER_8}); // list.add(new Object[] {name, BrowserVersion.INTERNET_EXPLORER_9}); // list.add(new Object[] {name, BrowserVersion.INTERNET_EXPLORER_10}); // list.add(new Object[] {name, BrowserVersion.FIREFOX_17}); +// list.add(new Object[] {name, BrowserVersion.FIREFOX_24}); } return list; } @@ -138,6 +145,10 @@ realList = FF17_; simulatedList = FF17_SIMULATED_; } + else if (browserVersion_ == BrowserVersion.FIREFOX_24) { + realList = FF24_; + simulatedList = FF24_SIMULATED_; + } else { fail("Unknown BrowserVersion " + browserVersion_); return; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.css; -import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE8; import org.junit.Test; import org.junit.runner.RunWith; @@ -701,7 +701,7 @@ @Test @Alerts(DEFAULT = { }, IE8 = { "li1" }) - @NotYetImplemented(IE) + @NotYetImplemented(IE8) public void pseudoAfter() throws Exception { final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html><head><title>Pseudo-After</title><script>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollectionTest.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollectionTest.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -83,14 +83,16 @@ @Test @Browsers(IE) @Alerts(DEFAULT = { "5", "6" }, - IE10 = "5") + IE10 = { "5", "exception" }) public void getElements() throws Exception { final String html = "<html><head><title>foo</title><script>\n" + "function doTest() {\n" + " alert(document.all.length);\n" - + " document.appendChild(document.createElement('div'));\n" - + " alert(document.all.length);\n" + + " try {" + + " document.appendChild(document.createElement('div'));\n" + + " alert(document.all.length);\n" + + " } catch (e) { alert('exception') }\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "</body></html>"; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -533,7 +533,7 @@ @Test @Alerts(DEFAULT = {"", "", "#0000aa", "#0000aa", "x", "x" }, IE = {"#ffffff", "", "#0000aa", "#0000aa", "#000000", "#000000" }, -// IE9 = {"#ffffff", "", "#0000aa", "#0000aa", "#000000", "#0" }, + IE9 = {"#ffffff", "", "#0000aa", "#0000aa", "#000000", "#0" }, IE10 = {"#ffffff", "", "#0000aa", "#0000aa", "#000000", "#0" }) public void bgColor() throws Exception { final String html = @@ -713,7 +713,8 @@ @BuggyWebDriver // tested with FF8, FF17, FF18 @Alerts(CHROME = { "0", "exception" }, FF = { "1", "[object HTMLBodyElement]" }, - IE = "exception") + IE = "exception", + IE10 = { "0", "exception" }) // TODO [IE10]MODALPANEL real IE10 opens a modal panel which webdriver cannot handle public void designMode_selectionRange_empty() throws Exception { designMode_selectionRange(""); @@ -728,7 +729,8 @@ @BuggyWebDriver // tested with FF8, FF17, FF18 @Alerts(CHROME = { "0", "exception" }, FF = { "1", "[object Text]" }, - IE = "exception") + IE = "exception", + IE10 = { "0", "exception" }) // TODO [IE10]MODALPANEL real IE10 opens a modal panel which webdriver cannot handle public void designMode_selectionRange_text() throws Exception { designMode_selectionRange("hello"); @@ -1384,7 +1386,7 @@ @Test @Alerts(FF = {"", "", "#0000aa", "#0000aa", "x", "x" }, IE = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#000000" }, -// IE9 = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#0" }, + IE9 = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#0" }, IE10 = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#0" }) public void alinkColor() throws Exception { final String html = @@ -1415,7 +1417,7 @@ @Test @Alerts(FF = {"", "", "#0000aa", "#0000aa", "x", "x" }, IE = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#000000" }, -// IE9 = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#0" }, + IE9 = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#0" }, IE10 = {"#0000ff", "", "#0000aa", "#0000aa", "#000000", "#0" }) public void linkColor() throws Exception { final String html = @@ -1446,7 +1448,7 @@ @Test @Alerts(FF17 = {"", "", "#0000aa", "#0000aa", "x", "x" }, IE = {"#800080", "", "#0000aa", "#0000aa", "#000000", "#000000" }, -// IE9 = {"#800080", "", "#0000aa", "#0000aa", "#000000", "#0" }, + IE9 = {"#800080", "", "#0000aa", "#0000aa", "#000000", "#0" }, IE10 = {"#800080", "", "#0000aa", "#0000aa", "#000000", "#0" }) public void vlinkColor() throws Exception { final String html = @@ -1477,7 +1479,7 @@ @Test @Alerts(FF = {"", "", "#0000aa", "#0000aa", "x", "x" }, IE = {"#000000", "", "#0000aa", "#0000aa", "#000000", "#000000" }, -// IE9 = {"#000000", "", "#0000aa", "#0000aa", "#000000", "#0" }, + IE9 = {"#000000", "", "#0000aa", "#0000aa", "#000000", "#0" }, IE10 = {"#000000", "", "#0000aa", "#0000aa", "#000000", "#0" }) public void fgColor() throws Exception { final String html = Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -207,7 +207,7 @@ @Test @Alerts(DEFAULT = { "myEncoding", "newEncoding", "newEncoding" }, FF17 = { "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "newEncoding" }, - IE10 = { "application/x-www-form-urlencoded" }) + IE10 = { "application/x-www-form-urlencoded", "exception" }) public void encodingProperty_dummyValues() throws Exception { doTestProperty("encoding", "enctype", "myEncoding", "newEncoding"); } @@ -237,9 +237,11 @@ = "<html><head><title>foo</title><script>\n" + "function doTest(){\n" + " alert(document.forms[0]." + jsProperty + ");\n" - + " document.forms[0]." + jsProperty + "='" + newValue + "';\n" - + " alert(document.forms[0]." + jsProperty + ");\n" - + " alert(document.forms[0].getAttribute('" + htmlProperty + "'));\n" + + " try {\n" + + " document.forms[0]." + jsProperty + "='" + newValue + "';\n" + + " alert(document.forms[0]." + jsProperty + ");\n" + + " alert(document.forms[0].getAttribute('" + htmlProperty + "'));\n" + + " } catch(e) { alert('exception'); }\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<p>hello world</p>\n" @@ -251,7 +253,7 @@ final WebDriver wd = loadPageWithAlerts2(html); final WebElement form = wd.findElement(By.xpath("//form")); - if (wd instanceof HtmlUnitDriver) { + if (wd instanceof HtmlUnitDriver && getExpectedAlerts().length >= 3) { // form.getAttribute("enctype") returns form.getAttribute("encoding") with the FF driver. Bug or feature? assertEquals(getExpectedAlerts()[2], form.getAttribute(htmlProperty)); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElementTest.java 2013-10-24 20:24:27 UTC (rev 8682) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElementTest.java 2013-10-24 20:25:00 UTC (rev 8683) @@ -328,8 +328,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = { "number: 300", "number: 200", "number: 1", "number: 1", "number: 1", "number: 1" }, - IE10 = { "number: 300", "number: 200", "number: 28", "number: 30", "number: 1", "number: 1" }) + @Alerts({ "number: 300", "number: 200", "number: 1", "number: 1", "number: 1", "number: 1" }) public void testWidthHeightWithSource() throws Exception { getMockWebConnection().setDefaultResponse(""); @@ -371,8 +370,7 @@ @Test @Alerts(DEFAULT = { "number: 300", "number: 200", "number: 24", "number: 24", "number: 24", "number: 24" }, CHROME = { "number: 300", "number: 200", "number: 18", "number: 20", "number: 18", "number: 20" }, - IE = { "number: 300", "number: 200", "number: 1", "number: 1", "number: 1", "number: 1" }, - IE10 = { "number: 300", "number: 200", "number: 28", "number: 30", "number: 1", "number: 1" }) + IE = { "number: 300", "number: 200", "number: 1", "number: 1", "number: 1", "number: 1" }) public void testWidthHeightInvalidSource() throws Exception { getMockWebConnection().setDefaultResponse(""); |