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] |