Title: [196890] trunk
Revision
196890
Author
[email protected]
Date
2016-02-21 19:28:55 -0800 (Sun, 21 Feb 2016)

Log Message

Add username / password attributes to HTMLAnchorElement / HTMLAreaElement
https://bugs.webkit.org/show_bug.cgi?id=154519

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/dom/interfaces-expected.txt:

Source/WebCore:

Add username / password attributes to HTMLAnchorElement / HTMLAreaElement as per:
https://html.spec.whatwg.org/#htmlhyperlinkelementutils

Firefox and Chrome already implement these.

Also stop treating null as the empty string for the HTMLHyperlinkElementUtils
attributes. This behavior does not match the specification or other browsers
(tested Firefox and Chrome).

Test: fast/dom/HTMLAnchorElement/set-href-attribute-user-pass.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::username):
(WebCore::HTMLAnchorElement::setUsername):
(WebCore::HTMLAnchorElement::password):
(WebCore::HTMLAnchorElement::setPassword):
* html/HTMLAnchorElement.h:
* html/HTMLAnchorElement.idl:
* html/HTMLAreaElement.idl:
* html/HTMLHyperlinkElementUtils.idl: Added.

LayoutTests:

* fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hash.js:
* fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-host.js:
* fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hostname.js:
* fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js:
* fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js:
* fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-search.js:
* fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt:
* fast/dom/HTMLAnchorElement/set-href-attribute-host-expected.txt:
* fast/dom/HTMLAnchorElement/set-href-attribute-hostname-expected.txt:
* fast/dom/HTMLAnchorElement/set-href-attribute-pathname-expected.txt:
* fast/dom/HTMLAnchorElement/set-href-attribute-protocol-expected.txt:
* fast/dom/HTMLAnchorElement/set-href-attribute-search-expected.txt:
Update / rebaseline tests now that we no longer treat null as the empty string.

* fast/dom/HTMLAnchorElement/set-href-attribute-user-pass-expected.txt: Added.
* fast/dom/HTMLAnchorElement/set-href-attribute-user-pass.html: Added.
Add test coverage for setting the username / password attributes.

* js/dom/dom-static-property-for-in-iteration-expected.txt:
Rebaseline now that HTMLAnchorElement / HTMLAreaElement have 2 additional
attributes: username and password.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (196889 => 196890)


--- trunk/LayoutTests/ChangeLog	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/ChangeLog	2016-02-22 03:28:55 UTC (rev 196890)
@@ -1,5 +1,34 @@
 2016-02-21  Chris Dumez  <[email protected]>
 
