OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 console.log('Test script injected!'); | 5 console.log('Test script injected!'); |
6 | 6 |
7 function getQueryParam(key, defaultVal) { | 7 function getQueryParam(key, defaultVal) { |
8 if (!defaultVal) defaultVal = ''; | 8 if (!defaultVal) defaultVal = ''; |
9 key = key.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]'); | 9 key = key.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]'); |
10 var regex = new RegExp('[\\?&]' + key + '=([^&#]*)'); | 10 var regex = new RegExp('[\\?&]' + key + '=([^&#]*)'); |
11 var qs = regex.exec(window.location.href); | 11 var qs = regex.exec(window.location.href); |
12 if (qs == null) | 12 if (qs == null) |
13 return defaultVal; | 13 return defaultVal; |
14 else | 14 else |
15 return qs[1]; | 15 return qs[1]; |
16 } | 16 } |
17 | 17 |
| 18 console.log(document.URL); |
18 if (document.URL.match(/https\:\/\/www\.google\.com\/accounts\/ServiceLogin/) || | 19 if (document.URL.match(/https\:\/\/www\.google\.com\/accounts\/ServiceLogin/) || |
19 document.URL.match(/https\:\/\/accounts\.google\.com\/ServiceLogin/) || | 20 document.URL.match(/https\:\/\/accounts\.google\.com\/ServiceLogin/) || |
20 document.URL.match( | 21 document.URL.match( |
21 /https\:\/\/gaiastaging\.corp\.google\.com\/ServiceLogin/) || | 22 /https\:\/\/gaiastaging\.corp\.google\.com\/ServiceLogin/) || |
22 document.URL.match(/https\:\/\/insecure\.com\/accounts\/ServiceLogin/)) { | 23 document.URL.match(/https\:\/\/insecure\.com\/accounts\/ServiceLogin/) || |
| 24 document.URL.match(/http\:\/\/localhost(:[0-9]*)?\/ServiceLogin/)) { |
23 var testEmail = unescape(getQueryParam('test_email')); | 25 var testEmail = unescape(getQueryParam('test_email')); |
24 var testPassword = unescape(getQueryParam('test_pwd')); | 26 var testPassword = unescape(getQueryParam('test_pwd')); |
| 27 var testContinue = unescape(getQueryParam('continue')); |
25 console.log('Got test account info: ' + testEmail + '/' + testPassword); | 28 console.log('Got test account info: ' + testEmail + '/' + testPassword); |
26 document.getElementById('Email').value = testEmail; | 29 document.getElementById('Email').value = testEmail; |
27 document.getElementById('Passwd').value = testPassword; | 30 document.getElementById('Passwd').value = testPassword; |
| 31 document.getElementById('continue').value = testContinue; |
28 console.log('Form field changed!'); | 32 console.log('Form field changed!'); |
29 if (testEmail != '') { | 33 if (testEmail != '') { |
30 document.getElementById('signIn').click(); | 34 document.getElementById('signIn').click(); |
31 console.log('Form submitted!'); | 35 console.log('Form submitted!'); |
32 } | 36 } |
33 } | 37 } |
OLD | NEW |