diff --git a/core/includes/module.inc b/core/includes/module.inc
index 60c403542917beb852f5df9c7b78d2d0f904181f..df9c138c725cbb5cf3a0afa645880b150d057458 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -176,7 +176,6 @@ function system_list($type) {
         }
         // Build a list of filenames so drupal_get_filename can use it.
         if ($record->status) {
-          drupal_classloader_register($record->name, dirname($record->filename));
           $lists['filepaths'][] = array('type' => $record->type, 'name' => $record->name, 'filepath' => $record->filename);
         }
       }
@@ -210,6 +209,7 @@ function system_list($type) {
     // drupal_get_filename() static cache with all enabled modules and themes.
     foreach ($lists['filepaths'] as $item) {
       drupal_get_filename($item['type'], $item['name'], $item['filepath']);
+      drupal_classloader_register($item['name'], dirname($item['filepath']));
     }
   }
 
diff --git a/core/modules/simpletest/tests/module.test b/core/modules/simpletest/tests/module.test
index 81f4a6b3f2be52b22de68d1679a15ba50b9d11bd..19acf608d89809bfa5e7364d5adbcdc8b3ffcf10 100644
--- a/core/modules/simpletest/tests/module.test
+++ b/core/modules/simpletest/tests/module.test
@@ -260,13 +260,19 @@ class ModuleClassLoaderTestCase extends DrupalWebTestCase {
 
     module_enable(array('module_test', 'module_autoload_test'), FALSE);
     $this->resetAll();
-    $this->drupalGet('module-test/class-loading');
-    $this->assertText($expected, t('Autoloader loads classes from an enabled module.'));
+    // Check twice to test an unprimed and primed system_list() cache.
+    for ($i=0; $i<2; $i++) {
+      $this->drupalGet('module-test/class-loading');
+      $this->assertText($expected, t('Autoloader loads classes from an enabled module.'));
+    }
 
     module_disable(array('module_autoload_test'), FALSE);
     $this->resetAll();
-    $this->drupalGet('module-test/class-loading');
-    $this->assertNoText($expected, t('Autoloader does not load classes from a disabled module.'));
+    // Check twice to test an unprimed and primed system_list() cache.
+    for ($i=0; $i<2; $i++) {
+      $this->drupalGet('module-test/class-loading');
+      $this->assertNoText($expected, t('Autoloader does not load classes from a disabled module.'));
+    }
   }
 }