Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.708
diff -u -r1.708 common.inc
--- includes/common.inc	25 Oct 2007 15:38:24 -0000	1.708
+++ includes/common.inc	25 Oct 2007 17:05:32 -0000
@@ -1786,15 +1786,20 @@
  *   (optional) If set to FALSE, the JavaScript file is loaded anew on every page
  *   call, that means, it is not cached. Defaults to TRUE. Used only when $type
  *   references a JavaScript file.
- * @param $preprocess
+ * @param $aggregate
  *   (optional) Should this JS file be aggregated if this
  *   feature has been turned on under the performance section?
+ * @param $compress
+ *   (optional) Should this JS file be compressed if aggregation
+ *   has been turned on under the performance section?
+ *   (optional) Should this CSS file be aggregated and compressed if this
+ *   feature has been turned on under the performance section?
  * @return
  *   If the first parameter is NULL, the JavaScript array that has been built so
  *   far for $scope is returned. If the first three parameters are NULL,
  *   an array with all scopes is returned.
  */
-function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer = FALSE, $cache = TRUE, $preprocess = TRUE) {
+function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer = FALSE, $cache = TRUE, $aggregate = TRUE, $compress = TRUE) {
   static $javascript = array();
 
   // Add jquery.js and drupal.js the first time a Javascript file is added.
@@ -1825,7 +1830,7 @@
         break;
       default:
         // If cache is FALSE, don't preprocess the JS file.
-        $javascript[$scope][$type][$data] = array('cache' => $cache, 'defer' => $defer, 'preprocess' => (!$cache ? FALSE : $preprocess));
+        $javascript[$scope][$type][$data] = array('cache' => $cache, 'defer' => $defer, 'aggregate' => (!$cache ? FALSE : $aggregate), 'compress' => (!$cache ? FALSE : $compress));
     }
   }
 
@@ -1892,7 +1897,7 @@
         // 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) {
-          if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {
+          if (!$info['aggregate'] || !$is_writable || !$preprocess_js) {
             $no_preprocess[$type] .= '<script type="text/javascript"'. ($info['defer'] ? ' defer="defer"' : '') .' src="'. base_path() . $path . ($info['cache'] ? '' : '?'. time()) ."\"></script>\n";
           }
           else {
@@ -1936,9 +1941,14 @@
   if (!file_exists($jspath .'/'. $filename)) {
     // Build aggregate JS file.
     foreach ($files as $path => $info) {
-      if ($info['preprocess']) {
+      if ($info['aggregate']) {
         // Append a ';' after each JS file to prevent them from running together.
-        $contents .= _drupal_compress_js(file_get_contents($path) .';');
+        $file_contents = file_get_contents($path) .';';
+        // Apply compression if set.
+        if ($info['compress']) {
+          $file_contents = _drupal_compress_js($file_contents);
+        }
+        $contents .= $file_contents;
       }
     }
 
