def get_applicable_overlays(self, error_bundle):
        """
        Given an error bundle, a list of overlays that are present in the
        current package or subpackage are returned.
        """

        content_paths = self.get_triples(subject='content')
        if not content_paths:
            return set()

        # Create some variables that will store where the applicable content
        # instruction path references and where it links to.
        chrome_path = ''
        content_root_path = '/'

        # Look through each of the listed packages and paths.
        for path in content_paths:
            chrome_name = path['predicate']
            if not path['object']:
                continue
            path_location = path['object'].strip().split()[0]

            # Handle jarred paths differently.
            if path_location.startswith('jar:'):
                if not error_bundle.is_nested_package:
                    continue

                # Parse out the JAR and it's location within the chrome.
                split_jar_url = path_location[4:].split('!', 2)
                # Ignore invalid/unsupported JAR URLs.
                if len(split_jar_url) != 2:
                    continue

                # Unpack the JAR URL.
                jar_path, package_path = split_jar_url

                # Ignore the instruction if the JAR it points to doesn't match
                # up with the current subpackage tree.
                if jar_path != error_bundle.package_stack[0]:
                    continue
                chrome_path = self._url_chunk_join(chrome_name, package_path)
                # content_root_path stays at the default: /

                break
            else:
                # If we're in a subpackage, a content instruction referring to
                # the root of the package obviously doesn't apply.
                if error_bundle.is_nested_package:
                    continue

                chrome_path = self._url_chunk_join(chrome_name, 'content')
                content_root_path = '/%s/' % path_location.strip('/')
                break

        if not chrome_path:
            return set()

        applicable_overlays = set()
        chrome_path = 'chrome://%s' % self._url_chunk_join(chrome_path + '/')

        for overlay in self.get_triples(subject='overlay'):
            if not overlay['object']:
                error_bundle.error(
                    err_id=('chromemanifest', 'get_applicable_overalys',
                            'object'),
                    error='Overlay instruction missing a property.',
                    description='When overlays are registered in a chrome '
                                'manifest file, they require a namespace and '
                                'a chrome URL at minimum.',
                    filename=overlay['filename'],
                    line=overlay['line'],
                    context=self.context)  #TODO(basta): Update this!
                continue
            overlay_url = overlay['object'].split()[0]
            if overlay_url.startswith(chrome_path):
                overlay_relative_path = overlay_url[len(chrome_path):]
                applicable_overlays.add('/%s' %
                        self._url_chunk_join(content_root_path,
                                             overlay_relative_path))

        return applicable_overlays
Given an error bundle, a list of overlays that are present in the
        current package or subpackage are returned.