コード例 #1
0
        public V8DebugScriptEngine(string name, FirebugConsole console)
        {
            if (String.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }

            if (console == null)
            {
                throw new ArgumentNullException("console");
            }

            m_name = name;

            //Create the Script Engine/
            var debuggingPort = PortUtilities.FindFreePort(IPAddress.Loopback);

            m_scriptEngine = new V8ScriptEngine(name, V8ScriptEngineFlags.DisableGlobalMembers | V8ScriptEngineFlags.EnableDebugging, debuggingPort)
            {
                AllowReflection = false,
            };

            m_scriptEngine.AddHostObject("console", console);

            //Create the connection to the debug port.
            m_debuggerConnection = new DebuggerConnection("tcp://127.0.0.1:" + debuggingPort);
            m_debuggerConnection.Connect();

            m_debuggerClient = new DebuggerClient(m_debuggerConnection);

            m_debuggerClient.ExceptionEvent  += debuggerClient_ExceptionEvent;
            m_debuggerClient.BreakpointEvent += m_debuggerClient_BreakpointEvent;

            m_currentScriptName = GetRandomScriptTargetName();
        }
コード例 #2
0
        public void Dispose()
        {
            if (m_debuggerClient != null)
            {
                m_debuggerClient.ExceptionEvent  -= debuggerClient_ExceptionEvent;
                m_debuggerClient.BreakpointEvent -= m_debuggerClient_BreakpointEvent;
                m_debuggerClient = null;
            }

            if (m_debuggerConnection != null)
            {
                m_debuggerConnection.Close();
                m_debuggerConnection.Dispose();
                m_debuggerConnection = null;
            }

            if (m_scriptEngine != null)
            {
                m_scriptEngine.Interrupt();
                m_scriptEngine.Dispose();
                m_scriptEngine = null;
            }
        }