@@ -593,13 +593,19 @@ void ScriptingCore::createGlobalContext() {
593
593
#if defined(JS_GC_ZEAL) && defined(DEBUG)
594
594
// JS_SetGCZeal(this->_cx, 2, JS_DEFAULT_ZEAL_FREQ);
595
595
#endif
596
+ #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
596
597
_global.emplace (_cx);
598
+ #else
599
+ _global.construct (_cx);
600
+ #endif
597
601
_global.ref () = NewGlobalObject (_cx);
598
602
599
603
JSAutoCompartment ac (_cx, _global.ref ());
600
604
605
+ #if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
601
606
// Removed in Firefox v34
602
- // js::SetDefaultObjectForContext(_cx, _global.ref());
607
+ js::SetDefaultObjectForContext (_cx, _global.ref ());
608
+ #endif
603
609
604
610
for (std::vector<sc_register_sth>::iterator it = registrationList.begin (); it != registrationList.end (); it++) {
605
611
sc_register_sth callback = *it;
@@ -1748,13 +1754,20 @@ bool JSBDebug_BufferWrite(JSContext* cx, unsigned argc, jsval* vp)
1748
1754
1749
1755
void ScriptingCore::enableDebugger (unsigned int port)
1750
1756
{
1757
+ #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
1751
1758
if (_debugGlobal.isNothing ())
1759
+ #else
1760
+ if (_debugGlobal.empty ())
1761
+ #endif
1752
1762
{
1753
1763
JSAutoCompartment ac0 (_cx, _global.ref ().get ());
1754
1764
1755
1765
JS_SetDebugMode (_cx, true );
1756
-
1766
+ # if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
1757
1767
_debugGlobal.emplace (_cx);
1768
+ #else
1769
+ _debugGlobal.construct (_cx);
1770
+ #endif
1758
1771
_debugGlobal.ref () = NewGlobalObject (_cx, true );
1759
1772
// Adds the debugger object to root, otherwise it may be collected by GC.
1760
1773
// AddObjectRoot(_cx, &_debugGlobal); no need, it's persistent rooted now
0 commit comments