+        Add username / password attributes to HTMLAnchorElement / HTMLAreaElement
+        https://bugs.webkit.org/show_bug.cgi?id=154519
+
+        Reviewed by Sam Weinig.
+
+        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hash.js:
+        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-host.js:
+        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hostname.js:
+        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js:
+        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js:
+        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-search.js:
+        * fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt:
+        * fast/dom/HTMLAnchorElement/set-href-attribute-host-expected.txt:
+        * fast/dom/HTMLAnchorElement/set-href-attribute-hostname-expected.txt:
+        * fast/dom/HTMLAnchorElement/set-href-attribute-pathname-expected.txt:
+        * fast/dom/HTMLAnchorElement/set-href-attribute-protocol-expected.txt:
+        * fast/dom/HTMLAnchorElement/set-href-attribute-search-expected.txt:
+        Update / rebaseline tests now that we no longer treat null as the empty string.
+
+        * fast/dom/HTMLAnchorElement/set-href-attribute-user-pass-expected.txt: Added.
+        * fast/dom/HTMLAnchorElement/set-href-attribute-user-pass.html: Added.
+        Add test coverage for setting the username / password attributes.
+
+        * js/dom/dom-static-property-for-in-iteration-expected.txt:
+        Rebaseline now that HTMLAnchorElement / HTMLAreaElement have 2 additional
+        attributes: username and password.
+
+2016-02-21  Chris Dumez  <[email protected]>
+
         iframe/frame/object.contentDocument should be on the prototype
         https://bugs.webkit.org/show_bug.cgi?id=154409
 

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hash.js (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hash.js	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hash.js	2016-02-22 03:28:55 UTC (rev 196890)
@@ -24,13 +24,10 @@
 a.hash = "#hash#value";
 shouldBe("a.href", "'https://www.my\"d(){}|~om?ain#com/path/testurl.html#middle'");
 
-// IE8 converts null to "null", which is not the right thing to do.
-// Firefox 3.5.2 removes the '#' at the end, and it should per
-// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
 debug("Set hash to null");
 a.href = ""
 a.hash = null;
-shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html#'");
+shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html#null'");
 
 // Firefox 3.5.2 removes the '#' at the end, and it should per
 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-host.js (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-host.js	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-host.js	2016-02-22 03:28:55 UTC (rev 196890)
@@ -45,13 +45,10 @@
 a.host = "www.otherdomain.com:";
 shouldBe("a.href", "'https://www.otherdomain.com:0/path/'");
 
-// IE8 converts null to "null", which is not the right thing to do.
-// Firefox 3.5.2 allows setting the host to null, which it shouldn't per
-// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
 debug("Set host to null");
 a.href = ""
 a.host = null;
-shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
+shouldBe("a.href", "'https://null/path/'");
 
 // Both IE8 and Firefox 3.5.2 allow setting the host to empty string, which they shouldn't, per
 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hostname.js (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hostname.js	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-hostname.js	2016-02-22 03:28:55 UTC (rev 196890)
@@ -23,13 +23,10 @@
 a.hostname = "www.otherdomain.com";
 shouldBe("a.href", "'foo://www.otherdomain.com/path/'");
 
-// IE8 converts null to "null", which is not the right thing to do.
-// Firefox 3.5.2 allows setting the hostname to null, which is wrong per
-// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
 debug("Set hostname to null");
 a.href = ""
 a.hostname = null;
-shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
+shouldBe("a.href", "'https://null:8080/path/'");
 
 // Both IE8 and Firefox 3.5.2 allow setting the host to empty string, against the spec at
 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js	2016-02-22 03:28:55 UTC (rev 196890)
@@ -32,11 +32,10 @@
 a.pathname = "/it/../path";
 shouldBe("a.href", "'https://www.mydomain.com/path?key=value'");
 
-// IE8 converts null to "null", which is not the right thing to do.
 debug("Set pathname to null");
 a.href = ""
 a.pathname = null;
-shouldBe("a.href", "'https://www.mydomain.com/?key=value'");
+shouldBe("a.href", "'https://www.mydomain.com/null?key=value'");
 
 debug("Set pathname to empty string");
 a.href = ""

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js	2016-02-22 03:28:55 UTC (rev 196890)
@@ -44,11 +44,10 @@
 debug("Exception: " + e.description);
 }
 
-// IE8 converts null to "null", which is not the right thing to do.
 debug("Set protocol to null");
 a.href = ""
 a.protocol = null;
-shouldBe("a.href", "'https://www.mydomain.com/path/'");
+shouldBe("a.href", "'null://www.mydomain.com/path/'");
 
 // IE8 throws "Invalid argument" exception.
 try {

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-search.js (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-search.js	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-search.js	2016-02-22 03:28:55 UTC (rev 196890)
@@ -33,11 +33,10 @@
 a.search = "?value=key";
 shouldBe("a.href", "'bad:/|/url?value=key'");
 
-// IE8 converts null to "null", which is not the right thing to do.
 debug("Set search to null");
 a.href = ""
 a.search = null;
-shouldBe("a.href", "'https://www.mydomain.com/path/'");
+shouldBe("a.href", "'https://www.mydomain.com/path/?null'");
 
 // Firefox 3.5.2 Removes the '?', and it shouldn't, per
 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -12,7 +12,7 @@
 '#' in hash value, and illegal characters in hostname
 PASS a.href is 'https://www.my"d(){}|~om?ain#com/path/testurl.html#middle'
 Set hash to null
-PASS a.href is 'https://www.mydomain.com/path/testurl.html#'
+PASS a.href is 'https://www.mydomain.com/path/testurl.html#null'
 Set hash to empty string
 PASS a.href is 'https://www.mydomain.com/path/testurl.html#'
 Add hash to mailto: protocol

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-host-expected.txt (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-host-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-host-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -18,7 +18,7 @@
 Colon without port number
 PASS a.href is 'https://www.otherdomain.com:0/path/'
 Set host to null
-PASS a.href is 'https://www.mydomain.com:8080/path/'
+PASS a.href is 'https://null/path/'
 Set host to empty string
 PASS a.href is 'https://www.mydomain.com:8080/path/'
 Set host to URL with file: protocol

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hostname-expected.txt (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hostname-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-hostname-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -10,7 +10,7 @@
 Set hostname to URL with foo: protocol
 PASS a.href is 'foo://www.otherdomain.com/path/'
 Set hostname to null
-PASS a.href is 'https://www.mydomain.com:8080/path/'
+PASS a.href is 'https://null:8080/path/'
 Set hostname to empty string
 PASS a.href is 'https://www.mydomain.com:8080/path/'
 Set hostname to URL with 2 colons

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-pathname-expected.txt (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-pathname-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-pathname-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -12,7 +12,7 @@
 Set a pathname containing .. in it
 PASS a.href is 'https://www.mydomain.com/path?key=value'
 Set pathname to null
-PASS a.href is 'https://www.mydomain.com/?key=value'
+PASS a.href is 'https://www.mydomain.com/null?key=value'
 Set pathname to empty string
 PASS a.href is 'https://www.mydomain.com/?key=value'
 Set pathname that includes illegal characters to URL that contains illegal characters.

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol-expected.txt (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -14,7 +14,7 @@
 Set a protocol that starts with ':'
 PASS a.href is 'https://www.mydomain.com/path/'
 Set protocol to null
-PASS a.href is 'https://www.mydomain.com/path/'
+PASS a.href is 'null://www.mydomain.com/path/'
 Set protocol to empty string
 PASS a.href is 'https://www.mydomain.com/path/'
 Set protocol to http on malformed URL

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search-expected.txt (196889 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -14,7 +14,7 @@
 Set search to a malformed URL
 PASS a.href is 'bad:/|/url?value=key'
 Set search to null
-PASS a.href is 'https://www.mydomain.com/path/'
+PASS a.href is 'https://www.mydomain.com/path/?null'
 Set search to empty string
 PASS a.href is 'https://www.mydomain.com/path/?'
 PASS successfullyParsed is true

Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-user-pass-expected.txt (0 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-user-pass-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-user-pass-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -0,0 +1,13 @@
+Test setting the username / password attributes of the URL in HTMLAnchorElement.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS a.href is 'https://[email protected]:8080/path/testurl.html#middle'
+PASS a.href is 'https://user:[email protected]:8080/path/testurl.html#middle'
+PASS a.href is 'https://null:[email protected]:8080/path/testurl.html#middle'
+PASS a.href is 'https://null:[email protected]:8080/path/testurl.html#middle'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-user-pass.html (0 => 196890)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-user-pass.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-user-pass.html	2016-02-22 03:28:55 UTC (rev 196890)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('Test setting the username / password attributes of the URL in HTMLAnchorElement.');
+
+var a = document.createElement('a');
+
+a.href = ""
+a.username = "user";
+shouldBe("a.href", "'https://[email protected]:8080/path/testurl.html#middle'");
+
+a.password = "password";
+shouldBe("a.href", "'https://user:[email protected]:8080/path/testurl.html#middle'");
+
+a.username = null;
+shouldBe("a.href", "'https://null:[email protected]:8080/path/testurl.html#middle'");
+
+a.password = null;
+shouldBe("a.href", "'https://null:[email protected]:8080/path/testurl.html#middle'");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (196889 => 196890)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-22 03:28:55 UTC (rev 196890)
@@ -1,5 +1,16 @@
 2016-02-21  Chris Dumez  <[email protected]>
 
+        Add username / password attributes to HTMLAnchorElement / HTMLAreaElement
+        https://bugs.webkit.org/show_bug.cgi?id=154519
+
+        Reviewed by Sam Weinig.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+
+2016-02-21  Chris Dumez  <[email protected]>
+
         iframe/frame/object.contentDocument should be on the prototype
         https://bugs.webkit.org/show_bug.cgi?id=154409
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (196889 => 196890)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -1607,8 +1607,8 @@
 PASS HTMLAnchorElement interface: attribute href 
 PASS HTMLAnchorElement interface: attribute origin 
 PASS HTMLAnchorElement interface: attribute protocol 
-FAIL HTMLAnchorElement interface: attribute username assert_true: The prototype object must have a property "username" expected true got false
-FAIL HTMLAnchorElement interface: attribute password assert_true: The prototype object must have a property "password" expected true got false
+PASS HTMLAnchorElement interface: attribute username 
+PASS HTMLAnchorElement interface: attribute password 
 PASS HTMLAnchorElement interface: attribute host 
 PASS HTMLAnchorElement interface: attribute hostname 
 PASS HTMLAnchorElement interface: attribute port 
@@ -1633,8 +1633,8 @@
 PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "href" with the proper type (13) 
 PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "origin" with the proper type (14) 
 PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "protocol" with the proper type (15) 
-FAIL HTMLAnchorElement interface: document.createElement("a") must inherit property "username" with the proper type (16) assert_inherits: property "username" not found in prototype chain
-FAIL HTMLAnchorElement interface: document.createElement("a") must inherit property "password" with the proper type (17) assert_inherits: property "password" not found in prototype chain
+PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "username" with the proper type (16) 
+PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "password" with the proper type (17) 
 PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "host" with the proper type (18) 
 PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "hostname" with the proper type (19) 
 PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "port" with the proper type (20) 
@@ -2476,16 +2476,16 @@
 PASS HTMLAreaElement interface: attribute relList 
 PASS HTMLAreaElement interface: attribute noHref 
 PASS HTMLAreaElement interface: attribute href 
-FAIL HTMLAreaElement interface: attribute origin assert_true: The prototype object must have a property "origin" expected true got false
-FAIL HTMLAreaElement interface: attribute protocol assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
-FAIL HTMLAreaElement interface: attribute username assert_true: The prototype object must have a property "username" expected true got false
-FAIL HTMLAreaElement interface: attribute password assert_true: The prototype object must have a property "password" expected true got false
-FAIL HTMLAreaElement interface: attribute host assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
-FAIL HTMLAreaElement interface: attribute hostname assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
-FAIL HTMLAreaElement interface: attribute port assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
-FAIL HTMLAreaElement interface: attribute pathname assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
-FAIL HTMLAreaElement interface: attribute search assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
-FAIL HTMLAreaElement interface: attribute hash assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
+FAIL HTMLAreaElement interface: attribute origin assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
+PASS HTMLAreaElement interface: attribute protocol 
+PASS HTMLAreaElement interface: attribute username 
+PASS HTMLAreaElement interface: attribute password 
+PASS HTMLAreaElement interface: attribute host 
+PASS HTMLAreaElement interface: attribute hostname 
+PASS HTMLAreaElement interface: attribute port 
+PASS HTMLAreaElement interface: attribute pathname 
+PASS HTMLAreaElement interface: attribute search 
+PASS HTMLAreaElement interface: attribute hash 
 PASS HTMLAreaElement must be primary interface of document.createElement("area") 
 PASS Stringification of document.createElement("area") 
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "alt" with the proper type (0) 
@@ -2498,10 +2498,10 @@
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "relList" with the proper type (7) 
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "noHref" with the proper type (8) 
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "href" with the proper type (9) 
-FAIL HTMLAreaElement interface: document.createElement("area") must inherit property "origin" with the proper type (10) assert_inherits: property "origin" not found in prototype chain
+PASS HTMLAreaElement interface: document.createElement("area") must inherit property "origin" with the proper type (10) 
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "protocol" with the proper type (11) 
-FAIL HTMLAreaElement interface: document.createElement("area") must inherit property "username" with the proper type (12) assert_inherits: property "username" not found in prototype chain
-FAIL HTMLAreaElement interface: document.createElement("area") must inherit property "password" with the proper type (13) assert_inherits: property "password" not found in prototype chain
+PASS HTMLAreaElement interface: document.createElement("area") must inherit property "username" with the proper type (12) 
+PASS HTMLAreaElement interface: document.createElement("area") must inherit property "password" with the proper type (13) 
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "host" with the proper type (14) 
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "hostname" with the proper type (15) 
 PASS HTMLAreaElement interface: document.createElement("area") must inherit property "port" with the proper type (16) 

Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (196889 => 196890)


--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -19,15 +19,17 @@
 PASS a["shape"] is 
 PASS a["target"] is 
 PASS a["type"] is 
-PASS a["hash"] is 
+PASS a["text"] is nerget
+PASS a["relList"] is 
+PASS a["origin"] is file://
+PASS a["protocol"] is file:
+PASS a["username"] is 
+PASS a["password"] is 
 PASS a["host"] is 
 PASS a["hostname"] is 
 PASS a["port"] is 
-PASS a["protocol"] is file:
 PASS a["search"] is 
-PASS a["origin"] is file://
-PASS a["text"] is nerget
-PASS a["relList"] is 
+PASS a["hash"] is 
 PASS a["title"] is 
 PASS a["lang"] is 
 PASS a["translate"] is true
@@ -47,7 +49,7 @@
 PASS a["style"] is [object CSSStyleDeclaration]
 PASS a["id"] is foo
 PASS a["offsetLeft"] is 8
-PASS a["offsetTop"] is 744
+PASS a["offsetTop"] is 774
 PASS a["offsetWidth"] is 40
 PASS a["offsetHeight"] is 18
 PASS a["clientLeft"] is 0

Modified: trunk/Source/WebCore/CMakeLists.txt (196889 => 196890)


--- trunk/Source/WebCore/CMakeLists.txt	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-02-22 03:28:55 UTC (rev 196890)
@@ -462,6 +462,7 @@
     html/HTMLHeadElement.idl
     html/HTMLHeadingElement.idl
     html/HTMLHtmlElement.idl
+    html/HTMLHyperlinkElementUtils.idl
     html/HTMLIFrameElement.idl
     html/HTMLImageElement.idl
     html/HTMLInputElement.idl

Modified: trunk/Source/WebCore/ChangeLog (196889 => 196890)


--- trunk/Source/WebCore/ChangeLog	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/ChangeLog	2016-02-22 03:28:55 UTC (rev 196890)
@@ -1,5 +1,36 @@
 2016-02-21  Chris Dumez  <[email protected]>
 
+        Add username / password attributes to HTMLAnchorElement / HTMLAreaElement
+        https://bugs.webkit.org/show_bug.cgi?id=154519
+
+        Reviewed by Sam Weinig.
+
+        Add username / password attributes to HTMLAnchorElement / HTMLAreaElement as per:
+        https://html.spec.whatwg.org/#htmlhyperlinkelementutils
+
+        Firefox and Chrome already implement these.
+
+        Also stop treating null as the empty string for the HTMLHyperlinkElementUtils
+        attributes. This behavior does not match the specification or other browsers
+        (tested Firefox and Chrome).
+
+        Test: fast/dom/HTMLAnchorElement/set-href-attribute-user-pass.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::username):
+        (WebCore::HTMLAnchorElement::setUsername):
+        (WebCore::HTMLAnchorElement::password):
+        (WebCore::HTMLAnchorElement::setPassword):
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAnchorElement.idl:
+        * html/HTMLAreaElement.idl:
+        * html/HTMLHyperlinkElementUtils.idl: Added.
+
+2016-02-21  Chris Dumez  <[email protected]>
+
         iframe/frame/object.contentDocument should be on the prototype
         https://bugs.webkit.org/show_bug.cgi?id=154409
 

Modified: trunk/Source/WebCore/DerivedSources.make (196889 => 196890)


--- trunk/Source/WebCore/DerivedSources.make	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/DerivedSources.make	2016-02-22 03:28:55 UTC (rev 196890)
@@ -376,6 +376,7 @@
     $(WebCore)/html/HTMLHeadElement.idl \
     $(WebCore)/html/HTMLHeadingElement.idl \
     $(WebCore)/html/HTMLHtmlElement.idl \
+    $(WebCore)/html/HTMLHyperlinkElementUtils.idl \
     $(WebCore)/html/HTMLIFrameElement.idl \
     $(WebCore)/html/HTMLImageElement.idl \
     $(WebCore)/html/HTMLInputElement.idl \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (196889 => 196890)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-02-22 03:28:55 UTC (rev 196890)
@@ -10518,6 +10518,7 @@
 		830784B01C52EE1900104D1D /* XMLDocument.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLDocument.idl; sourceTree = "<group>"; };
 		830784B11C52EE1900104D1D /* XMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocument.h; sourceTree = "<group>"; };
 		831D1F291C56ECA000F5F6C0 /* HTMLDataElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataElement.cpp; sourceTree = "<group>"; };
+		8329DCC21C7A6AE300730B33 /* HTMLHyperlinkElementUtils.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLHyperlinkElementUtils.idl; sourceTree = "<group>"; };
 		832B843319D8E55100B26055 /* SVGAnimateElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimateElementBase.h; sourceTree = "<group>"; };
 		832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateElementBase.cpp; sourceTree = "<group>"; };
 		8348BFA91B85729500912F36 /* ClassCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassCollection.cpp; sourceTree = "<group>"; };
@@ -19194,6 +19195,7 @@
 				A871DE1A0A152AC800B12A68 /* HTMLHtmlElement.cpp */,
 				A871DE1B0A152AC800B12A68 /* HTMLHtmlElement.h */,
 				1A85B17D0A1B183600D8C87C /* HTMLHtmlElement.idl */,
+				8329DCC21C7A6AE300730B33 /* HTMLHyperlinkElementUtils.idl */,
 				A871DE180A152AC800B12A68 /* HTMLIFrameElement.cpp */,
 				A871DE1E0A152AC800B12A68 /* HTMLIFrameElement.h */,
 				855542970AA4938800BA89F2 /* HTMLIFrameElement.idl */,

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (196889 => 196890)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2016-02-22 03:28:55 UTC (rev 196890)
@@ -391,6 +391,30 @@
     setHref(url.string());
 }
 
+String HTMLAnchorElement::username() const
+{
+    return href().encodedUser();
+}
+
+void HTMLAnchorElement::setUsername(const String& value)
+{
+    URL url = ""
+    url.setUser(value);
+    setHref(url.string());
+}
+
+String HTMLAnchorElement::password() const
+{
+    return href().encodedPass();
+}
+
+void HTMLAnchorElement::setPassword(const String& value)
+{
+    URL url = ""
+    url.setPass(value);
+    setHref(url.string());
+}
+
 String HTMLAnchorElement::hostname() const
 {
     return href().host();

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.h (196889 => 196890)


--- trunk/Source/WebCore/html/HTMLAnchorElement.h	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.h	2016-02-22 03:28:55 UTC (rev 196890)
@@ -73,6 +73,12 @@
     String host() const;
     void setHost(const String&);
 
+    String username() const;
+    void setUsername(const String&);
+
+    String password() const;
+    void setPassword(const String&);
+
     String hostname() const;
     void setHostname(const String&);
 

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.idl (196889 => 196890)


--- trunk/Source/WebCore/html/HTMLAnchorElement.idl	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.idl	2016-02-22 03:28:55 UTC (rev 196890)
@@ -22,7 +22,6 @@
     [Reflect] attribute DOMString charset;
     [Reflect] attribute DOMString coords;
     [Conditional=DOWNLOAD_ATTRIBUTE, Reflect] attribute DOMString download;
-    [Reflect, URL] attribute DOMString href;
     [Reflect] attribute DOMString hreflang;
     [Reflect] attribute DOMString name;
 
@@ -41,23 +40,8 @@
 #endif
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    readonly attribute DOMString hash;
-    readonly attribute DOMString host;
-    readonly attribute DOMString hostname;
-    readonly attribute DOMString pathname;
-    readonly attribute DOMString port;
-    readonly attribute DOMString protocol;
-    readonly attribute DOMString search;
     readonly attribute DOMString text;
 #else
-    [TreatNullAs=NullString] attribute DOMString hash;
-    [TreatNullAs=NullString] attribute DOMString host;
-    [TreatNullAs=NullString] attribute DOMString hostname;
-    [TreatNullAs=NullString] attribute DOMString pathname;
-    [TreatNullAs=NullString] attribute DOMString port;
-    [TreatNullAs=NullString] attribute DOMString protocol;
-    [TreatNullAs=NullString] attribute DOMString search;
-    [TreatNullAs=NullString] readonly attribute DOMString origin;
     [SetterRaisesException]  attribute DOMString text;
 #endif
 
@@ -73,3 +57,4 @@
     [PutForwards=value] readonly attribute DOMTokenList relList;
 };
 
+HTMLAnchorElement implements HTMLHyperlinkElementUtils;

Modified: trunk/Source/WebCore/html/HTMLAreaElement.idl (196889 => 196890)


--- trunk/Source/WebCore/html/HTMLAreaElement.idl	2016-02-22 03:27:44 UTC (rev 196889)
+++ trunk/Source/WebCore/html/HTMLAreaElement.idl	2016-02-22 03:28:55 UTC (rev 196890)
@@ -21,7 +21,6 @@
 interface HTMLAreaElement : HTMLElement {
     [Reflect] attribute DOMString alt;
     [Reflect] attribute DOMString coords;
-    [Reflect, URL] attribute DOMString href;
     [Reflect] attribute boolean noHref;
 
     // FIXME: This is supposed to be:
@@ -35,14 +34,6 @@
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     [Reflect] attribute DOMString accessKey;
 #endif
-    // IE Extensions
-    readonly attribute DOMString hash;
-    readonly attribute DOMString host;
-    readonly attribute DOMString hostname;
-    readonly attribute DOMString pathname;
-    readonly attribute DOMString port;
-    readonly attribute DOMString protocol;
-    readonly attribute DOMString search;
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     // Objective-C extension:
@@ -52,3 +43,4 @@
     [PutForwards=value] readonly attribute DOMTokenList relList;
 };
 
+HTMLAreaElement implements HTMLHyperlinkElementUtils;

Added: trunk/Source/WebCore/html/HTMLHyperlinkElementUtils.idl (0 => 196890)


--- trunk/Source/WebCore/html/HTMLHyperlinkElementUtils.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/HTMLHyperlinkElementUtils.idl	2016-02-22 03:28:55 UTC (rev 196890)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    NoInterfaceObject
+] interface HTMLHyperlinkElementUtils {
+    [Reflect, URL] attribute DOMString href;
+    readonly attribute DOMString origin;
+
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+    readonly attribute DOMString protocol;
+    readonly attribute DOMString host;
+    readonly attribute DOMString hostname;
+    readonly attribute DOMString port;
+    readonly attribute DOMString pathname;
+    readonly attribute DOMString search;
+    readonly attribute DOMString hash;
+#else
+    attribute DOMString protocol;
+    attribute DOMString username;
+    attribute DOMString password;
+    attribute DOMString host;
+    attribute DOMString hostname;
+    attribute DOMString port;
+    attribute DOMString pathname;
+    attribute DOMString search;
+    attribute DOMString hash;
+#endif
+};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to