Fix debugger issue

This commit is contained in:
pandamicro 2016-02-02 16:45:17 +08:00
parent fefd05e54d
commit 08056b7b02
2 changed files with 5 additions and 5 deletions

View File

@ -1975,15 +1975,17 @@ void ScriptingCore::enableDebugger(unsigned int port)
JSAutoCompartment acDebug(_cx, rootedDebugObj);
// these are used in the debug program
JS_DefineFunction(_cx, rootedDebugObj, "log", ScriptingCore::log, 0, JSPROP_READONLY | JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(_cx, rootedDebugObj, "require", ScriptingCore::executeScript, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(_cx, rootedDebugObj, "_bufferWrite", JSBDebug_BufferWrite, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(_cx, rootedDebugObj, "_enterNestedEventLoop", JSBDebug_enterNestedEventLoop, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(_cx, rootedDebugObj, "_exitNestedEventLoop", JSBDebug_exitNestedEventLoop, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(_cx, rootedDebugObj, "_getEventLoopNestLevel", JSBDebug_getEventLoopNestLevel, 0, JSPROP_READONLY | JSPROP_PERMANENT);
runScript("script/jsb_debugger.js", rootedDebugObj);
JS::RootedObject globalObj(_cx, _global.ref());
JS_WrapObject(_cx, &globalObj);
runScript("script/jsb_debugger.js", rootedDebugObj);
// prepare the debugger
jsval argv = OBJECT_TO_JSVAL(globalObj);
JS::RootedValue outval(_cx);

View File

@ -275,11 +275,9 @@ this.processInput = function (inputstr) {
this._prepareDebugger = function (global) {
window.globalDebuggee = global;
require = global.require;
this.globalDebuggee = global;
cc = global.cc;
// exports = global;
// load all functions exported in DevToolsUtils to global(exports)
require('script/debugger/DevToolsUtils.js', 'debug');
require('script/debugger/event-emitter.js', 'debug');