Index: chrome/test/data/password/between_parsing_and_rendering.html |
diff --git a/chrome/test/data/password/between_parsing_and_rendering.html b/chrome/test/data/password/between_parsing_and_rendering.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..320c1b751c6e2ed241f18a3558a3e15ec990e95d |
--- /dev/null |
+++ b/chrome/test/data/password/between_parsing_and_rendering.html |
@@ -0,0 +1,95 @@ |
+<!-- |
+This page enables to simulate the following scenario: |
+Once a page body, but not the entire frame, is loaded, a |
+password form is dynamically created and added to the page |
+body. |
+ |
+Three main points to note: |
+1. The form only gets created after the body loads. Therefore |
+ the form is not registered during form parsing stage |
+ (as in PasswordManager::OnPasswordFormsParsed). |
+2. The form gets created before the rendering stage, so it gets |
+ registered during PasswordManager::OnPasswordFormsRendered. |
+3. The form gets created before the main frame loads. Therefore |
+ the form is not registered during OnDynamicFormsSeen. |
+ |
+The goal is to make sure that there is enough time between the form |
+creation and the frame load, so that OnDynamicFormsSeen is not |
+triggered for the created form after frame load. To achieve that, |
+this page contains a strange stylesheet, distilled from a much bigger |
+stylesheet included in the current live.com website (that's where |
+http://crbug.com/367768 was demonstrated). The style uses |
+some webkit-only rules for background properties. |
+--> |
+<html> |
+ <head> |
+ <script> |
+function createForm() { |
+ var form = document.createElement('form'); |
+ form.setAttribute('action', 'done.html'); |
+ |
+ var username_label = document.createElement('label'); |
+ username_label.setAttribute('for', 'username'); |
+ username_label.innerText = 'Username: '; |
+ var username = document.createElement('input'); |
+ username.type = 'text'; |
+ username.name = 'username'; |
+ username.id = 'username'; |
+ |
+ var password_label = document.createElement('label'); |
+ password_label.innerText = 'Password: '; |
+ password_label.setAttribute('for', 'password'); |
+ var password = document.createElement('input'); |
+ password.type = 'password'; |
+ password.name = 'password'; |
+ password.id = 'password'; |
+ |
+ var submit = document.createElement('input'); |
+ submit.type = 'submit'; |
+ submit.id = 'submit-button'; |
+ submit.value = 'Submit'; |
+ |
+ form.appendChild(username_label); |
+ form.appendChild(username); |
+ form.appendChild(password_label); |
+ form.appendChild(password); |
+ form.appendChild(submit); |
+ |
+ return form; |
+} |
+ |
+function addForm(form) { |
+ document.getElementsByTagName('body')[0].appendChild(form); |
+} |
+ |
+function onLoadHandler() { |
+ addForm(createForm()); |
+} |
+ </script> |
+ <style> |
+::-webkit-scrollbar{ |
+ background-color:#abc; |
+} |
+::-webkit-scrollbar:disabled{ |
+ background-color:#abc |
+} |
+::-webkit-scrollbar-button{ |
+ background-color:#abc; |
+ background-image:url(nonexistent_image.png); |
+} |
+::-webkit-scrollbar-button:hover{ |
+ background-color:#abc |
+} |
+::-webkit-scrollbar-button:active{ |
+ background-color:#abc |
+} |
+::-webkit-scrollbar-button:disabled{ |
+ background-color:#abc |
+} |
+ </style> |
+ <title>Test dynamically created password form</title> |
+ </head> |
+ <body onload="onLoadHandler();"> |
+This page is not empty. |
+ </body> |
+</html> |