From: <rb...@us...> - 2014-01-02 13:54:59
|
Revision: 8938 http://sourceforge.net/p/htmlunit/code/8938 Author: rbri Date: 2014-01-02 13:54:54 +0000 (Thu, 02 Jan 2014) Log Message: ----------- Document.inputEncoding and Document.characterSet fixed for FF24 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/html/HTMLDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/EncodingSniffer.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-02 13:33:34 UTC (rev 8937) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-02 13:54:54 UTC (rev 8938) @@ -8,6 +8,10 @@ <body> <release version="2.14" date="???" description="Bugfixes, initial work on FF24 and IE11"> + <action type="fix" dev="rbri"> + JavaScript: Document.inputEncoding and Document.characterSet are doing some kind of + normalization on the encoding string starting with FF24. + </action> <action type="update" dev="rbri"> Upgrade Apache commons-lang to 3.2. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-02 13:33:34 UTC (rev 8937) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-02 13:54:54 UTC (rev 8938) @@ -465,6 +465,10 @@ @BrowserFeature(@WebBrowser(IE)) HTMLDOCUMENT_CHARSET_LOWERCASE, + /** Do a normalization of the charset names. */ + @BrowserFeature(@WebBrowser(value = FF, minVersion = 24)) + HTMLDOCUMENT_CHARSET_NORMALIZED, + /** Do document.bgColor/.alinkColor/.vlinkColor/.linkColor have value by default. */ @BrowserFeature(@WebBrowser(IE)) HTMLDOCUMENT_COLOR, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2014-01-02 13:33:34 UTC (rev 8937) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2014-01-02 13:54:54 UTC (rev 8938) @@ -26,6 +26,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_55; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_OBJECT_DETECTION; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_CHARSET_LOWERCASE; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_CHARSET_NORMALIZED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_COLOR; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_GET_ALSO_FRAMES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_GET_FOR_ID_AND_OR_NAME; @@ -139,6 +140,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet; import com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList; import com.gargoylesoftware.htmlunit.util.Cookie; +import com.gargoylesoftware.htmlunit.util.EncodingSniffer; import com.gargoylesoftware.htmlunit.util.UrlUtils; /** @@ -1051,7 +1053,11 @@ */ @JsxGetter({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) public String getInputEncoding() { - return getHtmlPage().getPageEncoding(); + final String encoding = getHtmlPage().getPageEncoding(); + if (encoding != null && getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_NORMALIZED)) { + return EncodingSniffer.translateEncodingLabel(encoding); + } + return encoding; } /** @@ -1064,6 +1070,9 @@ if (charset != null && getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_LOWERCASE)) { return charset.toLowerCase(Locale.ENGLISH); } + if (charset != null && getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_NORMALIZED)) { + return EncodingSniffer.translateEncodingLabel(charset); + } return charset; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/EncodingSniffer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/EncodingSniffer.java 2014-01-02 13:33:34 UTC (rev 8937) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/EncodingSniffer.java 2014-01-02 13:54:54 UTC (rev 8938) @@ -18,8 +18,10 @@ import java.io.InputStream; import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; +import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.logging.Log; @@ -83,6 +85,330 @@ new byte[] {'t', 'T'} }; + /** <a href="http://encoding.spec.whatwg.org/#encodings">Reference</a> */ + private static final Map<String, String> ENCODING_FROM_LABEL; + static { + ENCODING_FROM_LABEL = new HashMap<String, String>(); + + // The Encoding + // ------------ + ENCODING_FROM_LABEL.put("unicode-1-1-utf-8", "utf-8"); + ENCODING_FROM_LABEL.put("utf-8", "utf-8"); + ENCODING_FROM_LABEL.put("utf8", "utf-8"); + + // Legacy single-byte encodings + // ---------------------------- + + // ibm866 + ENCODING_FROM_LABEL.put("866", "ibm866"); + ENCODING_FROM_LABEL.put("cp866", "ibm866"); + ENCODING_FROM_LABEL.put("csibm866", "ibm866"); + ENCODING_FROM_LABEL.put("ibm866", "ibm866"); + + // iso-8859-2 + ENCODING_FROM_LABEL.put("csisolatin2", "iso-8859-2"); + ENCODING_FROM_LABEL.put("iso-8859-2", "iso-8859-2"); + ENCODING_FROM_LABEL.put("iso-ir-101", "iso-8859-2"); + ENCODING_FROM_LABEL.put("iso8859-2", "iso-8859-2"); + ENCODING_FROM_LABEL.put("iso88592", "iso-8859-2"); + ENCODING_FROM_LABEL.put("iso_8859-2", "iso-8859-2"); + ENCODING_FROM_LABEL.put("iso_8859-2:1987", "iso-8859-2"); + ENCODING_FROM_LABEL.put("l2", "iso-8859-2"); + ENCODING_FROM_LABEL.put("latin2", "iso-8859-2"); + + // iso-8859-3 + ENCODING_FROM_LABEL.put("csisolatin2", "iso-8859-3"); + ENCODING_FROM_LABEL.put("csisolatin3", "iso-8859-3"); + ENCODING_FROM_LABEL.put("iso-8859-3", "iso-8859-3"); + ENCODING_FROM_LABEL.put("iso-ir-109", "iso-8859-3"); + ENCODING_FROM_LABEL.put("iso8859-3", "iso-8859-3"); + ENCODING_FROM_LABEL.put("iso88593", "iso-8859-3"); + ENCODING_FROM_LABEL.put("iso_8859-3", "iso-8859-3"); + ENCODING_FROM_LABEL.put("iso_8859-3:1988", "iso-8859-3"); + ENCODING_FROM_LABEL.put("l3", "iso-8859-3"); + ENCODING_FROM_LABEL.put("latin3", "iso-8859-3"); + + // iso-8859-4 + ENCODING_FROM_LABEL.put("csisolatin4", "iso-8859-4"); + ENCODING_FROM_LABEL.put("iso-8859-4", "iso-8859-4"); + ENCODING_FROM_LABEL.put("iso-ir-110", "iso-8859-4"); + ENCODING_FROM_LABEL.put("iso8859-4", "iso-8859-4"); + ENCODING_FROM_LABEL.put("iso88594", "iso-8859-4"); + ENCODING_FROM_LABEL.put("iso_8859-4", "iso-8859-4"); + ENCODING_FROM_LABEL.put("iso_8859-4:1988", "iso-8859-4"); + ENCODING_FROM_LABEL.put("l4", "iso-8859-4"); + ENCODING_FROM_LABEL.put("latin4", "iso-8859-4"); + + // iso-8859-5 + ENCODING_FROM_LABEL.put("csisolatincyrillic", "iso-8859-5"); + ENCODING_FROM_LABEL.put("csisolatincyrillic", "iso-8859-5"); + ENCODING_FROM_LABEL.put("cyrillic", "iso-8859-5"); + ENCODING_FROM_LABEL.put("iso-8859-5", "iso-8859-5"); + ENCODING_FROM_LABEL.put("iso-ir-144", "iso-8859-5"); + ENCODING_FROM_LABEL.put("iso8859-5", "iso-8859-5"); + ENCODING_FROM_LABEL.put("iso88595", "iso-8859-5"); + ENCODING_FROM_LABEL.put("iso_8859-5", "iso-8859-5"); + ENCODING_FROM_LABEL.put("iso_8859-5:1988", "iso-8859-5"); + + // iso-8859-6 + ENCODING_FROM_LABEL.put("arabic", "iso-8859-6"); + ENCODING_FROM_LABEL.put("asmo-708", "iso-8859-6"); + ENCODING_FROM_LABEL.put("csiso88596e", "iso-8859-6"); + ENCODING_FROM_LABEL.put("csiso88596i", "iso-8859-6"); + ENCODING_FROM_LABEL.put("csisolatinarabic", "iso-8859-6"); + ENCODING_FROM_LABEL.put("ecma-114", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso-8859-6", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso-8859-6-e", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso-8859-6-i", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso-ir-127", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso8859-6", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso88596", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso_8859-6", "iso-8859-6"); + ENCODING_FROM_LABEL.put("iso_8859-6:1987", "iso-8859-6"); + + // iso-8859-7 + ENCODING_FROM_LABEL.put("csisolatingreek", "iso-8859-7"); + ENCODING_FROM_LABEL.put("ecma-118", "iso-8859-7"); + ENCODING_FROM_LABEL.put("elot_928", "iso-8859-7"); + ENCODING_FROM_LABEL.put("greek", "iso-8859-7"); + ENCODING_FROM_LABEL.put("greek8", "iso-8859-7"); + ENCODING_FROM_LABEL.put("iso-8859-7", "iso-8859-7"); + ENCODING_FROM_LABEL.put("iso-ir-126", "iso-8859-7"); + ENCODING_FROM_LABEL.put("iso8859-7", "iso-8859-7"); + ENCODING_FROM_LABEL.put("iso88597", "iso-8859-7"); + ENCODING_FROM_LABEL.put("iso_8859-7", "iso-8859-7"); + ENCODING_FROM_LABEL.put("iso_8859-7:1987", "iso-8859-7"); + ENCODING_FROM_LABEL.put("sun_eu_greek", "iso-8859-7"); + + // iso-8859-8 + ENCODING_FROM_LABEL.put("csisolatingreek", "iso-8859-8"); + ENCODING_FROM_LABEL.put("csiso88598e", "iso-8859-8"); + ENCODING_FROM_LABEL.put("csisolatinhebrew", "iso-8859-8"); + ENCODING_FROM_LABEL.put("hebrew", "iso-8859-8"); + ENCODING_FROM_LABEL.put("iso-8859-8", "iso-8859-8"); + ENCODING_FROM_LABEL.put("iso-8859-8-e", "iso-8859-8"); + ENCODING_FROM_LABEL.put("iso-ir-138", "iso-8859-8"); + ENCODING_FROM_LABEL.put("iso8859-8", "iso-8859-8"); + ENCODING_FROM_LABEL.put("iso88598", "iso-8859-8"); + ENCODING_FROM_LABEL.put("iso_8859-8", "iso-8859-8"); + ENCODING_FROM_LABEL.put("iso_8859-8:1988", "iso-8859-8"); + ENCODING_FROM_LABEL.put("visual", "iso-8859-8"); + + // iso-8859-8-i + ENCODING_FROM_LABEL.put("csiso88598i", "iso-8859-8-i"); + ENCODING_FROM_LABEL.put("iso-8859-8-i", "iso-8859-8-i"); + ENCODING_FROM_LABEL.put("logical", "iso-8859-8-i"); + + // iso-8859-10 + ENCODING_FROM_LABEL.put("csisolatin6", "iso-8859-10"); + ENCODING_FROM_LABEL.put("iso-8859-10", "iso-8859-10"); + ENCODING_FROM_LABEL.put("iso-ir-157", "iso-8859-10"); + ENCODING_FROM_LABEL.put("iso8859-10", "iso-8859-10"); + ENCODING_FROM_LABEL.put("iso885910", "iso-8859-10"); + ENCODING_FROM_LABEL.put("l6", "iso-8859-10"); + ENCODING_FROM_LABEL.put("latin6", "iso-8859-10"); + + // iso-8859-13 + ENCODING_FROM_LABEL.put("iso-8859-13", "iso-8859-13"); + ENCODING_FROM_LABEL.put("iso8859-13", "iso-8859-13"); + ENCODING_FROM_LABEL.put("iso885913", "iso-8859-13"); + + // iso-8859-14 + ENCODING_FROM_LABEL.put("iso-8859-14", "iso-8859-14"); + ENCODING_FROM_LABEL.put("iso8859-14", "iso-8859-14"); + ENCODING_FROM_LABEL.put("iso885914", "iso-8859-14"); + + // iso-8859-15 + ENCODING_FROM_LABEL.put("csisolatin9", "iso-8859-15"); + ENCODING_FROM_LABEL.put("iso-8859-15", "iso-8859-15"); + ENCODING_FROM_LABEL.put("iso8859-15", "iso-8859-15"); + ENCODING_FROM_LABEL.put("iso885915", "iso-8859-15"); + ENCODING_FROM_LABEL.put("iso_8859-15", "iso-8859-15"); + ENCODING_FROM_LABEL.put("l9", "iso-8859-15"); + + // iso-8859-16 + ENCODING_FROM_LABEL.put("iso-8859-16", "iso-8859-16"); + + // koi8-r + ENCODING_FROM_LABEL.put("cskoi8r", "koi8-r"); + ENCODING_FROM_LABEL.put("koi", "koi8-r"); + ENCODING_FROM_LABEL.put("koi8", "koi8-r"); + ENCODING_FROM_LABEL.put("koi8-r", "koi8-r"); + ENCODING_FROM_LABEL.put("koi8_r", "koi8-r"); + + // koi8-u + ENCODING_FROM_LABEL.put("koi8-u", "koi8-u"); + + // macintosh + ENCODING_FROM_LABEL.put("csmacintosh", "macintosh"); + ENCODING_FROM_LABEL.put("mac", "macintosh"); + ENCODING_FROM_LABEL.put("macintosh", "macintosh"); + ENCODING_FROM_LABEL.put("x-mac-roman", "macintosh"); + + // windows-874 + ENCODING_FROM_LABEL.put("dos-874", "windows-874"); + ENCODING_FROM_LABEL.put("iso-8859-11", "windows-874"); + ENCODING_FROM_LABEL.put("iso8859-11", "windows-874"); + ENCODING_FROM_LABEL.put("iso885911", "windows-874"); + ENCODING_FROM_LABEL.put("tis-620", "windows-874"); + ENCODING_FROM_LABEL.put("windows-874", "windows-874"); + + // windows-1250 + ENCODING_FROM_LABEL.put("cp1250", "windows-1250"); + ENCODING_FROM_LABEL.put("windows-1250", "windows-1250"); + ENCODING_FROM_LABEL.put("x-cp1250", "windows-1250"); + + // windows-1251 + ENCODING_FROM_LABEL.put("cp1251", "windows-1251"); + ENCODING_FROM_LABEL.put("windows-1251", "windows-1251"); + ENCODING_FROM_LABEL.put("x-cp1251", "windows-1251"); + + // windows-1252 + ENCODING_FROM_LABEL.put("ansi_x3.4-1968", "windows-1252"); + ENCODING_FROM_LABEL.put("ascii", "windows-1252"); + ENCODING_FROM_LABEL.put("cp1252", "windows-1252"); + ENCODING_FROM_LABEL.put("cp819", "windows-1252"); + ENCODING_FROM_LABEL.put("csisolatin1", "windows-1252"); + ENCODING_FROM_LABEL.put("ibm819", "windows-1252"); + ENCODING_FROM_LABEL.put("iso-8859-1", "windows-1252"); + ENCODING_FROM_LABEL.put("iso-ir-100", "windows-1252"); + ENCODING_FROM_LABEL.put("iso8859-1", "windows-1252"); + ENCODING_FROM_LABEL.put("iso88591", "windows-1252"); + ENCODING_FROM_LABEL.put("iso_8859-1", "windows-1252"); + ENCODING_FROM_LABEL.put("iso_8859-1:1987", "windows-1252"); + ENCODING_FROM_LABEL.put("l1", "windows-1252"); + ENCODING_FROM_LABEL.put("latin1", "windows-1252"); + ENCODING_FROM_LABEL.put("us-ascii", "windows-1252"); + ENCODING_FROM_LABEL.put("windows-1252", "windows-1252"); + ENCODING_FROM_LABEL.put("x-cp1252", "windows-1252"); + + // windows-1253 + ENCODING_FROM_LABEL.put("cp1253", "windows-1253"); + ENCODING_FROM_LABEL.put("windows-1253", "windows-1253"); + ENCODING_FROM_LABEL.put("x-cp1253", "windows-1253"); + + // windows-1254 + ENCODING_FROM_LABEL.put("cp1254", "windows-1254"); + ENCODING_FROM_LABEL.put("csisolatin5", "windows-1254"); + ENCODING_FROM_LABEL.put("iso-8859-9", "windows-1254"); + ENCODING_FROM_LABEL.put("iso-ir-148", "windows-1254"); + ENCODING_FROM_LABEL.put("iso8859-9", "windows-1254"); + ENCODING_FROM_LABEL.put("iso88599", "windows-1254"); + ENCODING_FROM_LABEL.put("iso_8859-9", "windows-1254"); + ENCODING_FROM_LABEL.put("iso_8859-9:1989", "windows-1254"); + ENCODING_FROM_LABEL.put("l5", "windows-1254"); + ENCODING_FROM_LABEL.put("latin5", "windows-1254"); + ENCODING_FROM_LABEL.put("windows-1254", "windows-1254"); + ENCODING_FROM_LABEL.put("x-cp1254", "windows-1254"); + + // windows-1255 + ENCODING_FROM_LABEL.put("cp1255", "windows-1255"); + ENCODING_FROM_LABEL.put("windows-1255", "windows-1255"); + ENCODING_FROM_LABEL.put("x-cp1255", "windows-1255"); + + // windows-1256 + ENCODING_FROM_LABEL.put("cp1256", "windows-1256"); + ENCODING_FROM_LABEL.put("windows-1256", "windows-1256"); + ENCODING_FROM_LABEL.put("x-cp1256", "windows-1256"); + + // windows-1257 + ENCODING_FROM_LABEL.put("cp1257", "windows-1257"); + ENCODING_FROM_LABEL.put("windows-1257", "windows-1257"); + ENCODING_FROM_LABEL.put("x-cp1257", "windows-1257"); + + // windows-1258 + ENCODING_FROM_LABEL.put("cp1258", "windows-1258"); + ENCODING_FROM_LABEL.put("windows-1258", "windows-1258"); + ENCODING_FROM_LABEL.put("x-cp1258", "windows-1258"); + + // windows-1258 + ENCODING_FROM_LABEL.put("x-mac-cyrillic", "x-mac-cyrillic"); + ENCODING_FROM_LABEL.put("x-mac-ukrainian", "x-mac-cyrillic"); + + // Legacy multi-byte Chinese (simplified) encodings + // ------------------------------------------------ + + // gb18030 + ENCODING_FROM_LABEL.put("chinese", "gb18030"); + ENCODING_FROM_LABEL.put("csgb2312", "gb18030"); + ENCODING_FROM_LABEL.put("csiso58gb231280", "gb18030"); + ENCODING_FROM_LABEL.put("gb18030", "gb18030"); + ENCODING_FROM_LABEL.put("gb2312", "gb18030"); + ENCODING_FROM_LABEL.put("gb_2312", "gb18030"); + ENCODING_FROM_LABEL.put("gb_2312-80", "gb18030"); + ENCODING_FROM_LABEL.put("gbk", "gb18030"); + ENCODING_FROM_LABEL.put("iso-ir-58", "gb18030"); + ENCODING_FROM_LABEL.put("x-gbk", "gb18030"); + + // gb18030 + ENCODING_FROM_LABEL.put("hz-gb-2312", "hz-gb-2312"); + + // Legacy multi-byte Chinese (traditional) encodings + // ------------------------------------------------ + + // big5 + ENCODING_FROM_LABEL.put("big5", "big5"); + ENCODING_FROM_LABEL.put("big5-hkscs", "big5"); + ENCODING_FROM_LABEL.put("cn-big5", "big5"); + ENCODING_FROM_LABEL.put("csbig5", "big5"); + ENCODING_FROM_LABEL.put("x-x-big5", "big5"); + + // Legacy multi-byte Japanese encodings + // ------------------------------------ + + // euc-jp + ENCODING_FROM_LABEL.put("cseucpkdfmtjapanese", "euc-jp"); + ENCODING_FROM_LABEL.put("euc-jp", "euc-jp"); + ENCODING_FROM_LABEL.put("x-euc-jp", "euc-jp"); + + // iso-2022-jp + ENCODING_FROM_LABEL.put("csiso2022jp", "iso-2022-jp"); + ENCODING_FROM_LABEL.put("iso-2022-jp", "iso-2022-jp"); + + // iso-2022-jp + ENCODING_FROM_LABEL.put("csshiftjis", "shift_jis"); + ENCODING_FROM_LABEL.put("ms_kanji", "shift_jis"); + ENCODING_FROM_LABEL.put("shift-jis", "shift_jis"); + ENCODING_FROM_LABEL.put("shift_jis", "shift_jis"); + ENCODING_FROM_LABEL.put("sjis", "shift_jis"); + ENCODING_FROM_LABEL.put("windows-31j", "shift_jis"); + ENCODING_FROM_LABEL.put("x-sjis", "shift_jis"); + + // Legacy multi-byte Korean encodings + // ------------------------------------ + + // euc-kr + ENCODING_FROM_LABEL.put("cseuckr", "euc-kr"); + ENCODING_FROM_LABEL.put("csksc56011987", "euc-kr"); + ENCODING_FROM_LABEL.put("euc-kr", "euc-kr"); + ENCODING_FROM_LABEL.put("iso-ir-149", "euc-kr"); + ENCODING_FROM_LABEL.put("korean", "euc-kr"); + ENCODING_FROM_LABEL.put("ks_c_5601-1987", "euc-kr"); + ENCODING_FROM_LABEL.put("ks_c_5601-1989", "euc-kr"); + ENCODING_FROM_LABEL.put("ksc5601", "euc-kr"); + ENCODING_FROM_LABEL.put("ksc_5601", "euc-kr"); + ENCODING_FROM_LABEL.put("windows-949", "euc-kr"); + + // Legacy miscellaneous encodings + // ------------------------------------ + + // replacement + ENCODING_FROM_LABEL.put("csiso2022kr", "replacement"); + ENCODING_FROM_LABEL.put("iso-2022-cn", "replacement"); + ENCODING_FROM_LABEL.put("iso-2022-cn-ext", "replacement"); + ENCODING_FROM_LABEL.put("iso-2022-kr", "replacement"); + + // utf-16be + ENCODING_FROM_LABEL.put("utf-16be", "utf-16be"); + + // utf-16le + ENCODING_FROM_LABEL.put("utf-16", "utf-16le"); + ENCODING_FROM_LABEL.put("utf-16le", "utf-16le"); + + // utf-16le + ENCODING_FROM_LABEL.put("x-user-defined", "x-user-defined"); + } + /** * The number of HTML bytes to sniff for encoding info embedded in <tt>meta</tt> tags; * relatively large because we don't have a fallback. @@ -792,4 +1118,21 @@ } } + /** + * Translates the given encoding label into a normalized form + * according to <a href="http://encoding.spec.whatwg.org/#encodings">Reference</a>. + * @param encodingLabel the label to translate + * @return the normalized encoding name or null if not found + */ + public static String translateEncodingLabel(final String encodingLabel) { + if (null == encodingLabel) { + return null; + } + final String encLC = encodingLabel.trim().toLowerCase(Locale.ENGLISH); + final String enc = ENCODING_FROM_LABEL.get(encLC); + if (encLC.equals(enc)) { + return encodingLabel; + } + return enc; + } } |
From: <asa...@us...> - 2014-01-02 14:13:52
|
Revision: 8940 http://sourceforge.net/p/htmlunit/code/8940 Author: asashour Date: 2014-01-02 14:13:47 +0000 (Thu, 02 Jan 2014) Log Message: ----------- Update declared Chrome to 31 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2014-01-02 14:07:10 UTC (rev 8939) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2014-01-02 14:13:47 UTC (rev 8940) @@ -153,10 +153,10 @@ /** Latest Chrome. Work In Progress!!! */ public static final BrowserVersion CHROME = new BrowserVersion( "Netscape", "5.0 (Windows NT 6.1) AppleWebKit/537.36" - + " (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36", + + " (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36" - + " (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36", - 29, "Chrome", null); + + " (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36", + 31, "Chrome", null); /** The default browser version. */ private static BrowserVersion DefaultBrowserVersion_ = INTERNET_EXPLORER_8; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java 2014-01-02 14:07:10 UTC (rev 8939) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java 2014-01-02 14:13:47 UTC (rev 8940) @@ -35,7 +35,7 @@ assertEquals(8.0f, BrowserVersion.INTERNET_EXPLORER_8.getBrowserVersionNumeric()); assertEquals(9.0f, BrowserVersion.INTERNET_EXPLORER_9.getBrowserVersionNumeric()); assertEquals(11.0f, BrowserVersion.INTERNET_EXPLORER_11.getBrowserVersionNumeric()); - assertEquals(29.0f, BrowserVersion.CHROME.getBrowserVersionNumeric()); + assertEquals(31.0f, BrowserVersion.CHROME.getBrowserVersionNumeric()); } /** |
From: <rb...@us...> - 2014-01-02 16:22:45
|
Revision: 8942 http://sourceforge.net/p/htmlunit/code/8942 Author: rbri Date: 2014-01-02 16:22:41 +0000 (Thu, 02 Jan 2014) Log Message: ----------- deprecate FIREFOX_17, FIREFOX_24 is our preferred Firefox for the next months Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-02 15:14:08 UTC (rev 8941) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-02 16:22:41 UTC (rev 8942) @@ -7,7 +7,10 @@ </properties> <body> - <release version="2.14" date="???" description="Bugfixes, initial work on FF24 and IE11"> + <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="update" dev="rbri"> + BrowserVersion: deprecate FIREFOX_17, FIREFOX_24 is our preferred Firefox for the next months. + </action> <action type="fix" dev="rbri"> JavaScript: Document.inputEncoding and Document.characterSet are doing some kind of normalization on the encoding string starting with FF24. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2014-01-02 15:14:08 UTC (rev 8941) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2014-01-02 16:22:41 UTC (rev 8942) @@ -67,6 +67,7 @@ * @author Chris Erskine * @author Ahmed Ashour * @author Frank Danek + * @author Ronald Brill */ public class BrowserVersion implements Serializable, Cloneable { @@ -120,7 +121,9 @@ /** * Firefox 17 ESR. * @since 2.12 + * @deprecated as of 2.14 */ + @Deprecated public static final BrowserVersion FIREFOX_17 = new BrowserVersion( NETSCAPE, "5.0 (Windows)", "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0", Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java 2014-01-02 15:14:08 UTC (rev 8941) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java 2014-01-02 16:22:41 UTC (rev 8942) @@ -70,10 +70,10 @@ if (BrowserVersionClassRunner.containsTestMethods(klass)) { final List<String> browsers = WebDriverTestCase.getBrowsersProperties(); - if (browsers.contains("hu") || browsers.contains("hu-ff17")) { + if (/*browsers.contains("hu") ||*/ browsers.contains("hu-ff17")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.FIREFOX_17, false)); } - if (/*browsers.contains("hu") ||*/ browsers.contains("hu-ff24")) { + if (browsers.contains("hu") || browsers.contains("hu-ff24")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.FIREFOX_24, false)); } if (browsers.contains("hu") || browsers.contains("hu-ie8")) { |
From: <rb...@us...> - 2014-01-04 11:43:02
|
Revision: 8947 http://sourceforge.net/p/htmlunit/code/8947 Author: rbri Date: 2014-01-04 11:42:57 +0000 (Sat, 04 Jan 2014) Log Message: ----------- next monster patch from Frank; many more fixes for IE11 and some for Chrome Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Attr.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Selection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalker.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleSheetList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMException.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLButtonElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTextAreaElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeErrorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/DocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Location2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NamespaceTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NodeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/RangeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/StorageTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/TextRangeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalkerTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleRuleTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMExceptionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMParserTest.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/HTMLTableElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTextAreaElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializerTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/xml/XmlPage2Test.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCacheTest.java Removed Paths: ------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/OfflineResourceList.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/OfflineResourceListTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -76,6 +76,7 @@ private String applicationName_; private String applicationVersion_; private String buildId_; + private String vendor_; private String browserLanguage_ = LANGUAGE_ENGLISH_US; private String cpuClass_ = CPU_CLASS_X86; private boolean onLine_ = true; @@ -173,6 +174,7 @@ FIREFOX_17.initDefaultFeatures(); FIREFOX_17.setBrowserLanguage("en-US"); + FIREFOX_17.setVendor(""); FIREFOX_17.buildId_ = "20130805152501"; FIREFOX_17.setHtmlAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); FIREFOX_17.setXmlHttpRequestAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); @@ -182,6 +184,7 @@ FIREFOX_24.initDefaultFeatures(); FIREFOX_24.setBrowserLanguage("en-US"); + FIREFOX_24.setVendor(""); FIREFOX_24.buildId_ = "20131112155850"; FIREFOX_24.setHtmlAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); FIREFOX_24.setXmlHttpRequestAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); @@ -190,6 +193,8 @@ INTERNET_EXPLORER_8.setHtmlAcceptHeader("image/gif, image/jpeg, image/pjpeg, image/pjpeg, */*"); + INTERNET_EXPLORER_11.setBrowserLanguage("en-US"); + INTERNET_EXPLORER_11.setVendor(""); INTERNET_EXPLORER_11.setHtmlAcceptHeader("text/html, application/xhtml+xml, */*"); INTERNET_EXPLORER_11.setImgAcceptHeader("image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5"); INTERNET_EXPLORER_11.setCssAcceptHeader("text/css, */*"); @@ -204,9 +209,10 @@ CHROME.initDefaultFeatures(); CHROME.setApplicationCodeName("Mozilla"); + CHROME.setVendor("Google Inc."); CHROME.setPlatform("MacIntel"); CHROME.setCpuClass(null); - CHROME.setBrowserLanguage("undefined"); + CHROME.setBrowserLanguage("en-US"); // there are other issues with Chrome; a different productSub, etc. } @@ -391,6 +397,13 @@ } /** + * @return the vendor + */ + public String getVendor() { + return vendor_; + } + + /** * Returns the browser application language, for example "en-us". * Default value is {@link #LANGUAGE_ENGLISH_US} if not explicitly configured. * @return the browser application language @@ -532,6 +545,13 @@ } /** + * @param vendor the vendor to set + */ + public void setVendor(final String vendor) { + this.vendor_ = vendor; + } + + /** * @param browserLanguage the browserLanguage to set */ public void setBrowserLanguage(final String browserLanguage) { @@ -698,6 +718,7 @@ clone.setApplicationCodeName(getApplicationCodeName()); clone.setApplicationMinorVersion(getApplicationMinorVersion()); + clone.setVendor(getVendor()); clone.setBrowserLanguage(getBrowserLanguage()); clone.setCpuClass(getCpuClass()); clone.setOnLine(isOnLine()); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -91,6 +91,10 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) CSS_PIXEL_VALUES_INT_ONLY, + /** The default value of the display property for the 'progress' tag is 'inline' instead of the default one. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + CSS_PROGRESS_DISPLAY_INLINE, + /** The default value of the display property for the 'script' tag is 'inline' instead of the default one. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) CSS_SCRIPT_DISPLAY_INLINE, @@ -328,10 +332,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_45, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_49, /** Was originally .isIE(). */ @@ -632,8 +632,7 @@ @BrowserFeature(@WebBrowser(IE)) JS_ALIGN_FOR_INPUT_IGNORES_VALUES, - /** Top scope constants can be assign (and are not... constants). - */ + /** Top scope constants can be assign (and are not... constants). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_ALLOW_CONST_ASSIGNMENT, @@ -644,6 +643,10 @@ @BrowserFeature(@WebBrowser(IE)) JS_ANCHORS_REQUIRES_NAME_OR_ID, + /** Indicates that the <code>ApplicationCache</code> is named <code>OfflineResourceList</code> instead. */ + @BrowserFeature(@WebBrowser(FF)) + JS_APPCACHE_NAME_OFFLINERESOURCELIST, + /** Indicates that the appendChild call create a DocumentFragment to be * the parentNode's parentNode if this was null. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) @@ -721,13 +724,20 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) JS_CONSTRUCTOR, - /** Is Date.toLocaleTimeString() in 24-hour format. */ - @BrowserFeature({ @WebBrowser(value = IE, minVersion = 8), @WebBrowser(value = FF, minVersion = 17), - @WebBrowser(CHROME) }) - JS_DATE_LOCATE_TIME_24, + /** <code>Date.toLocaleDateString()</code> returns a short form (d.M.yyyy). */ + @BrowserFeature(@WebBrowser(CHROME)) + JS_DATE_LOCALE_DATE_SHORT, + /** <code>Date.toLocaleDateString()</code> returns a short form (dd.MM.yyyy) with some weird special chars. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_DATE_LOCALE_DATE_SHORT_WITH_SPECIAL_CHARS, + + /** <code>Date.toLocaleTimeString()</code> returns a form with some weird special chars. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_DATE_LOCALE_TIME_WITH_SPECIAL_CHARS, + /** Is Date.toUTCString() and Date.toGMTString are returning UTC instead of GMT. */ - @BrowserFeature({ @WebBrowser(IE) }) + @BrowserFeature({ @WebBrowser(value = IE, maxVersion = 9) }) JS_DATE_USE_UTC, /** */ @@ -763,10 +773,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_DOCUMENT_APPEND_CHILD_SUPPORTED, - /** Document instead of HTMLDocument. */ - @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) - JS_DOCUMENT_CLASS_NAME, - /** Javascript function document.createElement can process html code. * e.g. document.createElement("<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='First Choice'>") * @see "http://msdn.microsoft.com/en-us/library/ms536389%28v=VS.85%29.aspx" @@ -887,6 +893,18 @@ @BrowserFeature(@WebBrowser(FF)) JS_DOMIMPLEMENTATION_FEATURE_XPATH_3, + /** <code>DOMParser.parseFromString(..)</code> handles an empty String as error. */ + @BrowserFeature({ @WebBrowser(CHROME), @WebBrowser(FF) }) + JS_DOMPARSER_EMPTY_STRING_IS_ERROR, + + /** <code>DOMParser.parseFromString(..)</code> throws an exception if an error occurs. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_DOMPARSER_EXCEPTION_ON_ERROR, + + /** <code>DOMParser.parseFromString(..)</code> creates a document containing a <code>parsererror</code> element. */ + @BrowserFeature(@WebBrowser(FF)) + JS_DOMPARSER_PARSERERROR_ON_ERROR, + /** Javascript property function delete thows an exception if the * given count is negative. */ @BrowserFeature(@WebBrowser(IE)) @@ -911,7 +929,7 @@ JS_ERROR_STACK, /** Indicates that "eval" function should have access to the local function scope. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_EVAL_LOCAL_SCOPE, /** Javascript event aborted check is based on the event handler return value (IE); @@ -1065,10 +1083,19 @@ * for url 'http://localhost/something/#%C3%BC'.<br> * IE evaluates to #%C3%BC. */ - @BrowserFeature({ @WebBrowser(value = IE, minVersion = 8, maxVersion = 9), @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(value = IE, minVersion = 8, maxVersion = 9), @WebBrowser(FF) }) JS_LOCATION_HASH_IS_DECODED, /** + * Set this property if the browser evaluates<br> + * window.location.hash to #%C3%BC; (like Firefox)<br> + * for url 'http://localhost/something/#ü'.<br> + * IE evaluates to #ü. + */ + @BrowserFeature({ @WebBrowser(value = IE, minVersion = 8, maxVersion = 9), @WebBrowser(FF) }) + JS_LOCATION_HASH_IS_ENCODED, + + /** * Property location.hash returns '#' for urls ending with a hash * sign (e.g. http://localhost/something/#). */ @@ -1078,9 +1105,17 @@ /** * Indicates if the String representation of a native function begins and ends with a \n. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) + @BrowserFeature(@WebBrowser(IE)) JS_NATIVE_FUNCTION_TOSTRING_NEW_LINE, + /** <code>Node.childNodes</code> ignores empty text nodes for XML pages. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) + JS_NODE_CHILDNODES_IGNORE_EMPTY_TEXT_NODES, + + /** The reference argument of <code>Node.insertBefore(..)</code> is optional. */ + @BrowserFeature({ @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) + JS_NODE_INSERT_BEFORE_REF_OPTIONAL, + /** Should throw exception if extra argument is passed to node.insertBefore(). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) JS_NODE_INSERT_BEFORE_THROW_EXCEPTION_FOR_EXTRA_ARGUMENT, @@ -1193,11 +1228,16 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) JS_SET_ATTRIBUTE_SUPPORTS_EVENT_HANDLERS, - /** When addressing an item in a stylesheet list, IE throws an exception for all - * invalid indexes not only for negative ones like FF does. + /** When addressing an item in a stylesheet list using a negative index an exception is thrown. */ + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, maxVersion = 9) }) + JS_STYLESHEETLIST_EXCEPTION_FOR_NEGATIVE_INDEX, + + /** + * When addressing an item in a stylesheet list using an index higher than the count of contained items an + * exception is thrown. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) - JS_STYLESHEET_LIST_EXEPTION_FOR_ALL_INVALID_INDEXES, + JS_STYLESHEETLIST_EXCEPTION_FOR_TOO_HIGH_INDEX, /** Indicates if style.getAttribute supports a (second) flags argument. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) @@ -1289,21 +1329,29 @@ @BrowserFeature({ @WebBrowser(IE), @WebBrowser(value = FF, minVersion = 10) }) JS_TEXT_AREA_SET_ROWS_THROWS_EXCEPTION, - /** It looks likes TreeWalker.expandEntityReferences is always <code>false</code> for FF17. - */ + /** Indicates that <code>TreeWalker.expandEntityReferences</code> is always <code>false</code>. */ @BrowserFeature(@WebBrowser(value = FF, minVersion = 17)) JS_TREEWALKER_EXPAND_ENTITY_REFERENCES_FALSE, + /** + * Indicates that the filter to be used by the TreeWalker has to be a function (so no object with a method + * <code>acceptNode(..)</code> is supported). + */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_TREEWALKER_FILTER_FUNCTION_ONLY, + /** Setting the property width/heigth to arbitrary values is allowed. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) JS_WIDTH_HEIGHT_ACCEPTS_ARBITRARY_VALUES, - /** Changing the opener of an window to something not null - * is not valid (in FF). - */ + /** Changing the opener of a window to something not null is not valid. */ @BrowserFeature({ @WebBrowser(value = FF, maxVersion = 17), @WebBrowser(CHROME) }) JS_WINDOW_CHANGE_OPENER_NOT_ALLOWED, + /** Changing the opener of a window to something not null and not a window is not valid. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_WINDOW_CHANGE_OPENER_ONLY_WINDOW_OBJECT, + /** Support for accessing the frame of a window by id additionally * to using the name (FF). */ @@ -1314,8 +1362,12 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_WINDOW_IS_A_FUNCTION, + /** <code>Window.onerror</code> gets the column number as 4th argument. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_WINDOW_ONERROR_COLUMN_ARGUMENT, + /** Window.postMessage is sent when the targetOrigin port is different than the current port. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_WINDOW_POST_MESSAGE_ALLOW_INVALID_PORT, /** Window.postMessage created cancelable event. */ @@ -1330,6 +1382,10 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) JS_XML, + /** Indicates that XML code embedded in an HTML page is handled by MSXML ActiveX. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) + JS_XML_IN_HTML_VIA_ACTIVEXOBJECT, + /** Indicates that new XMLSerializer().serializeToString(..) adds the xhtml namespace to the root element. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) JS_XML_SERIALIZER_ADD_XHTML_NAMESPACE, @@ -1343,10 +1399,22 @@ @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) JS_XML_SERIALIZER_BLANK_BEFORE_SELF_CLOSING, + /** + * Indicates that new XMLSerializer().serializeToString(..) called with a document fragment created by an + * HTMLPage always returns ''. + */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_XML_SERIALIZER_HTML_DOCUMENT_FRAGMENT_ALWAYS_EMPTY, + /** Indicates that new XMLSerializer().serializeToString(..) respects the XHTML definition for non empty tags. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) JS_XML_SERIALIZER_NON_EMPTY_TAGS, + /** Indicates that <code>XMLSerializer.serializeToString(..)</code> serializes a single CDataSection as escaped + * text instead of <code><![CDATA[xxx]]></code>. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_XML_SERIALIZER_ROOT_CDATA_AS_ESCAPED_TEXT, + /** Indicates that the browser uses the ActiveXObject for implementing XML support (IE). */ @BrowserFeature(@WebBrowser(IE)) JS_XML_SUPPORT_VIA_ACTIVEXOBJECT, @@ -1494,8 +1562,8 @@ @BrowserFeature({ @WebBrowser(IE), @WebBrowser(FF), @WebBrowser(CHROME) }) WINDOW_ACTIVE_ELEMENT_FOCUSED, - /** XMLHttpRequest does not trigger the error handler (IE). */ - @BrowserFeature(@WebBrowser(IE)) + /** XMLHttpRequest does not trigger the error handler. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) XHR_ERRORHANDLER_NOT_SUPPORTED, /** XMLHttpRequest triggers the opened event at the beginning of the send @@ -1504,12 +1572,21 @@ @BrowserFeature({ @WebBrowser(IE), @WebBrowser(value = FF, maxVersion = 17) }) XHR_FIRE_STATE_OPENED_AGAIN_IN_ASYNC_MODE, + /** + * Indicates if the port should be ignored during origin check. + * For IE11: this is currently a bug, see + * http://connect.microsoft.com/IE/feedback/details/781303/ + * origin-header-is-not-added-to-cors-requests-to-same-domain-but-different-port + */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + XHR_IGNORE_PORT_FOR_SAME_ORIGIN, + /** Indicates if a same origin check should be skipped. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 8) }) XHR_IGNORE_SAME_ORIGIN, /** Indicates if a request to a about URL is allowed. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) XHR_IGNORE_SAME_ORIGIN_TO_ABOUT, /** Indicates that the onreadystatechange handler is triggered for sync requests for COMPLETED (4). */ @@ -1530,10 +1607,10 @@ XHR_OPEN_ALLOW_EMTPY_URL, /** Indicates if a "Origin" header should be sent. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) XHR_ORIGIN_HEADER, - /** Indicates that responseXML returns the ActiveXObject. */ + /** Indicates that <code>responseXML</code> returns an MXSML ActiveX object. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) XHR_RESPONSE_XML_IS_ACTIVEXOBJECT, @@ -1550,14 +1627,25 @@ @BrowserFeature(@WebBrowser(IE)) XHR_WITHCREDENTIALS_ALLOW_ORIGIN_ALL, - /** Indicates that the propery 'withCredentials is not writable for sync requests. */ + /** + * Indicates that the property <code>withCredentials</code> is not writable before calling <code>open()</code>. + * Setting the property throws an exception. + */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 10)) + XHR_WITHCREDENTIALS_NOT_WRITEABLE_BEFORE_OPEN_EXCEPTION, + + /** + * Indicates that the property <code>withCredentials</code> is not writable for sync requests. + */ @BrowserFeature(@WebBrowser(value = FF, maxVersion = 23)) - XHR_WITHCREDENTIALS_SYNC_NOT_WRITEABLE, + XHR_WITHCREDENTIALS_NOT_WRITEABLE_IN_SYNC, - /** Indicates that the propery 'withCredentials is not writable for sync requests. - * Setting the property throws an exception. */ + /** + * Indicates that the property <code>withCredentials</code> is not writable for sync requests. + * Setting the property throws an exception. + */ @BrowserFeature(@WebBrowser(value = FF, minVersion = 24)) - XHR_WITHCREDENTIALS_SYNC_NOT_WRITEABLE_EXCEPTION, + XHR_WITHCREDENTIALS_NOT_WRITEABLE_IN_SYNC_EXCEPTION, /** Indicates that the 'SelectionNamespaces' property is supported by XPath expressions. */ @BrowserFeature({ @WebBrowser(IE), @WebBrowser(CHROME) }) Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -36,6 +36,7 @@ * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> * @author Marc Guillemot + * @author Frank Danek */ public class ScriptException extends RuntimeException { @@ -227,6 +228,21 @@ } /** + * Returns the column number of the source that was executing at the time of the exception. + * + * @return the column number or -1 if the exception was not thrown due to the + * execution of a script. + */ + public int getFailingColumnNumber() { + if (getCause() instanceof RhinoException) { + final RhinoException cause = (RhinoException) getCause(); + return cause.columnNumber(); + } + + return -1; + } + + /** * Gets the HTML page in which the script error occurred.<br/> * Caution: this page may be only partially parsed if the exception occurred in a script * executed at parsing time. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_PROGRESS_DISPLAY_INLINE; + import java.util.Map; import com.gargoylesoftware.htmlunit.SgmlPage; @@ -52,6 +54,9 @@ */ @Override public DisplayStyle getDefaultStyleDisplay() { + if (hasFeature(CSS_PROGRESS_DISPLAY_INLINE)) { + return DisplayStyle.INLINE; + } return DisplayStyle.INLINE_BLOCK; } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -55,7 +55,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.Node; import com.gargoylesoftware.htmlunit.javascript.host.NodeFilter; import com.gargoylesoftware.htmlunit.javascript.host.NodeList; -import com.gargoylesoftware.htmlunit.javascript.host.OfflineResourceList; +import com.gargoylesoftware.htmlunit.javascript.host.ApplicationCache; import com.gargoylesoftware.htmlunit.javascript.host.Plugin; import com.gargoylesoftware.htmlunit.javascript.host.PluginArray; import com.gargoylesoftware.htmlunit.javascript.host.Popup; @@ -283,7 +283,8 @@ @SuppressWarnings("unchecked") static final Class<? extends SimpleScriptable>[] CLASSES_ = new Class[] { ArrayBuffer.class, ArrayBufferView.class, ArrayBufferViewBase.class, - Attr.class, ActiveXObject.class, BoxObject.class, CDATASection.class, ClipboardData.class, + Attr.class, ActiveXObject.class, ApplicationCache.class, + BoxObject.class, CDATASection.class, ClipboardData.class, CSSCharsetRule.class, CSSFontFaceRule.class, CSSImportRule.class, CSSMediaRule.class, CSSPrimitiveValue.class, CSSRule.class, CSSRuleList.class, CSSStyleDeclaration.class, CSSStyleRule.class, CSSStyleSheet.class, CSSValue.class, @@ -334,7 +335,7 @@ KeyboardEvent.class, Location.class, MediaList.class, MessageEvent.class, MimeType.class, MimeTypeArray.class, MouseEvent.class, MutationEvent.class, NamedNodeMap.class, Namespace.class, NamespaceCollection.class, Navigator.class, - Node.class, NodeFilter.class, NodeList.class, OfflineResourceList.class, + Node.class, NodeFilter.class, NodeList.class, Plugin.class, PluginArray.class, Popup.class, Position.class, ProcessingInstruction.class, Range.class, RowContainer.class, SVGAElement.class, SVGAltGlyphElement.class, SVGAngle.class, SVGAnimateElement.class, Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -0,0 +1,265 @@ +/* + * 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.host; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; + +import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * <p>A collection of offline resources as defined in the + * <a href="http://www.w3.org/TR/2008/WD-html5-20080122/#appcache">HTML5 spec</a>. + * Intended to support offline web applications.</p> + * + * <p><b>NOTE:</b> This class is essentially a skeleton implementation providing minimal + * compatibility while we wait for the HTML5 dust to settle. The first real browser we should + * worry about supporting with this implementation will probably be either Firefox 3.5 + * or Firefox 4.</p> + * + * @version $Revision$ + * @author Daniel Gredler + * @see <a href="https://developer.mozilla.org/en/offline_resources_in_firefox">Offline Resources in Firefox</a> + * @see <a href="https://developer.mozilla.org/en/nsIDOMOfflineResourceList">Mozilla Documentation</a> + */ +@JsxClass(browsers = @WebBrowser(FF)) +public class ApplicationCache extends SimpleScriptable { + + /** The object isn't associated with an application cache. */ + public static final short STATUS_UNCACHED = 0; + /** The application cache is not in the process of being updated. */ + public static final short STATUS_IDLE = 1; + /** The application cache manifest is being fetched and checked for updates. */ + public static final short STATUS_CHECKING = 2; + /** Resources are being downloaded to be added to the cache. */ + public static final short STATUS_DOWNLOADING = 3; + /** There is a new version of the application cache available. */ + public static final short STATUS_UPDATEREADY = 4; + /** The application cache group is now obsolete. */ + public static final short STATUS_OBSOLETE = 5; + + private short status_ = STATUS_UNCACHED; + private Object onchecking_; + private Object onerror_; + private Object onnoupdate_; + private Object ondownloading_; + private Object onprogress_; + private Object onupdateready_; + private Object oncached_; + + /** + * Returns the event listener to be called when fetching the application cache manifest and checking for updates. + * @return the event listener to be called when fetching the application cache manifest and checking for updates + */ + @JsxGetter + public Object getOnchecking() { + return onchecking_; + } + + /** + * Sets the event listener to be called when fetching the application cache manifest and checking for updates. + * @param o the event listener to be called when fetching the application cache manifest and checking for updates + */ + @JsxSetter + public void setOnchecking(final Object o) { + onchecking_ = o; + } + + /** + * Returns the event listener to be called when an error occurs during the caching process. + * @return the event listener to be called when an error occurs during the caching process + */ + @JsxGetter + public Object getOnerror() { + return onerror_; + } + + /** + * Sets the event listener to be called when an error occurs during the caching process. + * @param o the event listener to be called when an error occurs during the caching process + */ + @JsxSetter + public void setOnerror(final Object o) { + onerror_ = o; + } + + /** + * Returns the event listener to be called when there is no update to download. + * @return the event listener to be called when there is no update to download + */ + @JsxGetter + public Object getOnnoupdate() { + return onnoupdate_; + } + + /** + * Sets the event listener to be called when there is no update to download. + * @param o the event listener to be called when there is no update to download + */ + @JsxSetter + public void setOnnoupdate(final Object o) { + onnoupdate_ = o; + } + + /** + * Returns the event listener to be called when resources are being downloaded into the cache. + * @return the event listener to be called when resources are being downloaded into the cache + */ + @JsxGetter + public Object getOndownloading() { + return ondownloading_; + } + + /** + * Sets the event listener to be called when resources are being downloaded into the cache. + * @param o the event listener to be called when resources are being downloaded into the cache + */ + @JsxSetter + public void setOndownloading(final Object o) { + ondownloading_ = o; + } + + /** + * Returns the event listener to be called periodically throughout the download process. + * @return the event listener to be called periodically throughout the download process + */ + @JsxGetter + public Object getOnprogress() { + return onprogress_; + } + + /** + * Sets the event listener to be called periodically throughout the download process. + * @param o the event listener to be called periodically throughout the download process + */ + @JsxSetter + public void setOnprogress(final Object o) { + onprogress_ = o; + } + + /** + * Returns the event listener to be called when a resource update is ready. + * @return the event listener to be called when a resource update is ready + */ + @JsxGetter + public Object getOnupdateready() { + return onupdateready_; + } + + /** + * Sets the event listener to be called when a resource update is ready. + * @param o the event listener to be called when a resource update is ready + */ + @JsxSetter + public void setOnupdateready(final Object o) { + onupdateready_ = o; + } + + /** + * Returns the event listener to be called when caching is complete. + * @return the event listener to be called when caching is complete + */ + @JsxGetter + public Object getOncached() { + return oncached_; + } + + /** + * Sets the event listener to be called when caching is complete. + * @param o the event listener to be called when caching is complete + */ + @JsxSetter + public void setOncached(final Object o) { + oncached_ = o; + } + + /** + * Returns the status of the application cache. + * @return the status of the application cache + */ + @JsxGetter + public short getStatus() { + return status_; + } + + /** + * Returns the number of entries in the dynamically managed offline resource list. + * @return the number of entries in the dynamically managed offline resource list + */ + @JsxGetter + public int getLength() { + return 0; // TODO: implement + } + + /** + * Adds an item to the dynamically managed entries. The resource will be fetched and added to the application cache. + * @param uri the URI of the item to add to the dynamically managed entries + */ + @JsxFunction + public void add(final String uri) { + // TODO: implement + } + + /** + * Returns <tt>true</tt> if the specified URI represents a resource that's in the application cache's list. + * @param uri the URI to check + * @return <tt>true</tt> if the specified URI represents a resource that's in the application cache's list + */ + @JsxFunction + public boolean hasItem(final String uri) { + return false; // TODO: implement + } + + /** + * Returns the URI of the item at the specific offset into the list of cached resources. + * @param index the index of the cached item whose URI should be returned + * @return the URI of the item at the specific offset into the list of cached resources + */ + @JsxFunction + public String item(final int index) { + return null; // TODO: implement + } + + /** + * Removes an item from the list of dynamically managed entries. If this was the last reference + * to the given URI in the application cache, the cache entry is removed. + * @param uri the URI to remove + */ + @JsxFunction + public void remove(final String uri) { + // TODO: implement + } + + /** + * Swaps in the newest version of the application cache. + */ + @JsxFunction + public void swapCache() { + // TODO: implement + } + + /** + * Begins the application cache update process. + */ + @JsxFunction + public void update() { + // TODO: implement + } + +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java ___________________________________________________________________ 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 Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Attr.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Attr.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Attr.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -107,7 +107,7 @@ * Returns the owner element. * @return the owner element */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public Object getOwnerElement() { final DomElement parent = getDomNodeOrDie().getOwnerElement(); if (parent != null) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -14,7 +14,9 @@ */ package com.gargoylesoftware.htmlunit.javascript.host; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DATE_LOCATE_TIME_24; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DATE_LOCALE_DATE_SHORT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DATE_LOCALE_DATE_SHORT_WITH_SPECIAL_CHARS; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DATE_LOCALE_TIME_WITH_SPECIAL_CHARS; import java.lang.reflect.Field; import java.text.DateFormat; @@ -37,6 +39,7 @@ * @version $Revision$ * @author Ahmed Ashour * @author Ronald Brill + * @author Frank Danek */ public final class DateCustom { @@ -56,7 +59,20 @@ */ public static String toLocaleDateString( final Context context, final Scriptable thisObj, final Object[] args, final Function function) { - final SimpleDateFormat format = new SimpleDateFormat("EEEE, MMMM dd, yyyy", getLocale(thisObj)); + final String formatString; + final BrowserVersion browserVersion = + ((Window) thisObj.getParentScope()).getWebWindow().getWebClient().getBrowserVersion(); + + if (browserVersion.hasFeature(JS_DATE_LOCALE_DATE_SHORT_WITH_SPECIAL_CHARS)) { + formatString = "dd.MM.yyyy"; + } + else if (browserVersion.hasFeature(JS_DATE_LOCALE_DATE_SHORT)) { + formatString = "d.M.yyyy"; + } + else { + formatString = "EEEE, MMMM dd, yyyy"; + } + final DateFormat format = new SimpleDateFormat(formatString, getLocale(thisObj)); return format.format(new Date(getDateValue(thisObj))); } @@ -71,12 +87,14 @@ public static String toLocaleTimeString( final Context context, final Scriptable thisObj, final Object[] args, final Function function) { final String formatString; - if (((Window) thisObj.getParentScope()).getWebWindow().getWebClient().getBrowserVersion() - .hasFeature(JS_DATE_LOCATE_TIME_24)) { - formatString = "HH:mm:ss"; + final BrowserVersion browserVersion = + ((Window) thisObj.getParentScope()).getWebWindow().getWebClient().getBrowserVersion(); + + if (browserVersion.hasFeature(JS_DATE_LOCALE_TIME_WITH_SPECIAL_CHARS)) { + formatString = "HH:mm:ss"; } else { - formatString = "hh:mm:ss a"; + formatString = "HH:mm:ss"; } final DateFormat format = new SimpleDateFormat(formatString, getLocale(thisObj)); return format.format(new Date(getDateValue(thisObj))); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -16,6 +16,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.ANCHOR_EMPTY_HREF_NO_FILENAME; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_LOCATION_HASH_IS_DECODED; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_LOCATION_HASH_IS_ENCODED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_LOCATION_HASH_RETURNS_HASH_FOR_EMPTY_DEFINED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.URL_ABOUT_BLANK_HAS_EMPTY_PATH; @@ -54,6 +55,7 @@ * @author David K. Taylor * @author Ahmed Ashour * @author Ronald Brill + * @author Frank Danek * * @see <a href="http://msdn.microsoft.com/en-us/library/ms535866.aspx">MSDN Documentation</a> */ @@ -173,7 +175,7 @@ } try { URL url = page.getUrl(); - final boolean encodeHash = getBrowserVersion().hasFeature(JS_LOCATION_HASH_IS_DECODED); + final boolean encodeHash = getBrowserVersion().hasFeature(JS_LOCATION_HASH_IS_ENCODED); final String hash = getHash(encodeHash); if (hash != null) { url = UrlUtils.getUrlWithNewRef(url, hash); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -28,9 +28,10 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Frank Danek * @see <a href="http://msdn.microsoft.com/en-us/library/ms535854.aspx">MSDN documentation</a> */ -@JsxClass(browsers = @WebBrowser(IE)) +@JsxClass(browsers = @WebBrowser(value = IE, maxVersion = 9)) public class Namespace extends SimpleScriptable { private String name_; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -18,7 +18,6 @@ import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; -import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.PluginConfiguration; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; @@ -100,7 +99,7 @@ * Returns the language of the browser (for Mozilla). * @return the language */ - @JsxGetter(@WebBrowser(FF)) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public String getLanguage() { return getBrowserVersion().getBrowserLanguage(); } @@ -145,7 +144,7 @@ * Returns the property "product". * @return the property "product" */ - @JsxGetter(@WebBrowser(FF)) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public String getProduct() { return "Gecko"; } @@ -155,7 +154,7 @@ * @see <a href="https://developer.mozilla.org/en/navigator.productSub">Mozilla Doc</a> * @return false */ - @JsxGetter(@WebBrowser(FF)) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF) }) public String getProductSub() { return "20100215"; } @@ -280,13 +279,9 @@ * Returns the vendor. * @return the vendor */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @JsxGetter({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) public String getVendor() { - final BrowserVersion browser = getBrowserVersion(); - if (browser.getNickname().startsWith("FF")) { - return ""; - } - return "Google Inc."; + return getBrowserVersion().getVendor(); } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -15,13 +15,14 @@ package com.gargoylesoftware.htmlunit.javascript.host; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_124; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_45; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NODE_CHILDNODES_IGNORE_EMPTY_TEXT_NODES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_APPEND_CHILD_CREATE_DOCUMENT_FRAGMENT_PARENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_APPEND_CHILD_THROWS_NO_EXCEPTION_FOR_WRONG_NODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CLONE_NODE_COPIES_EVENT_LISTENERS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_EVENT_HANDLER_AS_PROPERTY_DONT_RECEIVE_EVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures. JS_NODE_INSERT_BEFORE_THROW_EXCEPTION_FOR_EXTRA_ARGUMENT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NODE_INSERT_BEFORE_REF_OPTIONAL; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SERIALIZER_APPENDS_CRLF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; @@ -88,75 +89,75 @@ private EventListenersContainer eventListenersContainer_; /** @see org.w3c.dom.Node#ELEMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ELEMENT_NODE = org.w3c.dom.Node.ELEMENT_NODE; /** @see org.w3c.dom.Node#ATTRIBUTE_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ATTRIBUTE_NODE = org.w3c.dom.Node.ATTRIBUTE_NODE; /** @see org.w3c.dom.Node#TEXT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short TEXT_NODE = org.w3c.dom.Node.TEXT_NODE; /** @see org.w3c.dom.Node#CDATA_SECTION_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short CDATA_SECTION_NODE = org.w3c.dom.Node.CDATA_SECTION_NODE; /** @see org.w3c.dom.Node#ENTITY_REFERENCE_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ENTITY_REFERENCE_NODE = org.w3c.dom.Node.ENTITY_REFERENCE_NODE; /** @see org.w3c.dom.Node#ENTITY_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ENTITY_NODE = org.w3c.dom.Node.ENTITY_NODE; /** @see org.w3c.dom.Node#PROCESSING_INSTRUCTION_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short PROCESSING_INSTRUCTION_NODE = org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE; /** @see org.w3c.dom.Node#COMMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short COMMENT_NODE = org.w3c.dom.Node.COMMENT_NODE; /** @see org.w3c.dom.Node#DOCUMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({@WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_NODE = org.w3c.dom.Node.DOCUMENT_NODE; /** @see org.w3c.dom.Node#DOCUMENT_TYPE_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_TYPE_NODE = org.w3c.dom.Node.DOCUMENT_TYPE_NODE; /** @see org.w3c.dom.Node#DOCUMENT_FRAGMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_FRAGMENT_NODE = org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE; /** @see org.w3c.dom.Node#NOTATION_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short NOTATION_NODE = org.w3c.dom.Node.NOTATION_NODE; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_DISCONNECTED */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_DISCONNECTED = org.w3c.dom.Node.DOCUMENT_POSITION_DISCONNECTED; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_PRECEDING */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_PRECEDING = org.w3c.dom.Node.DOCUMENT_POSITION_PRECEDING; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_FOLLOWING */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_FOLLOWING = org.w3c.dom.Node.DOCUMENT_POSITION_FOLLOWING; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_CONTAINS */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_CONTAINS = org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINS; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_CONTAINED_BY */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_CONTAINED_BY = org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINED_BY; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxConstant({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = org.w3c.dom.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; @@ -270,7 +271,13 @@ } } - private RhinoException asJavaScriptException(final DOMException exception) { + /** + * Encapsulates the given {@link DOMException} into a Rhino-compatible exception. + * + * @param exception the exception to encapsulate + * @return the created exception + */ + protected RhinoException asJavaScriptException(final DOMException exception) { exception.setPrototype(getWindow().getPrototype(exception.getClass())); exception.setParentScope(getWindow()); @@ -400,7 +407,7 @@ refChildNode = null; } else { - if (args.length == 2) { + if (args.length == 2 || getBrowserVersion().hasFeature(JS_NODE_INSERT_BEFORE_REF_OPTIONAL)) { refChildNode = null; } else { @@ -447,7 +454,7 @@ * * @return whether this node is the same node as the given one */ - @JsxFunction(@WebBrowser(value = IE, minVersion = 9)) + @JsxFunction({ @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 9) }) public boolean isSameNode(final Object other) { return other == this; } @@ -490,9 +497,11 @@ if (childNodes_ == null) { final DomNode node = getDomNodeOrDie(); final boolean isXmlPage = node.getOwnerDocument() instanceof XmlPage; - final boolean isIE = getBrowserVersion().hasFeature(GENERATED_45); + final boolean shouldIgnoreEmptyTextNodes = + getBrowserVersion().hasFeature(JS_NODE_CHILDNODES_IGNORE_EMPTY_TEXT_NODES); final Boolean xmlSpaceDefault = isXMLSpaceDefault(node); - final boolean skipEmptyTextNode = isIE && isXmlPage && !Boolean.FALSE.equals(xmlSpaceDefault); + final boolean ignoreEmptyTextNode = + shouldIgnoreEmptyTextNodes && isXmlPage && !Boolean.FALSE.equals(xmlSpaceDefault); childNodes_ = new NodeList(node, false, "Node.childNodes") { @Override @@ -500,7 +509,7 @@ final List<Object> response = new ArrayList<Object>(); for (final DomNode child : node.getChildren()) { //IE: XmlPage ignores all empty text nodes - if (skipEmptyTextNode && child instanceof DomText + if (ignoreEmptyTextNode && child instanceof DomText && StringUtils.isBlank(((DomText) child).getNodeValue())) { //and 'xml:space' is 'default' continue; } @@ -948,7 +957,7 @@ * @see <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-compareDocumentPosition">DOM level 3</a> * @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node) */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxFunction({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public short compareDocumentPosition(final Object node) { if (!(node instanceof Node)) { throw Context.reportRuntimeError("Could not convert JavaScript argument arg 0"); @@ -991,7 +1000,7 @@ * Gets the textContent attribute. * @return the contents of this node as text */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public String getTextContent() { return getDomNodeOrDie().getTextContent(); } Deleted: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/OfflineResourceList.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/OfflineResourceList.java 2014-01-02 19:18:55 UTC (rev 8946) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/OfflineResourceList.java 2014-01-04 11:42:57 UTC (rev 8947) @@ -1,265 +0,0 @@ -/* - * 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 L... [truncated message content] |
From: <rb...@us...> - 2014-01-04 12:26:50
|
Revision: 8948 http://sourceforge.net/p/htmlunit/code/8948 Author: rbri Date: 2014-01-04 12:26:46 +0000 (Sat, 04 Jan 2014) Log Message: ----------- missing stuff from last commit Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCacheTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java 2014-01-04 11:42:57 UTC (rev 8947) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java 2014-01-04 12:26:46 UTC (rev 8948) @@ -14,7 +14,10 @@ */ package com.gargoylesoftware.htmlunit.javascript.host; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_APPCACHE_NAME_OFFLINERESOURCELIST; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; @@ -24,8 +27,7 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; /** - * <p>A collection of offline resources as defined in the - * <a href="http://www.w3.org/TR/2008/WD-html5-20080122/#appcache">HTML5 spec</a>. + * <p>A collection of offline resources as defined in the HTML5 spec. * Intended to support offline web applications.</p> * * <p><b>NOTE:</b> This class is essentially a skeleton implementation providing minimal @@ -35,10 +37,13 @@ * * @version $Revision$ * @author Daniel Gredler + * @author Frank Danek + * @see <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#application-cache-api"> + * HTML5 spec</a> * @see <a href="https://developer.mozilla.org/en/offline_resources_in_firefox">Offline Resources in Firefox</a> * @see <a href="https://developer.mozilla.org/en/nsIDOMOfflineResourceList">Mozilla Documentation</a> */ -@JsxClass(browsers = @WebBrowser(FF)) +@JsxClass(browsers = { @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public class ApplicationCache extends SimpleScriptable { /** The object isn't associated with an application cache. */ @@ -64,6 +69,19 @@ private Object oncached_; /** + * {@inheritDoc} + */ + @Override + public String getClassName() { + if (getWindow().getWebWindow() != null) { + if (getBrowserVersion().hasFeature(JS_APPCACHE_NAME_OFFLINERESOURCELIST)) { + return "OfflineResourceList"; + } + } + return super.getClassName(); + } + + /** * Returns the event listener to be called when fetching the application cache manifest and checking for updates. * @return the event listener to be called when fetching the application cache manifest and checking for updates */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCacheTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCacheTest.java 2014-01-04 11:42:57 UTC (rev 8947) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCacheTest.java 2014-01-04 12:26:46 UTC (rev 8948) @@ -19,10 +19,11 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.html.HtmlPageTest; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** - * Unit tests for {@link OfflineResourceList}. + * Tests for {@link ApplicationCache}. * * @version $Revision$ * @author Daniel Gredler @@ -32,20 +33,22 @@ public class ApplicationCacheTest extends WebDriverTestCase { /** - * @throws Exception if an error occurs + * @throws Exception if the test fails */ @Test - @Alerts(FF = "[object OfflineResourceList]", - IE = "undefined", - IE11 = "[object ApplicationCache]") - public void existence() throws Exception { - final String html - = "<html><body>\n" - + "<script>\n" - + " alert(window.applicationCache);\n" - + "</script>\n" + @Alerts(DEFAULT = "[object ApplicationCache]", + FF = "[object OfflineResourceList]", + IE8 = "undefined") + public void scriptableToString() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><head><title>foo</title><script>\n" + + " function test() {\n" + + " alert(window.applicationCache);\n" + + " }\n" + + "</script></head>\n" + + "<body onload='test()'>\n" + "</body></html>"; + loadPageWithAlerts2(html); } - } |
From: <rb...@us...> - 2014-01-04 15:25:12
|
Revision: 8950 http://sourceforge.net/p/htmlunit/code/8950 Author: rbri Date: 2014-01-04 15:25:08 +0000 (Sat, 04 Jan 2014) Log Message: ----------- use unicode notation instead of hidden char Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java 2014-01-04 12:34:24 UTC (rev 8949) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java 2014-01-04 15:25:08 UTC (rev 8950) @@ -63,7 +63,8 @@ ((Window) thisObj.getParentScope()).getWebWindow().getWebClient().getBrowserVersion(); if (browserVersion.hasFeature(JS_DATE_LOCALE_DATE_SHORT_WITH_SPECIAL_CHARS)) { - formatString = "dd.MM.yyyy"; + // [U+200E] -> Unicode Character 'LEFT-TO-RIGHT MARK' + formatString = "\u200Edd.MM.yyyy"; } else if (browserVersion.hasFeature(JS_DATE_LOCALE_DATE_SHORT)) { formatString = "d.M.yyyy"; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java 2014-01-04 12:34:24 UTC (rev 8949) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java 2014-01-04 15:25:08 UTC (rev 8950) @@ -139,9 +139,7 @@ @Test @Alerts(DEFAULT = "Saturday, January 01, 2000", CHROME = "1.1.2000", - IE11 = "01.01.2000") - // ATTENTION! the IE11 expectation only looks like a simple date but there are invisible control - // characters (char code 14 - shift out) surrounding the digit pairs... + IE11 = "\u200E01.01.2000") public void toLocaleDateString() throws Exception { final String html = "<html><head><title>foo</title><script>\n" @@ -151,6 +149,7 @@ + "</script></head><body onload='test()'>\n" + "</body></html>"; + System.out.println((int) getExpectedAlerts()[0].charAt(0)); loadPageWithAlerts2(html); } |
From: <rb...@us...> - 2014-01-05 12:58:41
|
Revision: 8951 http://sourceforge.net/p/htmlunit/code/8951 Author: rbri Date: 2014-01-05 12:58:37 +0000 (Sun, 05 Jan 2014) Log Message: ----------- finally fix the additional chars Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java 2014-01-04 15:25:08 UTC (rev 8950) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java 2014-01-05 12:58:37 UTC (rev 8951) @@ -64,7 +64,7 @@ if (browserVersion.hasFeature(JS_DATE_LOCALE_DATE_SHORT_WITH_SPECIAL_CHARS)) { // [U+200E] -> Unicode Character 'LEFT-TO-RIGHT MARK' - formatString = "\u200Edd.MM.yyyy"; + formatString = "\u200Edd\u200E.\u200EMM\u200E.\u200Eyyyy"; } else if (browserVersion.hasFeature(JS_DATE_LOCALE_DATE_SHORT)) { formatString = "d.M.yyyy"; @@ -91,7 +91,8 @@ ((Window) thisObj.getParentScope()).getWebWindow().getWebClient().getBrowserVersion(); if (browserVersion.hasFeature(JS_DATE_LOCALE_TIME_WITH_SPECIAL_CHARS)) { - formatString = "HH:mm:ss"; + // [U+200E] -> Unicode Character 'LEFT-TO-RIGHT MARK' + formatString = "\u200EHH\u200E:\u200Emm\u200E:\u200Ess"; } else { formatString = "HH:mm:ss"; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java 2014-01-04 15:25:08 UTC (rev 8950) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java 2014-01-05 12:58:37 UTC (rev 8951) @@ -139,7 +139,7 @@ @Test @Alerts(DEFAULT = "Saturday, January 01, 2000", CHROME = "1.1.2000", - IE11 = "\u200E01.01.2000") + IE11 = "\u200E01\u200E.\u200E01\u200E.\u200E2000") public void toLocaleDateString() throws Exception { final String html = "<html><head><title>foo</title><script>\n" @@ -149,7 +149,6 @@ + "</script></head><body onload='test()'>\n" + "</body></html>"; - System.out.println((int) getExpectedAlerts()[0].charAt(0)); loadPageWithAlerts2(html); } @@ -244,9 +243,7 @@ */ @Test @Alerts(DEFAULT = { "00:00:00", "07:08:09" }, - IE11 = { "00:00:00", "07:08:09" }) - // ATTENTION! the IE11 expectation only looks identical to the default one but there are invisible control - // characters (char code 14 - shift out) surrounding the digit pairs... + IE11 = { "\u200E00\u200E:\u200E00\u200E:\u200E00", "\u200E07\u200E:\u200E08\u200E:\u200E09" }) public void toLocaleTimeString() throws Exception { final String html = "<html><head><title>foo</title><script>\n" |
From: <asa...@us...> - 2014-01-06 18:07:26
|
Revision: 8952 http://sourceforge.net/p/htmlunit/code/8952 Author: asashour Date: 2014-01-06 18:07:23 +0000 (Mon, 06 Jan 2014) Log Message: ----------- JavaScript: window.getComputedStyle and CSSStyleDeclaration.getPropertyValue() are supported starting IE9. Issue 1566 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-05 12:58:37 UTC (rev 8951) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-06 18:07:23 UTC (rev 8952) @@ -8,6 +8,10 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="fix" dev="asashour" issue="1566"> + JavaScript: window.getComputedStyle and CSSStyleDeclaration.getPropertyValue() + are supported starting IE9. + </action> <action type="update" dev="rbri"> BrowserVersion: deprecate FIREFOX_17, FIREFOX_24 is our preferred Firefox for the next months. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-05 12:58:37 UTC (rev 8951) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-06 18:07:23 UTC (rev 8952) @@ -1596,7 +1596,7 @@ * @param pseudo a string specifying the pseudo-element to match (may be <tt>null</tt>) * @return the computed style */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public ComputedCSSStyleDeclaration getComputedStyle(final Element element, final String pseudo) { ComputedCSSStyleDeclaration style; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2014-01-05 12:58:37 UTC (rev 8951) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2014-01-06 18:07:23 UTC (rev 8952) @@ -3986,7 +3986,7 @@ * @param name the style property name * @return empty string if nothing found */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public String getPropertyValue(final String name) { if (name != null && name.contains("-")) { final Object value = getProperty(this, camelize(name)); |
From: <rb...@us...> - 2014-01-11 15:41:10
|
Revision: 8963 http://sourceforge.net/p/htmlunit/code/8963 Author: rbri Date: 2014-01-11 15:41:04 +0000 (Sat, 11 Jan 2014) Log Message: ----------- regex fixes for IE11 (Frank Danek) 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/regexp/HtmlUnitRegExpProxy.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-11 12:51:56 UTC (rev 8962) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-11 15:41:04 UTC (rev 8963) @@ -1208,6 +1208,14 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED, + /** <code>RegExp.lastParen</code> returns an empty string if the RegExp has too many groups. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_REGEXP_EMPTY_LASTPAREN_IF_TOO_MANY_GROUPS, + + /** RegExp group <code>$0</code> returns the whole previous match (see {@link java.util.regex.Matcher#group()}. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_REGEXP_GROUP0_RETURNS_WHOLE_MATCH, + /** Javascript script.text(...) reexecutes the script (IE). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_SCRIPT_ALWAYS_REEXECUTE_ON_SET_TEXT, 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-11 12:51:56 UTC (rev 8962) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java 2014-01-11 15:41:04 UTC (rev 8963) @@ -266,7 +266,7 @@ } // register custom RegExp processing - ScriptRuntime.setRegExpProxy(cx, new HtmlUnitRegExpProxy(ScriptRuntime.getRegExpProxy(cx))); + ScriptRuntime.setRegExpProxy(cx, new HtmlUnitRegExpProxy(ScriptRuntime.getRegExpProxy(cx), browserVersion_)); cx.setMaximumInterpreterStackDepth(10000); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxy.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxy.java 2014-01-11 12:51:56 UTC (rev 8962) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxy.java 2014-01-11 15:41:04 UTC (rev 8963) @@ -14,6 +14,9 @@ */ package com.gargoylesoftware.htmlunit.javascript.regexp; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_REGEXP_EMPTY_LASTPAREN_IF_TOO_MANY_GROUPS; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_REGEXP_GROUP0_RETURNS_WHOLE_MATCH; + import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -32,6 +35,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import com.gargoylesoftware.htmlunit.BrowserVersion; + /** * Begins customization of JavaScript RegExp base on JDK regular expression support. * @@ -46,13 +51,16 @@ private static final Pattern REPLACE_PATTERN = Pattern.compile("\\$\\$"); private final RegExpProxy wrapped_; + private final BrowserVersion browserVersion_; /** * Wraps a proxy to enhance it. * @param wrapped the original proxy + * @param browserVersion the current browser version */ - public HtmlUnitRegExpProxy(final RegExpProxy wrapped) { + public HtmlUnitRegExpProxy(final RegExpProxy wrapped, final BrowserVersion browserVersion) { wrapped_ = wrapped; + browserVersion_ = browserVersion; } /** @@ -184,7 +192,7 @@ return sb.toString(); } - static String computeReplacementValue(final String replacement, + String computeReplacementValue(final String replacement, final String originalString, final Matcher matcher) { int lastIndex = 0; @@ -223,6 +231,11 @@ case '&': ss = matcher.group(); break; + case '0': + if (browserVersion_.hasFeature(JS_REGEXP_GROUP0_RETURNS_WHOLE_MATCH)) { + ss = matcher.group(); + } + break; case '`': ss = originalString.substring(0, matcher.start()); break; @@ -298,12 +311,17 @@ // lastParen if (matcher.groupCount() > 0) { - final String last = matcher.group(matcher.groupCount()); - if (last == null) { + if (matcher.groupCount() > 9 && browserVersion_.hasFeature(JS_REGEXP_EMPTY_LASTPAREN_IF_TOO_MANY_GROUPS)) { lastParen = new SubString(); } else { - lastParen = new FixedSubString(last); + final String last = matcher.group(matcher.groupCount()); + if (last == null) { + lastParen = new SubString(); + } + else { + lastParen = new FixedSubString(last); + } } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java 2014-01-11 12:51:56 UTC (rev 8962) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java 2014-01-11 15:41:04 UTC (rev 8963) @@ -26,6 +26,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -277,18 +278,20 @@ final Matcher matcher1group = Pattern.compile("(h)").matcher("hello"); matcher1group.find(); - assertEquals("$", HtmlUnitRegExpProxy.computeReplacementValue("$$", theString, matcher0group)); - assertEquals("$$x$", HtmlUnitRegExpProxy.computeReplacementValue("$$$$x$$", theString, matcher0group)); + final HtmlUnitRegExpProxy proxy = new HtmlUnitRegExpProxy(null, BrowserVersion.FIREFOX_24); - assertEquals("$1", HtmlUnitRegExpProxy.computeReplacementValue("$1", theString, matcher0group)); - assertEquals("$2", HtmlUnitRegExpProxy.computeReplacementValue("$2", theString, matcher0group)); - assertEquals("h", HtmlUnitRegExpProxy.computeReplacementValue("$1", theString, matcher1group)); - assertEquals("$2", HtmlUnitRegExpProxy.computeReplacementValue("$2", theString, matcher1group)); + assertEquals("$", proxy.computeReplacementValue("$$", theString, matcher0group)); + assertEquals("$$x$", proxy.computeReplacementValue("$$$$x$$", theString, matcher0group)); - assertEquals("$", HtmlUnitRegExpProxy.computeReplacementValue("$", theString, matcher0group)); - assertEquals("$", HtmlUnitRegExpProxy.computeReplacementValue("$", theString, matcher1group)); - assertEquals("\\\\$", HtmlUnitRegExpProxy.computeReplacementValue("\\\\$", theString, matcher1group)); - assertEquals("$", HtmlUnitRegExpProxy.computeReplacementValue("$", theString, matcher1group)); + assertEquals("$1", proxy.computeReplacementValue("$1", theString, matcher0group)); + assertEquals("$2", proxy.computeReplacementValue("$2", theString, matcher0group)); + assertEquals("h", proxy.computeReplacementValue("$1", theString, matcher1group)); + assertEquals("$2", proxy.computeReplacementValue("$2", theString, matcher1group)); + + assertEquals("$", proxy.computeReplacementValue("$", theString, matcher0group)); + assertEquals("$", proxy.computeReplacementValue("$", theString, matcher1group)); + assertEquals("\\\\$", proxy.computeReplacementValue("\\\\$", theString, matcher1group)); + assertEquals("$", proxy.computeReplacementValue("$", theString, matcher1group)); } /** @@ -529,6 +532,59 @@ * @throws Exception if an error occurs */ @Test + @Alerts(DEFAULT = "ad$0db", + IE11 = "adfoodb") + public void replace_backReference_$0() throws Exception { + testEvaluate("'afoob'.replace(/(foo)/g, 'd$0d')"); + testEvaluate("'afoob'.replace(/(foo)/, 'd$0d')"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = "ad$0db", + IE11 = "adfkxxxkodb") + public void replace_backReference_$0WithMultipleGroups() throws Exception { + testEvaluate("'afkxxxkob'.replace(/(f)k(.*)k(o)/g, 'd$0d')"); + testEvaluate("'afkxxxkob'.replace(/(f)k(.*)k(o)/, 'd$0d')"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = "ad$0db", + IE11 = "adfoodb") + public void replace_backReference_$0WithNoGroups() throws Exception { + testEvaluate("'afoob'.replace(/foo/g, 'd$0d')"); + testEvaluate("'afoob'.replace(/foo/, 'd$0d')"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = "ad$0dbfuoc", + IE11 = "adfoodbfuoc") + public void replace_backReference_$0WithMultipleHits() throws Exception { + testEvaluate("'afoobfuoc'.replace(/(f.o)/, 'd$0d')"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = "ad$0dbd$0dc", + IE11 = "adfoodbdfuodc") + public void replace_backReference_$0WithMultipleHitsGlobal() throws Exception { + testEvaluate("'afoobfuoc'.replace(/(f.o)/g, 'd$0d')"); + } + + /** + * @throws Exception if an error occurs + */ + @Test @Alerts("kid\\'s toys") public void escapeQuote() throws Exception { testEvaluate("\"kid's toys\".replace(/'/g, \"\\\\'\")"); |
From: <rb...@us...> - 2014-01-11 17:15:31
|
Revision: 8964 http://sourceforge.net/p/htmlunit/code/8964 Author: rbri Date: 2014-01-11 17:15:28 +0000 (Sat, 11 Jan 2014) Log Message: ----------- cleanup: remove all browser features currently enabled for all supported browsers; add an check to BrowserVersionFeaturesTest Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -466,10 +466,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) HTMLCHECKEDINPUT_SET_CHECKED_TO_FALSE_WHEN_CLONE, - /** Setting defaultChecked updates checked also. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 8), @WebBrowser(CHROME) }) - HTMLCHECKEDINPUT_SET_DEFAULT_CHECKED_UPDATES_CHECKED, - /** Set the default value based on the current value when clone (IE). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) HTMLCHECKEDINPUT_SET_DEFAULT_VALUE_WHEN_CLONE, @@ -478,10 +474,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) HTMLCOLLECTION_COMMENT_IS_ELEMENT, - /** Allows multiple elements with the same 'id'. */ - @BrowserFeature({ @WebBrowser(IE), @WebBrowser(FF), @WebBrowser(CHROME) }) - HTMLCOLLECTION_IDENTICAL_IDS, - /** HtmlCollection returns null instead of undefined if an element was not found. */ @BrowserFeature(@WebBrowser(IE)) HTMLCOLLECTION_NULL_IF_NOT_FOUND, @@ -650,13 +642,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) IGNORE_CONTENTS_OF_INNER_HEAD, - /** - * The function addEventListener or attachEvent(IE) accepts null as listener - * instead of throwing an exception. - */ - @BrowserFeature({ @WebBrowser(IE), @WebBrowser(value = FF, minVersion = 17), @WebBrowser(CHROME) }) - JS_ADD_EVENT_LISTENER_ACCEPTS_NULL_LISTENER, - /** Setting the property align to arbitrary values is allowed. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) JS_ALIGN_ACCEPTS_ARBITRARY_VALUES, @@ -1004,10 +989,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_FRAME_BODY_NULL_IF_NOT_LOADED, - /** Indicates that the URL of parent window is used to resolve URLs in frames with javascript src. */ - @BrowserFeature({ @WebBrowser(value = IE, minVersion = 8), @WebBrowser(FF), @WebBrowser(CHROME) }) - JS_FRAME_RESOLVE_URL_WITH_PARENT_WINDOW, - /** Indicates if Function.bind is available. */ @BrowserFeature({ @WebBrowser(value = FF, minVersion = 10), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) @@ -1602,10 +1583,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) URL_MISSING_SLASHES, - /** */ - @BrowserFeature({ @WebBrowser(IE), @WebBrowser(FF), @WebBrowser(CHROME) }) - WINDOW_ACTIVE_ELEMENT_FOCUSED, - /** XMLHttpRequest does not trigger the error handler. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) XHR_ERRORHANDLER_NOT_SUPPORTED, @@ -1625,10 +1602,6 @@ @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) XHR_IGNORE_PORT_FOR_SAME_ORIGIN, - /** Indicates if a same origin check should be skipped. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 8) }) - XHR_IGNORE_SAME_ORIGIN, - /** Indicates if a request to a about URL is allowed. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) XHR_IGNORE_SAME_ORIGIN_TO_ABOUT, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -19,7 +19,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SUPPORT_VIA_ACTIVEXOBJECT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.PROTOCOL_DATA; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.URL_MINIMAL_QUERY_ENCODING; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.WINDOW_ACTIVE_ELEMENT_FOCUSED; import java.io.BufferedInputStream; import java.io.File; @@ -719,19 +718,11 @@ if (enclosedPage != null && enclosedPage.isHtmlPage()) { final Window jsWindow = (Window) currentWindow_.getScriptObject(); if (jsWindow != null) { - if (getBrowserVersion().hasFeature(WINDOW_ACTIVE_ELEMENT_FOCUSED)) { - final HTMLElement activeElement = - (HTMLElement) ((HTMLDocument) jsWindow.getDocument()).getActiveElement(); - if (activeElement != null) { - ((HtmlPage) enclosedPage).setFocusedElement(activeElement.getDomNodeOrDie(), true); - } + final HTMLElement activeElement = + (HTMLElement) ((HTMLDocument) jsWindow.getDocument()).getActiveElement(); + if (activeElement != null) { + ((HtmlPage) enclosedPage).setFocusedElement(activeElement.getDomNodeOrDie(), true); } - else { - final HtmlElement focusedElement = ((HtmlPage) enclosedPage).getFocusedElement(); - if (focusedElement != null) { - ((HtmlPage) enclosedPage).setFocusedElement(focusedElement, true); - } - } } } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -17,7 +17,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCHANGE_AFTER_ONCLICK; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCHANGE_LOSING_FOCUS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCHECKEDINPUT_SET_CHECKED_TO_FALSE_WHEN_CLONE; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCHECKEDINPUT_SET_DEFAULT_CHECKED_UPDATES_CHECKED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCHECKEDINPUT_SET_DEFAULT_VALUE_WHEN_CLONE; import java.io.IOException; @@ -209,9 +208,7 @@ @Override public void setDefaultChecked(final boolean defaultChecked) { defaultCheckedState_ = defaultChecked; - if (hasFeature(HTMLCHECKEDINPUT_SET_DEFAULT_CHECKED_UPDATES_CHECKED)) { - setChecked(defaultChecked); - } + setChecked(defaultChecked); if (hasFeature(HTMLCHECKEDINPUT_SET_CHECKED_TO_FALSE_WHEN_CLONE)) { reset(); forceChecked_ = true; @@ -286,7 +283,7 @@ */ @Override public void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue) { - if (hasFeature(HTMLCHECKEDINPUT_SET_DEFAULT_CHECKED_UPDATES_CHECKED) && "value".equals(qualifiedName)) { + if ("value".equals(qualifiedName)) { setDefaultValue(attributeValue, false); } super.setAttributeNS(namespaceURI, qualifiedName, attributeValue); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -19,7 +19,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCLICK_USES_POINTEREVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_PROPERTY_CHANGE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.KEYBOARD_EVENT_SPECIAL_KEYPRESS; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.WINDOW_ACTIVE_ELEMENT_FOCUSED; import java.io.IOException; import java.io.PrintWriter; @@ -1112,10 +1111,8 @@ public void focus() { final HtmlPage page = (HtmlPage) getPage(); page.setFocusedElement(this); - if (hasFeature(WINDOW_ACTIVE_ELEMENT_FOCUSED)) { - final HTMLElement jsElt = (HTMLElement) getScriptObject(); - jsElt.setActive(); - } + final HTMLElement jsElt = (HTMLElement) getScriptObject(); + jsElt.setActive(); } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -21,7 +21,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FOCUS_BODY_ELEMENT_AT_START; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FOCUS_HTML_ELEMENT_AT_START; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DEFERRED; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FRAME_RESOLVE_URL_WITH_PARENT_WINDOW; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.PAGE_SELECTION_RANGE_FROM_SELECTABLE_TEXT_INPUT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.URL_MISSING_SLASHES; @@ -685,8 +684,7 @@ if (frame) { final boolean frameSrcIsNotSet = (baseUrl == WebClient.URL_ABOUT_BLANK); final boolean frameSrcIsJs = "javascript".equals(baseUrl.getProtocol()); - final boolean jsFrameUseParentUrl = hasFeature(JS_FRAME_RESOLVE_URL_WITH_PARENT_WINDOW); - if (frameSrcIsNotSet || (frameSrcIsJs && jsFrameUseParentUrl)) { + if (frameSrcIsNotSet || frameSrcIsJs) { baseUrl = ((HtmlPage) window.getTopWindow().getEnclosedPage()).getWebResponse() .getWebRequest().getUrl(); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -17,7 +17,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCHANGE_AFTER_ONCLICK; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCHANGE_LOSING_FOCUS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCHECKEDINPUT_SET_CHECKED_TO_FALSE_WHEN_CLONE; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCHECKEDINPUT_SET_DEFAULT_CHECKED_UPDATES_CHECKED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCHECKEDINPUT_SET_DEFAULT_VALUE_WHEN_CLONE; import java.io.IOException; @@ -262,9 +261,7 @@ @Override public void setDefaultChecked(final boolean defaultChecked) { defaultCheckedState_ = defaultChecked; - if (hasFeature(HTMLCHECKEDINPUT_SET_DEFAULT_CHECKED_UPDATES_CHECKED)) { - setChecked(isDefaultChecked()); - } + setChecked(isDefaultChecked()); if (hasFeature(HTMLCHECKEDINPUT_SET_CHECKED_TO_FALSE_WHEN_CLONE)) { reset(); forceChecked_ = true; @@ -346,7 +343,7 @@ */ @Override public void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue) { - if (hasFeature(HTMLCHECKEDINPUT_SET_DEFAULT_CHECKED_UPDATES_CHECKED) && "value".equals(qualifiedName)) { + if ("value".equals(qualifiedName)) { setDefaultValue(attributeValue, false); } super.setAttributeNS(namespaceURI, qualifiedName, attributeValue); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -15,7 +15,6 @@ package com.gargoylesoftware.htmlunit.javascript.host; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_40; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ADD_EVENT_LISTENER_ACCEPTS_NULL_LISTENER; import java.io.Serializable; import java.util.ArrayList; @@ -24,7 +23,6 @@ import java.util.Locale; import java.util.Map; -import net.sourceforge.htmlunit.corejs.javascript.EvaluatorException; import net.sourceforge.htmlunit.corejs.javascript.Function; import org.apache.commons.logging.Log; @@ -84,12 +82,7 @@ */ public boolean addEventListener(final String type, final Function listener, final boolean useCapture) { if (null == listener) { - final boolean accept = jsNode_.getWindow().getWebWindow().getWebClient() - .getBrowserVersion().hasFeature(JS_ADD_EVENT_LISTENER_ACCEPTS_NULL_LISTENER); - if (accept) { - return true; - } - throw new EvaluatorException("Could not convert JavaScript argument (Listener was null)."); + return true; } final List<Function> listeners = getHandlersOrCreateIt(type).getHandlers(useCapture); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -18,7 +18,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_49; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_50; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_COMMENT_IS_ELEMENT; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_IDENTICAL_IDS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_OBJECT_DETECTION; import java.util.ArrayList; @@ -300,9 +299,6 @@ if (next instanceof DomElement) { final String id = ((DomElement) next).getAttribute("id"); if (name.equals(id)) { - if (!getBrowserVersion().hasFeature(HTMLCOLLECTION_IDENTICAL_IDS)) { - return getScriptableForElement(next); - } matchingElements.add(next); } } @@ -322,9 +318,6 @@ if (next instanceof DomElement) { final String nodeName = ((DomElement) next).getAttribute("name"); if (name.equals(nodeName)) { - if (!getBrowserVersion().hasFeature(HTMLCOLLECTION_IDENTICAL_IDS)) { - return getScriptableForElement(next); - } matchingElements.add(next); } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -17,7 +17,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_NULL_IF_NOT_FOUND; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_50; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_COMMENT_IS_ELEMENT; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_IDENTICAL_IDS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_OBJECT_DETECTION; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; @@ -202,9 +201,6 @@ if (next instanceof DomElement) { final String id = ((DomElement) next).getAttribute("id"); if (name.equals(id)) { - if (!getBrowserVersion().hasFeature(HTMLCOLLECTION_IDENTICAL_IDS)) { - return getScriptableForElement(next); - } matchingElements.add(next); } } @@ -225,9 +221,6 @@ if (next instanceof DomElement) { final String nodeName = ((DomElement) next).getAttribute("name"); if (name.equals(nodeName)) { - if (!getBrowserVersion().hasFeature(HTMLCOLLECTION_IDENTICAL_IDS)) { - return getScriptableForElement(next); - } matchingElements.add(next); } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -17,8 +17,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ERRORHANDLER_NOT_SUPPORTED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_FIRE_STATE_OPENED_AGAIN_IN_ASYNC_MODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_IGNORE_PORT_FOR_SAME_ORIGIN; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_IGNORE_SAME_ORIGIN; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_IGNORE_SAME_ORIGIN_TO_ABOUT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ONREADYSTATECANGE_SYNC_REQUESTS_COMPLETED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ONREADYSTATECANGE_SYNC_REQUESTS_NOT_TRIGGERED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ONREADYSTATECHANGE_WITH_EVENT_PARAM; @@ -497,9 +495,6 @@ try { final URL fullUrl = containingPage_.getFullyQualifiedUrl(url); final URL originUrl = containingPage_.getUrl(); - if (!isAllowCrossDomainsFor(originUrl, fullUrl)) { - throw Context.reportRuntimeError("Access to restricted URI denied"); - } final WebRequest request = new WebRequest(fullUrl, getBrowserVersion().getXmlHttpRequestAcceptHeader()); request.setCharset("UTF-8"); @@ -541,23 +536,6 @@ setState(STATE_OPENED, null); } - /** - * Used by IE6/7 only, to be removed when they are not supported. - */ - private boolean isAllowCrossDomainsFor(final URL originUrl, final URL newUrl) { - final BrowserVersion browser = getBrowserVersion(); - if (browser.hasFeature(XHR_IGNORE_SAME_ORIGIN)) { - return true; - } - - if (browser.hasFeature(XHR_IGNORE_SAME_ORIGIN_TO_ABOUT) - && "about".equals(newUrl.getProtocol())) { - return true; - } - - return originUrl.getHost().equals(newUrl.getHost()); - } - private boolean isSameOrigin(final URL originUrl, final URL newUrl) { if (!originUrl.getHost().equals(newUrl.getHost())) { return false; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java 2014-01-11 15:41:04 UTC (rev 8963) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java 2014-01-11 17:15:28 UTC (rev 8964) @@ -72,14 +72,15 @@ browsers.add(BrowserVersion.CHROME); for (final BrowserVersionFeatures feature : BrowserVersionFeatures.values()) { - boolean inUse = false; + int useCount = 0; for (BrowserVersion browserVersion : browsers) { if (browserVersion.hasFeature(feature)) { - inUse = true; - continue; + useCount++; } } - assertTrue("BrowserVersionFeatures.java: '" + feature.name() + "' in no longer in use.", inUse); + assertTrue("BrowserVersionFeatures.java: '" + feature.name() + "' in no longer in use.", useCount > 0); + assertTrue("BrowserVersionFeatures.java: '" + feature.name() + "' is enabled for all supported browsers.", + useCount < browsers.size()); } for (final BrowserVersionFeatures feature : BrowserVersionFeatures.values()) { |
From: <rb...@us...> - 2014-01-13 22:32:25
|
Revision: 8969 http://sourceforge.net/p/htmlunit/code/8969 Author: rbri Date: 2014-01-13 22:32:21 +0000 (Mon, 13 Jan 2014) Log Message: ----------- conversion of anchor elements into strings fixed Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement2Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-12 16:11:37 UTC (rev 8968) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-13 22:32:21 UTC (rev 8969) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="fix" dev="rbri"> + JavaScript: conversion of anchor element into strings fixed. + </action> <action type="fix" dev="rbri" due-to="Frank Danek"> JavaScript: hashChangeEvent processing fixed. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java 2014-01-12 16:11:37 UTC (rev 8968) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java 2014-01-13 22:32:21 UTC (rev 8969) @@ -101,22 +101,10 @@ page.executeJavaScriptIfPossible(builder.toString(), "javascript url", getStartLineNumber()); return; } - URL url = page.getFullyQualifiedUrl(href); - // fix for empty url - if (StringUtils.isEmpty(href)) { - final boolean dropFilename = hasFeature(ANCHOR_EMPTY_HREF_NO_FILENAME); - if (dropFilename) { - String path = url.getPath(); - path = path.substring(0, path.lastIndexOf('/') + 1); - url = UrlUtils.getUrlWithNewPath(url, path); - url = UrlUtils.getUrlWithNewRef(url, null); - } - else { - url = UrlUtils.getUrlWithNewRef(url, null); - } - } - final BrowserVersion browser = getPage().getWebClient().getBrowserVersion(); + final URL url = getTargetUrl(href, page); + + final BrowserVersion browser = page.getWebClient().getBrowserVersion(); final WebRequest webRequest = new WebRequest(url, browser.getHtmlAcceptHeader()); webRequest.setCharset(page.getPageEncoding()); webRequest.setAdditionalHeader("Referer", page.getUrl().toExternalForm()); @@ -133,6 +121,32 @@ } /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * @param href the href + * @param page the HtmlPage + * @return the calculated target url. + * @throws MalformedURLException if an IO error occurs + */ + public static URL getTargetUrl(final String href, final HtmlPage page) throws MalformedURLException { + URL url = page.getFullyQualifiedUrl(href); + // fix for empty url + if (StringUtils.isEmpty(href)) { + final boolean dropFilename = page.getWebClient().getBrowserVersion() + .hasFeature(ANCHOR_EMPTY_HREF_NO_FILENAME); + if (dropFilename) { + String path = url.getPath(); + path = path.substring(0, path.lastIndexOf('/') + 1); + url = UrlUtils.getUrlWithNewPath(url, path); + url = UrlUtils.getUrlWithNewRef(url, null); + } + else { + url = UrlUtils.getUrlWithNewRef(url, null); + } + } + return url; + } + /** * {@inheritDoc} */ @Override Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement.java 2014-01-12 16:11:37 UTC (rev 8968) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement.java 2014-01-13 22:32:21 UTC (rev 8969) @@ -397,23 +397,8 @@ return href; } - final int indexAnchor = href.indexOf('#'); - final String beforeAnchor; - final String anchorPart; - if (indexAnchor == -1) { - beforeAnchor = href; - anchorPart = ""; - } - else { - beforeAnchor = href.substring(0, indexAnchor); - anchorPart = href.substring(indexAnchor); - } - - final HtmlPage htmlPage = (HtmlPage) page; try { - final String response = - htmlPage.getFullyQualifiedUrl(beforeAnchor).toExternalForm() + anchorPart; - return response; + return HtmlAnchor.getTargetUrl(href, (HtmlPage) page).toExternalForm(); } catch (final MalformedURLException e) { return href; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement2Test.java 2014-01-12 16:11:37 UTC (rev 8968) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAnchorElement2Test.java 2014-01-13 22:32:21 UTC (rev 8969) @@ -256,8 +256,8 @@ * @throws Exception if the test fails */ @Test - @Alerts({ "http://htmlunit.sourceforge.net/", "§§URL§§test", "§§URL§§#ref#test", - "§§URL§§#ref#", "§§URL§§#ref" }) + @Alerts({ "http://htmlunit.sourceforge.net/", "§§URL§§test", "§§URL§§#test", + "§§URL§§#", "§§URL§§" }) public void getDefaultValueWithHash() throws Exception { final String html = "<html><head><title>AnchorTest</title>\n" @@ -289,6 +289,41 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "http://htmlunit.sourceforge.net/", "§§URL§§test", "§§URL§§index.html#test", + "§§URL§§index.html#", "§§URL§§index.html" }, + IE = { "http://htmlunit.sourceforge.net/", "§§URL§§test", "§§URL§§index.html#test", + "§§URL§§index.html#", "§§URL§§" }) + public void getDefaultValueWithHashAndFileName() throws Exception { + final String html + = "<html><head><title>AnchorTest</title>\n" + + "<script>\n" + + " function test() {\n" + + " alert(document.getElementById('absolute'));\n" + + " alert(document.getElementById('relative'));\n" + + " alert(document.getElementById('hash'));\n" + + " alert(document.getElementById('hashOnly'));\n" + + " alert(document.getElementById('empty'));\n" + + " }\n</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <a href='http://htmlunit.sourceforge.net/' id='absolute'>bla</a>\n" + + " <a href='test' id='relative'>bla</a>\n" + + " <a href='#test' id='hash'>bla</a>\n" + + " <a href='#' id='hashOnly'>bla</a>\n" + + " <a href='' id='empty'>bla</a>\n" + + "</body></html>"; + + getMockWebConnection().setDefaultResponse(html); + final WebDriver driver = loadPage2(html, UrlUtils.getUrlWithNewPath(URL_FIRST, "/index.html")); + + expandExpectedAlertsVariables(URL_FIRST); + assertEquals(getExpectedAlerts(), getCollectedAlerts(driver)); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts({ "true", "not defined" }) public void onclickToString() throws Exception { final String html @@ -303,8 +338,8 @@ + "</script>\n" + "</head>\n" + "<body onload='test()'>\n" - + " <a href='foo.html' onClick='alert(\"on click\")'>\n" - + " <a href='foo2.html'>\n" + + " <a href='foo.html' onClick='alert(\"on click\")'>a1</a>\n" + + " <a href='foo2.html'>a2</a>\n" + "</body></html>"; loadPageWithAlerts2(html); |
From: <rb...@us...> - 2014-01-13 22:35:59
|
Revision: 8970 http://sourceforge.net/p/htmlunit/code/8970 Author: rbri Date: 2014-01-13 22:35:54 +0000 (Mon, 13 Jan 2014) Log Message: ----------- Do not change the active element when the content of an iframe was changed. Issue 1568 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Document2Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-13 22:32:21 UTC (rev 8969) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-13 22:35:54 UTC (rev 8970) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="fix" dev="rbri" issue="1568"> + Do not change the active element when the content of an iframe was changed. + </action> <action type="fix" dev="rbri"> JavaScript: conversion of anchor element into strings fixed. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-13 22:32:21 UTC (rev 8969) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-13 22:35:54 UTC (rev 8970) @@ -61,6 +61,7 @@ import com.gargoylesoftware.htmlunit.html.FrameWindow; import com.gargoylesoftware.htmlunit.html.HTMLParserListener; import com.gargoylesoftware.htmlunit.html.HtmlElement; +import com.gargoylesoftware.htmlunit.html.HtmlInlineFrame; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine; import com.gargoylesoftware.htmlunit.javascript.JavaScriptErrorListener; @@ -701,7 +702,7 @@ if (currentWindow_ == window) { return; } - //onBlur event is triggered for focused element of old current window + // onBlur event is triggered for focused element of old current window if (currentWindow_ != null && !currentWindow_.isClosed()) { final Page enclosedPage = currentWindow_.getEnclosedPage(); if (enclosedPage != null && enclosedPage.isHtmlPage()) { @@ -712,16 +713,22 @@ } } currentWindow_ = window; - //1. In IE activeElement becomes focused element for new current window - //2. onFocus event is triggered for focusedElement of new current window - final Page enclosedPage = currentWindow_.getEnclosedPage(); - if (enclosedPage != null && enclosedPage.isHtmlPage()) { - final Window jsWindow = (Window) currentWindow_.getScriptObject(); - if (jsWindow != null) { - final HTMLElement activeElement = - (HTMLElement) ((HTMLDocument) jsWindow.getDocument()).getActiveElement(); - if (activeElement != null) { - ((HtmlPage) enclosedPage).setFocusedElement(activeElement.getDomNodeOrDie(), true); + + // when marking an iframe window as current we have no need to move the focus + final boolean isIFrame = currentWindow_ instanceof FrameWindow + && ((FrameWindow) currentWindow_).getFrameElement() instanceof HtmlInlineFrame; + if (!isIFrame) { + //1. activeElement becomes focused element for new current window + //2. onFocus event is triggered for focusedElement of new current window + final Page enclosedPage = currentWindow_.getEnclosedPage(); + if (enclosedPage != null && enclosedPage.isHtmlPage()) { + final Window jsWindow = (Window) currentWindow_.getScriptObject(); + if (jsWindow != null) { + final HTMLElement activeElement = + (HTMLElement) ((HTMLDocument) jsWindow.getDocument()).getActiveElement(); + if (activeElement != null) { + ((HtmlPage) enclosedPage).setFocusedElement(activeElement.getDomNodeOrDie(), true); + } } } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Document2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Document2Test.java 2014-01-13 22:32:21 UTC (rev 8969) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Document2Test.java 2014-01-13 22:35:54 UTC (rev 8970) @@ -309,8 +309,8 @@ */ @Test @Alerts(DEFAULT = { "[object HTMLBodyElement]", "http://localhost:12345/#", "http://localhost:12345/#" }, - IE11 = { "null", "http://localhost:12345/#", "http://localhost:12345/#" }) - @NotYetImplemented + IE11 = { "null", "http://localhost:12345/#", "http://localhost:12345/#" }, + IE8 = { "[object]", "http://localhost:12345/#", "http://localhost:12345/#" }) public void activeElement_iframe() throws Exception { final String html = "<html>\n" |
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 |
From: <rb...@us...> - 2014-01-14 20:40:27
|
Revision: 8974 http://sourceforge.net/p/htmlunit/code/8974 Author: rbri Date: 2014-01-14 20:40:23 +0000 (Tue, 14 Jan 2014) Log Message: ----------- revert the workaround for the ff24 jQuery test, fix the expectations for FF17 and the setup Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java trunk/htmlunit/src/test/resources/libraries/jQuery/1.8.2/expectations/results.FF24.txt Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-14 13:58:45 UTC (rev 8973) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-14 20:40:23 UTC (rev 8974) @@ -946,7 +946,8 @@ 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) }) + @BrowserFeature({ @WebBrowser(value = FF, minVersion = 24), @WebBrowser(CHROME), + @WebBrowser(value = IE, minVersion = 9) }) JS_ENUM_NUMBERS_FIRST, /** Indicates that 'exception' (technically NativeError) exposes "stack" property. */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java 2014-01-14 13:58:45 UTC (rev 8973) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ScriptRuntimeTest.java 2014-01-14 20:40:23 UTC (rev 8974) @@ -35,6 +35,7 @@ */ @Test @Alerts(DEFAULT = { "0", "50", "100", "xxx", "zzz", "yyy" }, + FF17 = {"xxx", "50", "zzz", "100", "0", "yyy" }, IE8 = {"xxx", "50", "zzz", "100", "0", "yyy" }) public void enumChangeObject() throws Exception { final String html Modified: trunk/htmlunit/src/test/resources/libraries/jQuery/1.8.2/expectations/results.FF24.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/jQuery/1.8.2/expectations/results.FF24.txt 2014-01-14 13:58:45 UTC (rev 8973) +++ trunk/htmlunit/src/test/resources/libraries/jQuery/1.8.2/expectations/results.FF24.txt 2014-01-14 20:40:23 UTC (rev 8974) @@ -523,46 +523,46 @@ 523. effects: jQuery.fx.prototype.cur() - <1.8 Back Compat (0, 7, 7) 524. effects: JS Overflow and Display (0, 2, 2) 525. effects: CSS Overflow and Display (0, 2, 2) -526. effects: CSS Auto to show (0, 5, 5) -527. effects: CSS Auto to hide (0, 4, 4) +526. effects: CSS Auto to 0 (0, 6, 6) +527. effects: CSS Auto to 50 (0, 6, 6) 528. effects: CSS Auto to 100 (0, 6, 6) -529. effects: CSS Auto to 50 (0, 6, 6) -530. effects: CSS Auto to 0 (0, 6, 6) -531. effects: JS Auto to show (0, 5, 5) -532. effects: JS Auto to hide (0, 4, 4) +529. effects: CSS Auto to show (0, 5, 5) +530. effects: CSS Auto to hide (0, 4, 4) +531. effects: JS Auto to 0 (0, 6, 6) +532. effects: JS Auto to 50 (0, 6, 6) 533. effects: JS Auto to 100 (0, 6, 6) -534. effects: JS Auto to 50 (0, 6, 6) -535. effects: JS Auto to 0 (0, 6, 6) -536. effects: CSS 100 to show (0, 5, 5) -537. effects: CSS 100 to hide (0, 4, 4) +534. effects: JS Auto to show (0, 5, 5) +535. effects: JS Auto to hide (0, 4, 4) +536. effects: CSS 100 to 0 (0, 6, 6) +537. effects: CSS 100 to 50 (0, 6, 6) 538. effects: CSS 100 to 100 (0, 6, 6) -539. effects: CSS 100 to 50 (0, 6, 6) -540. effects: CSS 100 to 0 (0, 6, 6) -541. effects: JS 100 to show (0, 5, 5) -542. effects: JS 100 to hide (0, 4, 4) +539. effects: CSS 100 to show (0, 5, 5) +540. effects: CSS 100 to hide (0, 4, 4) +541. effects: JS 100 to 0 (0, 6, 6) +542. effects: JS 100 to 50 (0, 6, 6) 543. effects: JS 100 to 100 (0, 6, 6) -544. effects: JS 100 to 50 (0, 6, 6) -545. effects: JS 100 to 0 (0, 6, 6) -546. effects: CSS 50 to show (0, 5, 5) -547. effects: CSS 50 to hide (0, 4, 4) +544. effects: JS 100 to show (0, 5, 5) +545. effects: JS 100 to hide (0, 4, 4) +546. effects: CSS 50 to 0 (0, 6, 6) +547. effects: CSS 50 to 50 (0, 6, 6) 548. effects: CSS 50 to 100 (0, 6, 6) -549. effects: CSS 50 to 50 (0, 6, 6) -550. effects: CSS 50 to 0 (0, 6, 6) -551. effects: JS 50 to show (0, 5, 5) -552. effects: JS 50 to hide (0, 4, 4) +549. effects: CSS 50 to show (0, 5, 5) +550. effects: CSS 50 to hide (0, 4, 4) +551. effects: JS 50 to 0 (0, 6, 6) +552. effects: JS 50 to 50 (0, 6, 6) 553. effects: JS 50 to 100 (0, 6, 6) -554. effects: JS 50 to 50 (0, 6, 6) -555. effects: JS 50 to 0 (0, 6, 6) -556. effects: CSS 0 to show (0, 5, 5) -557. effects: CSS 0 to hide (0, 4, 4) +554. effects: JS 50 to show (0, 5, 5) +555. effects: JS 50 to hide (0, 4, 4) +556. effects: CSS 0 to 0 (0, 6, 6) +557. effects: CSS 0 to 50 (0, 6, 6) 558. effects: CSS 0 to 100 (0, 6, 6) -559. effects: CSS 0 to 50 (0, 6, 6) -560. effects: CSS 0 to 0 (0, 6, 6) -561. effects: JS 0 to show (0, 5, 5) -562. effects: JS 0 to hide (0, 4, 4) +559. effects: CSS 0 to show (0, 5, 5) +560. effects: CSS 0 to hide (0, 4, 4) +561. effects: JS 0 to 0 (0, 6, 6) +562. effects: JS 0 to 50 (0, 6, 6) 563. effects: JS 0 to 100 (0, 6, 6) -564. effects: JS 0 to 50 (0, 6, 6) -565. effects: JS 0 to 0 (0, 6, 6) +564. effects: JS 0 to show (0, 5, 5) +565. effects: JS 0 to hide (0, 4, 4) 566. effects: Chain fadeOut fadeIn (0, 5, 5) 567. effects: Chain fadeIn fadeOut (0, 5, 5) 568. effects: Chain hide show (0, 5, 5) |
From: <asa...@us...> - 2014-01-15 11:16:50
|
Revision: 8975 http://sourceforge.net/p/htmlunit/code/8975 Author: asashour Date: 2014-01-15 11:16:47 +0000 (Wed, 15 Jan 2014) Log Message: ----------- CSSStyleDeclaration: fix serialization of StyleElement. Issue 1569 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-14 20:40:23 UTC (rev 8974) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-15 11:16:47 UTC (rev 8975) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="fix" dev="asashour" issue="1569"> + CSSStyleDeclaration: fix serialization of StyleElement. + </action> <action type="fix" dev="asashour"> JavaScript: enumerating ordered numbers first (Chrome, FF and IE11). </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2014-01-14 20:40:23 UTC (rev 8974) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2014-01-15 11:16:47 UTC (rev 8975) @@ -34,6 +34,7 @@ import java.awt.Color; import java.io.IOException; +import java.io.Serializable; import java.io.StringReader; import java.text.MessageFormat; import java.text.ParseException; @@ -4494,7 +4495,7 @@ * Contains information about a single style element, including its name, its value, and an index which * can be compared against other indices in order to determine precedence. */ - public static class StyleElement implements Comparable<StyleElement> { + public static class StyleElement implements Comparable<StyleElement>, Serializable { private final String name_; private final String value_; private final String priority_; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java 2014-01-14 20:40:23 UTC (rev 8974) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java 2014-01-15 11:16:47 UTC (rev 8975) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.css; +import java.io.Serializable; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.css.sac.AttributeCondition; @@ -31,7 +33,7 @@ * @version $Revision$ * @author Marc Guillemot */ -class SelectorSpecificity implements Comparable<SelectorSpecificity> { +class SelectorSpecificity implements Comparable<SelectorSpecificity>, Serializable { private static final Log LOG = LogFactory.getLog(SelectorSpecificity.class); /** * The specificity for declarations made in the style attributes of an element. Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java 2014-01-15 11:16:47 UTC (rev 8975) @@ -0,0 +1,53 @@ +/* + * 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.host.css; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.SimpleWebTestCase; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + +/** + * Unit tests for {@link CSSStyleDeclaration}. + * + * @version $Revision$ + * @author Ahmed Ashour + */ +@RunWith(BrowserRunner.class) +public class CSSStyleDeclaration4Test extends SimpleWebTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + public void serialize() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + "function doTest() {\n" + + " var node = document.getElementById('div1');\n" + + " var style = node.style;\n" + + " alert(style.color);\n" + + " style.color = 'pink';\n" + + " alert(style.color);\n" + + " alert(node.getAttribute('style'));\n" + + "}\n</script></head>\n" + + "<body onload='doTest()'><div id='div1' style='color: black'>foo</div></body></html>"; + + final HtmlPage page = loadPage(html); + clone(page.getWebClient()); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.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 |
From: <asa...@us...> - 2014-01-18 08:24:53
|
Revision: 8976 http://sourceforge.net/p/htmlunit/code/8976 Author: asashour Date: 2014-01-18 08:24:49 +0000 (Sat, 18 Jan 2014) Log Message: ----------- JavaScript: ClientRect: add 'width' and 'height' properties. Issue 1570 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-15 11:16:47 UTC (rev 8975) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-18 08:24:49 UTC (rev 8976) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="add" dev="asashour" issue="1570"> + JavaScript: ClientRect: add 'width' and 'height' properties. + </action> <action type="fix" dev="asashour" issue="1569"> CSSStyleDeclaration: fix serialization of StyleElement. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java 2014-01-15 11:16:47 UTC (rev 8975) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java 2014-01-18 08:24:49 UTC (rev 8976) @@ -14,10 +14,14 @@ */ package com.gargoylesoftware.htmlunit.javascript.host; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; + import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; /** * Specifies a rectangle that contains a line of text in either an element or a TextRange object. @@ -127,4 +131,22 @@ public int getTop() { return top_; } + + /** + * Returns the "width" property. + * @return the "width" property + */ + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF) }) + public int getWidth() { + return getRight() - getLeft(); + } + + /** + * Returns the "height" property. + * @return the "height" property + */ + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF) }) + public int getHeight() { + return getBottom() - getTop(); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2014-01-15 11:16:47 UTC (rev 8975) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2014-01-18 08:24:49 UTC (rev 8976) @@ -2752,7 +2752,7 @@ top += 2; } - final ClientRect textRectangle = new ClientRect(0, left, 0, top); + final ClientRect textRectangle = new ClientRect(top + getOffsetHeight(), left, left + getOffsetWidth(), top); textRectangle.setParentScope(getWindow()); textRectangle.setPrototype(getPrototype(textRectangle.getClass())); return textRectangle; Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectTest.java 2014-01-18 08:24:49 UTC (rev 8976) @@ -0,0 +1,59 @@ +/* + * 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.host; + +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; + +/** + * Tests for {@link ClientRect}. + * + * @version $Revision$ + * @author Ahmed Ashour + */ +@RunWith(BrowserRunner.class) +public class ClientRectTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "100", "400", "100", "450", "50", "0" }, + IE8 = { "102", "402", "102", "452", "undefined", "undefined" }) + public void width() throws Exception { + final String html = "<html><head><title>foo</title><script>\n" + + " function test() {\n" + + " try {\n" + + " var d1 = document.getElementById('div1');\n" + + " var pos = d1.getBoundingClientRect();\n" + + " alert(pos.top);\n" + + " alert(pos.left);\n" + + " alert(pos.bottom);\n" + + " alert(pos.right);\n" + + " alert(pos.width);\n" + + " alert(pos.height);\n" + + " } catch (e) { alert('exception');}\n" + + " }\n" + + "</script></head><body onload='test()'>\n" + + "<div id='outer' style='position: absolute; left: 400px; top: 100px; width: 50px; height: 80px;'>" + + "<div id='div1'></div></div>" + + "</body></html>"; + loadPageWithAlerts2(html); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectTest.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 |
From: <rb...@us...> - 2014-01-19 13:43:50
|
Revision: 8996 http://sourceforge.net/p/htmlunit/code/8996 Author: rbri Date: 2014-01-19 13:43:47 +0000 (Sun, 19 Jan 2014) Log Message: ----------- CSS: Parsing of the :not pseudo class fixed, only simple selectors are allowed. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-19 13:12:49 UTC (rev 8995) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-19 13:43:47 UTC (rev 8996) @@ -8,6 +8,10 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="fix" dev="rbri"> + CSS: Parsing of the :not pseudo class fixed, only simple selectors are allowed. + This was a problem with CSSParser and is fixed in version 0.9.13. + </action> <action type="add" dev="asashour" issue="1570"> JavaScript: ClientRect: add 'width' and 'height' properties. </action> 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 2014-01-19 13:12:49 UTC (rev 8995) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java 2014-01-19 13:43:47 UTC (rev 8996) @@ -814,9 +814,41 @@ } /** + * see http://dev.w3.org/csswg/selectors3/#negation and + * http://dev.w3.org/csswg/selectors3/#simple-selectors-dfn. + * * @throws Exception if an error occurs */ @Test + @Alerts("exception") + public void invalid_not() throws Exception { + final String html = "<html><head><title>First</title>\n" + + "<meta http-equiv='X-UA-Compatible' content='IE=edge'>\n" + + "<script>\n" + + "function test() {\n" + + " if (document.querySelectorAll) {\n" + + " try {\n" + + " alert(document.querySelectorAll('p a:not(a:first-of-type)')[0].id);\n" + + " } catch(e) {alert('exception')}\n" + + " }\n" + + "}\n" + + "</script></head>\n" + + "<body onload='test()'>\n" + + "<p>\n" + + " <strong id='strong'>This</strong> is a short blurb\n" + + " <a id='link_1' href='#'>with a link</a> or\n" + + " <a id='link_2' href='#'>two</a>.\n" + + " Or <cite id='with_title' title='hello world!'>a citation</cite>.\n" + + "</p>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test @Alerts(DEFAULT = "id4", IE8 = "exception") public void last_of_type() throws Exception { |
From: <asa...@us...> - 2014-01-20 11:55:47
|
Revision: 9001 http://sourceforge.net/p/htmlunit/code/9001 Author: asashour Date: 2014-01-20 11:55:43 +0000 (Mon, 20 Jan 2014) Log Message: ----------- Testing new HttpWebConnection on the server, as local tests aren't consistent. To be revereted back. Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java 2014-01-20 11:55:43 UTC (rev 9001) @@ -0,0 +1,239 @@ +/* + * 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; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.SocketTimeoutException; +import java.security.GeneralSecurityException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.http.HttpHost; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLContexts; +import org.apache.http.conn.ssl.X509HostnameVerifier; +import org.apache.http.protocol.HttpContext; + +/** + * Socket factory offering facilities for insecure SSL and for SOCKS proxy support. + * This looks rather like a hack than like clean code but at the time of the writing it seems to + * be the easiest way to provide SOCKS proxy support for HTTPS. + * + * @version $Revision$ + * @author Nicolas Belisle + * @author Ahmed Ashour + * @author Martin Huber + * @author Marc Guillemot + * @author Ronald Brill + */ +final class HtmlUnitSSLConnectionSocketFactory extends SSLConnectionSocketFactory { + private static final String SSL3ONLY = "htmlunit.SSL3Only"; + + static boolean isUseSSL3Only(final HttpContext context) { + return "TRUE".equalsIgnoreCase((String) context.getAttribute(SSL3ONLY)); + } + + public static SSLConnectionSocketFactory buildSSLSocketFactory(final WebClientOptions options) { + try { + if (!options.isUseInsecureSSL()) { + if (options.getSSLClientCertificateUrl() == null) { + return new HtmlUnitSSLConnectionSocketFactory((KeyStore) null, null); // only SOCKS awareness + } + // SOCKS + keystore + return new HtmlUnitSSLConnectionSocketFactory(getKeyStore(options), options.getSSLClientCertificatePassword()); + } + + // we need insecure SSL + SOCKS awareness + final SSLContext sslContext = SSLContext.getInstance("SSL"); + sslContext.init(getKeyManagers(options), new TrustManager[]{new InsecureTrustManager2()}, null); + + final SSLConnectionSocketFactory factory = new HtmlUnitSSLConnectionSocketFactory(sslContext, + SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + return factory; + } + catch (final GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private HtmlUnitSSLConnectionSocketFactory(final SSLContext sslContext, final X509HostnameVerifier hostnameVerifier) { + super(sslContext, hostnameVerifier); + } + + private HtmlUnitSSLConnectionSocketFactory(final KeyStore keystore, final String keystorePassword) + throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { + super(SSLContexts.custom() + .loadKeyMaterial(keystore, keystorePassword != null ? keystorePassword.toCharArray() : null) + .build(), + BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); + } + + /** + * {@inheritDoc} + */ + @Override + public Socket createSocket(final HttpContext context) throws IOException { + if (SocksSocketFactory.getSocksProxy(context) != null) { + // we create the socket in connectSocket has we need to know the destination to open the underlying request + return null; + } + final Socket socket = super.createSocket(context); + configureSocket((SSLSocket) socket, context); + return socket; + } + + private void configureSocket(final SSLSocket sslSocket, final HttpContext context) { + if (isUseSSL3Only(context)) { + sslSocket.setEnabledProtocols(new String[]{"SSLv3"}); + } + } + + public Socket connectSocket( + final int connectTimeout, + final Socket socket, + final HttpHost host, + final InetSocketAddress remoteAddress, + final InetSocketAddress localAddress, + final HttpContext context) throws IOException { + final HttpHost socksProxy = SocksSocketFactory.getSocksProxy(context); + if (socksProxy != null) { + final Socket underlying = SocksSocketFactory.createSocketWithSocksProxy(socksProxy); + underlying.setReuseAddress(true); + + // TODO: commented out for HttpClient 4.3 + // final int soTimeout = HttpConnectionParams.getSoTimeout(params); + + final SocketAddress socksProxyAddress = new InetSocketAddress(socksProxy.getHostName(), + socksProxy.getPort()); + try { + //underlying.setSoTimeout(soTimeout); + underlying.connect(remoteAddress, connectTimeout); + } + catch (final SocketTimeoutException ex) { + throw new ConnectTimeoutException("Connect to " + socksProxyAddress + " timed out"); + } + + final Socket sslSocket = getSSLSocketFactory().createSocket(underlying, socksProxy.getHostName(), + socksProxy.getPort(), true); + configureSocket((SSLSocket) sslSocket, context); + return sslSocket; + } + return super.connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, context); + } + + private javax.net.ssl.SSLSocketFactory getSSLSocketFactory() { + try { + final Field field = SSLConnectionSocketFactory.class.getDeclaredField("socketfactory"); + field.setAccessible(true); + return (javax.net.ssl.SSLSocketFactory) field.get(this); + } + catch (final Exception e) { + throw new RuntimeException(e); + } + } + + private static KeyManager[] getKeyManagers(final WebClientOptions options) { + if (options.getSSLClientCertificateUrl() == null) { + return null; + } + try { + final String password = options.getSSLClientCertificatePassword(); + final char[] passwordChars = password != null ? password.toCharArray() : null; + + final KeyStore keyStore = getKeyStore(options); + final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); + keyManagerFactory.init(keyStore, passwordChars); + return keyManagerFactory.getKeyManagers(); + } + catch (final Exception e) { + throw new RuntimeException(e); + } + } + + private static KeyStore getKeyStore(final WebClientOptions options) { + try { + final KeyStore keyStore = KeyStore.getInstance(options.getSSLClientCertificateType()); + final String password = options.getSSLClientCertificatePassword(); + final char[] passwordChars = password != null ? password.toCharArray() : null; + keyStore.load(options.getSSLClientCertificateUrl().openStream(), passwordChars); + return keyStore; + } + catch (final Exception e) { + throw new RuntimeException(e); + } + } +} + +/** + * A completely insecure (yet very easy to use) x509 trust manager. This manager trusts all servers + * and all clients, regardless of credentials or lack thereof. + * + * @version $Revision$ + * @author Daniel Gredler + * @author Marc Guillemot + */ +class InsecureTrustManager2 implements X509TrustManager { + private final Set<X509Certificate> acceptedIssuers_ = new HashSet<X509Certificate>(); + + /** + * {@inheritDoc} + */ + public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { + // Everyone is trusted! + acceptedIssuers_.addAll(Arrays.asList(chain)); + } + + /** + * {@inheritDoc} + */ + public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { + // Everyone is trusted! + acceptedIssuers_.addAll(Arrays.asList(chain)); + } + + /** + * {@inheritDoc} + */ + public X509Certificate[] getAcceptedIssuers() { + // it seems to be OK for Java <= 6 to return an empty array but not for Java 7 (at least 1.7.0_04-b20): + // requesting an URL with a valid certificate (working without WebClient.setUseInsecureSSL(true)) throws a + // javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated + // when the array returned here is empty + if (acceptedIssuers_.isEmpty()) { + return new X509Certificate[0]; + } + return acceptedIssuers_.toArray(new X509Certificate[acceptedIssuers_.size()]); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.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 Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-20 11:27:33 UTC (rev 9000) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-20 11:55:43 UTC (rev 9001) @@ -53,6 +53,8 @@ import org.apache.http.auth.Credentials; import org.apache.http.client.CookieStore; import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; @@ -62,41 +64,39 @@ import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.methods.HttpTrace; import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.client.params.ClientPNames; -import org.apache.http.client.params.HttpClientParams; +import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.client.utils.DateUtils; import org.apache.http.client.utils.URIUtils; import org.apache.http.client.utils.URLEncodedUtils; +import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.params.ConnRoutePNames; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.cookie.ClientCookie; import org.apache.http.cookie.Cookie; import org.apache.http.cookie.CookieAttributeHandler; import org.apache.http.cookie.CookieOrigin; import org.apache.http.cookie.CookiePathComparator; import org.apache.http.cookie.CookieSpec; -import org.apache.http.cookie.CookieSpecFactory; +import org.apache.http.cookie.CookieSpecProvider; import org.apache.http.cookie.MalformedCookieException; import org.apache.http.cookie.SetCookie; -import org.apache.http.cookie.params.CookieSpecPNames; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.InputStreamBody; -import org.apache.http.impl.client.AbstractHttpClient; -import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.impl.conn.PoolingClientConnectionManager; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.cookie.BasicClientCookie; import org.apache.http.impl.cookie.BasicPathHandler; +import org.apache.http.impl.cookie.BestMatchSpecFactory; import org.apache.http.impl.cookie.BrowserCompatSpec; +import org.apache.http.impl.cookie.BrowserCompatSpecFactory; +import org.apache.http.impl.cookie.IgnoreSpecFactory; +import org.apache.http.impl.cookie.NetscapeDraftSpecFactory; +import org.apache.http.impl.cookie.RFC2109SpecFactory; +import org.apache.http.impl.cookie.RFC2965SpecFactory; import org.apache.http.message.BasicHeader; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.CoreConnectionPNames; import org.apache.http.params.HttpParams; -import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import com.gargoylesoftware.htmlunit.util.KeyDataPair; @@ -105,6 +105,8 @@ /** * Default implementation of {@link WebConnection}, using the HttpClient library to perform HTTP requests. + * This is meant to use the new API in HttpClient 4.3, and should be renamed to HttpWebConnection, + * after the old code is removed. * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> @@ -120,13 +122,13 @@ public class HttpWebConnection implements WebConnection { private static final String HACKED_COOKIE_POLICY = "mine"; - private AbstractHttpClient httpClient_; + private HttpClientBuilder httpClientBuilder_; private final WebClient webClient_; /** Use single HttpContext, so there is no need to re-send authentication for each and every request. */ - private HttpContext httpContext_ = new BasicHttpContext(); + private HttpContext httpContext_ = new HttpClientContext(); private String virtualHost_; - private final CookieSpecFactory htmlUnitCookieSpecFactory_; + private final CookieSpecProvider htmlUnitCookieSpecProvider_; private final WebClientOptions usedOptions_ = new WebClientOptions(); /** @@ -135,9 +137,10 @@ */ public HttpWebConnection(final WebClient webClient) { webClient_ = webClient; - htmlUnitCookieSpecFactory_ = new CookieSpecFactory() { - public CookieSpec newInstance(final HttpParams params) { - return new HtmlUnitBrowserCompatCookieSpec(webClient_.getIncorrectnessListener()); + htmlUnitCookieSpecProvider_ = new CookieSpecProvider() { + @Override + public CookieSpec create(final HttpContext context) { + return new HtmlUnitBrowserCompatCookieSpec2(webClient_.getIncorrectnessListener()); } }; } @@ -147,7 +150,7 @@ */ public WebResponse getResponse(final WebRequest request) throws IOException { final URL url = request.getUrl(); - final AbstractHttpClient httpClient = getHttpClient(); + final HttpClientBuilder builder = reconfigureHttpClientIfNeeded(getHttpClientBuilder()); HttpUriRequest httpMethod = null; try { @@ -159,18 +162,19 @@ + " (reason: " + e.getMessage() + ")", e); } final HttpHost hostConfiguration = getHostConfiguration(request); - setProxy(httpMethod, request); +// setProxy(httpMethod, request); final long startTime = System.currentTimeMillis(); HttpResponse httpResponse = null; try { - httpResponse = httpClient.execute(hostConfiguration, httpMethod, httpContext_); + httpResponse = builder.build().execute(hostConfiguration, httpMethod, httpContext_); } catch (final SSLPeerUnverifiedException s) { // Try to use only SSLv3 instead if (webClient_.getOptions().isUseInsecureSSL()) { - HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); - httpResponse = httpClient.execute(hostConfiguration, httpMethod); + // TODO: asashour + // HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); + httpResponse = builder.build().execute(hostConfiguration, httpMethod); } else { throw s; @@ -182,7 +186,7 @@ // come out of connections and throw a ConnectionPoolTimeoutException. // => best solution, discard the HttpClient instance. synchronized (this) { - httpClient_ = null; + httpClientBuilder_ = null; } throw e; } @@ -218,17 +222,39 @@ return hostConfiguration; } - private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { +// private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { +// if (webRequest.getProxyHost() != null) { +// final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); +// final HttpParams httpRequestParams = httpUriRequest.getParams(); +// if (webRequest.isSocksProxy()) { +// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); +// } +// else { +// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); +// } +// } +// } + + private void setProxy(final HttpRequestBase httpRequest, final WebRequest webRequest) { + RequestConfig.Builder requestBuilder = createRequestConfig(); + configureTimeout(requestBuilder, webClient_.getOptions().getTimeout()); + if (webRequest.getProxyHost() != null) { final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); - final HttpParams httpRequestParams = httpUriRequest.getParams(); - if (webRequest.isSocksProxy()) { - SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); - } - else { - httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); - } + requestBuilder.setProxy(proxy); + httpRequest.setConfig(requestBuilder.build()); + +// if (webRequest.isSocksProxy()) { +// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); +// } +// else { +// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); +// } } + else { + requestBuilder.setProxy(null); + httpRequest.setConfig(requestBuilder.build()); + } } /** @@ -254,6 +280,7 @@ URI uri = URIUtils.createURI(url.getProtocol(), url.getHost(), url.getPort(), url.getPath(), escapeQuery(url.getQuery()), null); final HttpRequestBase httpMethod = buildHttpMethod(webRequest.getHttpMethod(), uri); + setProxy(httpMethod, webRequest); if (!(httpMethod instanceof HttpEntityEnclosingRequest)) { // this is the case for GET as well as TRACE, DELETE, OPTIONS and HEAD if (!webRequest.getRequestParameters().isEmpty()) { @@ -294,7 +321,8 @@ buildFilePart((KeyDataPair) pair, builder); } else { - builder.addTextBody(pair.getName(), pair.getValue()); + builder.addTextBody(pair.getName(), pair.getValue(), + ContentType.create(webRequest.getCharset())); } } method.setEntity(builder.build()); @@ -325,10 +353,8 @@ writeRequestHeadersToHttpMethod(httpMethod, webRequest.getAdditionalHeaders()); // getHttpClient().getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, true); - final AbstractHttpClient httpClient = getHttpClient(); + final HttpClientBuilder httpClient = getHttpClientBuilder(); - reconfigureHttpClientIfNeeded(httpClient); - // Tell the client where to get its credentials from // (it may have changed on the webClient since last call to getHttpClientFor(...)) final CredentialsProvider credentialsProvider = webClient_.getCredentialsProvider(); @@ -341,6 +367,7 @@ final AuthScope authScope = new AuthScope(requestUrl.getHost(), requestUrl.getPort()); // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestUrlCredentials); + httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); } // if someone has set credentials to this request, we have to add this @@ -351,18 +378,20 @@ // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestCredentials); } - httpClient.setCredentialsProvider(credentialsProvider); + httpContext_.removeAttribute(HttpClientContext.CREDS_PROVIDER); + httpClient.setDefaultCredentialsProvider(credentialsProvider); + httpContext_.removeAttribute(HttpClientContext.COOKIE_STORE); if (webClient_.getCookieManager().isCookiesEnabled()) { // Cookies are enabled. Note that it's important that we enable single cookie headers, // for compatibility purposes. - httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); - httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, HACKED_COOKIE_POLICY); - httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); + // TODO: asashour +// httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); + httpClient.setDefaultCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); } else { // Cookies are disabled. - httpClient.setCookieStore(new CookieStore() { + httpClient.setDefaultCookieStore(new CookieStore() { public void addCookie(final Cookie cookie) { /* empty */ } public void clear() { /* empty */ } public boolean clearExpired(final Date date) { @@ -501,16 +530,27 @@ * * @return the initialized HTTP client */ - protected synchronized AbstractHttpClient getHttpClient() { - if (httpClient_ == null) { - httpClient_ = createHttpClient(); + protected synchronized HttpClientBuilder getHttpClientBuilder() { + if (httpClientBuilder_ == null) { + httpClientBuilder_ = createHttpClient(); // this factory is required later // to be sure this is done, we do it outside the createHttpClient() call - httpClient_.getCookieSpecs().register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecFactory_); + final RegistryBuilder<CookieSpecProvider> registeryBuilder + = RegistryBuilder.<CookieSpecProvider>create() + .register(CookieSpecs.BEST_MATCH, new BestMatchSpecFactory()) + .register(CookieSpecs.STANDARD, new RFC2965SpecFactory()) + .register(CookieSpecs.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory()) + .register(CookieSpecs.NETSCAPE, new NetscapeDraftSpecFactory()) + .register(CookieSpecs.IGNORE_COOKIES, new IgnoreSpecFactory()) + .register("rfc2109", new RFC2109SpecFactory()) + .register("rfc2965", new RFC2965SpecFactory()); + + registeryBuilder.register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecProvider_); + httpClientBuilder_.setDefaultCookieSpecRegistry(registeryBuilder.build()); } - return httpClient_; + return httpClientBuilder_; } /** @@ -531,25 +571,40 @@ * some tracking; see feature request 1438216). * @return the <tt>HttpClient</tt> that will be used by this WebConnection */ - protected AbstractHttpClient createHttpClient() { - final HttpParams httpParams = new BasicHttpParams(); + protected HttpClientBuilder createHttpClient() { + // TODO: asashour +// final HttpParams httpParams = new BasicHttpParams(); +// +// HttpClientParams.setRedirecting(httpParams, false); +// // Set timeouts +// configureTimeout(httpParams, webClient_.getOptions().getTimeout()); +// +// final SchemeRegistry schemeRegistry = new SchemeRegistry(); +// schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); +// configureHttpsScheme(schemeRegistry); +// +// final PoolingClientConnectionManager connectionManager = +// new PoolingClientConnectionManager(schemeRegistry); +// connectionManager.setDefaultMaxPerRoute(6); +// +// final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); +// httpClient.setCookieStore(new HtmlUnitCookieStore2(webClient_.getCookieManager())); +// +// httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { +// @Override +// public boolean isRedirected(final HttpRequest request, final HttpResponse response, +// final HttpContext context) throws ProtocolException { +// return super.isRedirected(request, response, context) +// && response.getFirstHeader("location") != null; +// } +// }); +// +// if (getVirtualHost() != null) { +// httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); +// } - HttpClientParams.setRedirecting(httpParams, false); - // Set timeouts - configureTimeout(httpParams, webClient_.getOptions().getTimeout()); - - final SchemeRegistry schemeRegistry = new SchemeRegistry(); - schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); - configureHttpsScheme(schemeRegistry); - - final PoolingClientConnectionManager connectionManager = - new PoolingClientConnectionManager(schemeRegistry); - connectionManager.setDefaultMaxPerRoute(6); - - final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); - httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); - - httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { + final HttpClientBuilder builder = HttpClientBuilder.create(); + builder.setRedirectStrategy(new DefaultRedirectStrategy() { @Override public boolean isRedirected(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { @@ -557,45 +612,57 @@ && response.getFirstHeader("location") != null; } }); + configureTimeout(builder, webClient_.getOptions().getTimeout()); + return builder; + } - if (getVirtualHost() != null) { - httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); - } + private void configureTimeout(final HttpClientBuilder builder, final int timeout) { + RequestConfig.Builder requestBuilder = createRequestConfig(); + configureTimeout(requestBuilder, timeout); - return httpClient; + builder.setDefaultRequestConfig(requestBuilder.build()); + httpContext_.removeAttribute(HttpClientContext.REQUEST_CONFIG); + usedOptions_.setTimeout(timeout); } - private void configureTimeout(final HttpParams httpParams, final int timeout) { - httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, timeout); - httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout); + private RequestConfig.Builder createRequestConfig() { + RequestConfig.Builder requestBuilder = RequestConfig.custom() + .setCookieSpec(HACKED_COOKIE_POLICY) + .setRedirectsEnabled(false); + return requestBuilder; + } - usedOptions_.setTimeout(timeout); + private void configureTimeout(final RequestConfig.Builder builder, final int timeout) { + builder.setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout) + .setSocketTimeout(timeout); } /** * React on changes that may have occurred on the WebClient settings. * Registering as a listener would be probably better. */ - private void reconfigureHttpClientIfNeeded(final AbstractHttpClient httpClient) { + private HttpClientBuilder reconfigureHttpClientIfNeeded(final HttpClientBuilder httpClientBuilder) { final WebClientOptions options = webClient_.getOptions(); // register new SSL factory only if settings have changed if (options.isUseInsecureSSL() != usedOptions_.isUseInsecureSSL() || options.getSSLClientCertificateUrl() != usedOptions_.getSSLClientCertificateUrl()) { - configureHttpsScheme(httpClient.getConnectionManager().getSchemeRegistry()); + configureHttpsScheme(httpClientBuilder); } if (options.getTimeout() != usedOptions_.getTimeout()) { - configureTimeout(httpClient.getParams(), options.getTimeout()); + configureTimeout(httpClientBuilder, options.getTimeout()); } + return httpClientBuilder; } - private void configureHttpsScheme(final SchemeRegistry schemeRegistry) { + private void configureHttpsScheme(final HttpClientBuilder builder) { final WebClientOptions options = webClient_.getOptions(); - final SSLSocketFactory socketFactory = HtmlUnitSSLSocketFactory.buildSSLSocketFactory(options); + final SSLConnectionSocketFactory socketFactory = HtmlUnitSSLConnectionSocketFactory.buildSSLSocketFactory(options); - schemeRegistry.register(new Scheme("https", 443, socketFactory)); + builder.setSSLSocketFactory(socketFactory); usedOptions_.setUseInsecureSSL(options.isUseInsecureSSL()); usedOptions_.setSSLClientCertificate(options.getSSLClientCertificateUrl(), @@ -609,7 +676,8 @@ public void setVirtualHost(final String virtualHost) { virtualHost_ = virtualHost; if (virtualHost_ != null) { - getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); + // TODO: asashour + //getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); } } @@ -625,7 +693,7 @@ * Converts an HttpMethod into a WebResponse. */ private WebResponse makeWebResponse(final HttpResponse httpResponse, - final WebRequest request, final DownloadedContent downloadedContent, final long loadTime) { + final WebRequest request, final DownloadedContent responseBody, final long loadTime) { String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); if (statusMessage == null) { @@ -636,7 +704,7 @@ for (final Header header : httpResponse.getAllHeaders()) { headers.add(new NameValuePair(header.getName(), header.getValue())); } - final WebResponseData responseData = new WebResponseData(downloadedContent, statusCode, statusMessage, headers); + final WebResponseData responseData = new WebResponseData(responseBody, statusCode, statusMessage, headers); return newWebResponseInstance(responseData, loadTime, request); } @@ -721,18 +789,24 @@ * Shutdown the connection manager. */ public synchronized void shutdown() { - if (httpClient_ != null) { - httpClient_.getConnectionManager().shutdown(); - httpClient_ = null; + if (httpClientBuilder_ != null) { + // TODO: asashour + //httpClientBuilder_.getConnectionManager().shutdown(); + httpClientBuilder_ = null; } } + + //TODO: should we really do this? + public void clearCredentials() { + httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); + } } /** * Workaround for <a href="https://issues.apache.org/jira/browse/HTTPCLIENT-1006">HttpClient bug 1006</a>: * quotes are wrongly removed in cookie's values. */ -class HtmlUnitBrowserCompatCookieSpec extends BrowserCompatSpec { +class HtmlUnitBrowserCompatCookieSpec2 extends BrowserCompatSpec { /** * Comparator for sending cookies in right order. * See specification: @@ -763,7 +837,7 @@ "d/M/yyyy", }; - HtmlUnitBrowserCompatCookieSpec(final IncorrectnessListener incorrectnessListener) { + HtmlUnitBrowserCompatCookieSpec2(final IncorrectnessListener incorrectnessListener) { super(); final BasicPathHandler pathHandler = new BasicPathHandler() { @Override @@ -876,4 +950,5 @@ public synchronized void clear() { manager_.clearCookies(); } + } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java 2014-01-20 11:27:33 UTC (rev 9000) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java 2014-01-20 11:55:43 UTC (rev 9001) @@ -21,6 +21,7 @@ import org.apache.http.HttpHost; import org.apache.http.conn.scheme.PlainSocketFactory; import org.apache.http.params.HttpParams; +import org.apache.http.protocol.HttpContext; /** * SOCKS aware {@link org.apache.http.conn.scheme.SchemeSocketFactory}. @@ -41,6 +42,10 @@ return (HttpHost) parameters.getParameter(SOCKS_PROXY); } + static HttpHost getSocksProxy(final HttpContext context) { + return (HttpHost) context.getAttribute(SOCKS_PROXY); + } + static Socket createSocketWithSocksProxy(final HttpHost socksProxy) { final InetSocketAddress address = new InetSocketAddress(socksProxy.getHostName(), socksProxy.getPort()); final Proxy proxy = new Proxy(Proxy.Type.SOCKS, address); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-20 11:27:33 UTC (rev 9000) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-20 11:55:43 UTC (rev 9001) @@ -42,8 +42,7 @@ import org.apache.http.StatusLine; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.impl.client.AbstractHttpClient; -import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicHttpResponse; import org.apache.http.message.BasicStatusLine; import org.apache.log4j.Level; @@ -244,9 +243,9 @@ final boolean[] tabCalled = {false}; final WebConnection myWebConnection = new HttpWebConnection(webClient) { @Override - protected AbstractHttpClient createHttpClient() { + protected HttpClientBuilder createHttpClient() { tabCalled[0] = true; - return new DefaultHttpClient(); + return HttpClientBuilder.create(); } }; |
From: <asa...@us...> - 2014-01-20 14:19:26
|
Revision: 9002 http://sourceforge.net/p/htmlunit/code/9002 Author: asashour Date: 2014-01-20 14:19:21 +0000 (Mon, 20 Jan 2014) Log Message: ----------- Revert testing new HttpWebConnection on the server, as local tests aren't consistent. Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java Removed Paths: ------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java Deleted: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java 2014-01-20 11:55:43 UTC (rev 9001) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java 2014-01-20 14:19:21 UTC (rev 9002) @@ -1,239 +0,0 @@ -/* - * 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; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.SocketTimeoutException; -import java.security.GeneralSecurityException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocket; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - -import org.apache.http.HttpHost; -import org.apache.http.conn.ConnectTimeoutException; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.SSLContexts; -import org.apache.http.conn.ssl.X509HostnameVerifier; -import org.apache.http.protocol.HttpContext; - -/** - * Socket factory offering facilities for insecure SSL and for SOCKS proxy support. - * This looks rather like a hack than like clean code but at the time of the writing it seems to - * be the easiest way to provide SOCKS proxy support for HTTPS. - * - * @version $Revision$ - * @author Nicolas Belisle - * @author Ahmed Ashour - * @author Martin Huber - * @author Marc Guillemot - * @author Ronald Brill - */ -final class HtmlUnitSSLConnectionSocketFactory extends SSLConnectionSocketFactory { - private static final String SSL3ONLY = "htmlunit.SSL3Only"; - - static boolean isUseSSL3Only(final HttpContext context) { - return "TRUE".equalsIgnoreCase((String) context.getAttribute(SSL3ONLY)); - } - - public static SSLConnectionSocketFactory buildSSLSocketFactory(final WebClientOptions options) { - try { - if (!options.isUseInsecureSSL()) { - if (options.getSSLClientCertificateUrl() == null) { - return new HtmlUnitSSLConnectionSocketFactory((KeyStore) null, null); // only SOCKS awareness - } - // SOCKS + keystore - return new HtmlUnitSSLConnectionSocketFactory(getKeyStore(options), options.getSSLClientCertificatePassword()); - } - - // we need insecure SSL + SOCKS awareness - final SSLContext sslContext = SSLContext.getInstance("SSL"); - sslContext.init(getKeyManagers(options), new TrustManager[]{new InsecureTrustManager2()}, null); - - final SSLConnectionSocketFactory factory = new HtmlUnitSSLConnectionSocketFactory(sslContext, - SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); - return factory; - } - catch (final GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - private HtmlUnitSSLConnectionSocketFactory(final SSLContext sslContext, final X509HostnameVerifier hostnameVerifier) { - super(sslContext, hostnameVerifier); - } - - private HtmlUnitSSLConnectionSocketFactory(final KeyStore keystore, final String keystorePassword) - throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { - super(SSLContexts.custom() - .loadKeyMaterial(keystore, keystorePassword != null ? keystorePassword.toCharArray() : null) - .build(), - BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); - } - - /** - * {@inheritDoc} - */ - @Override - public Socket createSocket(final HttpContext context) throws IOException { - if (SocksSocketFactory.getSocksProxy(context) != null) { - // we create the socket in connectSocket has we need to know the destination to open the underlying request - return null; - } - final Socket socket = super.createSocket(context); - configureSocket((SSLSocket) socket, context); - return socket; - } - - private void configureSocket(final SSLSocket sslSocket, final HttpContext context) { - if (isUseSSL3Only(context)) { - sslSocket.setEnabledProtocols(new String[]{"SSLv3"}); - } - } - - public Socket connectSocket( - final int connectTimeout, - final Socket socket, - final HttpHost host, - final InetSocketAddress remoteAddress, - final InetSocketAddress localAddress, - final HttpContext context) throws IOException { - final HttpHost socksProxy = SocksSocketFactory.getSocksProxy(context); - if (socksProxy != null) { - final Socket underlying = SocksSocketFactory.createSocketWithSocksProxy(socksProxy); - underlying.setReuseAddress(true); - - // TODO: commented out for HttpClient 4.3 - // final int soTimeout = HttpConnectionParams.getSoTimeout(params); - - final SocketAddress socksProxyAddress = new InetSocketAddress(socksProxy.getHostName(), - socksProxy.getPort()); - try { - //underlying.setSoTimeout(soTimeout); - underlying.connect(remoteAddress, connectTimeout); - } - catch (final SocketTimeoutException ex) { - throw new ConnectTimeoutException("Connect to " + socksProxyAddress + " timed out"); - } - - final Socket sslSocket = getSSLSocketFactory().createSocket(underlying, socksProxy.getHostName(), - socksProxy.getPort(), true); - configureSocket((SSLSocket) sslSocket, context); - return sslSocket; - } - return super.connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, context); - } - - private javax.net.ssl.SSLSocketFactory getSSLSocketFactory() { - try { - final Field field = SSLConnectionSocketFactory.class.getDeclaredField("socketfactory"); - field.setAccessible(true); - return (javax.net.ssl.SSLSocketFactory) field.get(this); - } - catch (final Exception e) { - throw new RuntimeException(e); - } - } - - private static KeyManager[] getKeyManagers(final WebClientOptions options) { - if (options.getSSLClientCertificateUrl() == null) { - return null; - } - try { - final String password = options.getSSLClientCertificatePassword(); - final char[] passwordChars = password != null ? password.toCharArray() : null; - - final KeyStore keyStore = getKeyStore(options); - final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); - keyManagerFactory.init(keyStore, passwordChars); - return keyManagerFactory.getKeyManagers(); - } - catch (final Exception e) { - throw new RuntimeException(e); - } - } - - private static KeyStore getKeyStore(final WebClientOptions options) { - try { - final KeyStore keyStore = KeyStore.getInstance(options.getSSLClientCertificateType()); - final String password = options.getSSLClientCertificatePassword(); - final char[] passwordChars = password != null ? password.toCharArray() : null; - keyStore.load(options.getSSLClientCertificateUrl().openStream(), passwordChars); - return keyStore; - } - catch (final Exception e) { - throw new RuntimeException(e); - } - } -} - -/** - * A completely insecure (yet very easy to use) x509 trust manager. This manager trusts all servers - * and all clients, regardless of credentials or lack thereof. - * - * @version $Revision$ - * @author Daniel Gredler - * @author Marc Guillemot - */ -class InsecureTrustManager2 implements X509TrustManager { - private final Set<X509Certificate> acceptedIssuers_ = new HashSet<X509Certificate>(); - - /** - * {@inheritDoc} - */ - public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { - // Everyone is trusted! - acceptedIssuers_.addAll(Arrays.asList(chain)); - } - - /** - * {@inheritDoc} - */ - public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { - // Everyone is trusted! - acceptedIssuers_.addAll(Arrays.asList(chain)); - } - - /** - * {@inheritDoc} - */ - public X509Certificate[] getAcceptedIssuers() { - // it seems to be OK for Java <= 6 to return an empty array but not for Java 7 (at least 1.7.0_04-b20): - // requesting an URL with a valid certificate (working without WebClient.setUseInsecureSSL(true)) throws a - // javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated - // when the array returned here is empty - if (acceptedIssuers_.isEmpty()) { - return new X509Certificate[0]; - } - return acceptedIssuers_.toArray(new X509Certificate[acceptedIssuers_.size()]); - } -} Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-20 11:55:43 UTC (rev 9001) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-20 14:19:21 UTC (rev 9002) @@ -53,8 +53,6 @@ import org.apache.http.auth.Credentials; import org.apache.http.client.CookieStore; import org.apache.http.client.CredentialsProvider; -import org.apache.http.client.config.CookieSpecs; -import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; @@ -64,39 +62,41 @@ import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.methods.HttpTrace; import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.client.params.ClientPNames; +import org.apache.http.client.params.HttpClientParams; import org.apache.http.client.utils.DateUtils; import org.apache.http.client.utils.URIUtils; import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.params.ConnRoutePNames; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.cookie.ClientCookie; import org.apache.http.cookie.Cookie; import org.apache.http.cookie.CookieAttributeHandler; import org.apache.http.cookie.CookieOrigin; import org.apache.http.cookie.CookiePathComparator; import org.apache.http.cookie.CookieSpec; -import org.apache.http.cookie.CookieSpecProvider; +import org.apache.http.cookie.CookieSpecFactory; import org.apache.http.cookie.MalformedCookieException; import org.apache.http.cookie.SetCookie; +import org.apache.http.cookie.params.CookieSpecPNames; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.InputStreamBody; +import org.apache.http.impl.client.AbstractHttpClient; +import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.impl.cookie.BasicClientCookie; import org.apache.http.impl.cookie.BasicPathHandler; -import org.apache.http.impl.cookie.BestMatchSpecFactory; import org.apache.http.impl.cookie.BrowserCompatSpec; -import org.apache.http.impl.cookie.BrowserCompatSpecFactory; -import org.apache.http.impl.cookie.IgnoreSpecFactory; -import org.apache.http.impl.cookie.NetscapeDraftSpecFactory; -import org.apache.http.impl.cookie.RFC2109SpecFactory; -import org.apache.http.impl.cookie.RFC2965SpecFactory; import org.apache.http.message.BasicHeader; +import org.apache.http.params.BasicHttpParams; +import org.apache.http.params.CoreConnectionPNames; import org.apache.http.params.HttpParams; +import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import com.gargoylesoftware.htmlunit.util.KeyDataPair; @@ -105,8 +105,6 @@ /** * Default implementation of {@link WebConnection}, using the HttpClient library to perform HTTP requests. - * This is meant to use the new API in HttpClient 4.3, and should be renamed to HttpWebConnection, - * after the old code is removed. * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> @@ -122,13 +120,13 @@ public class HttpWebConnection implements WebConnection { private static final String HACKED_COOKIE_POLICY = "mine"; - private HttpClientBuilder httpClientBuilder_; + private AbstractHttpClient httpClient_; private final WebClient webClient_; /** Use single HttpContext, so there is no need to re-send authentication for each and every request. */ - private HttpContext httpContext_ = new HttpClientContext(); + private HttpContext httpContext_ = new BasicHttpContext(); private String virtualHost_; - private final CookieSpecProvider htmlUnitCookieSpecProvider_; + private final CookieSpecFactory htmlUnitCookieSpecFactory_; private final WebClientOptions usedOptions_ = new WebClientOptions(); /** @@ -137,10 +135,9 @@ */ public HttpWebConnection(final WebClient webClient) { webClient_ = webClient; - htmlUnitCookieSpecProvider_ = new CookieSpecProvider() { - @Override - public CookieSpec create(final HttpContext context) { - return new HtmlUnitBrowserCompatCookieSpec2(webClient_.getIncorrectnessListener()); + htmlUnitCookieSpecFactory_ = new CookieSpecFactory() { + public CookieSpec newInstance(final HttpParams params) { + return new HtmlUnitBrowserCompatCookieSpec(webClient_.getIncorrectnessListener()); } }; } @@ -150,7 +147,7 @@ */ public WebResponse getResponse(final WebRequest request) throws IOException { final URL url = request.getUrl(); - final HttpClientBuilder builder = reconfigureHttpClientIfNeeded(getHttpClientBuilder()); + final AbstractHttpClient httpClient = getHttpClient(); HttpUriRequest httpMethod = null; try { @@ -162,19 +159,18 @@ + " (reason: " + e.getMessage() + ")", e); } final HttpHost hostConfiguration = getHostConfiguration(request); -// setProxy(httpMethod, request); + setProxy(httpMethod, request); final long startTime = System.currentTimeMillis(); HttpResponse httpResponse = null; try { - httpResponse = builder.build().execute(hostConfiguration, httpMethod, httpContext_); + httpResponse = httpClient.execute(hostConfiguration, httpMethod, httpContext_); } catch (final SSLPeerUnverifiedException s) { // Try to use only SSLv3 instead if (webClient_.getOptions().isUseInsecureSSL()) { - // TODO: asashour - // HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); - httpResponse = builder.build().execute(hostConfiguration, httpMethod); + HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); + httpResponse = httpClient.execute(hostConfiguration, httpMethod); } else { throw s; @@ -186,7 +182,7 @@ // come out of connections and throw a ConnectionPoolTimeoutException. // => best solution, discard the HttpClient instance. synchronized (this) { - httpClientBuilder_ = null; + httpClient_ = null; } throw e; } @@ -222,39 +218,17 @@ return hostConfiguration; } -// private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { -// if (webRequest.getProxyHost() != null) { -// final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); -// final HttpParams httpRequestParams = httpUriRequest.getParams(); -// if (webRequest.isSocksProxy()) { -// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); -// } -// else { -// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); -// } -// } -// } - - private void setProxy(final HttpRequestBase httpRequest, final WebRequest webRequest) { - RequestConfig.Builder requestBuilder = createRequestConfig(); - configureTimeout(requestBuilder, webClient_.getOptions().getTimeout()); - + private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { if (webRequest.getProxyHost() != null) { final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); - requestBuilder.setProxy(proxy); - httpRequest.setConfig(requestBuilder.build()); - -// if (webRequest.isSocksProxy()) { -// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); -// } -// else { -// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); -// } + final HttpParams httpRequestParams = httpUriRequest.getParams(); + if (webRequest.isSocksProxy()) { + SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); + } + else { + httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + } } - else { - requestBuilder.setProxy(null); - httpRequest.setConfig(requestBuilder.build()); - } } /** @@ -280,7 +254,6 @@ URI uri = URIUtils.createURI(url.getProtocol(), url.getHost(), url.getPort(), url.getPath(), escapeQuery(url.getQuery()), null); final HttpRequestBase httpMethod = buildHttpMethod(webRequest.getHttpMethod(), uri); - setProxy(httpMethod, webRequest); if (!(httpMethod instanceof HttpEntityEnclosingRequest)) { // this is the case for GET as well as TRACE, DELETE, OPTIONS and HEAD if (!webRequest.getRequestParameters().isEmpty()) { @@ -321,8 +294,7 @@ buildFilePart((KeyDataPair) pair, builder); } else { - builder.addTextBody(pair.getName(), pair.getValue(), - ContentType.create(webRequest.getCharset())); + builder.addTextBody(pair.getName(), pair.getValue()); } } method.setEntity(builder.build()); @@ -353,8 +325,10 @@ writeRequestHeadersToHttpMethod(httpMethod, webRequest.getAdditionalHeaders()); // getHttpClient().getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, true); - final HttpClientBuilder httpClient = getHttpClientBuilder(); + final AbstractHttpClient httpClient = getHttpClient(); + reconfigureHttpClientIfNeeded(httpClient); + // Tell the client where to get its credentials from // (it may have changed on the webClient since last call to getHttpClientFor(...)) final CredentialsProvider credentialsProvider = webClient_.getCredentialsProvider(); @@ -367,7 +341,6 @@ final AuthScope authScope = new AuthScope(requestUrl.getHost(), requestUrl.getPort()); // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestUrlCredentials); - httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); } // if someone has set credentials to this request, we have to add this @@ -378,20 +351,18 @@ // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestCredentials); } - httpContext_.removeAttribute(HttpClientContext.CREDS_PROVIDER); - httpClient.setDefaultCredentialsProvider(credentialsProvider); + httpClient.setCredentialsProvider(credentialsProvider); - httpContext_.removeAttribute(HttpClientContext.COOKIE_STORE); if (webClient_.getCookieManager().isCookiesEnabled()) { // Cookies are enabled. Note that it's important that we enable single cookie headers, // for compatibility purposes. - // TODO: asashour -// httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); - httpClient.setDefaultCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); + httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); + httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, HACKED_COOKIE_POLICY); + httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); } else { // Cookies are disabled. - httpClient.setDefaultCookieStore(new CookieStore() { + httpClient.setCookieStore(new CookieStore() { public void addCookie(final Cookie cookie) { /* empty */ } public void clear() { /* empty */ } public boolean clearExpired(final Date date) { @@ -530,27 +501,16 @@ * * @return the initialized HTTP client */ - protected synchronized HttpClientBuilder getHttpClientBuilder() { - if (httpClientBuilder_ == null) { - httpClientBuilder_ = createHttpClient(); + protected synchronized AbstractHttpClient getHttpClient() { + if (httpClient_ == null) { + httpClient_ = createHttpClient(); // this factory is required later // to be sure this is done, we do it outside the createHttpClient() call - final RegistryBuilder<CookieSpecProvider> registeryBuilder - = RegistryBuilder.<CookieSpecProvider>create() - .register(CookieSpecs.BEST_MATCH, new BestMatchSpecFactory()) - .register(CookieSpecs.STANDARD, new RFC2965SpecFactory()) - .register(CookieSpecs.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory()) - .register(CookieSpecs.NETSCAPE, new NetscapeDraftSpecFactory()) - .register(CookieSpecs.IGNORE_COOKIES, new IgnoreSpecFactory()) - .register("rfc2109", new RFC2109SpecFactory()) - .register("rfc2965", new RFC2965SpecFactory()); - - registeryBuilder.register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecProvider_); - httpClientBuilder_.setDefaultCookieSpecRegistry(registeryBuilder.build()); + httpClient_.getCookieSpecs().register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecFactory_); } - return httpClientBuilder_; + return httpClient_; } /** @@ -571,40 +531,25 @@ * some tracking; see feature request 1438216). * @return the <tt>HttpClient</tt> that will be used by this WebConnection */ - protected HttpClientBuilder createHttpClient() { - // TODO: asashour -// final HttpParams httpParams = new BasicHttpParams(); -// -// HttpClientParams.setRedirecting(httpParams, false); -// // Set timeouts -// configureTimeout(httpParams, webClient_.getOptions().getTimeout()); -// -// final SchemeRegistry schemeRegistry = new SchemeRegistry(); -// schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); -// configureHttpsScheme(schemeRegistry); -// -// final PoolingClientConnectionManager connectionManager = -// new PoolingClientConnectionManager(schemeRegistry); -// connectionManager.setDefaultMaxPerRoute(6); -// -// final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); -// httpClient.setCookieStore(new HtmlUnitCookieStore2(webClient_.getCookieManager())); -// -// httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { -// @Override -// public boolean isRedirected(final HttpRequest request, final HttpResponse response, -// final HttpContext context) throws ProtocolException { -// return super.isRedirected(request, response, context) -// && response.getFirstHeader("location") != null; -// } -// }); -// -// if (getVirtualHost() != null) { -// httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); -// } + protected AbstractHttpClient createHttpClient() { + final HttpParams httpParams = new BasicHttpParams(); - final HttpClientBuilder builder = HttpClientBuilder.create(); - builder.setRedirectStrategy(new DefaultRedirectStrategy() { + HttpClientParams.setRedirecting(httpParams, false); + // Set timeouts + configureTimeout(httpParams, webClient_.getOptions().getTimeout()); + + final SchemeRegistry schemeRegistry = new SchemeRegistry(); + schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); + configureHttpsScheme(schemeRegistry); + + final PoolingClientConnectionManager connectionManager = + new PoolingClientConnectionManager(schemeRegistry); + connectionManager.setDefaultMaxPerRoute(6); + + final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); + httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); + + httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { @Override public boolean isRedirected(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { @@ -612,57 +557,45 @@ && response.getFirstHeader("location") != null; } }); - configureTimeout(builder, webClient_.getOptions().getTimeout()); - return builder; - } - private void configureTimeout(final HttpClientBuilder builder, final int timeout) { - RequestConfig.Builder requestBuilder = createRequestConfig(); - configureTimeout(requestBuilder, timeout); + if (getVirtualHost() != null) { + httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); + } - builder.setDefaultRequestConfig(requestBuilder.build()); - httpContext_.removeAttribute(HttpClientContext.REQUEST_CONFIG); - usedOptions_.setTimeout(timeout); + return httpClient; } - private RequestConfig.Builder createRequestConfig() { - RequestConfig.Builder requestBuilder = RequestConfig.custom() - .setCookieSpec(HACKED_COOKIE_POLICY) - .setRedirectsEnabled(false); - return requestBuilder; - } + private void configureTimeout(final HttpParams httpParams, final int timeout) { + httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, timeout); + httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout); - private void configureTimeout(final RequestConfig.Builder builder, final int timeout) { - builder.setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout) - .setSocketTimeout(timeout); + usedOptions_.setTimeout(timeout); } /** * React on changes that may have occurred on the WebClient settings. * Registering as a listener would be probably better. */ - private HttpClientBuilder reconfigureHttpClientIfNeeded(final HttpClientBuilder httpClientBuilder) { + private void reconfigureHttpClientIfNeeded(final AbstractHttpClient httpClient) { final WebClientOptions options = webClient_.getOptions(); // register new SSL factory only if settings have changed if (options.isUseInsecureSSL() != usedOptions_.isUseInsecureSSL() || options.getSSLClientCertificateUrl() != usedOptions_.getSSLClientCertificateUrl()) { - configureHttpsScheme(httpClientBuilder); + configureHttpsScheme(httpClient.getConnectionManager().getSchemeRegistry()); } if (options.getTimeout() != usedOptions_.getTimeout()) { - configureTimeout(httpClientBuilder, options.getTimeout()); + configureTimeout(httpClient.getParams(), options.getTimeout()); } - return httpClientBuilder; } - private void configureHttpsScheme(final HttpClientBuilder builder) { + private void configureHttpsScheme(final SchemeRegistry schemeRegistry) { final WebClientOptions options = webClient_.getOptions(); - final SSLConnectionSocketFactory socketFactory = HtmlUnitSSLConnectionSocketFactory.buildSSLSocketFactory(options); + final SSLSocketFactory socketFactory = HtmlUnitSSLSocketFactory.buildSSLSocketFactory(options); - builder.setSSLSocketFactory(socketFactory); + schemeRegistry.register(new Scheme("https", 443, socketFactory)); usedOptions_.setUseInsecureSSL(options.isUseInsecureSSL()); usedOptions_.setSSLClientCertificate(options.getSSLClientCertificateUrl(), @@ -676,8 +609,7 @@ public void setVirtualHost(final String virtualHost) { virtualHost_ = virtualHost; if (virtualHost_ != null) { - // TODO: asashour - //getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); + getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); } } @@ -693,7 +625,7 @@ * Converts an HttpMethod into a WebResponse. */ private WebResponse makeWebResponse(final HttpResponse httpResponse, - final WebRequest request, final DownloadedContent responseBody, final long loadTime) { + final WebRequest request, final DownloadedContent downloadedContent, final long loadTime) { String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); if (statusMessage == null) { @@ -704,7 +636,7 @@ for (final Header header : httpResponse.getAllHeaders()) { headers.add(new NameValuePair(header.getName(), header.getValue())); } - final WebResponseData responseData = new WebResponseData(responseBody, statusCode, statusMessage, headers); + final WebResponseData responseData = new WebResponseData(downloadedContent, statusCode, statusMessage, headers); return newWebResponseInstance(responseData, loadTime, request); } @@ -789,24 +721,18 @@ * Shutdown the connection manager. */ public synchronized void shutdown() { - if (httpClientBuilder_ != null) { - // TODO: asashour - //httpClientBuilder_.getConnectionManager().shutdown(); - httpClientBuilder_ = null; + if (httpClient_ != null) { + httpClient_.getConnectionManager().shutdown(); + httpClient_ = null; } } - - //TODO: should we really do this? - public void clearCredentials() { - httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); - } } /** * Workaround for <a href="https://issues.apache.org/jira/browse/HTTPCLIENT-1006">HttpClient bug 1006</a>: * quotes are wrongly removed in cookie's values. */ -class HtmlUnitBrowserCompatCookieSpec2 extends BrowserCompatSpec { +class HtmlUnitBrowserCompatCookieSpec extends BrowserCompatSpec { /** * Comparator for sending cookies in right order. * See specification: @@ -837,7 +763,7 @@ "d/M/yyyy", }; - HtmlUnitBrowserCompatCookieSpec2(final IncorrectnessListener incorrectnessListener) { + HtmlUnitBrowserCompatCookieSpec(final IncorrectnessListener incorrectnessListener) { super(); final BasicPathHandler pathHandler = new BasicPathHandler() { @Override @@ -950,5 +876,4 @@ public synchronized void clear() { manager_.clearCookies(); } - } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java 2014-01-20 11:55:43 UTC (rev 9001) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java 2014-01-20 14:19:21 UTC (rev 9002) @@ -21,7 +21,6 @@ import org.apache.http.HttpHost; import org.apache.http.conn.scheme.PlainSocketFactory; import org.apache.http.params.HttpParams; -import org.apache.http.protocol.HttpContext; /** * SOCKS aware {@link org.apache.http.conn.scheme.SchemeSocketFactory}. @@ -42,10 +41,6 @@ return (HttpHost) parameters.getParameter(SOCKS_PROXY); } - static HttpHost getSocksProxy(final HttpContext context) { - return (HttpHost) context.getAttribute(SOCKS_PROXY); - } - static Socket createSocketWithSocksProxy(final HttpHost socksProxy) { final InetSocketAddress address = new InetSocketAddress(socksProxy.getHostName(), socksProxy.getPort()); final Proxy proxy = new Proxy(Proxy.Type.SOCKS, address); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-20 11:55:43 UTC (rev 9001) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-20 14:19:21 UTC (rev 9002) @@ -42,7 +42,8 @@ import org.apache.http.StatusLine; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.AbstractHttpClient; +import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicHttpResponse; import org.apache.http.message.BasicStatusLine; import org.apache.log4j.Level; @@ -243,9 +244,9 @@ final boolean[] tabCalled = {false}; final WebConnection myWebConnection = new HttpWebConnection(webClient) { @Override - protected HttpClientBuilder createHttpClient() { + protected AbstractHttpClient createHttpClient() { tabCalled[0] = true; - return HttpClientBuilder.create(); + return new DefaultHttpClient(); } }; |
From: <asa...@us...> - 2014-01-20 19:02:39
|
Revision: 9009 http://sourceforge.net/p/htmlunit/code/9009 Author: asashour Date: 2014-01-20 19:02:33 +0000 (Mon, 20 Jan 2014) Log Message: ----------- move JavaScript ActiveX package to *.javascript.host.activex Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLJavaScriptEnvironment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLScriptable.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttribute.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCharacterData.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMComment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentType.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementation.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMap.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNode.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNodeList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMParseError.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMProcessingInstruction.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMSelection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMText.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLHTTPRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLSerializer.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLProcessor.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLTemplate.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactoryTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLTestUtil.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttributeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASectionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCommentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragmentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTypeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMapTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNodeListTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMParseErrorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMProcessingInstructionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMTextTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLHTTPRequestTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLSerializerTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLProcessorTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/ Removed Paths: ------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -52,7 +52,6 @@ import org.apache.http.client.CredentialsProvider; import org.w3c.css.sac.ErrorHandler; -import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; import com.gargoylesoftware.htmlunit.attachment.Attachment; import com.gargoylesoftware.htmlunit.attachment.AttachmentHandler; import com.gargoylesoftware.htmlunit.gae.GAEUtils; @@ -71,6 +70,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.Location; import com.gargoylesoftware.htmlunit.javascript.host.Node; import com.gargoylesoftware.htmlunit.javascript.host.Window; +import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -29,13 +29,13 @@ import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; -import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; +import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; /** * This is the host object that allows JavaScript to instantiate Java objects via the ActiveXObject Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -73,8 +73,6 @@ import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.WebWindowNotFoundException; -import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; -import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocument; import com.gargoylesoftware.htmlunit.html.BaseFrameElement; import com.gargoylesoftware.htmlunit.html.DomChangeEvent; import com.gargoylesoftware.htmlunit.html.DomChangeListener; @@ -99,6 +97,8 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; +import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; import com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactory.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import java.util.Locale; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLConfiguration.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import java.util.Map; import java.util.WeakHashMap; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLJavaScriptEnvironment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLJavaScriptEnvironment.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import java.lang.reflect.Method; import java.util.HashMap; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLScriptable.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLScriptable.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttribute.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttribute.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASection.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCharacterData.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCharacterData.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMComment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMComment.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragment.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentType.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentType.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElement.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementation.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementation.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMap.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMap.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNode.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNode.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNodeList.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNodeList.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMParseError.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMParseError.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMProcessingInstruction.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMProcessingInstruction.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMSelection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMSelection.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMText.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMText.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLHTTPRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLHTTPRequest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLSerializer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLSerializer.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import org.w3c.dom.NamedNodeMap; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLProcessor.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLProcessor.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLTemplate.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLTemplate.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -64,8 +64,6 @@ import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.WebResponse; import com.gargoylesoftware.htmlunit.WebWindow; -import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; -import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocument; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; @@ -78,6 +76,8 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; import com.gargoylesoftware.htmlunit.javascript.host.Event; +import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; import com.gargoylesoftware.htmlunit.util.NameValuePair; import com.gargoylesoftware.htmlunit.util.WebResponseWrapper; import com.gargoylesoftware.htmlunit.xml.XmlPage; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactoryTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactoryTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,13 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; +import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; + /** * Tests for {@link MSXMLActiveXObjectFactory}. * Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLTestUtil.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLTestUtil.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import com.gargoylesoftware.htmlunit.html.HtmlPageTest; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttributeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttributeTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,15 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -28,6 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMAttribute; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASectionTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,15 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -29,6 +28,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMCDATASection; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCommentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCommentTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCommentTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,15 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -28,6 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMComment; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument2Test.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument2Test.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,18 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import java.net.URL; @@ -33,6 +31,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument3Test.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument3Test.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,18 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callSerializeXMLDOMDocumentToString; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callSerializeXMLDOMDocumentToString; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragmentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragmentTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragmentTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,16 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -29,6 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocumentFragment; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,19 +12,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION_NAME; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION_NAME; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -33,6 +31,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTypeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTypeTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTypeTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,13 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,6 +26,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocumentType; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElementTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElementTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,16 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -29,6 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMElement; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementationTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementationTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,13 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,6 +25,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMImplementation; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMapTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMapTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMapTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,13 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,6 +25,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMNamedNodeMap; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNodeListTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeListTest.java 2014-01-20 18:57:23 UTC (rev 9008) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNodeListTest.java 2014-01-20 19:02:33 UTC (rev 9009) @@ -12,13 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.activex.javascript.msxml; +package com.gargoylesoftware.htmlunit.javascript.host.activex; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. - LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLT... [truncated message content] |
From: <asa...@us...> - 2014-01-20 20:11:56
|
Revision: 9017 http://sourceforge.net/p/htmlunit/code/9017 Author: asashour Date: 2014-01-20 20:11:51 +0000 (Mon, 20 Jan 2014) Log Message: ----------- Revert: move JavaScript ActiveX package to *.javascript.host.activex Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCommentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragmentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTypeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMapTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeListTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseErrorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstructionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMTextTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequestTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializerTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessorTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/ Removed Paths: ------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-20 20:09:24 UTC (rev 9016) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -52,6 +52,7 @@ import org.apache.http.client.CredentialsProvider; import org.w3c.css.sac.ErrorHandler; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; import com.gargoylesoftware.htmlunit.attachment.Attachment; import com.gargoylesoftware.htmlunit.attachment.AttachmentHandler; import com.gargoylesoftware.htmlunit.gae.GAEUtils; @@ -70,7 +71,6 @@ import com.gargoylesoftware.htmlunit.javascript.host.Location; import com.gargoylesoftware.htmlunit.javascript.host.Node; import com.gargoylesoftware.htmlunit.javascript.host.Window; -import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactory.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import java.util.Locale; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLConfiguration.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import java.util.Map; import java.util.WeakHashMap; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLJavaScriptEnvironment.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import java.lang.reflect.Method; import java.util.HashMap; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLScriptable.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttribute.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASection.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCharacterData.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMComment.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragment.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentType.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElement.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementation.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMap.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNode.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNodeList.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMParseError.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMProcessingInstruction.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMSelection.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMText.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLHTTPRequest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLSerializer.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import org.w3c.dom.NamedNodeMap; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLProcessor.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XSLTemplate.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java 2014-01-20 20:09:24 UTC (rev 9016) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -29,13 +29,13 @@ import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; -import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; /** * This is the host object that allows JavaScript to instantiate Java objects via the ActiveXObject Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-20 20:09:24 UTC (rev 9016) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -73,6 +73,8 @@ import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.WebWindowNotFoundException; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocument; import com.gargoylesoftware.htmlunit.html.BaseFrameElement; import com.gargoylesoftware.htmlunit.html.DomChangeEvent; import com.gargoylesoftware.htmlunit.html.DomChangeListener; @@ -97,8 +99,6 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; -import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; import com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2014-01-20 20:09:24 UTC (rev 9016) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -64,6 +64,8 @@ import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.WebResponse; import com.gargoylesoftware.htmlunit.WebWindow; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocument; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; @@ -76,8 +78,6 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; import com.gargoylesoftware.htmlunit.javascript.host.Event; -import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; import com.gargoylesoftware.htmlunit.util.NameValuePair; import com.gargoylesoftware.htmlunit.util.WebResponseWrapper; import com.gargoylesoftware.htmlunit.xml.XmlPage; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLActiveXObjectFactoryTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; -import com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLActiveXObjectFactory; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; /** * Tests for {@link MSXMLActiveXObjectFactory}. Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/MSXMLTestUtil.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import com.gargoylesoftware.htmlunit.html.HtmlPageTest; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMAttributeTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMAttribute; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMAttribute; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCDATASectionTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -28,7 +28,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMCDATASection; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMCDATASection; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCommentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMCommentTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCommentTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMComment; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMComment; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument2Test.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument2Test.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,16 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import java.net.URL; @@ -31,7 +31,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocument; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocument3Test.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument3Test.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,16 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callSerializeXMLDOMDocumentToString; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callSerializeXMLDOMDocumentToString; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragmentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentFragmentTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragmentTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocumentFragment; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocumentFragment; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,17 +12,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION_NAME; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION_NAME; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromString; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,7 +31,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocument; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocument; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTypeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMDocumentTypeTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTypeTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,7 +26,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMDocumentType; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocumentType; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMElementTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElementTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMElement; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMElement; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMImplementationTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementationTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callCreateXMLDOMDocument; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -25,7 +25,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMImplementation; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMImplementation; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMapTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/activex/XMLDOMNamedNodeMapTest.java 2014-01-20 19:02:33 UTC (rev 9009) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMapTest.java 2014-01-20 20:11:51 UTC (rev 9017) @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.gargoylesoftware.htmlunit.javascript.host.activex; +package com.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; -import static com.gargoylesoftware.htmlunit.javascript.host.activex.MSXMLTestUtil.createTestHTML; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; import org.junit.Test; import org.junit.runner.RunWith; @@ -25,7 +25,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.javascript.host.activex.XMLDOMNamedNodeMap; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMNamedNodeMap; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeListTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoy... [truncated message content] |
From: <rb...@us...> - 2014-01-21 18:41:07
|
Revision: 9026 http://sourceforge.net/p/htmlunit/code/9026 Author: rbri Date: 2014-01-21 18:41:03 +0000 (Tue, 21 Jan 2014) Log Message: ----------- Chrome expectations added Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype150rc1Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype160Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype161Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype171Test.java Added Paths: ----------- trunk/htmlunit/src/test/resources/libraries/prototype/1.5.0-rc1/expected.position.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.dom.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.form.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.position.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.selector.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.dom.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.form.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.position.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.dom_test.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.form_test.Chrome.txt trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.position_test.Chrome.txt Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-21 16:58:50 UTC (rev 9025) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2014-01-21 18:41:03 UTC (rev 9026) @@ -1596,7 +1596,7 @@ * @param pseudo a string specifying the pseudo-element to match (may be <tt>null</tt>) * @return the computed style */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9), @WebBrowser(CHROME) }) public ComputedCSSStyleDeclaration getComputedStyle(final Element element, final String pseudo) { ComputedCSSStyleDeclaration style; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java 2014-01-21 16:58:50 UTC (rev 9025) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java 2014-01-21 18:41:03 UTC (rev 9026) @@ -85,7 +85,7 @@ if (/*browsers.contains("hu") ||*/ browsers.contains("hu-ie11")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.INTERNET_EXPLORER_11, false)); } - if (/*browsers.contains("hu") || */browsers.contains("hu-chrome")) { + if (/*browsers.contains("hu") ||*/ browsers.contains("hu-chrome")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.CHROME, false)); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype150rc1Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype150rc1Test.java 2014-01-21 16:58:50 UTC (rev 9025) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype150rc1Test.java 2014-01-21 18:41:03 UTC (rev 9026) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.libraries; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.CHROME; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE8; import java.util.List; @@ -104,7 +105,7 @@ * @throws Exception if test fails */ @Test - @NotYetImplemented(IE8) + @NotYetImplemented({ IE8, CHROME }) public void dom() throws Exception { test("dom.html"); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype160Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype160Test.java 2014-01-21 16:58:50 UTC (rev 9025) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype160Test.java 2014-01-21 18:41:03 UTC (rev 9026) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.libraries; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.CHROME; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE11; @@ -148,7 +149,7 @@ * @throws Exception if test fails */ @Test - @NotYetImplemented({ FF, IE11 }) + @NotYetImplemented({ FF, IE11, CHROME }) public void form() throws Exception { test("form.html"); } @@ -207,7 +208,7 @@ * @throws Exception if test fails */ @Test - @NotYetImplemented({ FF, IE11 }) + @NotYetImplemented({ FF, IE11, CHROME }) public void unitTests() throws Exception { test("unit_tests.html"); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype161Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype161Test.java 2014-01-21 16:58:50 UTC (rev 9025) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype161Test.java 2014-01-21 18:41:03 UTC (rev 9026) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.libraries; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.CHROME; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE11; @@ -138,7 +139,7 @@ * @throws Exception if test fails */ @Test - @NotYetImplemented({ FF, IE11 }) + @NotYetImplemented({ FF, IE11, CHROME }) public void form() throws Exception { test("form.html"); } @@ -212,7 +213,7 @@ * @throws Exception if test fails */ @Test - @NotYetImplemented(IE11) + @NotYetImplemented({ IE11, CHROME }) public void selector() throws Exception { test("selector.html"); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype171Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype171Test.java 2014-01-21 16:58:50 UTC (rev 9025) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Prototype171Test.java 2014-01-21 18:41:03 UTC (rev 9026) @@ -14,18 +14,18 @@ */ package com.gargoylesoftware.htmlunit.libraries; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.CHROME; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE11; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE8; -import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE11; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.WebServerTestCase; -import com.gargoylesoftware.htmlunit.BrowserRunner.Browser; -import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; /** * Tests for compatibility with version 1.7.1 of @@ -150,7 +150,7 @@ * @throws Exception if test fails */ @Test - @NotYetImplemented({ FF, IE11 }) + @NotYetImplemented({ FF, IE11, CHROME }) public void form() throws Exception { test("form_test.html"); } @@ -249,7 +249,7 @@ * @throws Exception if test fails */ @Test - @NotYetImplemented(Browser.IE8) + @NotYetImplemented({ IE8, CHROME }) public void selector() throws Exception { test("selector_test.html"); } Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.5.0-rc1/expected.position.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.5.0-rc1/expected.position.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.5.0-rc1/expected.position.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,9 @@ +5 tests, 26 assertions, 2 failures, 0 errors +Status Test Message +passed testPrepare 4 assertions, 0 failures, 0 errors +passed testPositionedOffset 4 assertions, 0 failures, 0 errors +passed testPage 4 assertions, 0 failures, 0 errors +passed testOffsetParent 4 assertions, 0 failures, 0 errors +failed testWithin 10 assertions, 2 failures, 0 errors +Failure: left/top corner +Failure: left/bottom corner \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.dom.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.dom.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.dom.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,94 @@ +87 tests, 806 assertions, 5 failures, 0 errors +Status Test Message +passed testDollarFunction 9 assertions, 0 failures, 0 errors +passed testGetElementsByClassName 18 assertions, 0 failures, 0 errors +passed testElementInsertWithHTML 4 assertions, 0 failures, 0 errors +passed testElementInsertWithDOMNode 5 assertions, 0 failures, 0 errors +passed testElementInsertWithToElementMethod 2 assertions, 0 failures, 0 errors +passed testElementInsertWithToHTMLMethod 2 assertions, 0 failures, 0 errors +passed testElementInsertWithNonString 1 assertions, 0 failures, 0 errors +passed testElementInsertInTables 5 assertions, 0 failures, 0 errors +passed testElementInsertInSelect 2 assertions, 0 failures, 0 errors +passed testElementMethodInsert 12 assertions, 0 failures, 0 errors +passed testInsertionBackwardsCompatibility 4 assertions, 0 failures, 0 errors +passed testElementWrap 8 assertions, 0 failures, 0 errors +passed testElementWrapReturnsWrapper 2 assertions, 0 failures, 0 errors +passed testElementVisible 2 assertions, 0 failures, 0 errors +passed testElementToggle 4 assertions, 0 failures, 0 errors +passed testElementShow 2 assertions, 0 failures, 0 errors +passed testElementHide 2 assertions, 0 failures, 0 errors +passed testElementRemove 1 assertions, 0 failures, 0 errors +passed testElementUpdate 5 assertions, 0 failures, 0 errors +passed testElementUpdateWithScript 6 assertions, 0 failures, 0 errors +passed testElementUpdateInTableRow 2 assertions, 0 failures, 0 errors +passed testElementUpdateInTableCell 1 assertions, 0 failures, 0 errors +passed testElementUpdateInTable 1 assertions, 0 failures, 0 errors +passed testElementUpdateInSelect 1 assertions, 0 failures, 0 errors +passed testElementUpdateWithDOMNode 1 assertions, 0 failures, 0 errors +passed testElementUpdateWithToElementMethod 1 assertions, 0 failures, 0 errors +passed testElementUpdateWithToHTMLMethod 1 assertions, 0 failures, 0 errors +passed testElementReplace 7 assertions, 0 failures, 0 errors +passed testElementReplaceWithScript 4 assertions, 0 failures, 0 errors +passed testElementReplaceWithDOMNode 1 assertions, 0 failures, 0 errors +passed testElementReplaceWithToElementMethod 1 assertions, 0 failures, 0 errors +passed testElementReplaceWithToHTMLMethod 1 assertions, 0 failures, 0 errors +passed testElementSelectorMethod 6 assertions, 0 failures, 0 errors +passed testElementAdjacent 4 assertions, 0 failures, 0 errors +passed testElementIdentify 4 assertions, 0 failures, 0 errors +passed testElementClassNameMethod 4 assertions, 0 failures, 0 errors +passed testElementAncestors 3 assertions, 0 failures, 0 errors +passed testElementDescendants 3 assertions, 0 failures, 0 errors +passed testElementFirstDescendant 2 assertions, 0 failures, 0 errors +passed testElementChildElements 4 assertions, 0 failures, 0 errors +passed testElementImmediateDescendants 1 assertions, 0 failures, 0 errors +passed testElementPreviousSiblings 3 assertions, 0 failures, 0 errors +passed testElementNextSiblings 3 assertions, 0 failures, 0 errors +passed testElementSiblings 2 assertions, 0 failures, 0 errors +passed testElementUp 9 assertions, 0 failures, 0 errors +passed testElementDown 6 assertions, 0 failures, 0 errors +passed testElementPrevious 6 assertions, 0 failures, 0 errors +passed testElementNext 7 assertions, 0 failures, 0 errors +passed testElementInspect 3 assertions, 0 failures, 0 errors +passed testElementMakeClipping 15 assertions, 0 failures, 0 errors +passed testElementExtend 151 assertions, 0 failures, 0 errors +passed testElementExtendReextendsDiscardedNodes 2 assertions, 0 failures, 0 errors +passed testElementCleanWhitespace 9 assertions, 0 failures, 0 errors +passed testElementEmpty 3 assertions, 0 failures, 0 errors +passed testDescendantOf 17 assertions, 0 failures, 0 errors +passed testChildOf 5 assertions, 0 failures, 0 errors +passed testElementSetStyle 20 assertions, 0 failures, 0 errors +passed testElementSetStyleCamelized 2 assertions, 0 failures, 0 errors +passed testElementSetOpacity 6 assertions, 0 failures, 0 errors +passed testElementGetStyle 28 assertions, 0 failures, 0 errors +passed testElementGetOpacity 1 assertions, 0 failures, 0 errors +passed testElementReadAttribute 20 assertions, 0 failures, 0 errors +passed testElementWriteAttribute 7 assertions, 0 failures, 0 errors +passed testElementWriteAttributeWithBooleans 9 assertions, 0 failures, 0 errors +passed testElementWriteAttributeWithIssues 10 assertions, 0 failures, 0 errors +passed testElementWriteAttributeWithCustom 3 assertions, 0 failures, 0 errors +passed testNewElement 216 assertions, 0 failures, 0 errors +passed testElementGetHeight 2 assertions, 0 failures, 0 errors +passed testElementGetWidth 2 assertions, 0 failures, 0 errors +passed testElementGetDimensions 18 assertions, 0 failures, 0 errors +passed testDOMAttributesHavePrecedenceOverExtendedElementMethods 2 assertions, 0 failures, 0 errors +passed testClassNames 3 assertions, 0 failures, 0 errors +passed testHasClassName 6 assertions, 0 failures, 0 errors +passed testAddClassName 3 assertions, 0 failures, 0 errors +passed testRemoveClassName 3 assertions, 0 failures, 0 errors +passed testToggleClassName 4 assertions, 0 failures, 0 errors +failed testElementScrollTo 0 assertions, 2 failures, 0 errors +Failure: assertEqual: expected "-117", actual "0" Line #1453 +Failure: assertEqual: expected "-117", actual "0" Line #1457 +passed testCustomElementMethods 4 assertions, 0 failures, 0 errors +passed testSpecificCustomElementMethods 14 assertions, 0 failures, 0 errors +passed testScriptFragment 4 assertions, 0 failures, 0 errors +passed testPositionedOffset 4 assertions, 0 failures, 0 errors +passed testViewportOffset 4 assertions, 0 failures, 0 errors +passed testOffsetParent 4 assertions, 0 failures, 0 errors +passed testAbsolutize 2 assertions, 0 failures, 0 errors +failed testViewportDimensions 0 assertions, 2 failures, 0 errors +Failure: NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THESE TESTS TO PASS: expected "985", actual "935" Line #1552 +Failure: NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THESE TESTS TO PASS: expected "992", actual "942" Line #1553 +failed testViewportScrollOffsets 2 assertions, 1 failures, 0 errors +Failure: assertEqual: expected "25", actual "0" Line #1567 +passed testNodeConstants 13 assertions, 0 failures, 0 errors \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.form.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.form.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.form.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,17 @@ +15 tests, 109 assertions, 0 failures, 0 errors +Status Test Message +passed testDollarF 1 assertions, 0 failures, 0 errors +passed testFormElementEventObserver 2 assertions, 0 failures, 0 errors +passed testFormElementObserver 6 assertions, 0 failures, 0 errors +passed testFormObserver 5 assertions, 0 failures, 0 errors +passed testFormEnabling 16 assertions, 0 failures, 0 errors +passed testFormElementEnabling 5 assertions, 0 failures, 0 errors +passed testFormActivating 4 assertions, 0 failures, 0 errors +passed testFormGetElements 1 assertions, 0 failures, 0 errors +passed testFormGetInputs 6 assertions, 0 failures, 0 errors +passed testFormFindFirstElement 3 assertions, 0 failures, 0 errors +passed testFormSerialize 13 assertions, 0 failures, 0 errors +passed testFormMethodsOnExtendedElements 9 assertions, 0 failures, 0 errors +passed testFormRequest 9 assertions, 0 failures, 0 errors +passed testFormElementMethodsChaining 20 assertions, 0 failures, 0 errors +passed testSetValue 9 assertions, 0 failures, 0 errors \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.position.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.position.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.position.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,6 @@ +2 tests, 14 assertions, 2 failures, 0 errors +Status Test Message +passed testPrepare 4 assertions, 0 failures, 0 errors +failed testWithin 10 assertions, 2 failures, 0 errors +Failure: left/top corner Line #79 +Failure: left/bottom corner Line #80 \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.selector.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.selector.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.6.0/expected.selector.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,40 @@ +37 tests, 169 assertions, 0 failures, 0 errors +Status Test Message +passed testSelectorWithTagName 4 assertions, 0 failures, 0 errors +passed testSelectorWithId 3 assertions, 0 failures, 0 errors +passed testSelectorWithClassName 2 assertions, 0 failures, 0 errors +passed testSelectorWithTagNameAndId 2 assertions, 0 failures, 0 errors +passed testSelectorWithTagNameAndClassName 4 assertions, 0 failures, 0 errors +passed testSelectorWithIdAndClassName 4 assertions, 0 failures, 0 errors +passed testSelectorWithTagNameAndIdAndClassName 5 assertions, 0 failures, 0 errors +passed test$$MatchesAncestryWithTokensSeparatedByWhitespace 2 assertions, 0 failures, 0 errors +passed test$$CombinesResultsWhenMultipleExpressionsArePassed 1 assertions, 0 failures, 0 errors +passed testSelectorWithTagNameAndAttributeExistence 3 assertions, 0 failures, 0 errors +passed testSelectorWithTagNameAndSpecificAttributeValue 2 assertions, 0 failures, 0 errors +passed testSelectorWithTagNameAndWhitespaceTokenizedAttributeValue 2 assertions, 0 failures, 0 errors +passed testSelectorWithAttributeAndNoTagName 6 assertions, 0 failures, 0 errors +passed testSelectorWithUniversalAndHyphenTokenizedAttributeValue 2 assertions, 0 failures, 0 errors +passed testSelectorWithTagNameAndNegatedAttributeValue 1 assertions, 0 failures, 0 errors +passed testSelectorWithBracketAttributeValue 4 assertions, 0 failures, 0 errors +passed test$$WithNestedAttributeSelectors 1 assertions, 0 failures, 0 errors +passed testSelectorWithMultipleConditions 2 assertions, 0 failures, 0 errors +passed testSelectorMatchElements 3 assertions, 0 failures, 0 errors +passed testSelectorFindElement 4 assertions, 0 failures, 0 errors +passed testElementMatch 14 assertions, 0 failures, 0 errors +passed testSelectorWithSpaceInAttributeValue 1 assertions, 0 failures, 0 errors +passed testSelectorWithNamespacedAttributes 0 assertions, 0 failures, 0 errors +Info: -- skipped for comparison -- +passed testSelectorWithChild 6 assertions, 0 failures, 0 errors +passed testSelectorWithAdjacence 10 assertions, 0 failures, 0 errors +passed testSelectorWithLaterSibling 10 assertions, 0 failures, 0 errors +passed testSelectorWithNewAttributeOperators 9 assertions, 0 failures, 0 errors +passed testSelectorWithDuplicates 2 assertions, 0 failures, 0 errors +passed testSelectorWithFirstLastOnlyNthNthLastChild 18 assertions, 0 failures, 0 errors +passed testSelectorWithFirstLastNthNthLastOfType 5 assertions, 0 failures, 0 errors +passed testSelectorWithNot 10 assertions, 0 failures, 0 errors +passed testSelectorWithEnabledDisabledChecked 3 assertions, 0 failures, 0 errors +passed testSelectorWithEmpty 2 assertions, 0 failures, 0 errors +passed testIdenticalResultsFromEquivalentSelectors 11 assertions, 0 failures, 0 errors +passed testSelectorsThatShouldReturnNothing 4 assertions, 0 failures, 0 errors +passed testCommasFor$$ 4 assertions, 0 failures, 0 errors +passed testSelectorExtendsAllNodes 3 assertions, 0 failures, 0 errors \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.dom.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.dom.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.dom.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,108 @@ +95 tests, 900 assertions, 5 failures, 0 errors +Status Test Message +testDollarFunction passed 9 assertions, 0 failures, 0 errors +testGetElementsByClassName passed 0 assertions, 0 failures, 0 errors +Info: -- skipped for comparison -- +testElementInsertWithHTML passed 4 assertions, 0 failures, 0 errors +testElementInsertWithDOMNode passed 5 assertions, 0 failures, 0 errors +testElementInsertWithToElementMethod passed 2 assertions, 0 failures, 0 errors +testElementInsertWithToHTMLMethod passed 2 assertions, 0 failures, 0 errors +testElementInsertWithNonString passed 1 assertions, 0 failures, 0 errors +testElementInsertInTables passed 5 assertions, 0 failures, 0 errors +testElementInsertInSelect passed 2 assertions, 0 failures, 0 errors +testElementMethodInsert passed 12 assertions, 0 failures, 0 errors +testNewElementInsert passed 4 assertions, 0 failures, 0 errors +testInsertionBackwardsCompatibility passed 4 assertions, 0 failures, 0 errors +testElementWrap passed 8 assertions, 0 failures, 0 errors +testElementWrapReturnsWrapper passed 2 assertions, 0 failures, 0 errors +testElementVisible passed 2 assertions, 0 failures, 0 errors +testElementToggle passed 4 assertions, 0 failures, 0 errors +testElementShow passed 2 assertions, 0 failures, 0 errors +testElementHide passed 2 assertions, 0 failures, 0 errors +testElementRemove passed 1 assertions, 0 failures, 0 errors +testElementUpdate passed 5 assertions, 0 failures, 0 errors +testElementUpdateWithScript passed 6 assertions, 0 failures, 0 errors +testElementUpdateInTableRow passed 2 assertions, 0 failures, 0 errors +testElementUpdateInTableCell passed 1 assertions, 0 failures, 0 errors +testElementUpdateInTable passed 1 assertions, 0 failures, 0 errors +testElementUpdateInSelect passed 1 assertions, 0 failures, 0 errors +testElementUpdateWithDOMNode passed 1 assertions, 0 failures, 0 errors +testElementUpdateWithToElementMethod passed 1 assertions, 0 failures, 0 errors +testElementUpdateWithToHTMLMethod passed 1 assertions, 0 failures, 0 errors +testElementUpdateScriptElement passed 1 assertions, 0 failures, 0 errors +testElementReplace passed 7 assertions, 0 failures, 0 errors +testElementReplaceWithScript passed 4 assertions, 0 failures, 0 errors +testElementReplaceWithDOMNode passed 1 assertions, 0 failures, 0 errors +testElementReplaceWithToElementMethod passed 1 assertions, 0 failures, 0 errors +testElementReplaceWithToHTMLMethod passed 1 assertions, 0 failures, 0 errors +testElementSelectorMethod passed 6 assertions, 0 failures, 0 errors +testElementAdjacent passed 4 assertions, 0 failures, 0 errors +testElementIdentify passed 5 assertions, 0 failures, 0 errors +testElementClassNameMethod passed 4 assertions, 0 failures, 0 errors +testElementAncestors passed 3 assertions, 0 failures, 0 errors +testElementDescendants passed 3 assertions, 0 failures, 0 errors +testElementFirstDescendant passed 2 assertions, 0 failures, 0 errors +testElementChildElements passed 4 assertions, 0 failures, 0 errors +testElementImmediateDescendants passed 1 assertions, 0 failures, 0 errors +testElementPreviousSiblings passed 3 assertions, 0 failures, 0 errors +testElementNextSiblings passed 3 assertions, 0 failures, 0 errors +testElementSiblings passed 2 assertions, 0 failures, 0 errors +testElementUp passed 10 assertions, 0 failures, 0 errors +testElementDown passed 9 assertions, 0 failures, 0 errors +testElementPrevious passed 7 assertions, 0 failures, 0 errors +testElementNext passed 8 assertions, 0 failures, 0 errors +testElementInspect passed 3 assertions, 0 failures, 0 errors +testElementMakeClipping passed 15 assertions, 0 failures, 0 errors +testElementExtend passed 151 assertions, 0 failures, 0 errors +testElementExtendReextendsDiscardedNodes passed 2 assertions, 0 failures, 0 errors +testElementCleanWhitespace passed 9 assertions, 0 failures, 0 errors +testElementEmpty passed 3 assertions, 0 failures, 0 errors +testDescendantOf passed 22 assertions, 0 failures, 0 errors +testChildOf passed 5 assertions, 0 failures, 0 errors +testElementSetStyle passed 20 assertions, 0 failures, 0 errors +testElementSetStyleCamelized passed 2 assertions, 0 failures, 0 errors +testElementSetOpacity passed 6 assertions, 0 failures, 0 errors +testElementGetStyle passed 30 assertions, 0 failures, 0 errors +testElementGetOpacity passed 1 assertions, 0 failures, 0 errors +testElementReadAttribute passed 22 assertions, 0 failures, 0 errors +testElementWriteAttribute passed 7 assertions, 0 failures, 0 errors +testElementWriteAttributeWithBooleans passed 9 assertions, 0 failures, 0 errors +testElementWriteAttributeWithIssues passed 13 assertions, 0 failures, 0 errors +testElementWriteAttributeWithCustom passed 3 assertions, 0 failures, 0 errors +testElementHasAttribute passed 6 assertions, 0 failures, 0 errors +testNewElement passed 220 assertions, 0 failures, 0 errors +testElementGetHeight passed 2 assertions, 0 failures, 0 errors +testElementGetWidth passed 2 assertions, 0 failures, 0 errors +testElementGetDimensions passed 18 assertions, 0 failures, 0 errors +testDOMAttributesHavePrecedenceOverExtendedElementMethods passed 2 assertions, 0 failures, 0 errors +testClassNames passed 3 assertions, 0 failures, 0 errors +testHasClassName passed 6 assertions, 0 failures, 0 errors +testAddClassName passed 3 assertions, 0 failures, 0 errors +testRemoveClassName passed 3 assertions, 0 failures, 0 errors +testToggleClassName passed 4 assertions, 0 failures, 0 errors +testElementScrollTo failed 0 assertions, 2 failures, 0 errors +Failure: assertEqual +expected: <-1971>, actual: <0> +Failure: assertEqual +expected: <-1971>, actual: <0> +testCustomElementMethods passed 4 assertions, 0 failures, 0 errors +testSpecificCustomElementMethods passed 14 assertions, 0 failures, 0 errors +testScriptFragment passed 4 assertions, 0 failures, 0 errors +testPositionedOffset passed 9 assertions, 0 failures, 0 errors +testCumulativeOffset passed 3 assertions, 0 failures, 0 errors +testViewportOffset passed 7 assertions, 0 failures, 0 errors +testOffsetParent passed 5 assertions, 0 failures, 0 errors +testAbsolutize passed 3 assertions, 0 failures, 0 errors +testRelativize passed 1 assertions, 0 failures, 0 errors +testViewportDimensions failed 0 assertions, 2 failures, 0 errors +Failure: NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS +expected: <970>, actual: <920> +Failure: NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS +expected: <992>, actual: <942> +testElementToViewportDimensionsDoesNotAffectDocumentProperties passed 38 assertions, 0 failures, 0 errors +testViewportScrollOffsets failed 2 assertions, 1 failures, 0 errors +Failure: NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THESE TESTS TO PASS +expected: <25>, actual: <0> +testNodeConstants passed 13 assertions, 0 failures, 0 errors +testElementStorage passed 11 assertions, 0 failures, 0 errors +testElementClone passed 15 assertions, 0 failures, 0 errors \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.form.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.form.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.form.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,21 @@ +17 tests, 111 assertions, 1 failures, 0 errors +Status Test Message +testDollarF passed 1 assertions, 0 failures, 0 errors +testFormReset passed 1 assertions, 0 failures, 0 errors +testFormElementEventObserver passed 2 assertions, 0 failures, 0 errors +testFormElementObserver passed 6 assertions, 0 failures, 0 errors +testFormObserver passed 5 assertions, 0 failures, 0 errors +testFormEnabling passed 16 assertions, 0 failures, 0 errors +testFormElementEnabling passed 5 assertions, 0 failures, 0 errors +testFormActivating passed 4 assertions, 0 failures, 0 errors +testFormGetElements passed 1 assertions, 0 failures, 0 errors +testFormGetInputs passed 6 assertions, 0 failures, 0 errors +testFormFindFirstElement passed 3 assertions, 0 failures, 0 errors +testFormSerialize passed 14 assertions, 0 failures, 0 errors +testFormMethodsOnExtendedElements passed 9 assertions, 0 failures, 0 errors +testFormRequest failed 8 assertions, 1 failures, 0 errors +Failure: wrong default action for form element with empty action attribute +got <false> +testFormElementMethodsChaining passed 20 assertions, 0 failures, 0 errors +testSetValue passed 9 assertions, 0 failures, 0 errors +testSerializeFormTroublesomeNames passed 1 assertions, 0 failures, 0 errors \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.position.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.position.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.6.1/expected.position.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,8 @@ +2 tests, 14 assertions, 2 failures, 0 errors +Status Test Message +testPrepare passed 4 assertions, 0 failures, 0 errors +testWithin failed 10 assertions, 2 failures, 0 errors +Failure: left/top corner +got <false> +Failure: left/bottom corner +got <false> \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.dom_test.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.dom_test.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.dom_test.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,106 @@ +97 tests, 917 assertions, 2 failures, 0 errors +Status Test Message +testDollarFunction passed 9 assertions, 0 failures, 0 errors +testGetElementsByClassName passed 0 assertions, 0 failures, 0 errors +Info: -- skipped for comparison -- +testElementInsertWithHTML passed 4 assertions, 0 failures, 0 errors +testElementInsertWithDOMNode passed 5 assertions, 0 failures, 0 errors +testElementInsertWithToElementMethod passed 2 assertions, 0 failures, 0 errors +testElementInsertWithToHTMLMethod passed 2 assertions, 0 failures, 0 errors +testElementInsertWithNonString passed 1 assertions, 0 failures, 0 errors +testElementInsertInTables passed 5 assertions, 0 failures, 0 errors +testElementInsertInSelect passed 2 assertions, 0 failures, 0 errors +testElementMethodInsert passed 12 assertions, 0 failures, 0 errors +testNewElementInsert passed 4 assertions, 0 failures, 0 errors +testInsertionBackwardsCompatibility passed 4 assertions, 0 failures, 0 errors +testElementWrap passed 8 assertions, 0 failures, 0 errors +testElementWrapReturnsWrapper passed 2 assertions, 0 failures, 0 errors +testElementVisible passed 2 assertions, 0 failures, 0 errors +testElementToggle passed 4 assertions, 0 failures, 0 errors +testElementShow passed 2 assertions, 0 failures, 0 errors +testElementHide passed 2 assertions, 0 failures, 0 errors +testElementRemove passed 1 assertions, 0 failures, 0 errors +testElementUpdate passed 5 assertions, 0 failures, 0 errors +testElementUpdateWithScript passed 6 assertions, 0 failures, 0 errors +testElementUpdateInTableRow passed 2 assertions, 0 failures, 0 errors +testElementUpdateInTableCell passed 1 assertions, 0 failures, 0 errors +testElementUpdateInTable passed 1 assertions, 0 failures, 0 errors +testElementUpdateInSelect passed 1 assertions, 0 failures, 0 errors +testElementUpdateWithLinkTag passed 7 assertions, 0 failures, 0 errors +testElementUpdateWithDOMNode passed 1 assertions, 0 failures, 0 errors +testElementUpdateWithToElementMethod passed 1 assertions, 0 failures, 0 errors +testElementUpdateWithToHTMLMethod passed 1 assertions, 0 failures, 0 errors +testElementUpdateScriptElement passed 1 assertions, 0 failures, 0 errors +testElementReplace passed 7 assertions, 0 failures, 0 errors +testElementReplaceWithScript passed 4 assertions, 0 failures, 0 errors +testElementReplaceWithDOMNode passed 1 assertions, 0 failures, 0 errors +testElementReplaceWithToElementMethod passed 1 assertions, 0 failures, 0 errors +testElementReplaceWithToHTMLMethod passed 1 assertions, 0 failures, 0 errors +testElementSelectorMethod passed 6 assertions, 0 failures, 0 errors +testElementAdjacent passed 4 assertions, 0 failures, 0 errors +testElementIdentify passed 5 assertions, 0 failures, 0 errors +testElementClassNameMethod passed 4 assertions, 0 failures, 0 errors +testElementAncestors passed 3 assertions, 0 failures, 0 errors +testElementDescendants passed 3 assertions, 0 failures, 0 errors +testElementFirstDescendant passed 2 assertions, 0 failures, 0 errors +testElementChildElements passed 4 assertions, 0 failures, 0 errors +testElementImmediateDescendants passed 1 assertions, 0 failures, 0 errors +testElementPreviousSiblings passed 3 assertions, 0 failures, 0 errors +testElementNextSiblings passed 3 assertions, 0 failures, 0 errors +testElementSiblings passed 2 assertions, 0 failures, 0 errors +testElementUp passed 10 assertions, 0 failures, 0 errors +testElementDown passed 9 assertions, 0 failures, 0 errors +testElementPrevious passed 7 assertions, 0 failures, 0 errors +testElementNext passed 8 assertions, 0 failures, 0 errors +testElementInspect passed 3 assertions, 0 failures, 0 errors +testElementMakeClipping passed 15 assertions, 0 failures, 0 errors +testElementExtend passed 151 assertions, 0 failures, 0 errors +testElementExtendReextendsDiscardedNodes passed 2 assertions, 0 failures, 0 errors +testElementCleanWhitespace passed 9 assertions, 0 failures, 0 errors +testElementEmpty passed 3 assertions, 0 failures, 0 errors +testDescendantOf passed 22 assertions, 0 failures, 0 errors +testChildOf passed 5 assertions, 0 failures, 0 errors +testElementSetStyle passed 20 assertions, 0 failures, 0 errors +testElementSetStyleCamelized passed 2 assertions, 0 failures, 0 errors +testElementSetOpacity passed 6 assertions, 0 failures, 0 errors +testElementGetStyle passed 30 assertions, 0 failures, 0 errors +testElementGetOpacity passed 1 assertions, 0 failures, 0 errors +testElementReadAttribute passed 22 assertions, 0 failures, 0 errors +testElementWriteAttribute passed 7 assertions, 0 failures, 0 errors +testElementWriteAttributeWithBooleans passed 9 assertions, 0 failures, 0 errors +testElementWriteAttributeWithIssues passed 13 assertions, 0 failures, 0 errors +testElementWriteAttributeWithCustom passed 3 assertions, 0 failures, 0 errors +testElementHasAttribute passed 6 assertions, 0 failures, 0 errors +testNewElement passed 222 assertions, 0 failures, 0 errors +testElementGetHeight passed 2 assertions, 0 failures, 0 errors +testElementGetWidth passed 2 assertions, 0 failures, 0 errors +testElementGetDimensions passed 18 assertions, 0 failures, 0 errors +testDOMAttributesHavePrecedenceOverExtendedElementMethods passed 2 assertions, 0 failures, 0 errors +testClassNames passed 3 assertions, 0 failures, 0 errors +testHasClassName passed 6 assertions, 0 failures, 0 errors +testAddClassName passed 3 assertions, 0 failures, 0 errors +testRemoveClassName passed 3 assertions, 0 failures, 0 errors +testToggleClassName passed 4 assertions, 0 failures, 0 errors +testElementScrollTo failed 0 assertions, 2 failures, 0 errors +Failure: assertEqual +expected: <-1>, actual: <0> +Failure: assertEqual +expected: <-1>, actual: <0> +testCustomElementMethods passed 4 assertions, 0 failures, 0 errors +testSpecificCustomElementMethods passed 14 assertions, 0 failures, 0 errors +testScriptFragment passed 4 assertions, 0 failures, 0 errors +testPositionedOffset passed 9 assertions, 0 failures, 0 errors +testCumulativeOffset passed 4 assertions, 0 failures, 0 errors +testViewportOffset passed 7 assertions, 0 failures, 0 errors +testOffsetParent passed 8 assertions, 0 failures, 0 errors +testAbsolutize passed 3 assertions, 0 failures, 0 errors +testRelativize passed 1 assertions, 0 failures, 0 errors +testViewportDimensions passed 0 assertions, 0 failures, 0 errors +Info: -- skipped for comparison -- +testElementToViewportDimensionsDoesNotAffectDocumentProperties passed 38 assertions, 0 failures, 0 errors +testViewportScrollOffsets passed 2 assertions, 0 failures, 0 errors +Info: -- skipped for comparison -- +testNodeConstants passed 13 assertions, 0 failures, 0 errors +testElementStorage passed 11 assertions, 0 failures, 0 errors +testElementClone passed 15 assertions, 0 failures, 0 errors +testElementPurge passed 4 assertions, 0 failures, 0 errors \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.form_test.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.form_test.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.form_test.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,23 @@ +19 tests, 115 assertions, 1 failures, 0 errors +Status Test Message +testDollarF passed 1 assertions, 0 failures, 0 errors +testFormReset passed 1 assertions, 0 failures, 0 errors +testFormElementEventObserver passed 2 assertions, 0 failures, 0 errors +testFormElementObserver passed 6 assertions, 0 failures, 0 errors +testFormObserver passed 5 assertions, 0 failures, 0 errors +testFormEnabling passed 16 assertions, 0 failures, 0 errors +testFormElementEnabling passed 5 assertions, 0 failures, 0 errors +testFormActivating passed 5 assertions, 0 failures, 0 errors +testFormGetElements passed 1 assertions, 0 failures, 0 errors +testFormGetInputs passed 6 assertions, 0 failures, 0 errors +testFormFindFirstElement passed 3 assertions, 0 failures, 0 errors +testFormSerialize passed 14 assertions, 0 failures, 0 errors +testFormSerializeWithDuplicateNames passed 1 assertions, 0 failures, 0 errors +testFormSerializeURIEncodesInputs passed 1 assertions, 0 failures, 0 errors +testFormMethodsOnExtendedElements passed 9 assertions, 0 failures, 0 errors +testFormRequest failed 8 assertions, 1 failures, 0 errors +Failure: wrong default action for form element with empty action attribute +got <false> +testFormElementMethodsChaining passed 20 assertions, 0 failures, 0 errors +testSetValue passed 9 assertions, 0 failures, 0 errors +testSerializeFormTroublesomeNames passed 2 assertions, 0 failures, 0 errors \ No newline at end of file Added: trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.position_test.Chrome.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.position_test.Chrome.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/prototype/1.7.1/expected.position_test.Chrome.txt 2014-01-21 18:41:03 UTC (rev 9026) @@ -0,0 +1,8 @@ +2 tests, 14 assertions, 2 failures, 0 errors +Status Test Message +testPrepare passed 4 assertions, 0 failures, 0 errors +testWithin failed 10 assertions, 2 failures, 0 errors +Failure: left/top corner +got <false> +Failure: left/bottom corner +got <false> \ No newline at end of file |
From: <rb...@us...> - 2014-01-22 19:26:45
|
Revision: 9034 http://sourceforge.net/p/htmlunit/code/9034 Author: rbri Date: 2014-01-22 19:26:39 +0000 (Wed, 22 Jan 2014) Log Message: ----------- another test partly migrated to WebDriver; failing test maked as NYI as a first step Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElementTest.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement3Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-22 18:30:55 UTC (rev 9033) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2014-01-22 19:26:39 UTC (rev 9034) @@ -1052,14 +1052,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_HTML_GENERIC_ELEMENT_CLASS_NAME, - /** Javascript method getHeight of IFrames may return negative values. */ - @BrowserFeature(@WebBrowser(IE)) - JS_IFRAME_GET_HEIGHT_NEGATIVE_VALUES, - - /** Javascript method getWidth of IFrames may return negative values. */ - @BrowserFeature(@WebBrowser(IE)) - JS_IFRAME_GET_WIDTH_NEGATIVE_VALUES, - /** IE ignores the last line containing uncommented. */ @BrowserFeature(@WebBrowser(IE)) JS_IGNORES_LAST_LINE_CONTAINING_UNCOMMENTED, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java 2014-01-22 18:30:55 UTC (rev 9033) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java 2014-01-22 19:26:39 UTC (rev 9034) @@ -14,8 +14,6 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IFRAME_GET_HEIGHT_NEGATIVE_VALUES; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IFRAME_GET_WIDTH_NEGATIVE_VALUES; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; @@ -162,9 +160,7 @@ */ @JsxGetter(propertyName = "width") public String getWidth_js() { - final boolean ie = getBrowserVersion().hasFeature(JS_IFRAME_GET_WIDTH_NEGATIVE_VALUES); - final Boolean returnNegativeValues = ie ? Boolean.TRUE : null; - return getWidthOrHeight("width", returnNegativeValues); + return getWidthOrHeight("width", Boolean.TRUE); } /** @@ -182,9 +178,7 @@ */ @JsxGetter(propertyName = "height") public String getHeight_js() { - final boolean ie = getBrowserVersion().hasFeature(JS_IFRAME_GET_HEIGHT_NEGATIVE_VALUES); - final Boolean returnNegativeValues = ie ? Boolean.TRUE : null; - return getWidthOrHeight("height", returnNegativeValues); + return getWidthOrHeight("height", Boolean.TRUE); } /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement2Test.java 2014-01-22 18:30:55 UTC (rev 9033) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement2Test.java 2014-01-22 19:26:39 UTC (rev 9034) @@ -265,7 +265,6 @@ */ @Test @Alerts({ "createIFrame", "loaded" }) - @NotYetImplemented public void documentCreateElement_iFrameInsideDiv() throws Exception { final String html = "<html>\n" Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement3Test.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement3Test.java 2014-01-22 19:26:39 UTC (rev 9034) @@ -0,0 +1,538 @@ +/* + * 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.host.html; + +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; + +import java.net.URL; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.MockWebConnection; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; + +/** + * Tests for {@link HTMLIFrameElement}. + * + * @version $Revision$ + * @author Marc Guillemot + * @author Ahmed Ashour + * @author Daniel Gredler + * @author Ronald Brill + * @author Frank Danek + */ +@RunWith(BrowserRunner.class) +public class HTMLIFrameElement3Test extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("false") + public void style() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + "function doTest() {\n" + + " alert(document.getElementById('myIFrame').style == undefined);\n" + + "}\n</script></head>\n" + + "<body onload='doTest()'>\n" + + "<iframe id='myIFrame' src='about:blank'></iframe></body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({ "1", "myIFrame" }) + public void referenceFromJavaScript() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + "function doTest() {\n" + + " alert(window.frames.length);\n" + + " alert(window.frames['myIFrame'].name);\n" + + "}\n</script></head>\n" + + "<body onload='doTest()'>\n" + + "<iframe name='myIFrame' src='about:blank'></iframe></body></html>"; + loadPageWithAlerts2(html); + } + + /** + * Regression test for bug 1562872. + * @throws Exception if the test fails + */ + @Test + @Alerts({ "about:blank", "about:blank" }) + public void directAccessPerName() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + "function doTest() {\n" + + " alert(myIFrame.location);\n" + + " alert(Frame.location);\n" + + "}\n</script></head>\n" + + "<body onload='doTest()'>\n" + + "<iframe name='myIFrame' src='about:blank'></iframe>\n" + + "<iframe name='Frame' src='about:blank'></iframe>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * Tests that the <tt><iframe></tt> node is visible from the contained page when it is loaded. + * @throws Exception if the test fails + */ + @Test + @Alerts("IFRAME") + public void onLoadGetsIFrameElementByIdInParent() throws Exception { + final String firstContent + = "<html><head><title>First</title></head>\n" + + "<body>\n" + + "<iframe id='myIFrame' src='frame.html'></iframe></body></html>"; + + final String frameContent + = "<html><head><title>Frame</title><script>\n" + + "function doTest() {\n" + + " alert(parent.document.getElementById('myIFrame').tagName);\n" + + "}\n</script></head>\n" + + "<body onload='doTest()'>\n" + + "</body></html>"; + + final MockWebConnection webConnection = getMockWebConnection(); + + webConnection.setDefaultResponse(frameContent); + webConnection.setResponse(URL_FIRST, firstContent); + + loadPageWithAlerts2(firstContent); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(FF) + @Alerts(FF = "true") + public void contentDocument() throws Exception { + final String html + = "<html><head><title>first</title>\n" + + "<script>\n" + + "function test() {\n" + + " alert(document.getElementById('myFrame').contentDocument == frames.foo.document);\n" + + "}\n" + + "</script></head>\n" + + "<body onload='test()'>\n" + + "<iframe name='foo' id='myFrame' src='about:blank'></iframe>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("true") + public void frameElement() throws Exception { + final String html + = "<html><head><title>first</title>\n" + + "<script>\n" + + "function test() {\n" + + " alert(document.getElementById('myFrame') == frames.foo.frameElement);\n" + + "}\n" + + "</script></head>\n" + + "<body onload='test()'>\n" + + "<iframe name='foo' id='myFrame' src='about:blank'></iframe>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * Verifies that writing to an iframe keeps the same intrinsic variables around (window, + * document, etc) and in a usable form. Bug detected via the jQuery 1.1.3.1 unit tests. + * + * @throws Exception if an error occurs + */ + @Test + @Alerts({ "false", "false", "true", "true", "true", "object", "object" }) + public void writeToIFrame() throws Exception { + final String html = + "<html><body onload='test()'><script>\n" + + " function test() {\n" + + " \n" + + " var frame = document.createElement('iframe');\n" + + " document.body.appendChild(frame);\n" + + " var win = frame.contentWindow;\n" + + " var doc = frame.contentWindow.document;\n" + + " alert(win == window);\n" + + " alert(doc == document);\n" + + " \n" + + " doc.open();\n" + + " doc.write(\"<html><body><input type='text'/></body></html>\");\n" + + " doc.close();\n" + + " var win2 = frame.contentWindow;\n" + + " var doc2 = frame.contentWindow.document;\n" + + " alert(win == win2);\n" + + " alert(doc == doc2);\n" + + " \n" + + " var input = doc.getElementsByTagName('input')[0];\n" + + " var input2 = doc2.getElementsByTagName('input')[0];\n" + + " alert(input == input2);\n" + + " alert(typeof input);\n" + + " alert(typeof input2);\n" + + " }\n" + + "</script></body></html>"; + loadPageWithAlerts2(html); + } + + /** + * Verifies that writing to an iframe keeps the same intrinsic variables around (window, + * document, etc) and in a usable form. Bug detected via the jQuery 1.1.3.1 unit tests. + * + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "123", "undefined" }, + IE11 = { "123" }) + public void iFrameReinitialized() throws Exception { + final String html = + "<html><body><a id='test' href='2.html' target='theFrame'>page 2 in frame</a>\n" + + "<iframe name='theFrame' src='1.html'></iframe>\n" + + "</body></html>"; + + final String frame1 = "<html><head><script>window.foo = 123; alert(window.foo);</script></head></html>"; + final String frame2 = "<html><head><script>alert(window.foo);</script></head></html>"; + + final MockWebConnection webConnection = getMockWebConnection(); + + webConnection.setResponse(URL_FIRST, html); + webConnection.setResponse(new URL(URL_FIRST, "1.html"), frame1); + webConnection.setResponse(new URL(URL_FIRST, "2.html"), frame2); + + final WebDriver driver = loadPage2(html); + + driver.findElement(By.id("test")).click(); + + assertEquals(getExpectedAlerts(), getCollectedAlerts(driver)); + assertEquals(3, getMockWebConnection().getRequestCount()); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("about:blank") + public void setSrc_JavascriptUrl() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + " function test() {\n" + + " document.getElementById('iframe1').src = 'javascript:void(0)';\n" + + " alert(window.frames[0].location);\n" + + " }\n" + + "</script></head>\n" + + "<body onload='test()'>\n" + + "<iframe id='iframe1'></iframe>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(FF = {"", "100", "foo", "20%", "-5", "30.2", "400", "abc", "-5", "100.2", "10%", "300" }, + IE = {"", "100", "", "20%", "-5", "30", "error", "400", "100", "-5", "100", "10%", "300" }) + @NotYetImplemented(FF) + public void width() throws Exception { + final String html + = "<html><body>\n" + + "<iframe id='i1'></iframe>\n" + + "<iframe id='i2' width='100'></iframe>\n" + + "<iframe id='i3' width='foo'></iframe>\n" + + "<iframe id='i4' width='20%'></iframe>\n" + + "<iframe id='i5' width='-5'></iframe>\n" + + "<iframe id='i6' width='30.2'></iframe>\n" + + "<script>\n" + + "function set(e, value) {\n" + + " try {\n" + + " e.width = value;\n" + + " } catch (e) {\n" + + " alert('error');\n" + + " }\n" + + "}\n" + + "var i1 = document.getElementById('i1');\n" + + "var i2 = document.getElementById('i2');\n" + + "var i3 = document.getElementById('i3');\n" + + "var i4 = document.getElementById('i4');\n" + + "var i5 = document.getElementById('i5');\n" + + "var i6 = document.getElementById('i6');\n" + + "alert(i1.width);\n" + + "alert(i2.width);\n" + + "alert(i3.width);\n" + + "alert(i4.width);\n" + + "alert(i5.width);\n" + + "alert(i6.width);\n" + + "set(i1, '400');\n" + + "set(i2, 'abc');\n" + + "set(i3, -5);\n" + + "set(i4, 100.2);\n" + + "set(i5, '10%');\n" + + "set(i6, 300);\n" + + "alert(i1.width);\n" + + "alert(i2.width);\n" + + "alert(i3.width);\n" + + "alert(i4.width);\n" + + "alert(i5.width);\n" + + "alert(i6.width);\n" + + "</script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(FF = {"", "100", "foo", "20%", "-5", "30.2", "400", "abc", "-5", "100.2", "10%", "300" }, + IE = {"", "100", "", "20%", "-5", "30", "error", "400", "100", "-5", "100", "10%", "300" }) + @NotYetImplemented(FF) + public void height() throws Exception { + final String html + = "<html><body>\n" + + "<iframe id='i1'></iframe>\n" + + "<iframe id='i2' height='100'></iframe>\n" + + "<iframe id='i3' height='foo'></iframe>\n" + + "<iframe id='i4' height='20%'></iframe>\n" + + "<iframe id='i5' height='-5'></iframe>\n" + + "<iframe id='i6' height='30.2'></iframe>\n" + + "<script>\n" + + "function set(e, value) {\n" + + " try {\n" + + " e.height = value;\n" + + " } catch (e) {\n" + + " alert('error');\n" + + " }\n" + + "}\n" + + "var i1 = document.getElementById('i1');\n" + + "var i2 = document.getElementById('i2');\n" + + "var i3 = document.getElementById('i3');\n" + + "var i4 = document.getElementById('i4');\n" + + "var i5 = document.getElementById('i5');\n" + + "var i6 = document.getElementById('i6');\n" + + "alert(i1.height);\n" + + "alert(i2.height);\n" + + "alert(i3.height);\n" + + "alert(i4.height);\n" + + "alert(i5.height);\n" + + "alert(i6.height);\n" + + "set(i1, '400');\n" + + "set(i2, 'abc');\n" + + "set(i3, -5);\n" + + "set(i4, 100.2);\n" + + "set(i5, '10%');\n" + + "set(i6, 300);\n" + + "alert(i1.height);\n" + + "alert(i2.height);\n" + + "alert(i3.height);\n" + + "alert(i4.height);\n" + + "alert(i5.height);\n" + + "alert(i6.height);\n" + + "</script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * Test the ReadyState which is an IE feature. + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "uninitialized", "complete" }, + IE = { "loading", "complete" }) + @NotYetImplemented(FF) + public void readyState_IFrame() throws Exception { + final String html = "<html><head></head>\n" + + " <body>\n" + + " <iframe id='i'></iframe>\n" + + " <script>\n" + + " alert(document.getElementById('i').contentWindow.document.readyState);\n" + + " window.onload = function() {\n" + + " alert(document.getElementById('i').contentWindow.document.readyState);\n" + + " };\n" + + " </script>\n" + + " </body>\n" + + "</html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "null", "[object HTMLBodyElement]" }, + IE8 = { "null", "[object]" }) + public void body() throws Exception { + final String html = + "<html><body>\n" + + "<iframe name='theFrame' src='1.html'></iframe>\n" + + "</body></html>"; + + final String frame = "<html><head><script>alert(document.body);</script></head>\n" + + "<body><script>alert(document.body);</script></html>"; + + final MockWebConnection webConnection = getMockWebConnection(); + + webConnection.setResponse(URL_FIRST, html); + webConnection.setDefaultResponse(frame); + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = "128px", + IE = "128") + @NotYetImplemented(FF) + public void width_px() throws Exception { + final String html + = "<html><head>" + + "<script>\n" + + " function test() {\n" + + " var iframe = document.getElementById('myFrame');\n" + + " iframe.width = '128px';\n" + + " alert(iframe.width);\n" + + " }\n" + + "</script>\n" + + "<body onload='test()'>\n" + + " <iframe id='myFrame'></iframe>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * IE: getElementById() returns a different object than with direct 'id' variable. + * @throws Exception if an error occurs + */ + @Test + @Alerts(IE = { "[object]", "[object]", "undefined", "" }, + FF = { "[object HTMLIFrameElement]", "[object HTMLIFrameElement]", "", "" }, + IE11 = { "[object Window]", "[object HTMLIFrameElement]", "undefined", "" }) + @NotYetImplemented(IE) + public void idByName() throws Exception { + final String html + = "<html><head>" + + "<script>\n" + + " function test() {\n" + + " alert(myFrame);\n" + + " alert(document.getElementById('myFrame'));\n" + + " alert(myFrame.width);\n" + + " alert(document.getElementById('myFrame').width);\n" + + " }\n" + + "</script>\n" + + "<body onload='test()'>\n" + + " <iframe id='myFrame'></iframe>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * Regression test for bug 2940926. + * @throws Exception if an error occurs + */ + @Test + @Alerts("foo") + public void settingInnerHtmlTriggersFrameLoad() throws Exception { + final String html + = "<html><body><div id='d' onclick='loadFrame()'>Click me to show frame</div><script>\n" + + "function loadFrame() {\n" + + " var s = '<iframe id=\"i\" src=\"frame.html\">';\n" + + " s += '<p>Your browser does not support frames</p>';\n" + + " s += '</iframe>';\n" + + " var d = document.getElementById('d');\n" + + " d.innerHTML = s;\n" + + "}\n" + + "</script></body></html>"; + final String html2 = "<html><body>foo</body></html>"; + + final MockWebConnection conn = getMockWebConnection(); + conn.setResponse(URL_FIRST, html); + conn.setResponse(new URL(URL_FIRST, "frame.html"), html2); + + final WebDriver driver = loadPage2(html); + + driver.findElement(By.id("d")).click(); + + driver.switchTo().frame("i"); + final String content = driver.findElement(By.xpath("//html/body")).getText(); + assertEquals(getExpectedAlerts()[0], content); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("something") + public void window() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + "function test() {\n" + + " var iframe = document.getElementById('myIFrame');\n" + + " iframe.contentWindow.contents = 'something';\n" + + " iframe.src = 'javascript:window[\\'contents\\']';\n" + + "}\n</script></head>\n" + + "<body onload='test()'>\n" + + "<iframe id='myIFrame' src='about:blank'></iframe></body></html>"; + + final WebDriver driver = loadPage2(html); + + driver.switchTo().frame(0); + final String content = driver.findElement(By.xpath("//html/body")).getText(); + assertEquals(getExpectedAlerts()[0], content); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("something") + public void settingSrc() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + "function test() {\n" + + " var iframe = document.createElement('iframe');\n" + + " var content = 'something';\n" + + " iframe.src = 'about:blank';\n" + + " document.body.appendChild(iframe);\n" + + " iframe.contentWindow.document.open('text/html', 'replace');\n" + + " iframe.contentWindow.document.write(content);\n" + + " iframe.contentWindow.document.close();\n" + + "}\n</script></head>\n" + + "<body onload='test()'></body></html>"; + + final WebDriver driver = loadPage2(html); + + driver.switchTo().frame(0); + final String content = driver.findElement(By.xpath("//html/body")).getText(); + assertEquals(getExpectedAlerts()[0], content); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement3Test.java ___________________________________________________________________ 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 Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElementTest.java 2014-01-22 18:30:55 UTC (rev 9033) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElementTest.java 2014-01-22 19:26:39 UTC (rev 9034) @@ -14,21 +14,12 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; -import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; -import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; - -import java.net.URL; -import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import com.gargoylesoftware.htmlunit.BrowserRunner; -import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; -import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; -import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; -import com.gargoylesoftware.htmlunit.CollectingAlertHandler; import com.gargoylesoftware.htmlunit.MockWebConnection; import com.gargoylesoftware.htmlunit.SimpleWebTestCase; import com.gargoylesoftware.htmlunit.WebClient; @@ -54,203 +45,6 @@ * @throws Exception if the test fails */ @Test - @Alerts("false") - public void style() throws Exception { - final String html - = "<html><head><title>First</title><script>\n" - + "function doTest() {\n" - + " alert(document.getElementById('myIFrame').style == undefined);\n" - + "}\n</script></head>\n" - + "<body onload='doTest()'>\n" - + "<iframe id='myIFrame' src='about:blank'></iframe></body></html>"; - loadPageWithAlerts(html); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts({ "1", "myIFrame" }) - public void referenceFromJavaScript() throws Exception { - final String html - = "<html><head><title>First</title><script>\n" - + "function doTest() {\n" - + " alert(window.frames.length);\n" - + " alert(window.frames['myIFrame'].name);\n" - + "}\n</script></head>\n" - + "<body onload='doTest()'>\n" - + "<iframe name='myIFrame' src='about:blank'></iframe></body></html>"; - loadPageWithAlerts(html); - } - - /** - * Regression test for bug 1562872. - * @throws Exception if the test fails - */ - @Test - @Alerts({ "about:blank", "about:blank" }) - public void directAccessPerName() throws Exception { - final String html - = "<html><head><title>First</title><script>\n" - + "function doTest() {\n" - + " alert(myIFrame.location);\n" - + " alert(Frame.location);\n" - + "}\n</script></head>\n" - + "<body onload='doTest()'>\n" - + "<iframe name='myIFrame' src='about:blank'></iframe>\n" - + "<iframe name='Frame' src='about:blank'></iframe>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** - * Tests that the <tt><iframe></tt> node is visible from the contained page when it is loaded. - * @throws Exception if the test fails - */ - @Test - @Alerts("IFRAME") - public void onLoadGetsIFrameElementByIdInParent() throws Exception { - final String firstContent - = "<html><head><title>First</title></head>\n" - + "<body>\n" - + "<iframe id='myIFrame' src='frame.html'></iframe></body></html>"; - - final String frameContent - = "<html><head><title>Frame</title><script>\n" - + "function doTest() {\n" - + " alert(parent.document.getElementById('myIFrame').tagName);\n" - + "}\n</script></head>\n" - + "<body onload='doTest()'>\n" - + "</body></html>"; - - final WebClient webClient = getWebClient(); - final MockWebConnection webConnection = getMockWebConnection(); - - webConnection.setDefaultResponse(frameContent); - webConnection.setResponse(URL_FIRST, firstContent); - webClient.setWebConnection(webConnection); - - final List<String> collectedAlerts = new ArrayList<String>(); - webClient.setAlertHandler(new CollectingAlertHandler(collectedAlerts)); - - webClient.getPage(URL_FIRST); - assertEquals(getExpectedAlerts(), collectedAlerts); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Browsers(FF) - @Alerts(FF = "true") - public void contentDocument() throws Exception { - final String html - = "<html><head><title>first</title>\n" - + "<script>\n" - + "function test() {\n" - + " alert(document.getElementById('myFrame').contentDocument == frames.foo.document);\n" - + "}\n" - + "</script></head>\n" - + "<body onload='test()'>\n" - + "<iframe name='foo' id='myFrame' src='about:blank'></iframe>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("true") - public void frameElement() throws Exception { - final String html - = "<html><head><title>first</title>\n" - + "<script>\n" - + "function test() {\n" - + " alert(document.getElementById('myFrame') == frames.foo.frameElement);\n" - + "}\n" - + "</script></head>\n" - + "<body onload='test()'>\n" - + "<iframe name='foo' id='myFrame' src='about:blank'></iframe>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** - * Verifies that writing to an iframe keeps the same intrinsic variables around (window, - * document, etc) and in a usable form. Bug detected via the jQuery 1.1.3.1 unit tests. - * - * @throws Exception if an error occurs - */ - @Test - @Alerts({ "false", "false", "true", "true", "true", "object", "object" }) - public void writeToIFrame() throws Exception { - final String html = - "<html><body onload='test()'><script>\n" - + " function test() {\n" - + " \n" - + " var frame = document.createElement('iframe');\n" - + " document.body.appendChild(frame);\n" - + " var win = frame.contentWindow;\n" - + " var doc = frame.contentWindow.document;\n" - + " alert(win == window);\n" - + " alert(doc == document);\n" - + " \n" - + " doc.open();\n" - + " doc.write(\"<html><body><input type='text'/></body></html>\");\n" - + " doc.close();\n" - + " var win2 = frame.contentWindow;\n" - + " var doc2 = frame.contentWindow.document;\n" - + " alert(win == win2);\n" - + " alert(doc == doc2);\n" - + " \n" - + " var input = doc.getElementsByTagName('input')[0];\n" - + " var input2 = doc2.getElementsByTagName('input')[0];\n" - + " alert(input == input2);\n" - + " alert(typeof input);\n" - + " alert(typeof input2);\n" - + " }\n" - + "</script></body></html>"; - loadPageWithAlerts(html); - } - - /** - * Verifies that writing to an iframe keeps the same intrinsic variables around (window, - * document, etc) and in a usable form. Bug detected via the jQuery 1.1.3.1 unit tests. - * - * @throws Exception if an error occurs - */ - @Test - @Alerts({ "123", "undefined" }) - public void iFrameReinitialized() throws Exception { - final String html = - "<html><body><a href='2.html' target='theFrame'>page 2 in frame</a>\n" - + "<iframe name='theFrame' src='1.html'></iframe>\n" - + "</body></html>"; - - final String frame1 = "<html><head><script>window.foo = 123; alert(window.foo);</script></head></html>"; - final String frame2 = "<html><head><script>alert(window.foo);</script></head></html>"; - - final WebClient webClient = getWebClient(); - final MockWebConnection webConnection = getMockWebConnection(); - - webConnection.setResponse(URL_FIRST, html); - webConnection.setResponse(new URL(URL_FIRST, "1.html"), frame1); - webConnection.setResponse(new URL(URL_FIRST, "2.html"), frame2); - webClient.setWebConnection(webConnection); - - final List<String> collectedAlerts = new ArrayList<String>(); - webClient.setAlertHandler(new CollectingAlertHandler(collectedAlerts)); - - final HtmlPage page = webClient.getPage(URL_FIRST); - page.getAnchors().get(0).click(); - assertEquals(getExpectedAlerts(), collectedAlerts); - } - - /** - * @throws Exception if the test fails - */ - @Test public void setSrcAttribute() throws Exception { final String firstContent = "<html><head><title>First</title><script>\n" @@ -286,25 +80,6 @@ } /** - * @throws Exception if the test fails - */ - @Test - @Alerts("about:blank") - public void setSrc_JavascriptUrl() throws Exception { - final String html - = "<html><head><title>First</title><script>\n" - + " function test() {\n" - + " document.getElementById('iframe1').src = 'javascript:void(0)';\n" - + " alert(window.frames[0].location);\n" - + " }\n" - + "</script></head>\n" - + "<body onload='test()'>\n" - + "<iframe id='iframe1'></iframe>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** * Verify that an iframe.src with a "javascript:..." URL loaded by a client with JavaScript * disabled does not cause a NullPointerException (reported on the mailing list). * @throws Exception if an error occurs @@ -324,282 +99,9 @@ } /** - * @throws Exception if an error occurs - */ - @Test - @Alerts(FF = {"", "100", "foo", "20%", "0", "30", "400", "abc", "0", "100", "10%", "300" }, - IE = {"", "100", "", "20%", "-5", "30", "error", "400", "100", "-5", "100", "10%", "300" }) - public void width() throws Exception { - final String html - = "<html><body>\n" - + "<iframe id='i1'></iframe>\n" - + "<iframe id='i2' width='100'></iframe>\n" - + "<iframe id='i3' width='foo'></iframe>\n" - + "<iframe id='i4' width='20%'></iframe>\n" - + "<iframe id='i5' width='-5'></iframe>\n" - + "<iframe id='i6' width='30.2'></iframe>\n" - + "<script>\n" - + "function set(e, value) {\n" - + " try {\n" - + " e.width = value;\n" - + " } catch (e) {\n" - + " alert('error');\n" - + " }\n" - + "}\n" - + "var i1 = document.getElementById('i1');\n" - + "var i2 = document.getElementById('i2');\n" - + "var i3 = document.getElementById('i3');\n" - + "var i4 = document.getElementById('i4');\n" - + "var i5 = document.getElementById('i5');\n" - + "var i6 = document.getElementById('i6');\n" - + "alert(i1.width);\n" - + "alert(i2.width);\n" - + "alert(i3.width);\n" - + "alert(i4.width);\n" - + "alert(i5.width);\n" - + "alert(i6.width);\n" - + "set(i1, '400');\n" - + "set(i2, 'abc');\n" - + "set(i3, -5);\n" - + "set(i4, 100.2);\n" - + "set(i5, '10%');\n" - + "set(i6, 300);\n" - + "alert(i1.width);\n" - + "alert(i2.width);\n" - + "alert(i3.width);\n" - + "alert(i4.width);\n" - + "alert(i5.width);\n" - + "alert(i6.width);\n" - + "</script>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** - * @throws Exception if an error occurs - */ - @Test - @Alerts(FF = {"", "100", "foo", "20%", "0", "30", "400", "abc", "0", "100", "10%", "300" }, - IE = {"", "100", "", "20%", "-5", "30", "error", "400", "100", "-5", "100", "10%", "300" }) - public void height() throws Exception { - final String html - = "<html><body>\n" - + "<iframe id='i1'></iframe>\n" - + "<iframe id='i2' height='100'></iframe>\n" - + "<iframe id='i3' height='foo'></iframe>\n" - + "<iframe id='i4' height='20%'></iframe>\n" - + "<iframe id='i5' height='-5'></iframe>\n" - + "<iframe id='i6' height='30.2'></iframe>\n" - + "<script>\n" - + "function set(e, value) {\n" - + " try {\n" - + " e.height = value;\n" - + " } catch (e) {\n" - + " alert('error');\n" - + " }\n" - + "}\n" - + "var i1 = document.getElementById('i1');\n" - + "var i2 = document.getElementById('i2');\n" - + "var i3 = document.getElementById('i3');\n" - + "var i4 = document.getElementById('i4');\n" - + "var i5 = document.getElementById('i5');\n" - + "var i6 = document.getElementById('i6');\n" - + "alert(i1.height);\n" - + "alert(i2.height);\n" - + "alert(i3.height);\n" - + "alert(i4.height);\n" - + "alert(i5.height);\n" - + "alert(i6.height);\n" - + "set(i1, '400');\n" - + "set(i2, 'abc');\n" - + "set(i3, -5);\n" - + "set(i4, 100.2);\n" - + "set(i5, '10%');\n" - + "set(i6, 300);\n" - + "alert(i1.height);\n" - + "alert(i2.height);\n" - + "alert(i3.height);\n" - + "alert(i4.height);\n" - + "alert(i5.height);\n" - + "alert(i6.height);\n" - + "</script>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** - * Test the ReadyState which is an IE feature. * @throws Exception if the test fails */ @Test - @Alerts({ "loading", "complete" }) - public void readyState_IFrame() throws Exception { - final String html = "<html><head></head>\n" - + " <body>\n" - + " <iframe id='i'></iframe>\n" - + " <script>\n" - + " alert(document.getElementById('i').contentWindow.document.readyState);\n" - + " window.onload = function() {\n" - + " alert(document.getElementById('i').contentWindow.document.readyState);\n" - + " };\n" - + " </script>\n" - + " </body>\n" - + "</html>"; - - loadPageWithAlerts(html); - } - - /** - * @throws Exception if an error occurs - */ - @Test - @Alerts(FF = { "null", "[object HTMLBodyElement]" }, - IE = { "null", "[object]" }) - public void body() throws Exception { - final String html = - "<html><body>\n" - + "<iframe name='theFrame' src='1.html'></iframe>\n" - + "</body></html>"; - - final String frame = "<html><head><script>alert(document.body);</script></head>\n" - + "<body><script>alert(document.body);</script></html>"; - - final WebClient webClient = getWebClient(); - final MockWebConnection webConnection = getMockWebConnection(); - - webConnection.setResponse(URL_FIRST, html); - webConnection.setDefaultResponse(frame); - webClient.setWebConnection(webConnection); - - final List<String> collectedAlerts = new ArrayList<String>(); - webClient.setAlertHandler(new CollectingAlertHandler(collectedAlerts)); - - webClient.getPage(URL_FIRST); - assertEquals(getExpectedAlerts(), collectedAlerts); - } - - /** - * @throws Exception if an error occurs - */ - @Test - @Alerts("128") - public void width_px() throws Exception { - final String html - = "<html><head>" - + "<script>\n" - + " function test() {\n" - + " var iframe = document.getElementById('myFrame');\n" - + " iframe.width = '128px';\n" - + " alert(iframe.width);\n" - + " }\n" - + "</script>\n" - + "<body onload='test()'>\n" - + " <iframe id='myFrame'></iframe>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** - * IE: getElementById() returns a different object than with direct 'id' variable. - * @throws Exception if an error occurs - */ - @Test - @Alerts(IE = { "[object]", "[object]", "undefined", "" }, - FF = { "[object HTMLIFrameElement]", "[object HTMLIFrameElement]", "", "" }) - @NotYetImplemented(IE) - public void idByName() throws Exception { - final String html - = "<html><head>" - + "<script>\n" - + " function test() {\n" - + " alert(myFrame);\n" - + " alert(document.getElementById('myFrame'));\n" - + " alert(myFrame.width);\n" - + " alert(document.getElementById('myFrame').width);\n" - + " }\n" - + "</script>\n" - + "<body onload='test()'>\n" - + " <iframe id='myFrame'></iframe>\n" - + "</body></html>"; - loadPageWithAlerts(html); - } - - /** - * Regression test for bug 2940926. - * @throws Exception if an error occurs - */ - @Test - public void settingInnerHtmlTriggersFrameLoad() throws Exception { - final String html - = "<html><body><div id='d' onclick='loadFrame()'>Click me to show frame</div><script>\n" - + "function loadFrame() {\n" - + " var s = '<iframe id=\"i\" src=\"frame.html\">';\n" - + " s += '<p>Your browser does not support frames</p>';\n" - + " s += '</iframe>';\n" - + " var d = document.getElementById('d');\n" - + " d.innerHTML = s;\n" - + "}\n" - + "</script></body></html>"; - final String html2 = "<html><body>foo</body></html>"; - - final MockWebConnection conn = getMockWebConnection(); - conn.setResponse(URL_FIRST, html); - conn.setResponse(new URL(URL_FIRST, "frame.html"), html2); - - final WebClient client = getWebClient(); - client.setWebConnection(conn); - - final HtmlPage page = client.getPage(URL_FIRST); - page.getHtmlElementById("d").click(); - - final HtmlInlineFrame frame = (HtmlInlineFrame) page.getElementById("i"); - final HtmlPage framePage = (HtmlPage) frame.getEnclosedPage(); - assertEquals("foo", framePage.getBody().asText()); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void window() throws Exception { - final String html - = "<html><head><title>First</title><script>\n" - + "function test() {\n" - + " var iframe = document.getElementById('myIFrame');\n" - + " iframe.contentWindow.contents = 'something';\n" - + " iframe.src = 'javascript:window[\\'contents\\']';\n" - + "}\n</script></head>\n" - + "<body onload='test()'>\n" - + "<iframe id='myIFrame' src='about:blank'></iframe></body></html>"; - final HtmlPage page = loadPageWithAlerts(html); - assertFalse(((HtmlPage) page.getFrames().get(0).getEnclosedPage()).asText().isEmpty()); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void settingSrc() throws Exception { - final String html - = "<html><head><title>First</title><script>\n" - + "function test() {\n" - + " var iframe = document.createElement('iframe');\n" - + " var content = 'something';\n" - + " iframe.src = 'about:blank';\n" - + " document.body.appendChild(iframe);\n" - + " iframe.contentWindow.document.open('text/html', 'replace');\n" - + " iframe.contentWindow.document.write(content);\n" - + " iframe.contentWindow.document.close();\n" - + "}\n</script></head>\n" - + "<body onload='test()'></body></html>"; - final HtmlPage page = loadPageWithAlerts(html); - assertFalse(((HtmlPage) page.getFrames().get(0).getEnclosedPage()).asText().isEmpty()); - } - - /** - * @throws Exception if the test fails - */ - @Test public void testRemoveFrameWindow() throws Exception { final String index = "<html><head></head><body>" + "<div id='content'>" |
From: <asa...@us...> - 2014-01-23 01:19:51
|
Revision: 9037 http://sourceforge.net/p/htmlunit/code/9037 Author: asashour Date: 2014-01-23 01:19:49 +0000 (Thu, 23 Jan 2014) Log Message: ----------- Test new HttpWebConnection Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.java 2014-01-23 01:19:49 UTC (rev 9037) @@ -0,0 +1,239 @@ +/* + * 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; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.SocketTimeoutException; +import java.security.GeneralSecurityException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.http.HttpHost; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLContexts; +import org.apache.http.conn.ssl.X509HostnameVerifier; +import org.apache.http.protocol.HttpContext; + +/** + * Socket factory offering facilities for insecure SSL and for SOCKS proxy support. + * This looks rather like a hack than like clean code but at the time of the writing it seems to + * be the easiest way to provide SOCKS proxy support for HTTPS. + * + * @version $Revision$ + * @author Nicolas Belisle + * @author Ahmed Ashour + * @author Martin Huber + * @author Marc Guillemot + * @author Ronald Brill + */ +final class HtmlUnitSSLConnectionSocketFactory extends SSLConnectionSocketFactory { + private static final String SSL3ONLY = "htmlunit.SSL3Only"; + + static boolean isUseSSL3Only(final HttpContext context) { + return "TRUE".equalsIgnoreCase((String) context.getAttribute(SSL3ONLY)); + } + + public static SSLConnectionSocketFactory buildSSLSocketFactory(final WebClientOptions options) { + try { + if (!options.isUseInsecureSSL()) { + if (options.getSSLClientCertificateUrl() == null) { + return new HtmlUnitSSLConnectionSocketFactory((KeyStore) null, null); // only SOCKS awareness + } + // SOCKS + keystore + return new HtmlUnitSSLConnectionSocketFactory(getKeyStore(options), options.getSSLClientCertificatePassword()); + } + + // we need insecure SSL + SOCKS awareness + final SSLContext sslContext = SSLContext.getInstance("SSL"); + sslContext.init(getKeyManagers(options), new TrustManager[]{new InsecureTrustManager2()}, null); + + final SSLConnectionSocketFactory factory = new HtmlUnitSSLConnectionSocketFactory(sslContext, + SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + return factory; + } + catch (final GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private HtmlUnitSSLConnectionSocketFactory(final SSLContext sslContext, final X509HostnameVerifier hostnameVerifier) { + super(sslContext, hostnameVerifier); + } + + private HtmlUnitSSLConnectionSocketFactory(final KeyStore keystore, final String keystorePassword) + throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { + super(SSLContexts.custom() + .loadKeyMaterial(keystore, keystorePassword != null ? keystorePassword.toCharArray() : null) + .build(), + BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); + } + + /** + * {@inheritDoc} + */ + @Override + public Socket createSocket(final HttpContext context) throws IOException { + if (SocksSocketFactory.getSocksProxy(context) != null) { + // we create the socket in connectSocket has we need to know the destination to open the underlying request + return null; + } + final Socket socket = super.createSocket(context); + configureSocket((SSLSocket) socket, context); + return socket; + } + + private void configureSocket(final SSLSocket sslSocket, final HttpContext context) { + if (isUseSSL3Only(context)) { + sslSocket.setEnabledProtocols(new String[]{"SSLv3"}); + } + } + + public Socket connectSocket( + final int connectTimeout, + final Socket socket, + final HttpHost host, + final InetSocketAddress remoteAddress, + final InetSocketAddress localAddress, + final HttpContext context) throws IOException { + final HttpHost socksProxy = SocksSocketFactory.getSocksProxy(context); + if (socksProxy != null) { + final Socket underlying = SocksSocketFactory.createSocketWithSocksProxy(socksProxy); + underlying.setReuseAddress(true); + + // TODO: commented out for HttpClient 4.3 + // final int soTimeout = HttpConnectionParams.getSoTimeout(params); + + final SocketAddress socksProxyAddress = new InetSocketAddress(socksProxy.getHostName(), + socksProxy.getPort()); + try { + //underlying.setSoTimeout(soTimeout); + underlying.connect(remoteAddress, connectTimeout); + } + catch (final SocketTimeoutException ex) { + throw new ConnectTimeoutException("Connect to " + socksProxyAddress + " timed out"); + } + + final Socket sslSocket = getSSLSocketFactory().createSocket(underlying, socksProxy.getHostName(), + socksProxy.getPort(), true); + configureSocket((SSLSocket) sslSocket, context); + return sslSocket; + } + return super.connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, context); + } + + private javax.net.ssl.SSLSocketFactory getSSLSocketFactory() { + try { + final Field field = SSLConnectionSocketFactory.class.getDeclaredField("socketfactory"); + field.setAccessible(true); + return (javax.net.ssl.SSLSocketFactory) field.get(this); + } + catch (final Exception e) { + throw new RuntimeException(e); + } + } + + private static KeyManager[] getKeyManagers(final WebClientOptions options) { + if (options.getSSLClientCertificateUrl() == null) { + return null; + } + try { + final String password = options.getSSLClientCertificatePassword(); + final char[] passwordChars = password != null ? password.toCharArray() : null; + + final KeyStore keyStore = getKeyStore(options); + final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); + keyManagerFactory.init(keyStore, passwordChars); + return keyManagerFactory.getKeyManagers(); + } + catch (final Exception e) { + throw new RuntimeException(e); + } + } + + private static KeyStore getKeyStore(final WebClientOptions options) { + try { + final KeyStore keyStore = KeyStore.getInstance(options.getSSLClientCertificateType()); + final String password = options.getSSLClientCertificatePassword(); + final char[] passwordChars = password != null ? password.toCharArray() : null; + keyStore.load(options.getSSLClientCertificateUrl().openStream(), passwordChars); + return keyStore; + } + catch (final Exception e) { + throw new RuntimeException(e); + } + } +} + +/** + * A completely insecure (yet very easy to use) x509 trust manager. This manager trusts all servers + * and all clients, regardless of credentials or lack thereof. + * + * @version $Revision$ + * @author Daniel Gredler + * @author Marc Guillemot + */ +class InsecureTrustManager2 implements X509TrustManager { + private final Set<X509Certificate> acceptedIssuers_ = new HashSet<X509Certificate>(); + + /** + * {@inheritDoc} + */ + public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { + // Everyone is trusted! + acceptedIssuers_.addAll(Arrays.asList(chain)); + } + + /** + * {@inheritDoc} + */ + public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { + // Everyone is trusted! + acceptedIssuers_.addAll(Arrays.asList(chain)); + } + + /** + * {@inheritDoc} + */ + public X509Certificate[] getAcceptedIssuers() { + // it seems to be OK for Java <= 6 to return an empty array but not for Java 7 (at least 1.7.0_04-b20): + // requesting an URL with a valid certificate (working without WebClient.setUseInsecureSSL(true)) throws a + // javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated + // when the array returned here is empty + if (acceptedIssuers_.isEmpty()) { + return new X509Certificate[0]; + } + return acceptedIssuers_.toArray(new X509Certificate[acceptedIssuers_.size()]); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HtmlUnitSSLConnectionSocketFactory.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 Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-22 20:18:44 UTC (rev 9036) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-23 01:19:49 UTC (rev 9037) @@ -53,6 +53,8 @@ import org.apache.http.auth.Credentials; import org.apache.http.client.CookieStore; import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; @@ -62,41 +64,37 @@ import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.methods.HttpTrace; import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.client.params.ClientPNames; -import org.apache.http.client.params.HttpClientParams; +import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.client.utils.DateUtils; import org.apache.http.client.utils.URIUtils; import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.conn.params.ConnRoutePNames; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.cookie.ClientCookie; import org.apache.http.cookie.Cookie; import org.apache.http.cookie.CookieAttributeHandler; import org.apache.http.cookie.CookieOrigin; import org.apache.http.cookie.CookiePathComparator; import org.apache.http.cookie.CookieSpec; -import org.apache.http.cookie.CookieSpecFactory; +import org.apache.http.cookie.CookieSpecProvider; import org.apache.http.cookie.MalformedCookieException; import org.apache.http.cookie.SetCookie; -import org.apache.http.cookie.params.CookieSpecPNames; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.InputStreamBody; -import org.apache.http.impl.client.AbstractHttpClient; -import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.impl.conn.PoolingClientConnectionManager; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.cookie.BasicClientCookie; import org.apache.http.impl.cookie.BasicPathHandler; +import org.apache.http.impl.cookie.BestMatchSpecFactory; import org.apache.http.impl.cookie.BrowserCompatSpec; +import org.apache.http.impl.cookie.BrowserCompatSpecFactory; +import org.apache.http.impl.cookie.IgnoreSpecFactory; +import org.apache.http.impl.cookie.NetscapeDraftSpecFactory; +import org.apache.http.impl.cookie.RFC2109SpecFactory; +import org.apache.http.impl.cookie.RFC2965SpecFactory; import org.apache.http.message.BasicHeader; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.CoreConnectionPNames; -import org.apache.http.params.HttpParams; -import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import com.gargoylesoftware.htmlunit.util.KeyDataPair; @@ -105,6 +103,8 @@ /** * Default implementation of {@link WebConnection}, using the HttpClient library to perform HTTP requests. + * This is meant to use the new API in HttpClient 4.3, and should be renamed to HttpWebConnection, + * after the old code is removed. * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> @@ -120,13 +120,13 @@ public class HttpWebConnection implements WebConnection { private static final String HACKED_COOKIE_POLICY = "mine"; - private AbstractHttpClient httpClient_; + private HttpClientBuilder httpClientBuilder_; private final WebClient webClient_; /** Use single HttpContext, so there is no need to re-send authentication for each and every request. */ - private HttpContext httpContext_ = new BasicHttpContext(); + private HttpContext httpContext_ = new HttpClientContext(); private String virtualHost_; - private final CookieSpecFactory htmlUnitCookieSpecFactory_; + private final CookieSpecProvider htmlUnitCookieSpecProvider_; private final WebClientOptions usedOptions_ = new WebClientOptions(); /** @@ -135,8 +135,9 @@ */ public HttpWebConnection(final WebClient webClient) { webClient_ = webClient; - htmlUnitCookieSpecFactory_ = new CookieSpecFactory() { - public CookieSpec newInstance(final HttpParams params) { + htmlUnitCookieSpecProvider_ = new CookieSpecProvider() { + @Override + public CookieSpec create(final HttpContext context) { return new HtmlUnitBrowserCompatCookieSpec(webClient_.getIncorrectnessListener()); } }; @@ -147,7 +148,7 @@ */ public WebResponse getResponse(final WebRequest request) throws IOException { final URL url = request.getUrl(); - final AbstractHttpClient httpClient = getHttpClient(); + final HttpClientBuilder builder = reconfigureHttpClientIfNeeded(getHttpClientBuilder()); HttpUriRequest httpMethod = null; try { @@ -159,18 +160,19 @@ + " (reason: " + e.getMessage() + ")", e); } final HttpHost hostConfiguration = getHostConfiguration(request); - setProxy(httpMethod, request); +// setProxy(httpMethod, request); final long startTime = System.currentTimeMillis(); HttpResponse httpResponse = null; try { - httpResponse = httpClient.execute(hostConfiguration, httpMethod, httpContext_); + httpResponse = builder.build().execute(hostConfiguration, httpMethod, httpContext_); } catch (final SSLPeerUnverifiedException s) { // Try to use only SSLv3 instead if (webClient_.getOptions().isUseInsecureSSL()) { - HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); - httpResponse = httpClient.execute(hostConfiguration, httpMethod); + // TODO: asashour + // HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); + httpResponse = builder.build().execute(hostConfiguration, httpMethod); } else { throw s; @@ -182,7 +184,7 @@ // come out of connections and throw a ConnectionPoolTimeoutException. // => best solution, discard the HttpClient instance. synchronized (this) { - httpClient_ = null; + httpClientBuilder_ = null; } throw e; } @@ -218,17 +220,39 @@ return hostConfiguration; } - private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { +// private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { +// if (webRequest.getProxyHost() != null) { +// final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); +// final HttpParams httpRequestParams = httpUriRequest.getParams(); +// if (webRequest.isSocksProxy()) { +// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); +// } +// else { +// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); +// } +// } +// } + + private void setProxy(final HttpRequestBase httpRequest, final WebRequest webRequest) { + RequestConfig.Builder requestBuilder = createRequestConfig(); + configureTimeout(requestBuilder, webClient_.getOptions().getTimeout()); + if (webRequest.getProxyHost() != null) { final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); - final HttpParams httpRequestParams = httpUriRequest.getParams(); - if (webRequest.isSocksProxy()) { - SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); - } - else { - httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); - } + requestBuilder.setProxy(proxy); + httpRequest.setConfig(requestBuilder.build()); + +// if (webRequest.isSocksProxy()) { +// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); +// } +// else { +// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); +// } } + else { + requestBuilder.setProxy(null); + httpRequest.setConfig(requestBuilder.build()); + } } /** @@ -254,6 +278,7 @@ URI uri = URIUtils.createURI(url.getProtocol(), url.getHost(), url.getPort(), url.getPath(), escapeQuery(url.getQuery()), null); final HttpRequestBase httpMethod = buildHttpMethod(webRequest.getHttpMethod(), uri); + setProxy(httpMethod, webRequest); if (!(httpMethod instanceof HttpEntityEnclosingRequest)) { // this is the case for GET as well as TRACE, DELETE, OPTIONS and HEAD if (!webRequest.getRequestParameters().isEmpty()) { @@ -294,7 +319,8 @@ buildFilePart((KeyDataPair) pair, builder); } else { - builder.addTextBody(pair.getName(), pair.getValue()); + builder.addTextBody(pair.getName(), pair.getValue(), + ContentType.create("text/plain", webRequest.getCharset())); } } method.setEntity(builder.build()); @@ -325,10 +351,8 @@ writeRequestHeadersToHttpMethod(httpMethod, webRequest.getAdditionalHeaders()); // getHttpClient().getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, true); - final AbstractHttpClient httpClient = getHttpClient(); + final HttpClientBuilder httpClient = getHttpClientBuilder(); - reconfigureHttpClientIfNeeded(httpClient); - // Tell the client where to get its credentials from // (it may have changed on the webClient since last call to getHttpClientFor(...)) final CredentialsProvider credentialsProvider = webClient_.getCredentialsProvider(); @@ -341,6 +365,7 @@ final AuthScope authScope = new AuthScope(requestUrl.getHost(), requestUrl.getPort()); // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestUrlCredentials); + httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); } // if someone has set credentials to this request, we have to add this @@ -350,19 +375,22 @@ final AuthScope authScope = new AuthScope(requestUrl.getHost(), requestUrl.getPort()); // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestCredentials); + httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); } - httpClient.setCredentialsProvider(credentialsProvider); + httpContext_.removeAttribute(HttpClientContext.CREDS_PROVIDER); + httpClient.setDefaultCredentialsProvider(credentialsProvider); + httpContext_.removeAttribute(HttpClientContext.COOKIE_STORE); if (webClient_.getCookieManager().isCookiesEnabled()) { // Cookies are enabled. Note that it's important that we enable single cookie headers, // for compatibility purposes. - httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); - httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, HACKED_COOKIE_POLICY); - httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); + // TODO: asashour +// httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); + httpClient.setDefaultCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); } else { // Cookies are disabled. - httpClient.setCookieStore(new CookieStore() { + httpClient.setDefaultCookieStore(new CookieStore() { public void addCookie(final Cookie cookie) { /* empty */ } public void clear() { /* empty */ } public boolean clearExpired(final Date date) { @@ -501,16 +529,27 @@ * * @return the initialized HTTP client */ - protected synchronized AbstractHttpClient getHttpClient() { - if (httpClient_ == null) { - httpClient_ = createHttpClient(); + protected synchronized HttpClientBuilder getHttpClientBuilder() { + if (httpClientBuilder_ == null) { + httpClientBuilder_ = createHttpClient(); // this factory is required later // to be sure this is done, we do it outside the createHttpClient() call - httpClient_.getCookieSpecs().register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecFactory_); + final RegistryBuilder<CookieSpecProvider> registeryBuilder + = RegistryBuilder.<CookieSpecProvider>create() + .register(CookieSpecs.BEST_MATCH, new BestMatchSpecFactory()) + .register(CookieSpecs.STANDARD, new RFC2965SpecFactory()) + .register(CookieSpecs.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory()) + .register(CookieSpecs.NETSCAPE, new NetscapeDraftSpecFactory()) + .register(CookieSpecs.IGNORE_COOKIES, new IgnoreSpecFactory()) + .register("rfc2109", new RFC2109SpecFactory()) + .register("rfc2965", new RFC2965SpecFactory()); + + registeryBuilder.register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecProvider_); + httpClientBuilder_.setDefaultCookieSpecRegistry(registeryBuilder.build()); } - return httpClient_; + return httpClientBuilder_; } /** @@ -531,25 +570,40 @@ * some tracking; see feature request 1438216). * @return the <tt>HttpClient</tt> that will be used by this WebConnection */ - protected AbstractHttpClient createHttpClient() { - final HttpParams httpParams = new BasicHttpParams(); + protected HttpClientBuilder createHttpClient() { + // TODO: asashour +// final HttpParams httpParams = new BasicHttpParams(); +// +// HttpClientParams.setRedirecting(httpParams, false); +// // Set timeouts +// configureTimeout(httpParams, webClient_.getOptions().getTimeout()); +// +// final SchemeRegistry schemeRegistry = new SchemeRegistry(); +// schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); +// configureHttpsScheme(schemeRegistry); +// +// final PoolingClientConnectionManager connectionManager = +// new PoolingClientConnectionManager(schemeRegistry); +// connectionManager.setDefaultMaxPerRoute(6); +// +// final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); +// httpClient.setCookieStore(new HtmlUnitCookieStore2(webClient_.getCookieManager())); +// +// httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { +// @Override +// public boolean isRedirected(final HttpRequest request, final HttpResponse response, +// final HttpContext context) throws ProtocolException { +// return super.isRedirected(request, response, context) +// && response.getFirstHeader("location") != null; +// } +// }); +// +// if (getVirtualHost() != null) { +// httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); +// } - HttpClientParams.setRedirecting(httpParams, false); - // Set timeouts - configureTimeout(httpParams, webClient_.getOptions().getTimeout()); - - final SchemeRegistry schemeRegistry = new SchemeRegistry(); - schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); - configureHttpsScheme(schemeRegistry); - - final PoolingClientConnectionManager connectionManager = - new PoolingClientConnectionManager(schemeRegistry); - connectionManager.setDefaultMaxPerRoute(6); - - final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); - httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); - - httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { + final HttpClientBuilder builder = HttpClientBuilder.create(); + builder.setRedirectStrategy(new DefaultRedirectStrategy() { @Override public boolean isRedirected(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { @@ -557,45 +611,57 @@ && response.getFirstHeader("location") != null; } }); + configureTimeout(builder, webClient_.getOptions().getTimeout()); + return builder; + } - if (getVirtualHost() != null) { - httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); - } + private void configureTimeout(final HttpClientBuilder builder, final int timeout) { + RequestConfig.Builder requestBuilder = createRequestConfig(); + configureTimeout(requestBuilder, timeout); - return httpClient; + builder.setDefaultRequestConfig(requestBuilder.build()); + httpContext_.removeAttribute(HttpClientContext.REQUEST_CONFIG); + usedOptions_.setTimeout(timeout); } - private void configureTimeout(final HttpParams httpParams, final int timeout) { - httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, timeout); - httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout); + private RequestConfig.Builder createRequestConfig() { + RequestConfig.Builder requestBuilder = RequestConfig.custom() + .setCookieSpec(HACKED_COOKIE_POLICY) + .setRedirectsEnabled(false); + return requestBuilder; + } - usedOptions_.setTimeout(timeout); + private void configureTimeout(final RequestConfig.Builder builder, final int timeout) { + builder.setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout) + .setSocketTimeout(timeout); } /** * React on changes that may have occurred on the WebClient settings. * Registering as a listener would be probably better. */ - private void reconfigureHttpClientIfNeeded(final AbstractHttpClient httpClient) { + private HttpClientBuilder reconfigureHttpClientIfNeeded(final HttpClientBuilder httpClientBuilder) { final WebClientOptions options = webClient_.getOptions(); // register new SSL factory only if settings have changed if (options.isUseInsecureSSL() != usedOptions_.isUseInsecureSSL() || options.getSSLClientCertificateUrl() != usedOptions_.getSSLClientCertificateUrl()) { - configureHttpsScheme(httpClient.getConnectionManager().getSchemeRegistry()); + configureHttpsScheme(httpClientBuilder); } if (options.getTimeout() != usedOptions_.getTimeout()) { - configureTimeout(httpClient.getParams(), options.getTimeout()); + configureTimeout(httpClientBuilder, options.getTimeout()); } + return httpClientBuilder; } - private void configureHttpsScheme(final SchemeRegistry schemeRegistry) { + private void configureHttpsScheme(final HttpClientBuilder builder) { final WebClientOptions options = webClient_.getOptions(); - final SSLSocketFactory socketFactory = HtmlUnitSSLSocketFactory.buildSSLSocketFactory(options); + final SSLConnectionSocketFactory socketFactory = HtmlUnitSSLConnectionSocketFactory.buildSSLSocketFactory(options); - schemeRegistry.register(new Scheme("https", 443, socketFactory)); + builder.setSSLSocketFactory(socketFactory); usedOptions_.setUseInsecureSSL(options.isUseInsecureSSL()); usedOptions_.setSSLClientCertificate(options.getSSLClientCertificateUrl(), @@ -609,7 +675,8 @@ public void setVirtualHost(final String virtualHost) { virtualHost_ = virtualHost; if (virtualHost_ != null) { - getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); + // TODO: asashour + //getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); } } @@ -625,7 +692,7 @@ * Converts an HttpMethod into a WebResponse. */ private WebResponse makeWebResponse(final HttpResponse httpResponse, - final WebRequest request, final DownloadedContent downloadedContent, final long loadTime) { + final WebRequest request, final DownloadedContent responseBody, final long loadTime) { String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); if (statusMessage == null) { @@ -636,7 +703,7 @@ for (final Header header : httpResponse.getAllHeaders()) { headers.add(new NameValuePair(header.getName(), header.getValue())); } - final WebResponseData responseData = new WebResponseData(downloadedContent, statusCode, statusMessage, headers); + final WebResponseData responseData = new WebResponseData(responseBody, statusCode, statusMessage, headers); return newWebResponseInstance(responseData, loadTime, request); } @@ -721,11 +788,17 @@ * Shutdown the connection manager. */ public synchronized void shutdown() { - if (httpClient_ != null) { - httpClient_.getConnectionManager().shutdown(); - httpClient_ = null; + if (httpClientBuilder_ != null) { + // TODO: asashour + //httpClientBuilder_.getConnectionManager().shutdown(); + httpClientBuilder_ = null; } } + + //TODO: should we really do this? +// public void clearCredentials() { +// httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); +// } } /** @@ -876,4 +949,5 @@ public synchronized void clear() { manager_.clearCookies(); } + } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java 2014-01-22 20:18:44 UTC (rev 9036) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SocksSocketFactory.java 2014-01-23 01:19:49 UTC (rev 9037) @@ -21,6 +21,7 @@ import org.apache.http.HttpHost; import org.apache.http.conn.scheme.PlainSocketFactory; import org.apache.http.params.HttpParams; +import org.apache.http.protocol.HttpContext; /** * SOCKS aware {@link org.apache.http.conn.scheme.SchemeSocketFactory}. @@ -41,6 +42,10 @@ return (HttpHost) parameters.getParameter(SOCKS_PROXY); } + static HttpHost getSocksProxy(final HttpContext context) { + return (HttpHost) context.getAttribute(SOCKS_PROXY); + } + static Socket createSocketWithSocksProxy(final HttpHost socksProxy) { final InetSocketAddress address = new InetSocketAddress(socksProxy.getHostName(), socksProxy.getPort()); final Proxy proxy = new Proxy(Proxy.Type.SOCKS, address); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-22 20:18:44 UTC (rev 9036) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-23 01:19:49 UTC (rev 9037) @@ -44,6 +44,7 @@ import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.AbstractHttpClient; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicHttpResponse; import org.apache.http.message.BasicStatusLine; import org.apache.log4j.Level; @@ -244,9 +245,9 @@ final boolean[] tabCalled = {false}; final WebConnection myWebConnection = new HttpWebConnection(webClient) { @Override - protected AbstractHttpClient createHttpClient() { + protected HttpClientBuilder createHttpClient() { tabCalled[0] = true; - return new DefaultHttpClient(); + return HttpClientBuilder.create(); } }; |
From: <asa...@us...> - 2014-01-23 08:57:18
|
Revision: 9039 http://sourceforge.net/p/htmlunit/code/9039 Author: asashour Date: 2014-01-23 08:57:11 +0000 (Thu, 23 Jan 2014) Log Message: ----------- Revert: new HttpWebConnection Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-23 08:53:21 UTC (rev 9038) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-01-23 08:57:11 UTC (rev 9039) @@ -53,8 +53,6 @@ import org.apache.http.auth.Credentials; import org.apache.http.client.CookieStore; import org.apache.http.client.CredentialsProvider; -import org.apache.http.client.config.CookieSpecs; -import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; @@ -64,37 +62,41 @@ import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.methods.HttpTrace; import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.client.params.ClientPNames; +import org.apache.http.client.params.HttpClientParams; import org.apache.http.client.utils.DateUtils; import org.apache.http.client.utils.URIUtils; import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.config.RegistryBuilder; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.params.ConnRoutePNames; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.cookie.ClientCookie; import org.apache.http.cookie.Cookie; import org.apache.http.cookie.CookieAttributeHandler; import org.apache.http.cookie.CookieOrigin; import org.apache.http.cookie.CookiePathComparator; import org.apache.http.cookie.CookieSpec; -import org.apache.http.cookie.CookieSpecProvider; +import org.apache.http.cookie.CookieSpecFactory; import org.apache.http.cookie.MalformedCookieException; import org.apache.http.cookie.SetCookie; +import org.apache.http.cookie.params.CookieSpecPNames; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.InputStreamBody; +import org.apache.http.impl.client.AbstractHttpClient; +import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.impl.cookie.BasicClientCookie; import org.apache.http.impl.cookie.BasicPathHandler; -import org.apache.http.impl.cookie.BestMatchSpecFactory; import org.apache.http.impl.cookie.BrowserCompatSpec; -import org.apache.http.impl.cookie.BrowserCompatSpecFactory; -import org.apache.http.impl.cookie.IgnoreSpecFactory; -import org.apache.http.impl.cookie.NetscapeDraftSpecFactory; -import org.apache.http.impl.cookie.RFC2109SpecFactory; -import org.apache.http.impl.cookie.RFC2965SpecFactory; import org.apache.http.message.BasicHeader; +import org.apache.http.params.BasicHttpParams; +import org.apache.http.params.CoreConnectionPNames; +import org.apache.http.params.HttpParams; +import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import com.gargoylesoftware.htmlunit.util.KeyDataPair; @@ -103,8 +105,6 @@ /** * Default implementation of {@link WebConnection}, using the HttpClient library to perform HTTP requests. - * This is meant to use the new API in HttpClient 4.3, and should be renamed to HttpWebConnection, - * after the old code is removed. * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> @@ -120,13 +120,13 @@ public class HttpWebConnection implements WebConnection { private static final String HACKED_COOKIE_POLICY = "mine"; - private HttpClientBuilder httpClientBuilder_; + private AbstractHttpClient httpClient_; private final WebClient webClient_; /** Use single HttpContext, so there is no need to re-send authentication for each and every request. */ - private HttpContext httpContext_ = new HttpClientContext(); + private HttpContext httpContext_ = new BasicHttpContext(); private String virtualHost_; - private final CookieSpecProvider htmlUnitCookieSpecProvider_; + private final CookieSpecFactory htmlUnitCookieSpecFactory_; private final WebClientOptions usedOptions_ = new WebClientOptions(); /** @@ -135,9 +135,8 @@ */ public HttpWebConnection(final WebClient webClient) { webClient_ = webClient; - htmlUnitCookieSpecProvider_ = new CookieSpecProvider() { - @Override - public CookieSpec create(final HttpContext context) { + htmlUnitCookieSpecFactory_ = new CookieSpecFactory() { + public CookieSpec newInstance(final HttpParams params) { return new HtmlUnitBrowserCompatCookieSpec(webClient_.getIncorrectnessListener()); } }; @@ -148,7 +147,7 @@ */ public WebResponse getResponse(final WebRequest request) throws IOException { final URL url = request.getUrl(); - final HttpClientBuilder builder = reconfigureHttpClientIfNeeded(getHttpClientBuilder()); + final AbstractHttpClient httpClient = getHttpClient(); HttpUriRequest httpMethod = null; try { @@ -160,19 +159,18 @@ + " (reason: " + e.getMessage() + ")", e); } final HttpHost hostConfiguration = getHostConfiguration(request); -// setProxy(httpMethod, request); + setProxy(httpMethod, request); final long startTime = System.currentTimeMillis(); HttpResponse httpResponse = null; try { - httpResponse = builder.build().execute(hostConfiguration, httpMethod, httpContext_); + httpResponse = httpClient.execute(hostConfiguration, httpMethod, httpContext_); } catch (final SSLPeerUnverifiedException s) { // Try to use only SSLv3 instead if (webClient_.getOptions().isUseInsecureSSL()) { - // TODO: asashour - // HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); - httpResponse = builder.build().execute(hostConfiguration, httpMethod); + HtmlUnitSSLSocketFactory.setUseSSL3Only(getHttpClient().getParams(), true); + httpResponse = httpClient.execute(hostConfiguration, httpMethod); } else { throw s; @@ -184,7 +182,7 @@ // come out of connections and throw a ConnectionPoolTimeoutException. // => best solution, discard the HttpClient instance. synchronized (this) { - httpClientBuilder_ = null; + httpClient_ = null; } throw e; } @@ -220,39 +218,17 @@ return hostConfiguration; } -// private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { -// if (webRequest.getProxyHost() != null) { -// final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); -// final HttpParams httpRequestParams = httpUriRequest.getParams(); -// if (webRequest.isSocksProxy()) { -// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); -// } -// else { -// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); -// } -// } -// } - - private void setProxy(final HttpRequestBase httpRequest, final WebRequest webRequest) { - RequestConfig.Builder requestBuilder = createRequestConfig(); - configureTimeout(requestBuilder, webClient_.getOptions().getTimeout()); - + private static void setProxy(final HttpUriRequest httpUriRequest, final WebRequest webRequest) { if (webRequest.getProxyHost() != null) { final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort()); - requestBuilder.setProxy(proxy); - httpRequest.setConfig(requestBuilder.build()); - -// if (webRequest.isSocksProxy()) { -// SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); -// } -// else { -// httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); -// } + final HttpParams httpRequestParams = httpUriRequest.getParams(); + if (webRequest.isSocksProxy()) { + SocksSocketFactory.setSocksProxy(httpRequestParams, proxy); + } + else { + httpRequestParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + } } - else { - requestBuilder.setProxy(null); - httpRequest.setConfig(requestBuilder.build()); - } } /** @@ -278,7 +254,6 @@ URI uri = URIUtils.createURI(url.getProtocol(), url.getHost(), url.getPort(), url.getPath(), escapeQuery(url.getQuery()), null); final HttpRequestBase httpMethod = buildHttpMethod(webRequest.getHttpMethod(), uri); - setProxy(httpMethod, webRequest); if (!(httpMethod instanceof HttpEntityEnclosingRequest)) { // this is the case for GET as well as TRACE, DELETE, OPTIONS and HEAD if (!webRequest.getRequestParameters().isEmpty()) { @@ -319,8 +294,7 @@ buildFilePart((KeyDataPair) pair, builder); } else { - builder.addTextBody(pair.getName(), pair.getValue(), - ContentType.create("text/plain", webRequest.getCharset())); + builder.addTextBody(pair.getName(), pair.getValue()); } } method.setEntity(builder.build()); @@ -351,8 +325,10 @@ writeRequestHeadersToHttpMethod(httpMethod, webRequest.getAdditionalHeaders()); // getHttpClient().getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, true); - final HttpClientBuilder httpClient = getHttpClientBuilder(); + final AbstractHttpClient httpClient = getHttpClient(); + reconfigureHttpClientIfNeeded(httpClient); + // Tell the client where to get its credentials from // (it may have changed on the webClient since last call to getHttpClientFor(...)) final CredentialsProvider credentialsProvider = webClient_.getCredentialsProvider(); @@ -365,7 +341,6 @@ final AuthScope authScope = new AuthScope(requestUrl.getHost(), requestUrl.getPort()); // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestUrlCredentials); - httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); } // if someone has set credentials to this request, we have to add this @@ -375,22 +350,19 @@ final AuthScope authScope = new AuthScope(requestUrl.getHost(), requestUrl.getPort()); // updating our client to keep the credentials for the next request credentialsProvider.setCredentials(authScope, requestCredentials); - httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); } - httpContext_.removeAttribute(HttpClientContext.CREDS_PROVIDER); - httpClient.setDefaultCredentialsProvider(credentialsProvider); + httpClient.setCredentialsProvider(credentialsProvider); - httpContext_.removeAttribute(HttpClientContext.COOKIE_STORE); if (webClient_.getCookieManager().isCookiesEnabled()) { // Cookies are enabled. Note that it's important that we enable single cookie headers, // for compatibility purposes. - // TODO: asashour -// httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); - httpClient.setDefaultCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); + httpClient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, Boolean.TRUE); + httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, HACKED_COOKIE_POLICY); + httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); } else { // Cookies are disabled. - httpClient.setDefaultCookieStore(new CookieStore() { + httpClient.setCookieStore(new CookieStore() { public void addCookie(final Cookie cookie) { /* empty */ } public void clear() { /* empty */ } public boolean clearExpired(final Date date) { @@ -529,27 +501,16 @@ * * @return the initialized HTTP client */ - protected synchronized HttpClientBuilder getHttpClientBuilder() { - if (httpClientBuilder_ == null) { - httpClientBuilder_ = createHttpClient(); + protected synchronized AbstractHttpClient getHttpClient() { + if (httpClient_ == null) { + httpClient_ = createHttpClient(); // this factory is required later // to be sure this is done, we do it outside the createHttpClient() call - final RegistryBuilder<CookieSpecProvider> registeryBuilder - = RegistryBuilder.<CookieSpecProvider>create() - .register(CookieSpecs.BEST_MATCH, new BestMatchSpecFactory()) - .register(CookieSpecs.STANDARD, new RFC2965SpecFactory()) - .register(CookieSpecs.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory()) - .register(CookieSpecs.NETSCAPE, new NetscapeDraftSpecFactory()) - .register(CookieSpecs.IGNORE_COOKIES, new IgnoreSpecFactory()) - .register("rfc2109", new RFC2109SpecFactory()) - .register("rfc2965", new RFC2965SpecFactory()); - - registeryBuilder.register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecProvider_); - httpClientBuilder_.setDefaultCookieSpecRegistry(registeryBuilder.build()); + httpClient_.getCookieSpecs().register(HACKED_COOKIE_POLICY, htmlUnitCookieSpecFactory_); } - return httpClientBuilder_; + return httpClient_; } /** @@ -570,40 +531,25 @@ * some tracking; see feature request 1438216). * @return the <tt>HttpClient</tt> that will be used by this WebConnection */ - protected HttpClientBuilder createHttpClient() { - // TODO: asashour -// final HttpParams httpParams = new BasicHttpParams(); -// -// HttpClientParams.setRedirecting(httpParams, false); -// // Set timeouts -// configureTimeout(httpParams, webClient_.getOptions().getTimeout()); -// -// final SchemeRegistry schemeRegistry = new SchemeRegistry(); -// schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); -// configureHttpsScheme(schemeRegistry); -// -// final PoolingClientConnectionManager connectionManager = -// new PoolingClientConnectionManager(schemeRegistry); -// connectionManager.setDefaultMaxPerRoute(6); -// -// final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); -// httpClient.setCookieStore(new HtmlUnitCookieStore2(webClient_.getCookieManager())); -// -// httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { -// @Override -// public boolean isRedirected(final HttpRequest request, final HttpResponse response, -// final HttpContext context) throws ProtocolException { -// return super.isRedirected(request, response, context) -// && response.getFirstHeader("location") != null; -// } -// }); -// -// if (getVirtualHost() != null) { -// httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); -// } + protected AbstractHttpClient createHttpClient() { + final HttpParams httpParams = new BasicHttpParams(); - final HttpClientBuilder builder = HttpClientBuilder.create(); - builder.setRedirectStrategy(new DefaultRedirectStrategy() { + HttpClientParams.setRedirecting(httpParams, false); + // Set timeouts + configureTimeout(httpParams, webClient_.getOptions().getTimeout()); + + final SchemeRegistry schemeRegistry = new SchemeRegistry(); + schemeRegistry.register(new Scheme("http", 80, new SocksSocketFactory())); + configureHttpsScheme(schemeRegistry); + + final PoolingClientConnectionManager connectionManager = + new PoolingClientConnectionManager(schemeRegistry); + connectionManager.setDefaultMaxPerRoute(6); + + final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); + httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); + + httpClient.setRedirectStrategy(new DefaultRedirectStrategy() { @Override public boolean isRedirected(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { @@ -611,57 +557,45 @@ && response.getFirstHeader("location") != null; } }); - configureTimeout(builder, webClient_.getOptions().getTimeout()); - return builder; - } - private void configureTimeout(final HttpClientBuilder builder, final int timeout) { - RequestConfig.Builder requestBuilder = createRequestConfig(); - configureTimeout(requestBuilder, timeout); + if (getVirtualHost() != null) { + httpClient.getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); + } - builder.setDefaultRequestConfig(requestBuilder.build()); - httpContext_.removeAttribute(HttpClientContext.REQUEST_CONFIG); - usedOptions_.setTimeout(timeout); + return httpClient; } - private RequestConfig.Builder createRequestConfig() { - RequestConfig.Builder requestBuilder = RequestConfig.custom() - .setCookieSpec(HACKED_COOKIE_POLICY) - .setRedirectsEnabled(false); - return requestBuilder; - } + private void configureTimeout(final HttpParams httpParams, final int timeout) { + httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, timeout); + httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout); - private void configureTimeout(final RequestConfig.Builder builder, final int timeout) { - builder.setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout) - .setSocketTimeout(timeout); + usedOptions_.setTimeout(timeout); } /** * React on changes that may have occurred on the WebClient settings. * Registering as a listener would be probably better. */ - private HttpClientBuilder reconfigureHttpClientIfNeeded(final HttpClientBuilder httpClientBuilder) { + private void reconfigureHttpClientIfNeeded(final AbstractHttpClient httpClient) { final WebClientOptions options = webClient_.getOptions(); // register new SSL factory only if settings have changed if (options.isUseInsecureSSL() != usedOptions_.isUseInsecureSSL() || options.getSSLClientCertificateUrl() != usedOptions_.getSSLClientCertificateUrl()) { - configureHttpsScheme(httpClientBuilder); + configureHttpsScheme(httpClient.getConnectionManager().getSchemeRegistry()); } if (options.getTimeout() != usedOptions_.getTimeout()) { - configureTimeout(httpClientBuilder, options.getTimeout()); + configureTimeout(httpClient.getParams(), options.getTimeout()); } - return httpClientBuilder; } - private void configureHttpsScheme(final HttpClientBuilder builder) { + private void configureHttpsScheme(final SchemeRegistry schemeRegistry) { final WebClientOptions options = webClient_.getOptions(); - final SSLConnectionSocketFactory socketFactory = HtmlUnitSSLConnectionSocketFactory.buildSSLSocketFactory(options); + final SSLSocketFactory socketFactory = HtmlUnitSSLSocketFactory.buildSSLSocketFactory(options); - builder.setSSLSocketFactory(socketFactory); + schemeRegistry.register(new Scheme("https", 443, socketFactory)); usedOptions_.setUseInsecureSSL(options.isUseInsecureSSL()); usedOptions_.setSSLClientCertificate(options.getSSLClientCertificateUrl(), @@ -675,8 +609,7 @@ public void setVirtualHost(final String virtualHost) { virtualHost_ = virtualHost; if (virtualHost_ != null) { - // TODO: asashour - //getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); + getHttpClient().getParams().setParameter(ClientPNames.VIRTUAL_HOST, virtualHost_); } } @@ -692,7 +625,7 @@ * Converts an HttpMethod into a WebResponse. */ private WebResponse makeWebResponse(final HttpResponse httpResponse, - final WebRequest request, final DownloadedContent responseBody, final long loadTime) { + final WebRequest request, final DownloadedContent downloadedContent, final long loadTime) { String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); if (statusMessage == null) { @@ -703,7 +636,7 @@ for (final Header header : httpResponse.getAllHeaders()) { headers.add(new NameValuePair(header.getName(), header.getValue())); } - final WebResponseData responseData = new WebResponseData(responseBody, statusCode, statusMessage, headers); + final WebResponseData responseData = new WebResponseData(downloadedContent, statusCode, statusMessage, headers); return newWebResponseInstance(responseData, loadTime, request); } @@ -788,17 +721,11 @@ * Shutdown the connection manager. */ public synchronized void shutdown() { - if (httpClientBuilder_ != null) { - // TODO: asashour - //httpClientBuilder_.getConnectionManager().shutdown(); - httpClientBuilder_ = null; + if (httpClient_ != null) { + httpClient_.getConnectionManager().shutdown(); + httpClient_ = null; } } - - //TODO: should we really do this? -// public void clearCredentials() { -// httpContext_.removeAttribute(HttpClientContext.TARGET_AUTH_STATE); -// } } /** @@ -949,5 +876,4 @@ public synchronized void clear() { manager_.clearCookies(); } - } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-23 08:53:21 UTC (rev 9038) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-01-23 08:57:11 UTC (rev 9039) @@ -44,7 +44,6 @@ import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.AbstractHttpClient; import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicHttpResponse; import org.apache.http.message.BasicStatusLine; import org.apache.log4j.Level; @@ -245,9 +244,9 @@ final boolean[] tabCalled = {false}; final WebConnection myWebConnection = new HttpWebConnection(webClient) { @Override - protected HttpClientBuilder createHttpClient() { + protected AbstractHttpClient createHttpClient() { tabCalled[0] = true; - return HttpClientBuilder.create(); + return new DefaultHttpClient(); } }; |