Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.870 diff -u -r1.870 common.inc --- includes/common.inc 28 Feb 2009 07:36:06 -0000 1.870 +++ includes/common.inc 28 Feb 2009 09:11:45 -0000 @@ -2339,8 +2339,7 @@ * * - Add external JavaScript ('external'): * Allows the inclusion of external JavaScript files that are not hosted on the - * local server. Note that these external JavaScript references do not get - * aggregated when preprocessing is on. + * local server. * * - Add settings ('setting'): * Adds a setting to Drupal's global storage of JavaScript settings. Per-page @@ -2411,8 +2410,7 @@ * a JavaScript file. Defaults to TRUE. * - preprocess * Aggregate the JavaScript if the JavaScript optimization setting has - * been toggled in admin/settings/performance. Note that JavaScript of - * type 'external' is not aggregated. Defaults to TRUE. + * been toggled in admin/settings/performance. Defaults to TRUE. * @return * The contructed array of JavaScript files. * @see drupal_get_js() @@ -2606,8 +2604,12 @@ break; case 'external': - // Preprocessing for external JavaScript files is ignored. - $output .= '\n"; + if (!$item['preprocess'] || !$is_writable || !$preprocess_js) { + $output .= '\n"; + } + else { + $files[$item['data']] = $item; + } break; } } @@ -2776,8 +2778,20 @@ // Build aggregate JS file. foreach ($files as $path => $info) { if ($info['preprocess']) { - // Append a ';' after each JS file to prevent them from running together. - $contents .= file_get_contents($path) . ';'; + switch ($info['type']) { + case 'file': + // Append a ';' after each JS file to prevent them from running together. + $contents .= file_get_contents($path) . ';'; + break; + case 'external': + // Request the external file. + $request = drupal_http_request($info['data']); + // Aggregate the file when the response is successful. + if ($request->code == 200) { + $contents .= $request->data . ';'; + } + break; + } } }