diff --git a/core/includes/common.inc b/core/includes/common.inc index 45a29b2..982bc1f 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3901,8 +3901,10 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS // this is an AJAX request. // @todo Clean up container call. $container = drupal_container(); - $type = $container->get('content_negotiation')->getContentType($container->get('request')); - if (!empty($items['settings']) || $type == 'ajax') { + if ($container->has('request') && $container->has('content_negotiation')) { + $type = $container->get('content_negotiation')->getContentType($container->get('request')); + } + if (!empty($items['settings']) || (!empty($type) && $type == 'ajax')) { global $theme_key; // Provide the page with information about the theme that's used, so that // a later AJAX request can be rendered using the same theme.