Esempio n. 1
0
    def start(self, lua_source, sandboxed, lua_package_path,
              lua_sandbox_allowed_modules):
        self.log(lua_source)
        self.sandboxed = sandboxed
        self.lua = SplashLuaRuntime(
            sandboxed=sandboxed,
            lua_package_path=lua_package_path,
            lua_sandbox_allowed_modules=lua_sandbox_allowed_modules)
        self.splash = Splash(self.lua, self.tab, self.render_options)

        self.runner = SplashScriptRunner(
            lua=self.lua,
            splash=self.splash,
            log=self.log,
            sandboxed=sandboxed,
        )

        try:
            main_coro = self.get_main(lua_source)
        except (ValueError, lupa.LuaSyntaxError, lupa.LuaError) as e:
            raise ScriptError("lua_source: " + repr(e))

        self.runner.start(
            main_coro=main_coro,
            return_result=self.return_result,
            return_error=self.return_error,
        )
Esempio n. 2
0
    def __init__(self, **kwargs):
        super(SplashKernel, self).__init__(**kwargs)
        self.tab = init_browser()

        self.lua = SplashLuaRuntime(self.sandboxed, "", ())
        self.splash = Splash(lua=self.lua, tab=self.tab)
        self.lua.add_to_globals("splash", self.splash.get_wrapped())
        self.runner = DeferredSplashRunner(self.lua, self.splash, self.sandboxed) #, self.log_msg)
        self.completer = Completer(self.lua)
        self.inspector = Inspector(self.lua)
Esempio n. 3
0
    def __init__(self, **kwargs):
        super(SplashKernel, self).__init__(**kwargs)
        self.tab = init_browser(SplashKernel.network_manager_factory)

        self.lua = SplashLuaRuntime(self.sandboxed, "", ())
        self.exceptions = StoredExceptions()
        self.splash = Splash(lua=self.lua,
                             exceptions=self.exceptions,
                             tab=self.tab)
        self.lua.add_to_globals("splash", self.splash.get_wrapped())
        self.extras = Extras(self.lua, self.exceptions)
        self.extras.inject_to_globals()

        self.runner = DeferredSplashRunner(self.lua, self.splash,
                                           self.sandboxed)  #, self.log_msg)
        self.completer = Completer(self.lua)
        self.inspector = Inspector(self.lua)
Esempio n. 4
0
def configured_lua():
    from splash.lua_runtime import SplashLuaRuntime
    return SplashLuaRuntime(False, "", ())
Esempio n. 5
0
def configured_lua():
    from splash.lua_runtime import SplashLuaRuntime
    return SplashLuaRuntime(sandboxed=False,
                            lua_package_path="",
                            lua_sandbox_allowed_modules=())