Index: includes/ajax.inc
===================================================================
--- includes/ajax.inc	(revision 28139)
+++ includes/ajax.inc	(working copy)
@@ -461,11 +461,18 @@
       case 'inline':
         // presently we ignore inline javascript.
         break;
+      case 'theme':
+        // Prevent JS from the wrong theme from loading.
+        // The theme JS should already be loaded anyway.
+        break;
       default:
         // If JS preprocessing is off, we still need to output the scripts.
         // Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones.
         foreach ($data as $path => $info) {
-          $js_files[] = base_path() . $path . ($info['cache'] ? $query_string : '?' . time());
+          // Never re-add the jQuery library
+          if (strpos($path, 'misc/jquery.js') !== 0) {
+            $js_files[] = base_path() . $path . ($info['cache'] ? $query_string : '?' . time());
+          }
         }
     }
   }
