Diff
Modified: trunk/LayoutTests/ChangeLog (205911 => 205912)
--- trunk/LayoutTests/ChangeLog 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/ChangeLog 2016-09-14 16:56:06 UTC (rev 205912)
@@ -1,3 +1,23 @@
+2016-09-14 Chris Dumez <[email protected]>
+
+ input.type cannot be set to "file" after being set to another type
+ https://bugs.webkit.org/show_bug.cgi?id=161943
+
+ Reviewed by Daniel Bates.
+
+ * fast/dom/HTMLInputElement/input-type-change-to-file-expected.txt: Added.
+ * fast/dom/HTMLInputElement/input-type-change-to-file.html: Added.
+ * fast/dom/HTMLInputElement/input-type-file-security-expected.txt: Added
+ * fast/dom/HTMLInputElement/input-type-file-security.html: Added
+ Add layout test coverage. I have verified that these tests are passing in both
+ Firefox and Chrome.
+
+ * fast/forms/input-type-change3-expected.txt:
+ * fast/forms/input-type-change3.html:
+ * fast/forms/input-valueasnumber-unsupported-expected.txt:
+ * fast/forms/input-valueasnumber-unsupported.html:
+ Update existing tests to reflect behavior change.
+
2016-09-14 Ryan Haddad <[email protected]>
Rebaseline tests added with r205905 for ios-simulator.
Added: trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-change-to-file-expected.txt (0 => 205912)
--- trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-change-to-file-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-change-to-file-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -0,0 +1,23 @@
+Tests that the input type can be set to 'file' after having been set to another type
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.type is "text"
+PASS input.getAttribute('type') is null
+input.setAttribute('type', 'radio')
+PASS input.type is "radio"
+PASS input.getAttribute('type') is "radio"
+input.setAttribute('type', 'file')
+PASS input.type is "file"
+PASS input.getAttribute('type') is "file"
+input.type = 'radio'
+PASS input.type is "radio"
+PASS input.getAttribute('type') is "radio"
+input.type = 'file'
+PASS input.type is "file"
+PASS input.getAttribute('type') is "file"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-change-to-file.html (0 => 205912)
--- trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-change-to-file.html (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-change-to-file.html 2016-09-14 16:56:06 UTC (rev 205912)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that the input type can be set to 'file' after having been set to another type");
+
+var input = document.createElement("input");
+shouldBeEqualToString("input.type", "text");
+shouldBeNull("input.getAttribute('type')");
+
+evalAndLog("input.setAttribute('type', 'radio')");
+shouldBeEqualToString("input.type", "radio");
+shouldBeEqualToString("input.getAttribute('type')", "radio");
+
+evalAndLog("input.setAttribute('type', 'file')");
+shouldBeEqualToString("input.type", "file");
+shouldBeEqualToString("input.getAttribute('type')", "file");
+
+evalAndLog("input.type = 'radio'");
+shouldBeEqualToString("input.type", "radio");
+shouldBeEqualToString("input.getAttribute('type')", "radio");
+
+evalAndLog("input.type = 'file'");
+shouldBeEqualToString("input.type", "file");
+shouldBeEqualToString("input.getAttribute('type')", "file");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-file-security-expected.txt (0 => 205912)
--- trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-file-security-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-file-security-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -0,0 +1,15 @@
+Tests that input.value is properly reset when changing the input type to 'file'.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.type is "text"
+input.value = '/etc/hosts'
+PASS input.value is "/etc/hosts"
+input.type = 'file'
+PASS input.value is ""
+PASS input.getAttribute('value') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-file-security.html (0 => 205912)
--- trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-file-security.html (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/input-type-file-security.html 2016-09-14 16:56:06 UTC (rev 205912)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that input.value is properly reset when changing the input type to 'file'.");
+
+var input = document.createElement("input");
+shouldBeEqualToString("input.type", "text");
+evalAndLog("input.value = '/etc/hosts'");
+shouldBeEqualToString("input.value", "/etc/hosts");
+
+evalAndLog("input.type = 'file'");
+// Make sure that input.value is properly reset.
+shouldBeEqualToString("input.value", "");
+shouldBeNull("input.getAttribute('value')");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/forms/input-type-change3-expected.txt (205911 => 205912)
--- trunk/LayoutTests/fast/forms/input-type-change3-expected.txt 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/fast/forms/input-type-change3-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -14,7 +14,7 @@
PASS input.type for " button " is correctly "text".
PASS input.type for "checkbox" is correctly "checkbox".
PASS input.type for "email" is correctly "email".
-PASS input.type for "file" is correctly "email".
+PASS input.type for "file" is correctly "file".
PASS input.type for "hidden" is correctly "hidden".
PASS input.type for "image" is correctly "image".
PASS input.type for "isindex" is correctly "text".
Modified: trunk/LayoutTests/fast/forms/input-type-change3.html (205911 => 205912)
--- trunk/LayoutTests/fast/forms/input-type-change3.html 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/fast/forms/input-type-change3.html 2016-09-14 16:56:06 UTC (rev 205912)
@@ -37,7 +37,7 @@
check(" button ", "text");
check("checkbox", "checkbox");
check("email", "email");
-check("file", "email"); // We can't change a concrete type to file for a security reason.
+check("file", "file");
check("hidden", "hidden");
check("image", "image");
check("isindex", "text");
Modified: trunk/LayoutTests/fast/forms/input-valueasnumber-unsupported-expected.txt (205911 => 205912)
--- trunk/LayoutTests/fast/forms/input-valueasnumber-unsupported-expected.txt 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/fast/forms/input-valueasnumber-unsupported-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -15,9 +15,6 @@
Check for type=email
PASS input.valueAsNumber is Number.NaN
PASS input.valueAsNumber = 0 threw exception InvalidStateError (DOM Exception 11): The object is in an invalid state..
-Check for type=file
-PASS input.valueAsNumber is Number.NaN
-PASS input.valueAsNumber = 0 threw exception InvalidStateError (DOM Exception 11): The object is in an invalid state..
Check for type=hidden
PASS input.valueAsNumber is Number.NaN
PASS input.valueAsNumber = 0 threw exception InvalidStateError (DOM Exception 11): The object is in an invalid state..
Modified: trunk/LayoutTests/fast/forms/input-valueasnumber-unsupported.html (205911 => 205912)
--- trunk/LayoutTests/fast/forms/input-valueasnumber-unsupported.html 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/fast/forms/input-valueasnumber-unsupported.html 2016-09-14 16:56:06 UTC (rev 205912)
@@ -25,7 +25,6 @@
checkValueAsNumber('checkbox');
checkValueAsNumber('color');
checkValueAsNumber('email');
-checkValueAsNumber('file');
checkValueAsNumber('hidden');
checkValueAsNumber('image');
checkValueAsNumber('khtml_isindex');
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (205911 => 205912)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-09-14 16:56:06 UTC (rev 205912)
@@ -1,3 +1,15 @@
+2016-09-14 Chris Dumez <[email protected]>
+
+ input.type cannot be set to "file" after being set to another type
+ https://bugs.webkit.org/show_bug.cgi?id=161943
+
+ Reviewed by Daniel Bates.
+
+ Rebaseline a couple of W3C tests now that more checks are passing.
+
+ * web-platform-tests/html/dom/reflection-forms-expected.txt:
+ * web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt:
+
2016-09-13 Alex Christensen <[email protected]>
Implement URLSearchParams
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (205911 => 205912)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -6649,8 +6649,8 @@
PASS input.type: setAttribute() to "adio" followed by IDL get
PASS input.type: setAttribute() to "RADIO" followed by getAttribute()
PASS input.type: setAttribute() to "RADIO" followed by IDL get
-FAIL input.type: setAttribute() to "file" followed by getAttribute() assert_equals: expected "file" but got "radio"
-FAIL input.type: setAttribute() to "file" followed by IDL get assert_equals: expected "file" but got "radio"
+PASS input.type: setAttribute() to "file" followed by getAttribute()
+PASS input.type: setAttribute() to "file" followed by IDL get
PASS input.type: setAttribute() to "xfile" followed by getAttribute()
PASS input.type: setAttribute() to "xfile" followed by IDL get
PASS input.type: setAttribute() to "file\0" followed by getAttribute()
@@ -6657,8 +6657,8 @@
PASS input.type: setAttribute() to "file\0" followed by IDL get
PASS input.type: setAttribute() to "ile" followed by getAttribute()
PASS input.type: setAttribute() to "ile" followed by IDL get
-FAIL input.type: setAttribute() to "FILE" followed by getAttribute() assert_equals: expected "FILE" but got "text"
-FAIL input.type: setAttribute() to "FILE" followed by IDL get assert_equals: expected "file" but got "text"
+PASS input.type: setAttribute() to "FILE" followed by getAttribute()
+PASS input.type: setAttribute() to "FILE" followed by IDL get
PASS input.type: setAttribute() to "submit" followed by getAttribute()
PASS input.type: setAttribute() to "submit" followed by IDL get
PASS input.type: setAttribute() to "xsubmit" followed by getAttribute()
@@ -7014,8 +7014,8 @@
PASS input.type: IDL set to "RADIO" followed by getAttribute()
PASS input.type: IDL set to "RADIO" followed by IDL get
PASS input.type: IDL set to "file" should not throw
-FAIL input.type: IDL set to "file" followed by getAttribute() assert_equals: expected "file" but got "radio"
-FAIL input.type: IDL set to "file" followed by IDL get assert_equals: expected "file" but got "radio"
+PASS input.type: IDL set to "file" followed by getAttribute()
+PASS input.type: IDL set to "file" followed by IDL get
PASS input.type: IDL set to "xfile" should not throw
PASS input.type: IDL set to "xfile" followed by getAttribute()
PASS input.type: IDL set to "xfile" followed by IDL get
@@ -7026,8 +7026,8 @@
PASS input.type: IDL set to "ile" followed by getAttribute()
PASS input.type: IDL set to "ile" followed by IDL get
PASS input.type: IDL set to "FILE" should not throw
-FAIL input.type: IDL set to "FILE" followed by getAttribute() assert_equals: expected "FILE" but got "text"
-FAIL input.type: IDL set to "FILE" followed by IDL get assert_equals: expected "file" but got "text"
+PASS input.type: IDL set to "FILE" followed by getAttribute()
+PASS input.type: IDL set to "FILE" followed by IDL get
PASS input.type: IDL set to "submit" should not throw
PASS input.type: IDL set to "submit" followed by getAttribute()
PASS input.type: IDL set to "submit" followed by IDL get
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt (205911 => 205912)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -15,7 +15,7 @@
PASS change state from hidden to color
PASS change state from hidden to checkbox
PASS change state from hidden to radio
-FAIL change state from hidden to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from hidden to file
PASS change state from hidden to submit
PASS change state from hidden to image
PASS change state from hidden to reset
@@ -36,7 +36,7 @@
PASS change state from text to color
FAIL change state from text to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from text to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from text to file assert_equals: expected "" but got " foobar "
+PASS change state from text to file
FAIL change state from text to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from text to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from text to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -57,7 +57,7 @@
PASS change state from search to color
FAIL change state from search to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from search to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from search to file assert_equals: expected "" but got " foobar "
+PASS change state from search to file
FAIL change state from search to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from search to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from search to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -78,7 +78,7 @@
PASS change state from tel to color
FAIL change state from tel to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from tel to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from tel to file assert_equals: expected "" but got " foobar "
+PASS change state from tel to file
FAIL change state from tel to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from tel to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from tel to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -99,7 +99,7 @@
PASS change state from url to color
FAIL change state from url to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from url to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
-FAIL change state from url to file assert_equals: expected "" but got "foobar"
+PASS change state from url to file
FAIL change state from url to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from url to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from url to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
@@ -120,7 +120,7 @@
PASS change state from email to color
FAIL change state from email to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from email to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
-FAIL change state from email to file assert_equals: expected "" but got "foobar"
+PASS change state from email to file
FAIL change state from email to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from email to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from email to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
@@ -141,7 +141,7 @@
PASS change state from password to color
FAIL change state from password to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from password to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from password to file assert_equals: expected "" but got " foobar "
+PASS change state from password to file
FAIL change state from password to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from password to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from password to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -162,7 +162,7 @@
PASS change state from datetime to color
FAIL change state from datetime to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from datetime to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from datetime to file assert_equals: expected "" but got " foobar "
+PASS change state from datetime to file
FAIL change state from datetime to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from datetime to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from datetime to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -183,7 +183,7 @@
PASS change state from date to color
FAIL change state from date to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from date to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from date to file assert_equals: expected "" but got " foobar "
+PASS change state from date to file
FAIL change state from date to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from date to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from date to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -204,7 +204,7 @@
PASS change state from month to color
FAIL change state from month to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from month to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from month to file assert_equals: expected "" but got " foobar "
+PASS change state from month to file
FAIL change state from month to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from month to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from month to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -225,7 +225,7 @@
PASS change state from week to color
FAIL change state from week to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from week to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from week to file assert_equals: expected "" but got " foobar "
+PASS change state from week to file
FAIL change state from week to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from week to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from week to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -246,7 +246,7 @@
PASS change state from time to color
FAIL change state from time to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from time to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from time to file assert_equals: expected "" but got " foobar "
+PASS change state from time to file
FAIL change state from time to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from time to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from time to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -288,7 +288,7 @@
PASS change state from range to color
FAIL change state from range to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
FAIL change state from range to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
-FAIL change state from range to file assert_equals: expected "" but got "50"
+PASS change state from range to file
FAIL change state from range to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
FAIL change state from range to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
FAIL change state from range to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
@@ -309,7 +309,7 @@
PASS change state from color to range
FAIL change state from color to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "#000000"
FAIL change state from color to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "#000000"
-FAIL change state from color to file assert_equals: expected "" but got "#000000"
+PASS change state from color to file
FAIL change state from color to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "#000000"
FAIL change state from color to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "#000000"
FAIL change state from color to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "#000000"
@@ -330,7 +330,7 @@
PASS change state from checkbox to range
PASS change state from checkbox to color
PASS change state from checkbox to radio
-FAIL change state from checkbox to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from checkbox to file
PASS change state from checkbox to submit
PASS change state from checkbox to image
PASS change state from checkbox to reset
@@ -351,7 +351,7 @@
PASS change state from radio to range
PASS change state from radio to color
PASS change state from radio to checkbox
-FAIL change state from radio to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from radio to file
PASS change state from radio to submit
PASS change state from radio to image
PASS change state from radio to reset
@@ -394,7 +394,7 @@
PASS change state from submit to color
PASS change state from submit to checkbox
PASS change state from submit to radio
-FAIL change state from submit to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from submit to file
PASS change state from submit to image
PASS change state from submit to reset
PASS change state from submit to button
@@ -415,7 +415,7 @@
PASS change state from image to color
PASS change state from image to checkbox
PASS change state from image to radio
-FAIL change state from image to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from image to file
PASS change state from image to submit
PASS change state from image to reset
PASS change state from image to button
@@ -436,7 +436,7 @@
PASS change state from reset to color
PASS change state from reset to checkbox
PASS change state from reset to radio
-FAIL change state from reset to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from reset to file
PASS change state from reset to submit
PASS change state from reset to image
PASS change state from reset to button
@@ -457,7 +457,7 @@
PASS change state from button to color
PASS change state from button to checkbox
PASS change state from button to radio
-FAIL change state from button to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from button to file
PASS change state from button to submit
PASS change state from button to image
PASS change state from button to reset
Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (205911 => 205912)
--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -6649,8 +6649,8 @@
PASS input.type: setAttribute() to "adio" followed by IDL get
PASS input.type: setAttribute() to "RADIO" followed by getAttribute()
PASS input.type: setAttribute() to "RADIO" followed by IDL get
-FAIL input.type: setAttribute() to "file" followed by getAttribute() assert_equals: expected "file" but got "radio"
-FAIL input.type: setAttribute() to "file" followed by IDL get assert_equals: expected "file" but got "radio"
+PASS input.type: setAttribute() to "file" followed by getAttribute()
+PASS input.type: setAttribute() to "file" followed by IDL get
PASS input.type: setAttribute() to "xfile" followed by getAttribute()
PASS input.type: setAttribute() to "xfile" followed by IDL get
PASS input.type: setAttribute() to "file\0" followed by getAttribute()
@@ -6657,8 +6657,8 @@
PASS input.type: setAttribute() to "file\0" followed by IDL get
PASS input.type: setAttribute() to "ile" followed by getAttribute()
PASS input.type: setAttribute() to "ile" followed by IDL get
-FAIL input.type: setAttribute() to "FILE" followed by getAttribute() assert_equals: expected "FILE" but got "text"
-FAIL input.type: setAttribute() to "FILE" followed by IDL get assert_equals: expected "file" but got "text"
+PASS input.type: setAttribute() to "FILE" followed by getAttribute()
+PASS input.type: setAttribute() to "FILE" followed by IDL get
PASS input.type: setAttribute() to "submit" followed by getAttribute()
PASS input.type: setAttribute() to "submit" followed by IDL get
PASS input.type: setAttribute() to "xsubmit" followed by getAttribute()
@@ -7014,8 +7014,8 @@
PASS input.type: IDL set to "RADIO" followed by getAttribute()
PASS input.type: IDL set to "RADIO" followed by IDL get
PASS input.type: IDL set to "file" should not throw
-FAIL input.type: IDL set to "file" followed by getAttribute() assert_equals: expected "file" but got "radio"
-FAIL input.type: IDL set to "file" followed by IDL get assert_equals: expected "file" but got "radio"
+PASS input.type: IDL set to "file" followed by getAttribute()
+PASS input.type: IDL set to "file" followed by IDL get
PASS input.type: IDL set to "xfile" should not throw
PASS input.type: IDL set to "xfile" followed by getAttribute()
PASS input.type: IDL set to "xfile" followed by IDL get
@@ -7026,8 +7026,8 @@
PASS input.type: IDL set to "ile" followed by getAttribute()
PASS input.type: IDL set to "ile" followed by IDL get
PASS input.type: IDL set to "FILE" should not throw
-FAIL input.type: IDL set to "FILE" followed by getAttribute() assert_equals: expected "FILE" but got "text"
-FAIL input.type: IDL set to "FILE" followed by IDL get assert_equals: expected "file" but got "text"
+PASS input.type: IDL set to "FILE" followed by getAttribute()
+PASS input.type: IDL set to "FILE" followed by IDL get
PASS input.type: IDL set to "submit" should not throw
PASS input.type: IDL set to "submit" followed by getAttribute()
PASS input.type: IDL set to "submit" followed by IDL get
Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt (205911 => 205912)
--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt 2016-09-14 16:56:06 UTC (rev 205912)
@@ -15,7 +15,7 @@
FAIL change state from hidden to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
PASS change state from hidden to checkbox
PASS change state from hidden to radio
-FAIL change state from hidden to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from hidden to file
PASS change state from hidden to submit
PASS change state from hidden to image
PASS change state from hidden to reset
@@ -36,7 +36,7 @@
FAIL change state from text to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
FAIL change state from text to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from text to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from text to file assert_equals: expected "" but got " foobar "
+PASS change state from text to file
FAIL change state from text to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from text to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from text to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -57,7 +57,7 @@
FAIL change state from search to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
FAIL change state from search to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from search to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from search to file assert_equals: expected "" but got " foobar "
+PASS change state from search to file
FAIL change state from search to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from search to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from search to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -78,7 +78,7 @@
FAIL change state from tel to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
FAIL change state from tel to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from tel to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from tel to file assert_equals: expected "" but got " foobar "
+PASS change state from tel to file
FAIL change state from tel to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from tel to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from tel to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -99,7 +99,7 @@
FAIL change state from url to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got "foobar"
FAIL change state from url to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from url to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
-FAIL change state from url to file assert_equals: expected "" but got "foobar"
+PASS change state from url to file
FAIL change state from url to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from url to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from url to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
@@ -120,7 +120,7 @@
FAIL change state from email to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got "foobar"
FAIL change state from email to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from email to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
-FAIL change state from email to file assert_equals: expected "" but got "foobar"
+PASS change state from email to file
FAIL change state from email to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from email to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
FAIL change state from email to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "foobar"
@@ -141,7 +141,7 @@
FAIL change state from password to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
FAIL change state from password to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from password to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from password to file assert_equals: expected "" but got " foobar "
+PASS change state from password to file
FAIL change state from password to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from password to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from password to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -162,7 +162,7 @@
FAIL change state from datetime to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
FAIL change state from datetime to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from datetime to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from datetime to file assert_equals: expected "" but got " foobar "
+PASS change state from datetime to file
FAIL change state from datetime to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from datetime to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from datetime to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -288,7 +288,7 @@
FAIL change state from range to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got "50"
FAIL change state from range to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
FAIL change state from range to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
-FAIL change state from range to file assert_equals: expected "" but got "50"
+PASS change state from range to file
FAIL change state from range to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
FAIL change state from range to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
FAIL change state from range to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got "50"
@@ -309,7 +309,7 @@
PASS change state from color to range
FAIL change state from color to checkbox assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from color to radio assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
-FAIL change state from color to file assert_equals: expected "" but got " foobar "
+PASS change state from color to file
FAIL change state from color to submit assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from color to image assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
FAIL change state from color to reset assert_equals: input.value should be ' foo\rbar ' after change of state expected " foo\rbar " but got " foobar "
@@ -330,7 +330,7 @@
PASS change state from checkbox to range
FAIL change state from checkbox to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
PASS change state from checkbox to radio
-FAIL change state from checkbox to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from checkbox to file
PASS change state from checkbox to submit
PASS change state from checkbox to image
PASS change state from checkbox to reset
@@ -351,7 +351,7 @@
PASS change state from radio to range
FAIL change state from radio to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
PASS change state from radio to checkbox
-FAIL change state from radio to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from radio to file
PASS change state from radio to submit
PASS change state from radio to image
PASS change state from radio to reset
@@ -394,7 +394,7 @@
FAIL change state from submit to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
PASS change state from submit to checkbox
PASS change state from submit to radio
-FAIL change state from submit to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from submit to file
PASS change state from submit to image
PASS change state from submit to reset
PASS change state from submit to button
@@ -415,7 +415,7 @@
FAIL change state from image to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
PASS change state from image to checkbox
PASS change state from image to radio
-FAIL change state from image to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from image to file
PASS change state from image to submit
PASS change state from image to reset
PASS change state from image to button
@@ -436,7 +436,7 @@
FAIL change state from reset to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
PASS change state from reset to checkbox
PASS change state from reset to radio
-FAIL change state from reset to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from reset to file
PASS change state from reset to submit
PASS change state from reset to image
PASS change state from reset to button
@@ -457,7 +457,7 @@
FAIL change state from button to color assert_equals: input.value should be #000000 after change of state expected "#000000" but got " foobar "
PASS change state from button to checkbox
PASS change state from button to radio
-FAIL change state from button to file assert_equals: expected "" but got " foo\rbar "
+PASS change state from button to file
PASS change state from button to submit
PASS change state from button to image
PASS change state from button to reset
Modified: trunk/Source/WebCore/ChangeLog (205911 => 205912)
--- trunk/Source/WebCore/ChangeLog 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/Source/WebCore/ChangeLog 2016-09-14 16:56:06 UTC (rev 205912)
@@ -1,3 +1,26 @@
+2016-09-14 Chris Dumez <[email protected]>
+
+ input.type cannot be set to "file" after being set to another type
+ https://bugs.webkit.org/show_bug.cgi?id=161943
+
+ Reviewed by Daniel Bates.
+
+ input.type cannot be set to "file" after being set to another type.
+ This behavior does not match the HTML specification or the behavior
+ of Firefox and Chrome. This patch drops this restriction and aligns
+ our behavior with other browsers.
+
+ Test: fast/dom/HTMLInputElement/input-type-change-to-file.html
+
+ * html/FileInputType.cpp:
+ (WebCore::FileInputType::canChangeFromAnotherType): Deleted.
+ * html/FileInputType.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::updateType):
+ * html/InputType.cpp:
+ (WebCore::InputType::canChangeFromAnotherType): Deleted.
+ * html/InputType.h:
+
2016-09-14 Carlos Garnacho <[email protected]>
[GTK][Wayland] Implement clipboard support
Modified: trunk/Source/WebCore/html/FileInputType.cpp (205911 => 205912)
--- trunk/Source/WebCore/html/FileInputType.cpp 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/Source/WebCore/html/FileInputType.cpp 2016-09-14 16:56:06 UTC (rev 205912)
@@ -205,16 +205,6 @@
return false;
}
-bool FileInputType::canChangeFromAnotherType() const
-{
- // Don't allow the type to be changed to file after the first type change.
- // In other engines this might mean a _javascript_ programmer could set a text
- // field's value to something like /etc/passwd and then change it to a file input.
- // I don't think this would actually occur in WebKit, but this rule still may be
- // important for compatibility.
- return false;
-}
-
FileList* FileInputType::files()
{
return m_fileList.get();
Modified: trunk/Source/WebCore/html/FileInputType.h (205911 => 205912)
--- trunk/Source/WebCore/html/FileInputType.h 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/Source/WebCore/html/FileInputType.h 2016-09-14 16:56:06 UTC (rev 205912)
@@ -60,7 +60,6 @@
void handleDOMActivateEvent(Event&) override;
RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) override;
bool canSetStringValue() const override;
- bool canChangeFromAnotherType() const override;
FileList* files() override;
void setFiles(PassRefPtr<FileList>) override;
#if PLATFORM(IOS)
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (205911 => 205912)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2016-09-14 16:56:06 UTC (rev 205912)
@@ -476,18 +476,10 @@
{
ASSERT(m_inputType);
auto newType = InputType::create(*this, attributeWithoutSynchronization(typeAttr));
- bool hadType = m_hasType;
m_hasType = true;
if (m_inputType->formControlType() == newType->formControlType())
return;
- if (hadType && !newType->canChangeFromAnotherType()) {
- // Set the attribute back to the old value.
- // Useful in case we were called from inside parseAttribute.
- setAttributeWithoutSynchronization(typeAttr, type());
- return;
- }
-
removeFromRadioButtonGroup();
bool didStoreValue = m_inputType->storesValueSeparateFromAttribute();
Modified: trunk/Source/WebCore/html/InputType.cpp (205911 => 205912)
--- trunk/Source/WebCore/html/InputType.cpp 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/Source/WebCore/html/InputType.cpp 2016-09-14 16:56:06 UTC (rev 205912)
@@ -623,11 +623,6 @@
return false;
}
-bool InputType::canChangeFromAnotherType() const
-{
- return true;
-}
-
void InputType::minOrMaxAttributeChanged()
{
}
Modified: trunk/Source/WebCore/html/InputType.h (205911 => 205912)
--- trunk/Source/WebCore/html/InputType.h 2016-09-14 16:55:15 UTC (rev 205911)
+++ trunk/Source/WebCore/html/InputType.h 2016-09-14 16:56:06 UTC (rev 205912)
@@ -82,7 +82,6 @@
static bool themeSupportsDataListUI(InputType*);
virtual const AtomicString& formControlType() const = 0;
- virtual bool canChangeFromAnotherType() const;
// Type query functions.