diff --git a/core/includes/common.inc b/core/includes/common.inc
index c6f6688..9757a1e 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1420,6 +1420,10 @@ function drupal_set_time_limit($time_limit) {
 /**
  * Returns the path to a system item (module, theme, etc.).
  *
+ * This function should only be used when including a file containing PHP code;
+ * the 'module://', 'profile://' and 'theme://' stream wrappers should be used
+ * for other use cases.
+ *
  * @param $type
  *   The type of the item (i.e. theme, theme_engine, module, profile).
  * @param $name
diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php
index 54e7e7a..2e30d6d 100644
--- a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php
@@ -87,7 +87,14 @@ protected function getTarget($uri = NULL) {
       $uri = $this->uri;
     }
 
-    list($scheme, $target) = explode('://', $uri, 2);
+    $uri_parts = explode('://', $uri, 2);
+    if (count($uri_parts) === 1) {
+      // The delimiter ('://') was not found in $uri, malformed $uri passed.
+      throw new \InvalidArgumentException('Malformed $uri parameter passed: %s', $uri);
+    }
+    else {
+      list($scheme, $target) = $uri_parts;
+    }
 
     // Remove erroneous leading or trailing, forward-slashes and backslashes.
     return trim($target, '\/');
diff --git a/core/lib/Drupal/Core/StreamWrapper/ModuleStream.php b/core/lib/Drupal/Core/StreamWrapper/ModuleStream.php
new file mode 100644
index 0000000..c2951bc
--- /dev/null
+++ b/core/lib/Drupal/Core/StreamWrapper/ModuleStream.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\StreamWrapper\ModuleStream.
+ */
+
+namespace Drupal\Core\StreamWrapper;
+
+/**
+ * Defines a read-only Drupal stream wrapper base class for modules.
+ *
+ * This class extends the complete stream wrapper implementation in LocalStream.
+ * URIs such as "module://system" are expanded to a normal filesystem path
+ * such as "modules/system" and then PHP filesystem functions are
+ * invoked.
+ */
+class ModuleStream extends SystemStream {
+
+  /**
+   * Get the module name of the current URI.
+   *
+   * @param string $uri
+   *   Optional URI.
+   *
+   * @return string
+   *   The extension name.
+   */
+  public function getOwnerName($uri = NULL) {
+    $name = parent::getOwnerName($uri);
+    return \Drupal::moduleHandler()->moduleExists($name) ? $name : FALSE;
+  }
+
+  /**
+   * Gets the module's directory path.
+   *
+   * @param string $uri
+   *   Optional URI.
+   *
+   * @return string
+   *   String specifying the path.
+   */
+  public function getDirectoryPath($uri = NULL) {
+    return drupal_get_path('module', $this->getOwnerName($uri));
+  }
+
+}
diff --git a/core/lib/Drupal/Core/StreamWrapper/ProfileStream.php b/core/lib/Drupal/Core/StreamWrapper/ProfileStream.php
new file mode 100644
index 0000000..31a0c0f
--- /dev/null
+++ b/core/lib/Drupal/Core/StreamWrapper/ProfileStream.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\StreamWrapper\ProfileStream.
+ */
+
+namespace Drupal\Core\StreamWrapper;
+
+/**
+ * Defines a read-only Drupal stream wrapper base class for profiles.
+ *
+ * This class extends the complete stream wrapper implementation in LocalStream.
+ * URIs such as "profile://standard" are expanded to a normal filesystem path
+ * such as "profiles/standard" and then PHP filesystem functions are invoked.
+ *
+ * Specifying "profile://current" will return a stream for the currently
+ * installed profile.
+ */
+class ProfileStream extends SystemStream {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getOwnerName($uri = NULL) {
+    $name = parent::getOwnerName($uri);
+    $current = drupal_get_profile();
+    switch ($name) {
+      case 'current':
+      case $current:
+        return $current;
+      default:
+        return !is_null(drupal_get_filename('profile', $name)) ? $name : FALSE;
+    }
+  }
+
+  /**
+   * Gets the profile's directory path.
+   *
+   * @param string $uri
+   *   Optional URI.
+   *
+   * @return string
+   *   String specifying the path.
+   */
+  public function getDirectoryPath($uri = NULL) {
+    return drupal_get_path('profile', $this->getOwnerName($uri));
+  }
+
+}
diff --git a/core/lib/Drupal/Core/StreamWrapper/SystemStream.php b/core/lib/Drupal/Core/StreamWrapper/SystemStream.php
new file mode 100644
index 0000000..5087344
--- /dev/null
+++ b/core/lib/Drupal/Core/StreamWrapper/SystemStream.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\StreamWrapper\SystemStream.
+ */
+
+namespace Drupal\Core\StreamWrapper;
+
+/**
+ * Defines a base stream wrapper implementation.
+ *
+ * This class provides a read-only Drupal stream wrapper base class for system
+ * files such as modules, themes and profiles.
+ */
+abstract class SystemStream extends LocalReadOnlyStream {
+
+  /**
+   * Get the module, theme, or profile name of the current URI.
+   *
+   * @param string $uri
+   *   Optional URI.
+   *
+   * @return string
+   *   The extension name.
+   */
+  public function getOwnerName($uri = NULL) {
+    if (!isset($uri)) {
+      $uri = $this->uri;
+    }
+
+    $uri_parts = explode('://', $uri, 2);
+    if (count($uri_parts) === 1) {
+      // The delimiter ('://') was not found in $uri, malformed $uri passed.
+      throw new \InvalidArgumentException('Malformed $uri parameter passed: %s', $uri);
+    }
+    else {
+      list($scheme, $target) = $uri_parts;
+    }
+    // Remove the trailing filename from the path.
+    $length = strpos($target, '/');
+    return ($length === FALSE) ? $target : substr($target, 0, $length);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getTarget($uri = NULL) {
+    // If the owner doesn't exist at all, we don't extract anything.
+    if ($this->getOwnerName($uri) === FALSE) {
+      return FALSE;
+    }
+    $target = parent::getTarget($uri);
+    // Remove the preceding owner name including slash from the path.
+    $start = strpos($target, '/') + 1;
+    $target = ($start === FALSE) ? '' : substr($target, $start);
+    // Return the target if it exists in filesystem.
+    return file_exists($this->getDirectoryPath($uri) . '/' . $target) ? $target : FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getExternalUrl() {
+    $dir = $this->getDirectoryPath();
+    if (empty($dir)) {
+      return FALSE;
+    }
+
+    $path = str_replace('\\', '/', $this->getTarget());
+    return \Drupal::request()->getBaseUrl() . '/' . $dir . '/' . drupal_encode_path($path);
+  }
+
+}
diff --git a/core/lib/Drupal/Core/StreamWrapper/ThemeStream.php b/core/lib/Drupal/Core/StreamWrapper/ThemeStream.php
new file mode 100644
index 0000000..24e925b
--- /dev/null
+++ b/core/lib/Drupal/Core/StreamWrapper/ThemeStream.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\StreamWrapper\ThemeStream.
+ */
+
+namespace Drupal\Core\StreamWrapper;
+
+/**
+ * Defines a read-only Drupal stream wrapper base class for themes.
+ *
+ * This class extends the complete stream wrapper implementation in LocalStream.
+ * URIs such as "theme://bartik" are expanded to a normal filesystem path
+ * such as "themes/bartik" and then PHP filesystem functions are invoked.
+ *
+ * Specifying "theme://current" returns a stream for the current theme,
+ * "theme://default" returns a stream for the default theme, and "theme://admin"
+ * returns a stream for the admin theme.
+ */
+class ThemeStream extends SystemStream {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getOwnerName($uri = NULL) {
+    global $theme_key;
+    $name = parent::getOwnerName($uri);
+    switch ($name) {
+      case 'current':
+        return $theme_key;
+      case 'default':
+        return \Drupal::config('system.theme')->get('default');
+      case 'admin':
+        return \Drupal::config('system.theme')->get('admin');
+      default:
+        // Return name only for enabled and admin themes.
+        return drupal_theme_access($name) ? $name : FALSE;
+    }
+  }
+
+  /**
+   * Gets the theme's directory path.
+   *
+   * @param string $uri
+   *   Optional URI.
+   *
+   * @return string
+   *   String specifying the path.
+   */
+  public function getDirectoryPath($uri = NULL) {
+    return drupal_get_path('theme', $this->getOwnerName($uri));
+  }
+
+}
diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module
index 5184454..8c9419d 100644
--- a/core/modules/block/tests/modules/block_test/block_test.module
+++ b/core/modules/block/tests/modules/block_test/block_test.module
@@ -9,7 +9,7 @@
  * Implements hook_system_theme_info().
  */
 function block_test_system_theme_info() {
-  $themes['block_test_theme'] = drupal_get_path('module', 'block_test') . '/themes/block_test_theme/block_test_theme.info.yml';
+  $themes['block_test_theme'] = "module://block_test/themes/block_test_theme/block_test_theme.info.yml";
   return $themes;
 }
 
diff --git a/core/modules/breakpoint/tests/breakpoint_theme_test.module b/core/modules/breakpoint/tests/breakpoint_theme_test.module
index 765cc50..57e8888 100644
--- a/core/modules/breakpoint/tests/breakpoint_theme_test.module
+++ b/core/modules/breakpoint/tests/breakpoint_theme_test.module
@@ -8,6 +8,6 @@
  * Implements hook_system_theme_info().
  */
 function breakpoint_theme_test_system_theme_info() {
-  $themes['breakpoint_test_theme'] = drupal_get_path('module', 'breakpoint_theme_test') . '/themes/breakpoint_test_theme/breakpoint_test_theme.info.yml';
+  $themes['breakpoint_test_theme'] = "module://breakpoint_theme_test/themes/breakpoint_test_theme/breakpoint_test_theme.info.yml";
   return $themes;
 }
diff --git a/core/modules/file/tests/file_test/file_test.dummy.inc b/core/modules/file/tests/file_test/file_test.dummy.inc
new file mode 100644
index 0000000..a09fd2e
--- /dev/null
+++ b/core/modules/file/tests/file_test/file_test.dummy.inc
@@ -0,0 +1 @@
+Dummy file used by SystemStreamTest.php.
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchSimplifyTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchSimplifyTest.php
index 5b1e5d4..73efb55 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchSimplifyTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchSimplifyTest.php
@@ -30,7 +30,7 @@ function testSearchSimplifyUnicode() {
     // their own lines).  So the even-numbered lines should simplify to nothing,
     // and the odd-numbered lines we need to split into shorter chunks and
     // verify that simplification doesn't lose any characters.
-    $input = file_get_contents(DRUPAL_ROOT . '/core/modules/search/tests/UnicodeTest.txt');
+    $input = file_get_contents('module://search/tests/UnicodeTest.txt');
     $basestrings = explode(chr(10), $input);
     $strings = array();
     foreach ($basestrings as $key => $string) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/SystemStreamUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/File/SystemStreamUnitTest.php
new file mode 100644
index 0000000..74fae36
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/File/SystemStreamUnitTest.php
@@ -0,0 +1,182 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\system\Tests\File\StreamWrapperTest.
+ */
+
+namespace Drupal\system\Tests\File;
+
+use Drupal\simpletest\DrupalUnitTestBase;
+
+/**
+ * Tests stream wrapper functions.
+ */
+class SystemStreamUnitTest extends DrupalUnitTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('system', 'file', 'file_test');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'System Stream wrappers',
+      'description' => 'Unit tests system stream wrapper functions.',
+      'group' => 'File API',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+    drupal_static_reset('file_get_stream_wrappers');
+  }
+
+  function tearDown() {
+    parent::tearDown();
+  }
+
+  /**
+   * Test the Module stream wrapper functions.
+   */
+  function testModuleStream() {
+    // Generate a module stream wrapper instance
+    $uri1 = 'module://system';
+    $uri2 = 'module://system/css/system.admin.css';
+    $uri3 = 'module://file_test/file_test.dummy.inc';
+    $uri4 = 'module://file_test/includes/file_test.dummy.inc';
+    $uri5 = 'module://ckeditor/ckeditor.info.yml';
+    $uri6 = 'module://foo_bar/foo.bar.js';
+    $instance = file_stream_wrapper_get_instance_by_scheme('module');
+
+    // getOwnerName()
+    $this->assertEqual($instance->getOwnerName($uri1), 'system', 'Extract module name from a partial URI.');
+    $this->assertEqual($instance->getOwnerName($uri2), 'system', 'Extract module name for a resource located in a subdirectory.');
+    $this->assertEqual($instance->getOwnerName($uri3), 'file_test', 'Extract module name for a module located in a subdirectory.');
+    $this->assertEqual($instance->getOwnerName($uri4), 'file_test', 'Extract module name even for a non-existing resource, as long as the module exists.');
+    $this->assertFalse($instance->getOwnerName($uri5), "Fail returning a disabled module's name.");
+    $this->assertFalse($instance->getOwnerName($uri6), "Fail returning a non-existing module's name.");
+
+    // getTarget()
+    $this->assertEqual($instance->getTarget($uri1), '', 'Return empty target from a partial URI.');
+    $this->assertEqual($instance->getTarget($uri2), 'css/system.admin.css', 'Extract target for a resource located in a subdirectory.');
+    $this->assertEqual($instance->getTarget($uri3), 'file_test.dummy.inc', 'Extract target for a module in a non-standard location.');
+    $this->assertFalse($instance->getTarget($uri4), 'Fail returning a target for a non-existing resource.');
+    $this->assertFalse($instance->getTarget($uri5), "Fail returning a target within a disabled module.");
+    $this->assertFalse($instance->getTarget($uri6), "Fail returning a target within a non-existing module.");
+
+    // getDirectoryPath()
+    $this->assertEqual($instance->getDirectoryPath($uri1), 'core/modules/system', "Lookup module's directory path for a partial URI.");
+    $this->assertEqual($instance->getDirectoryPath($uri2), 'core/modules/system', "Lookup module's directory path for a resource located in a subdirectory.");
+    $this->assertEqual($instance->getDirectoryPath($uri3), 'core/modules/file/tests/file_test', "Lookup module's directory path for a module located in a subdirectory.");
+    $this->assertEqual($instance->getDirectoryPath($uri4), 'core/modules/file/tests/file_test', "Lookup module's directory path even for a non-existing resource, as long as the module exists.");
+    $this->assertFalse($instance->getDirectoryPath($uri5), "Fail returning a disabled module's directory path");
+    $this->assertFalse($instance->getDirectoryPath($uri6), "Fail returning a non-existing module's directory path.");
+  }
+
+  /**
+   * Test the Profile stream wrapper functions.
+   */
+  function testProfileStream() {
+    $uri1 = 'profile://minimal';
+    $uri2 = 'profile://minimal/config/block.block.stark.login.yml';
+    $uri3 = 'profile://minimal/config/node.type.article.yml';
+    $uri4 = 'profile://foo_bar/';
+    $uri5 = 'profile://current';
+    $uri6 = 'profile://current/standard.info.yml';
+    $instance = file_stream_wrapper_get_instance_by_scheme('profile');
+
+    // getOwnerName()
+    $this->assertEqual($instance->getOwnerName($uri1), 'minimal', "Extract profile's name from a partial URI.");
+    $this->assertEqual($instance->getOwnerName($uri2), 'minimal', "Extract profile's name for a resource located in a subdirectory.");
+    $this->assertEqual($instance->getOwnerName($uri3), 'minimal', "Extract profile's name even for a non-existing resource, as long as the profile exists.");
+    $this->assertFalse($instance->getOwnerName($uri4), "Fail returning a non-existing profile's name.");
+    $this->assertEqual($instance->getOwnerName($uri5), 'standard', format_string('Lookup real name of %current for a partial URI.', array('%current' => 'profile://current')));
+    $this->assertEqual($instance->getOwnerName($uri6), 'standard', format_string('Lookup real name of %current for a resource.', array('%current' => 'profile://current')));
+
+    // getTarget()
+    $this->assertEqual($instance->getTarget($uri1), '', 'Return empty target for a partial URI giving only the profile.');
+    $this->assertEqual($instance->getTarget($uri2), 'config/block.block.stark.login.yml', 'Extract target for a resource located in a subdirectory.');
+    $this->assertFalse($instance->getTarget($uri3), 'Fail returning a target for a non-existing resource.');
+    $this->assertFalse($instance->getTarget($uri4), 'Fail returning a target within a non-existing profile.');
+    $this->assertEqual($instance->getTarget($uri5), '', format_string('Return empty target for a partial URI giving only %current.', array('%current' => 'profile://current')));
+    $this->assertEqual($instance->getTarget($uri6), 'standard.info.yml', format_string("Extract target from a resource within %current.", array('%current' => 'profile://current')));
+
+    // getDirectoryPath()
+    $this->assertEqual($instance->getDirectoryPath($uri1), 'core/profiles/minimal', "Lookup profile's directory path for a partial URI.");
+    $this->assertEqual($instance->getDirectoryPath($uri2), 'core/profiles/minimal', "Lookup profile's directory path for a resource located in a subdirectory.");
+    $this->assertEqual($instance->getDirectoryPath($uri3), 'core/profiles/minimal', "Lookup profile's directory path even for a non-existing resource, as long as the profile exists.");
+    $this->assertFalse($instance->getDirectoryPath($uri4), "Fail returning a non-existing profile's directory path.");
+    $this->assertEqual($instance->getDirectoryPath($uri5), 'core/profiles/standard', format_string('Lookup real directory path of %current for a partial URI.', array('%current' => 'profile://current')));
+    $this->assertEqual($instance->getDirectoryPath($uri6), 'core/profiles/standard', format_string('Lookup real directory path of %current for a resource.', array('%current' => 'profile://current')));
+  }
+
+  /**
+   * Test the Theme stream wrapper functions.
+   */
+  function testThemeStream() {
+    // Disable Bartik theme
+    $system_theme_disabled = config('system.theme.disabled');
+    $this->assertNotIdentical($system_theme_disabled->get('bartik'), '0', format_string('%bartik theme was enabled.', array('%bartik' => 'Bartik')));
+    $system_theme_disabled->set('bartik', 0)->save();
+    $this->assertIdentical($system_theme_disabled->get('bartik'), '0', format_string('Now disable %bartik theme.', array('%bartik' => 'Bartik')));
+
+    // Set admin theme to Seven
+    $system_theme = config('system.theme');
+    $this->assertNull($system_theme->get('admin'), 'No admin theme was set.');
+    file_put_contents('admin.theme', print_r($system_theme->get('admin'), TRUE));
+    $system_theme->set('admin', 'seven')->save();
+    $this->assertEqual($system_theme->get('admin'), 'seven', format_string('Now make %seven the admin theme.', array('%seven' => 'Seven')));
+
+    $uri1 = 'theme://seven';
+    $uri2 = 'theme://seven/style.css';
+    $uri3 = 'theme://bartik/color/preview.js';
+    $uri4 = 'theme://fifteen/screenshot.png';
+    $uri5 = 'theme://current';
+    $uri6 = 'theme://current/logo.png';
+    $uri7 = 'theme://default';
+    $uri8 = 'theme://default/stark.info.yml';
+    $uri9 = 'theme://admin';
+    $uri10 = 'theme://admin/stark.info.yml';
+    $instance = file_stream_wrapper_get_instance_by_scheme('theme');
+
+    // getOwnerName()
+    $this->assertEqual($instance->getOwnerName($uri1), 'seven', "Extract theme's name from a partial URI.");
+    $this->assertEqual($instance->getOwnerName($uri2), 'seven', "Extract theme's name from a full URI.");
+    $this->assertEqual($instance->getOwnerName($uri3), 'bartik', "Extract theme's name from a full URI with subdirectory.");
+//    $this->assertFalse($instance->getOwnerName($uri3), "Fail returning a disabled theme's name.");
+    $this->assertFalse($instance->getOwnerName($uri4), "Fail returning a non-existing theme's name.");
+    $this->assertEqual($instance->getOwnerName($uri5), 'bla', format_string('Lookup real name of %current for a partial URI.', array('%current' => 'theme://current')) . $instance->getOwnerName($uri5));
+    $this->assertEqual($instance->getOwnerName($uri6), 'bla', format_string('Lookup real name of %current for a resource.', array('%current' => 'theme://current')) . $instance->getOwnerName($uri6));
+    $this->assertEqual($instance->getOwnerName($uri7), 'stark', format_string('Lookup real name of %default for a partial URI.', array('%default' => 'theme://default')));
+    $this->assertEqual($instance->getOwnerName($uri8), 'stark', format_string('Lookup real name of %default for a resource.', array('%default' => 'theme://default')));
+    $this->assertEqual($instance->getOwnerName($uri9), 'seven', format_string('Lookup real name of %admin for a partial URI.', array('%admin' => 'theme://admin')));
+    $this->assertEqual($instance->getOwnerName($uri10), 'seven', format_string('Lookup real name of %admin even for a non-existing resource.', array('%admin' => 'theme://admin')));
+
+    // getTarget()
+    $this->assertEqual($instance->getTarget($uri1), '', 'Return empty target for a partial URI giving only the theme.');
+    $this->assertEqual($instance->getTarget($uri2), 'style.css', 'Extract target for a resource.' . $instance->getTarget($uri3));
+    $this->assertEqual($instance->getTarget($uri3), 'color/preview.js', 'Extract target for a resource located in a subdirectory.');
+    $this->assertFalse($instance->getTarget($uri4), 'Fail returning a target within a non-existing theme.');
+    $this->assertEqual($instance->getTarget($uri5), '', format_string('Return empty target for a partial URI giving only %current.', array('%current' => 'theme://current')));
+    $this->assertEqual($instance->getTarget($uri6), 'logo.png', format_string("Extract target from a resource within %current.", array('%current' => 'theme://current')));
+    $this->assertEqual($instance->getTarget($uri7), '', format_string('Return empty target for a partial URI giving only %default.', array('%default' => 'theme://default')));
+    $this->assertEqual($instance->getTarget($uri8), 'stark.info.yml', format_string("Extract target from a resource located in a subdirectory of %default.", array('%default' => 'theme://default')) . $instance->getTarget($uri8));
+    $this->assertEqual($instance->getTarget($uri9), '', format_string('Return empty target for a partial URI giving only %admin.', array('%admin' => 'theme://admin')));
+    $this->assertFalse($instance->getTarget($uri10), format_string("Fail returning target for a non-existing resource within %admin.", array('%admin' => 'theme://admin')));
+
+    // getDirectoryPath()
+    $this->assertEqual($instance->getDirectoryPath($uri1), 'core/themes/seven', "Lookup theme's directory path for a partial URI.");
+    $this->assertEqual($instance->getDirectoryPath($uri2), 'core/themes/seven', "Lookup theme's directory path for a resource located in a subdirectory.");
+    $this->assertEqual($instance->getDirectoryPath($uri3), 'core/themes/bartik', "Lookup theme's directory path for a resource.");
+    $this->assertFalse($instance->getDirectoryPath($uri4), "Fail returning a non-existing theme's directory path.");
+    $this->assertEqual($instance->getDirectoryPath($uri5), 'core/themes/standard', format_string('Lookup real directory path of %current for a partial URI.', array('%current' => 'profile://current')));
+    $this->assertEqual($instance->getDirectoryPath($uri6), 'core/themes/standard', format_string('Lookup real directory path of %current for a resource.', array('%current' => 'profile://current')));
+    $this->assertEqual($instance->getDirectoryPath($uri7), 'core/themes/stark', format_string('Lookup real directory path of %default for a partial URI.', array('%default' => 'profile://default')));
+    $this->assertEqual($instance->getDirectoryPath($uri8), 'core/themes/stark', format_string('Lookup real directory path of %default for a resource.', array('%default' => 'profile://default')));
+    $this->assertEqual($instance->getDirectoryPath($uri9), 'core/themes/seven', format_string('Lookup real directory path of %admin for a partial URI.', array('%admin' => 'profile://admin')));
+    $this->assertEqual($instance->getDirectoryPath($uri10), 'core/themes/seven', format_string('Lookup real directory path of %admin for a resource.', array('%admin' => 'profile://admin')));
+  }
+}
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 94fbd21..140068a 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1995,6 +1995,24 @@ function system_stream_wrappers() {
       'description' => t('Temporary local files for upload and previews.'),
       'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
     ),
+    'module' => array(
+      'name' => t('Module files'),
+      'class' => 'Drupal\Core\StreamWrapper\ModuleStream',
+      'description' => t('Local module files.'),
+      'type' => STREAM_WRAPPERS_READ,
+    ),
+    'theme' => array(
+      'name' => t('Theme files'),
+      'class' => 'Drupal\Core\StreamWrapper\ThemeStream',
+      'description' => t('Local theme files.'),
+      'type' => STREAM_WRAPPERS_READ,
+    ),
+    'profile' => array(
+      'name' => t('Profile files'),
+      'class' => 'Drupal\Core\StreamWrapper\ProfileStream',
+      'description' => t('Local profile files.'),
+      'type' => STREAM_WRAPPERS_READ,
+    ),
   );
 
   // Only register the private file stream wrapper if a file path has been set.
diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module
index e358018..f28eda2 100644
--- a/core/modules/system/tests/modules/ajax_test/ajax_test.module
+++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module
@@ -53,7 +53,7 @@ function ajax_test_menu() {
  * Implements hook_system_theme_info().
  */
 function ajax_test_system_theme_info() {
-  $themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info.yml';
+  $themes['test_theme'] = "module://system/tests/themes/test_theme/test_theme.info.yml";
   return $themes;
 }
 
diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module
index 40a78f3..77241c8 100644
--- a/core/modules/system/tests/modules/theme_test/theme_test.module
+++ b/core/modules/system/tests/modules/theme_test/theme_test.module
@@ -34,10 +34,10 @@ function theme_test_theme($existing, $type, $theme, $path) {
  * Implements hook_system_theme_info().
  */
 function theme_test_system_theme_info() {
-  $themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info.yml';
-  $themes['test_basetheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_basetheme/test_basetheme.info.yml';
-  $themes['test_subtheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_subtheme/test_subtheme.info.yml';
-  $themes['test_theme_phptemplate'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme_phptemplate/test_theme_phptemplate.info.yml';
+  $themes['test_theme'] = "module://system/tests/themes/test_theme/test_theme.info.yml";
+  $themes['test_basetheme'] = "module://system/tests/themes/test_basetheme/test_basetheme.info.yml";
+  $themes['test_subtheme'] = "module://system/tests/themes/test_subtheme/test_subtheme.info.yml";
+  $themes['test_theme_phptemplate'] = "module://system/tests/themes/test_theme_phptemplate/test_theme_phptemplate.info.yml";
   return $themes;
 }
 
@@ -112,13 +112,12 @@ function theme_test_template_test_page_callback() {
  * @see http://drupal.org/node/967266#comment-3689670
  */
 function theme_test_info_stylesheets() {
-  $path = drupal_get_path('module', 'theme_test');
-  drupal_add_css("$path/css/base-override.css");
-  drupal_add_css("$path/css/base-override.sub-remove.css");
-  drupal_add_css("$path/css/base-remove.css");
-  drupal_add_css("$path/css/base-remove.sub-override.css");
-  drupal_add_css("$path/css/sub-override.css");
-  drupal_add_css("$path/css/sub-remove.css");
+  drupal_add_css("module://theme_test/css/base-override.css");
+  drupal_add_css("module://theme_test/css/base-override.sub-remove.css");
+  drupal_add_css("module://theme_test/css/base-remove.css");
+  drupal_add_css("module://theme_test/css/base-remove.sub-override.css");
+  drupal_add_css("module://theme_test/css/sub-override.css");
+  drupal_add_css("module://theme_test/css/sub-remove.css");
   return '';
 }
 
diff --git a/core/modules/update/tests/modules/update_test/update_test.module b/core/modules/update/tests/modules/update_test/update_test.module
index eef4c67..9afce15 100644
--- a/core/modules/update/tests/modules/update_test/update_test.module
+++ b/core/modules/update/tests/modules/update_test/update_test.module
@@ -12,8 +12,8 @@
  * Implements hook_system_theme_info().
  */
 function update_test_system_theme_info() {
-  $themes['update_test_basetheme'] = drupal_get_path('module', 'update') . '/tests/themes/update_test_basetheme/update_test_basetheme.info.yml';
-  $themes['update_test_subtheme'] = drupal_get_path('module', 'update') . '/tests/themes/update_test_subtheme/update_test_subtheme.info.yml';
+  $themes['update_test_basetheme'] = "module://update/tests/themes/update_test_basetheme/update_test_basetheme.info.yml";
+  $themes['update_test_subtheme'] = "module://update/tests/themes/update_test_subtheme/update_test_subtheme.info.yml";
   return $themes;
 }
 
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index 388d599..7ee64b0 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -1958,7 +1958,7 @@ public function buildOptionsForm(&$form, &$form_state) {
 
         // Field templates aren't registered the normal way...and they're always
         // this one, anyhow.
-        $output .= '<pre>' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/templates/views-view-field.tpl.php')) . '</pre>';
+        $output .= '<pre>' . check_plain(file_get_contents("module://views/templates/views-view-field.tpl.php")) . '</pre>';
 
         $form['analysis'] = array(
           '#markup' => '<div class="form-item">' . $output . '</div>',
