| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| description('Test getting the password attribute of a URL object.'); |
| |
| var a = new URL("about:blank"); |
| |
| debug("Default password is empty"); |
| shouldBe("a.password", "''"); |
| |
| debug("Unspecified password should return empty string"); |
| a.href = "http://example.com/"; |
| shouldBe("a.password", "''"); |
| |
| debug("Empty password should be empty"); |
| a.href = "http://a:@example.com/"; |
| shouldBe("a.password", "''"); |
| |
| debug("Regular passowrd retrieval"); |
| a.href = "http://joebob1:abc123@example.com/"; |
| shouldBe("a.password", "'abc123'"); |
| |
| debug("Password with empty username"); |
| a.href = "http://:def456@example.com/"; |
| shouldBe("a.password", "'def456'"); |
| |
| debug("Setting password"); |
| a.href = "http://@example.com/"; |
| a.password = "xyzzy"; |
| shouldBe("a.href", "'http://:xyzzy@example.com/'"); |
| |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |