OLD | NEW |
1 <!-- | 1 <!-- |
2 This page enables to simulate the following scenario: | 2 This page enables to simulate the following scenario: |
3 Once a page body, but not the entire frame, is loaded, a | 3 Once a page body, but not the entire frame, is loaded, a |
4 password form is dynamically created and added to the page | 4 password form is dynamically created and added to the page |
5 body. | 5 body. |
6 | 6 |
7 Three main points to note: | 7 Three main points to note: |
8 1. The form only gets created after the body loads. Therefore | 8 1. The form only gets created after the body loads. Therefore |
9 the form is not registered during form parsing stage | 9 the form is not registered during form parsing stage |
10 (as in PasswordManager::OnPasswordFormsParsed). | 10 (as in PasswordManager::OnPasswordFormsParsed). |
11 2. The form gets created before the rendering stage, so it gets | 11 2. The form gets created before the rendering stage, so it gets |
12 registered during PasswordManager::OnPasswordFormsRendered. | 12 registered during PasswordManager::OnPasswordFormsRendered. |
13 3. The form gets created before the main frame loads. Therefore | 13 3. The form gets created before the main frame loads. Therefore |
14 the form is not registered during OnDynamicFormsSeen. | 14 the form is not registered during OnDynamicFormsSeen. |
15 | 15 |
16 The goal is to make sure that there is enough time between the form | 16 The goal is to make sure that there is enough time between the form |
17 creation and the frame load, so that OnDynamicFormsSeen is not | 17 creation and the frame load, so that OnDynamicFormsSeen is not |
18 triggered for the created form after frame load. To achieve that, | 18 triggered for the created form after frame load. To achieve that, |
19 this page contains a strange stylesheet, distilled from a much bigger | 19 this page contains a strange stylesheet, distilled from a much bigger |
20 stylesheet included in the current live.com website (that's where | 20 stylesheet included in the current live.com website (that's where |
21 http://crbug.com/367768 was demonstrated). The style uses | 21 http://crbug.com/367768 was demonstrated). The style uses |
22 some webkit-only rules for background properties. | 22 some webkit-only rules for background properties. |
23 --> | 23 --> |
24 <html> | 24 <html> |
25 <head> | 25 <head> |
| 26 <script src="form_utils.js"></script> |
26 <script> | 27 <script> |
27 function createForm() { | |
28 var form = document.createElement('form'); | |
29 form.setAttribute('action', 'done.html'); | |
30 | |
31 var username_label = document.createElement('label'); | |
32 username_label.setAttribute('for', 'username'); | |
33 username_label.innerText = 'Username: '; | |
34 var username = document.createElement('input'); | |
35 username.type = 'text'; | |
36 username.name = 'username'; | |
37 username.id = 'username'; | |
38 | |
39 var password_label = document.createElement('label'); | |
40 password_label.innerText = 'Password: '; | |
41 password_label.setAttribute('for', 'password'); | |
42 var password = document.createElement('input'); | |
43 password.type = 'password'; | |
44 password.name = 'password'; | |
45 password.id = 'password'; | |
46 | |
47 var submit = document.createElement('input'); | |
48 submit.type = 'submit'; | |
49 submit.id = 'submit-button'; | |
50 submit.value = 'Submit'; | |
51 | |
52 form.appendChild(username_label); | |
53 form.appendChild(username); | |
54 form.appendChild(password_label); | |
55 form.appendChild(password); | |
56 form.appendChild(submit); | |
57 | |
58 return form; | |
59 } | |
60 | |
61 function addForm(form) { | |
62 document.getElementsByTagName('body')[0].appendChild(form); | |
63 } | |
64 | |
65 function onLoadHandler() { | 28 function onLoadHandler() { |
66 addForm(createForm()); | 29 document.body.appendChild(createSimplePasswordForm()); |
67 } | 30 } |
68 </script> | 31 </script> |
69 <style> | 32 <style> |
70 ::-webkit-scrollbar{ | 33 ::-webkit-scrollbar{ |
71 background-color:#abc; | 34 background-color:#abc; |
72 } | 35 } |
73 ::-webkit-scrollbar:disabled{ | 36 ::-webkit-scrollbar:disabled{ |
74 background-color:#abc | 37 background-color:#abc |
75 } | 38 } |
76 ::-webkit-scrollbar-button{ | 39 ::-webkit-scrollbar-button{ |
77 background-color:#abc; | 40 background-color:#abc; |
78 background-image:url(nonexistent_image.png); | 41 background-image:url(nonexistent_image.png); |
79 } | 42 } |
80 ::-webkit-scrollbar-button:hover{ | 43 ::-webkit-scrollbar-button:hover{ |
81 background-color:#abc | 44 background-color:#abc |
82 } | 45 } |
83 ::-webkit-scrollbar-button:active{ | 46 ::-webkit-scrollbar-button:active{ |
84 background-color:#abc | 47 background-color:#abc |
85 } | 48 } |
86 ::-webkit-scrollbar-button:disabled{ | 49 ::-webkit-scrollbar-button:disabled{ |
87 background-color:#abc | 50 background-color:#abc |
88 } | 51 } |
89 </style> | 52 </style> |
90 <title>Test dynamically created password form</title> | 53 <title>Test dynamically created password form</title> |
91 </head> | 54 </head> |
92 <body onload="onLoadHandler();"> | 55 <body onload="onLoadHandler();"> |
93 This page is not empty. | 56 This page is not empty. |
94 </body> | 57 </body> |
95 </html> | 58 </html> |
OLD | NEW |