diff --git a/core/includes/common.inc b/core/includes/common.inc
index bb14e95fb34b90973651ccb85d1c48acaf3f0683..9ec3d0d5fa5a973c20725e33f5dbabb42fab47ad 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3827,7 +3827,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
 
       // Provide the page with information about the individual JavaScript files
       // used, information not otherwise available when aggregation is enabled.
-      $setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
+      $setting['ajaxPageState']['js'] = array_fill_keys(array_keys($javascript), 1);
       unset($setting['ajaxPageState']['js']['settings']);
 
       // Provide the page with information about the individual CSS files used,