diff --git includes/common.inc includes/common.inc
index 72fcf76..49ea5b2 100644
--- includes/common.inc
+++ includes/common.inc
@@ -3959,8 +3959,7 @@ function drupal_add_js($data = NULL, $options = NULL) {
   $options['weight'] += count($javascript) / 1000;
 
   if (isset($data)) {
-    // Add jquery.js and drupal.js, as well as the basePath setting, the
-    // first time a JavaScript file is added.
+    // Add basic JavaScript settings: basePath and pathPrefix
     if (empty($javascript)) {
       // url() generates the prefix using hook_url_outbound_alter(). Instead of
       // running the hook_url_outbound_alter() again here, extract the prefix
@@ -3978,17 +3977,23 @@ function drupal_add_js($data = NULL, $options = NULL) {
           'every_page' => TRUE,
           'weight' => 0,
         ),
-        'misc/drupal.js' => array(
-          'data' => 'misc/drupal.js',
-          'type' => 'file',
-          'scope' => 'header',
-          'group' => JS_LIBRARY,
-          'every_page' => TRUE,
-          'weight' => -1,
-          'preprocess' => TRUE,
-          'cache' => TRUE,
-          'defer' => FALSE,
-        ),
+      );
+    }
+
+    // Add jquery.js, jquery.once.js and drupal.js, as well as the basePath
+    // setting, the first time a JavaScript code is added. (Don't add these if
+    // only JavaScript settings have been added.)
+    if ($options['type'] != 'setting' && !isset($javascript['misc/drupal.js'])) {
+      $javascript['misc/drupal.js'] = array(
+        'data' => 'misc/drupal.js',
+        'type' => 'file',
+        'scope' => 'header',
+        'group' => JS_LIBRARY,
+        'every_page' => TRUE,
+        'weight' => -1,
+        'preprocess' => TRUE,
+        'cache' => TRUE,
+        'defer' => FALSE,
       );
       // Register all required libraries.
       drupal_add_library('system', 'jquery', TRUE);
