Skip to content

Commit 927f979

Browse files
committed
Ensure v33 v34 compatibility
1 parent afee3c1 commit 927f979

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

frameworks/js-bindings/bindings/manual/ScriptingCore.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,13 +593,19 @@ void ScriptingCore::createGlobalContext() {
593593
#if defined(JS_GC_ZEAL) && defined(DEBUG)
594594
//JS_SetGCZeal(this->_cx, 2, JS_DEFAULT_ZEAL_FREQ);
595595
#endif
596+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
596597
_global.emplace(_cx);
598+
#else
599+
_global.construct(_cx);
600+
#endif
597601
_global.ref() = NewGlobalObject(_cx);
598602

599603
JSAutoCompartment ac(_cx, _global.ref());
600604

605+
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
601606
// Removed in Firefox v34
602-
// js::SetDefaultObjectForContext(_cx, _global.ref());
607+
js::SetDefaultObjectForContext(_cx, _global.ref());
608+
#endif
603609

604610
for (std::vector<sc_register_sth>::iterator it = registrationList.begin(); it != registrationList.end(); it++) {
605611
sc_register_sth callback = *it;
@@ -1748,13 +1754,20 @@ bool JSBDebug_BufferWrite(JSContext* cx, unsigned argc, jsval* vp)
17481754

17491755
void ScriptingCore::enableDebugger(unsigned int port)
17501756
{
1757+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
17511758
if (_debugGlobal.isNothing())
1759+
#else
1760+
if (_debugGlobal.empty())
1761+
#endif
17521762
{
17531763
JSAutoCompartment ac0(_cx, _global.ref().get());
17541764

17551765
JS_SetDebugMode(_cx, true);
1756-
1766+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
17571767
_debugGlobal.emplace(_cx);
1768+
#else
1769+
_debugGlobal.construct(_cx);
1770+
#endif
17581771
_debugGlobal.ref() = NewGlobalObject(_cx, true);
17591772
// Adds the debugger object to root, otherwise it may be collected by GC.
17601773
//AddObjectRoot(_cx, &_debugGlobal); no need, it's persistent rooted now

0 commit comments

Comments
 (0)