Need a 'getGlobalObject()' or similar function in ScriptingCore to allow access to the global Javascript object

In the Javascript/Spidermonkey implementation of ScriptingCore there is currently no way of retrieving the global Javascript object even though the global Javascript context and debug global Javascript object being available through accessor functions. Being able to retrieve the global Javascript object from ScriptingCore would be useful in cases where you need to override built-in Javascript methods provided by Cocos2dx, and for other situations. For example we needed to override the Javascript ‘log()’ function to output messages made in Javascript to our own custom destinations. This couldn’t be done without first having access to the global javascript object because JS_DefineFunction() requires this object.

Suggest adding a small accessor method like below in ‘scripting/javascript/bindings/ScriptingCore.cpp&h’ in order to provide this object to user code (if required):

class ScriptingCore : public CCScriptEngineProtocol
{
public:

    /// ... other code

    /**
     * @return The global object for the script
     */
    JSObject* getGlobalObject() {
        return global_;
    };

    /// ... other code

}

Thanks,
Darragh.

Thank you, issue #1682 was created.

Brilliant- thank you!