def __init__(self, backend, platform_backend, startup_args, find_existing=False): super(Browser, self).__init__(app_backend=backend, platform_backend=platform_backend) try: self._browser_backend = backend self._platform_backend = platform_backend self._tabs = tab_list.TabList(backend.tab_list_backend) self._browser_backend.SetBrowser(self) if find_existing: self._browser_backend.BindDevToolsClient() else: self._browser_backend.Start(startup_args) self._LogBrowserInfo() except Exception: exc_info = sys.exc_info() logging.error( 'Failed with %s while starting the browser backend.', exc_info[0].__name__) # Show the exception name only. try: self.DumpStateUponFailure() self.Close() except Exception: # pylint: disable=broad-except exception_formatter.PrintFormattedException( msg='Exception raised while closing platform backend') raise exc_info[0], exc_info[1], exc_info[2]
def __init__(self, backend, platform_backend, credentials_path): super(Browser, self).__init__(app_backend=backend, platform_backend=platform_backend) self._browser_backend = backend self._platform_backend = platform_backend self._local_server_controller = local_server.LocalServerController( platform_backend) self._tabs = tab_list.TabList(backend.tab_list_backend) self.credentials = browser_credentials.BrowserCredentials() self.credentials.credentials_path = credentials_path self._platform_backend.DidCreateBrowser(self, self._browser_backend) browser_options = self._browser_backend.browser_options self.platform.FlushDnsCache() if browser_options.clear_sytem_cache_for_browser_and_profile_on_start: if self.platform.CanFlushIndividualFilesFromSystemCache(): self.platform.FlushSystemCacheForDirectory( self._browser_backend.profile_directory) self.platform.FlushSystemCacheForDirectory( self._browser_backend.browser_directory) else: self.platform.FlushEntireSystemCache() self._browser_backend.SetBrowser(self) self._browser_backend.Start() self._platform_backend.DidStartBrowser(self, self._browser_backend) self._profiling_controller = profiling_controller.ProfilingController( self._browser_backend.profiling_controller_backend)
def __init__(self, backend, platform_backend, startup_args, find_existing=False): super(Browser, self).__init__(app_backend=backend, platform_backend=platform_backend) try: self._browser_backend = backend self._platform_backend = platform_backend self._tabs = tab_list.TabList(backend.tab_list_backend) self._browser_backend.SetBrowser(self) if find_existing: self._browser_backend.BindDevToolsClient() else: # TODO(crbug.com/787834): Move url computation out of the browser # backend and into the callers of this constructor. startup_url = self._browser_backend.GetBrowserStartupUrl() self._browser_backend.Start(startup_args, startup_url=startup_url) self._LogBrowserInfo() except Exception: exc_info = sys.exc_info() logging.error( 'Failed with %s while starting the browser backend.', exc_info[0].__name__) # Show the exception name only. try: self.DumpStateUponFailure() self.Close() except Exception: # pylint: disable=broad-except exception_formatter.PrintFormattedException( msg='Exception raised while closing platform backend') raise exc_info[0], exc_info[1], exc_info[2]
def __init__(self, backend, platform_backend, startup_args): super(Browser, self).__init__(app_backend=backend, platform_backend=platform_backend) try: self._browser_backend = backend self._platform_backend = platform_backend self._tabs = tab_list.TabList(backend.tab_list_backend) self._browser_backend.SetBrowser(self) # TODO(crbug.com/787834): Move the statup args and url computation out # of the browser backend and into the callers of this constructor. startup_args = list(startup_args) startup_args.extend(self._browser_backend.GetBrowserStartupArgs()) startup_url = self._browser_backend.GetBrowserStartupUrl() self._browser_backend.Start(startup_args, startup_url=startup_url) self._LogBrowserInfo() self._profiling_controller = profiling_controller.ProfilingController( self._browser_backend.profiling_controller_backend) except Exception: exc_info = sys.exc_info() logging.error( 'Failed with %s while starting the browser backend.', exc_info[0].__name__) # Show the exception name only. try: self.Close() except Exception: # pylint: disable=broad-except exception_formatter.PrintFormattedException( msg='Exception raised while closing platform backend') raise exc_info[0], exc_info[1], exc_info[2]
def __init__(self, backend, platform_backend): super(Browser, self).__init__(app_backend=backend, platform_backend=platform_backend) try: self._browser_backend = backend self._platform_backend = platform_backend self._tabs = tab_list.TabList(backend.tab_list_backend) self._platform_backend.DidCreateBrowser(self, self._browser_backend) self._browser_backend.SetBrowser(self) self._browser_backend.Start() self._LogBrowserInfo() self._platform_backend.DidStartBrowser(self, self._browser_backend) self._profiling_controller = profiling_controller.ProfilingController( self._browser_backend.profiling_controller_backend) except Exception: exc_info = sys.exc_info() logging.error( 'Failed with %s while starting the browser backend.', exc_info[0].__name__) # Show the exception name only. try: self.Close() except Exception: # pylint: disable=broad-except exception_formatter.PrintFormattedException( msg='Exception raised while closing platform backend') raise exc_info[0], exc_info[1], exc_info[2]
def __init__(self, backend, platform_backend, startup_args, find_existing=False): super(Browser, self).__init__(app_backend=backend, platform_backend=platform_backend) try: self._browser_backend = backend self._platform_backend = platform_backend self._tabs = tab_list.TabList(backend.tab_list_backend) self._browser_backend.SetBrowser(self) if find_existing: self._browser_backend.BindDevToolsClient() else: self._browser_backend.Start(startup_args) self._LogBrowserInfo() except Exception: self.DumpStateUponFailure() self.Close() raise
def __init__(self, backend, platform_backend, credentials_path): super(Browser, self).__init__(app_backend=backend, platform_backend=platform_backend) try: self._browser_backend = backend self._platform_backend = platform_backend self._tabs = tab_list.TabList(backend.tab_list_backend) self.credentials = browser_credentials.BrowserCredentials() self.credentials.credentials_path = credentials_path self._platform_backend.DidCreateBrowser(self, self._browser_backend) browser_options = self._browser_backend.browser_options self.platform.FlushDnsCache() if browser_options.clear_sytem_cache_for_browser_and_profile_on_start: if self.platform.CanFlushIndividualFilesFromSystemCache(): self.platform.FlushSystemCacheForDirectory( self._browser_backend.profile_directory) self.platform.FlushSystemCacheForDirectory( self._browser_backend.browser_directory) elif self.platform.SupportFlushEntireSystemCache(): self.platform.FlushEntireSystemCache() else: logging.warning('Flush system cache is not supported. ' + 'Did not flush system cache.') self._browser_backend.SetBrowser(self) self._browser_backend.Start() self._LogBrowserInfo() self._platform_backend.DidStartBrowser(self, self._browser_backend) self._profiling_controller = profiling_controller.ProfilingController( self._browser_backend.profiling_controller_backend) except Exception: exc_info = sys.exc_info() logging.error( 'Failed with %s while starting the browser backend.', exc_info[0].__name__) # Show the exception name only. try: self._platform_backend.WillCloseBrowser( self, self._browser_backend) except Exception: exception_formatter.PrintFormattedException( msg='Exception raised while closing platform backend') raise exc_info[0], exc_info[1], exc_info[2]