[HtmlUnit] SVN: [15395] trunk/htmlunit/src

rbri--- via HtmlUnit-develop <[email protected]>
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID <[email protected]>
Revision: 15395
          http://sourceforge.net/p/htmlunit/code/15395
Author:   rbri
Date:     2018-06-27 19:30:26 +0000 (Wed, 27 Jun 2018)
Log Message:
-----------
ff60 support (wip)

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java	2018-06-27 19:00:38 UTC (rev 15394)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java	2018-06-27 19:30:26 UTC (rev 15395)
@@ -945,6 +945,12 @@
     JS_IMAGE_PROTOTYPE_SAME_AS_HTML_IMAGE,
 
     /**
+     * Getting the width and height of an image tag with an empty source returns 0x0.
+     */
+    @BrowserFeature({CHROME, FF60})
+    JS_IMAGE_WIDTH_HEIGHT_EMPTY_SOURCE_RETURNS_0x0,
+
+    /**
      * Getting the width and height of an image tag without a source returns 16x16;
      * for invalid values returns 0.
      */
@@ -952,8 +958,8 @@
     JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0,
 
     /**
-     * Getting the width and height of an image tag without a source returns 18x20;
-     * for invalid values returns 1.
+     * Getting the width and height of an image tag without a source returns 24x24;
+     * for invalid values returns 0x0.
      */
     @BrowserFeature(FF)
     JS_IMAGE_WIDTH_HEIGHT_RETURNS_24x24_0x0,

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	2018-06-27 19:00:38 UTC (rev 15394)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java	2018-06-27 19:30:26 UTC (rev 15395)
@@ -1765,7 +1765,7 @@
      * @see <a href="http://msdn.microsoft.com/en-us/library/ms536759.aspx">MSDN Documentation</a>
      * @see <a href="https://developer.mozilla.org/en/DOM/window.showModalDialog">Mozilla Documentation</a>
      */
-    @JsxFunction({IE, FF})
+    @JsxFunction({IE, FF52})
     public Object showModalDialog(final String url, final Object arguments, final String features) {
         final WebWindow webWindow = getWebWindow();
         final WebClient client = webWindow.getWebClient();

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java	2018-06-27 19:00:38 UTC (rev 15394)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java	2018-06-27 19:30:26 UTC (rev 15395)
@@ -15,8 +15,9 @@
 package com.gargoylesoftware.htmlunit.javascript.host.html;
 
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ALIGN_ACCEPTS_ARBITRARY_VALUES;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IMAGE_WIDTH_HEIGHT_EMPTY_SOURCE_RETURNS_0x0;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IMAGE_WIDTH_HEIGHT_RETURNS_24x24_0x0;
-import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IMAGE_WIDTH_HEIGHT_RETURNS_28x30_28x30;
 import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
 import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
@@ -253,6 +254,9 @@
         }
 
         final BrowserVersion browserVersion = getBrowserVersion();
+        if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_EMPTY_SOURCE_RETURNS_0x0) && StringUtils.isEmpty(src)) {
+            return 0;
+        }
         if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0) && StringUtils.isBlank(src)) {
             return 0;
         }
@@ -313,6 +317,9 @@
         }
 
         final BrowserVersion browserVersion = getBrowserVersion();
+        if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_EMPTY_SOURCE_RETURNS_0x0) && StringUtils.isEmpty(src)) {
+            return 0;
+        }
         if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0) && StringUtils.isBlank(src)) {
             return 0;
         }

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java	2018-06-27 19:00:38 UTC (rev 15394)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java	2018-06-27 19:30:26 UTC (rev 15395)
@@ -1143,15 +1143,15 @@
      */
     @Test
     @Alerts(DEFAULT = {
-            "string string 7 number string",
-            "string string 8 number object",
-            "string string 9 number object",
-            "string string 1 number object"},
+                "string string 7 number string",
+                "string string 8 number object",
+                "string string 9 number object",
+                "string string 1 number object"},
             FF = {
-            "string string 0 number string",
-            "string string 0 number object",
-            "string string 9 number object",
-            "string string 1 number object"})
+                "string string 0 number string",
+                "string string 0 number object",
+                "string string 9 number object",
+                "string string 1 number object"})
     public void onErrorExceptionInstance() throws Exception {
         final String html
                 = "<html>\n"


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.