Index: misc/form.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/form.js,v
retrieving revision 1.11
diff -u -p -r1.11 form.js
--- misc/form.js	31 Aug 2009 05:51:07 -0000	1.11
+++ misc/form.js	11 Oct 2009 17:13:50 -0000
@@ -68,7 +68,6 @@ Drupal.behaviors.multiselectSelector = {
   }
 };
 
-
 /**
  * Automatically display the guidelines of the selected text format.
  */
@@ -86,4 +85,22 @@ Drupal.behaviors.filterGuidelines = {
   }
 };
 
+/**
+ * Prepopulate form fields with information from the visitor cookie.
+ */
+Drupal.behaviors.formPrepopulateFromCookie = {
+  attach: function (context, settings) {
+    $('form.form-prepopulate-from-cookie').once('form-prepopulate-from-cookie', function () {
+      var formContext = this;
+      $.each(['name', 'mail', 'homepage'], function () {
+        var $element = $('[name=' + this + ']', formContext);
+        var cookie = $.cookie('Drupal.visitor.' + this);
+        if ($element.length && cookie) {
+          $element.val(cookie);
+        }
+      });
+    });
+  }
+};
+
 })(jQuery);
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.783
diff -u -p -r1.783 comment.module
--- modules/comment/comment.module	10 Oct 2009 21:39:02 -0000	1.783
+++ modules/comment/comment.module	11 Oct 2009 17:17:23 -0000
@@ -1644,7 +1644,7 @@ function comment_form($form, &$form_stat
 
   if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
     $form['#attached']['library'][] = array('system', 'cookie');
-    $form['#attached']['js'][] = drupal_get_path('module', 'comment') . '/comment.js';
+    $form['#attributes']['class'][] = 'form-prepopulate-from-cookie';
   }
 
   $comment = (array) $comment;
Index: modules/contact/contact.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v
retrieving revision 1.31
diff -u -p -r1.31 contact.pages.inc
--- modules/contact/contact.pages.inc	11 Oct 2009 01:06:27 -0000	1.31
+++ modules/contact/contact.pages.inc	11 Oct 2009 17:17:57 -0000
@@ -47,7 +47,7 @@ function contact_site_form($form, &$form
 
   if (!$user->uid) {
     $form['#attached']['library'][] = array('system', 'cookie');
-    $form['#attached']['js'][] = drupal_get_path('module', 'contact') . '/contact.js';
+    $form['#attributes']['class'][] = 'form-prepopulate-from-cookie';
   }
 
   $form['#token'] = $user->uid ? $user->name . $user->mail : '';
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1062
diff -u -p -r1.1062 user.module
--- modules/user/user.module	10 Oct 2009 21:39:03 -0000	1.1062
+++ modules/user/user.module	11 Oct 2009 17:19:48 -0000
@@ -3081,6 +3081,9 @@ function user_register_form($form, &$for
   $form['#user'] = drupal_anonymous_user();
   $form['#user_category'] = 'register';
 
+  $form['#attached']['library'][] = array('system', 'cookie');
+  $form['#attributes']['class'][] = 'form-prepopulate-from-cookie';
+
   // Start with the default user account fields.
   user_account_form($form, $form_state);
 
