From 928964bd70d9454303c88f21d904ea188588714f Mon Sep 17 00:00:00 2001 From: pandamicro Date: Mon, 9 Oct 2017 15:26:01 +0800 Subject: [PATCH 01/16] Fix 0 id causing assert failure issue --- jsb/jsb-etc.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jsb/jsb-etc.js b/jsb/jsb-etc.js index 7ebd6a08d4..1bbf2754d0 100644 --- a/jsb/jsb-etc.js +++ b/jsb/jsb-etc.js @@ -67,7 +67,7 @@ cc.Scheduler.prototype.schedule = function (callback, target, interval, repeat, } delay = delay || 0; var instanceId = target.__instanceId || target.uuid; - cc.assertID(instanceId, 1510); + cc.assertID(!isNaN(instanceId), 1510); if (!callback.__callbackId) { callback.__callbackId = _callbackId++; } @@ -83,7 +83,7 @@ cc.Scheduler.prototype.unschedule = function (callback, target) { callback = tmp; } var instanceId = target.__instanceId || target.uuid; - cc.assertID(instanceId && callback.__callbackId, 1510); + cc.assertID(!isNaN(instanceId) && !isNaN(callback.__callbackId), 1510); var key = instanceId + '_' + callback.__callbackId; this._unschedule(key, target); }; @@ -100,6 +100,7 @@ cc.view.setOrientation = function () {}; var _windowTimeIntervalId = 0; var _windowTimeFunHash = {}; var WindowTimeFun = function (code) { + this.__instanceId = cc.ClassManager.getNewInstanceId(); this._intervalId = _windowTimeIntervalId++; this._code = code; }; From cb834c99e791dff45d440a99d4316b4d384643f2 Mon Sep 17 00:00:00 2001 From: 2youyouo2 <501251991@qq.com> Date: Mon, 9 Oct 2017 15:29:59 +0800 Subject: [PATCH 02/16] fixed radial sprite culling --- cocos2d/core/sprites/CCScale9Sprite.js | 29 +++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/cocos2d/core/sprites/CCScale9Sprite.js b/cocos2d/core/sprites/CCScale9Sprite.js index fcc6ddf1f5..c53f49f990 100644 --- a/cocos2d/core/sprites/CCScale9Sprite.js +++ b/cocos2d/core/sprites/CCScale9Sprite.js @@ -753,10 +753,29 @@ var fillQuadGeneratorRadial = { } sprite._vertCount = count; - cornerId[0] = 0; // bl - cornerId[1] = 2; // br - cornerId[2] = 4; // tl - cornerId[3] = 6; // tr + var minx = Infinity, miny = Infinity, maxx = -Infinity, maxy = -Infinity; + var x, y; + for (var i = 0, l = offset; i < l; i+=2) { + x = vertices[i]; + y = vertices[i+1]; + if (x <= minx) { + minx = x; + cornerId[0] = i; + } + else if (x >= maxx) { + maxx = x; + cornerId[1] = i; + } + + if (y <= miny) { + miny = y; + cornerId[2] = i; + } + else if (y >= maxy) { + maxy = y; + cornerId[3] = i; + } + } }, _generateTriangle: function(wt, offset, vert0, vert1, vert2) { @@ -1423,7 +1442,7 @@ cc.Scale9Sprite = _ccsg.Node.extend({ // x2, y2 rightBottom // x3, y3 leftTop // x4, y4 rightTop - var vert = this._isTriangle ? this._rawVerts : this._vertices, + var vert = this._vertices, x0 = vert[cornerId[0]], x1 = vert[cornerId[1]], x2 = vert[cornerId[2]], x3 = vert[cornerId[3]], y0 = vert[cornerId[0] + 1], y1 = vert[cornerId[1] + 1], y2 = vert[cornerId[2] + 1], y3 = vert[cornerId[3] + 1]; if (((x0-vl) & (x1-vl) & (x2-vl) & (x3-vl)) >> 31 || // All outside left From 2bb573b3dbc3b762fc122692db645f6312504e7d Mon Sep 17 00:00:00 2001 From: pandamicro Date: Mon, 9 Oct 2017 15:48:00 +0800 Subject: [PATCH 03/16] Use undefined for id validation --- jsb/jsb-etc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsb/jsb-etc.js b/jsb/jsb-etc.js index 692ede1665..225d56346e 100644 --- a/jsb/jsb-etc.js +++ b/jsb/jsb-etc.js @@ -67,7 +67,7 @@ cc.Scheduler.prototype.schedule = function (callback, target, interval, repeat, } delay = delay || 0; var instanceId = target.__instanceId || target.uuid; - cc.assertID(!isNaN(instanceId), 1510); + cc.assertID(instanceId !== undefined, 1510); if (!callback.__callbackId) { callback.__callbackId = _callbackId++; } @@ -83,7 +83,7 @@ cc.Scheduler.prototype.unschedule = function (callback, target) { callback = tmp; } var instanceId = target.__instanceId || target.uuid; - cc.assertID(!isNaN(instanceId) && !isNaN(callback.__callbackId), 1510); + cc.assertID(instanceId !== undefined && callback.__callbackId !== undefined, 1510); var key = instanceId + '_' + callback.__callbackId; this._unschedule(key, target); }; From fc13234a5cf59c17fd778083a2ed6e241fa88f54 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 10 Oct 2017 16:26:30 +0800 Subject: [PATCH 04/16] update unschedule code jsb-etc.js fix fireball/issues/6432 --- jsb/jsb-etc.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jsb/jsb-etc.js b/jsb/jsb-etc.js index 225d56346e..93dafcce0b 100644 --- a/jsb/jsb-etc.js +++ b/jsb/jsb-etc.js @@ -82,8 +82,12 @@ cc.Scheduler.prototype.unschedule = function (callback, target) { target = callback; callback = tmp; } + if (callback.__callbackId === undefined) { + return; + } + var instanceId = target.__instanceId || target.uuid; - cc.assertID(instanceId !== undefined && callback.__callbackId !== undefined, 1510); + cc.assertID(instanceId !== undefined, 1510); var key = instanceId + '_' + callback.__callbackId; this._unschedule(key, target); }; From cdad460e9d6b4b53811a5a9c3fa000cc7c4bb270 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Wed, 11 Oct 2017 09:53:24 +0800 Subject: [PATCH 05/16] fix api doc --- cocos2d/core/components/CCEditBox.js | 1 + cocos2d/core/components/CCSprite.js | 2 +- cocos2d/core/components/CCVideoPlayer.js | 29 ++++++++++++------------ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cocos2d/core/components/CCEditBox.js b/cocos2d/core/components/CCEditBox.js index 65f9b779de..18423d9aec 100644 --- a/cocos2d/core/components/CCEditBox.js +++ b/cocos2d/core/components/CCEditBox.js @@ -644,4 +644,5 @@ cc.EditBox = module.exports = EditBox; * // when you don't need editbox anymore * editbox.node.destroy(); * @method destroy + * @return {Boolean} whether it is the first time the destroy being called */ diff --git a/cocos2d/core/components/CCSprite.js b/cocos2d/core/components/CCSprite.js index 596123a8f3..7da5d38c33 100644 --- a/cocos2d/core/components/CCSprite.js +++ b/cocos2d/core/components/CCSprite.js @@ -28,7 +28,7 @@ var Base = require('./CCRendererUnderSG'); /** * !#en Enum for sprite type. * !#zh Sprite 类型 - * @enum Sprite.SpriteType + * @enum Sprite.Type */ /** * !#en The simple type. diff --git a/cocos2d/core/components/CCVideoPlayer.js b/cocos2d/core/components/CCVideoPlayer.js index 07dce51579..8c341f5997 100644 --- a/cocos2d/core/components/CCVideoPlayer.js +++ b/cocos2d/core/components/CCVideoPlayer.js @@ -369,6 +369,21 @@ var VideoPlayer = cc.Class({ } return false; } + + /** + * !#en if you don't need the VideoPlayer and it isn't in any running Scene, you should + * call the destroy method on this component or the associated node explicitly. + * Otherwise, the created DOM element won't be removed from web page. + * !#zh + * 如果你不再使用 VideoPlayer,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。 + * 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。 + * @example + * videoplayer.node.parent = null; // or videoplayer.node.removeFromParent(false); + * // when you don't need videoplayer anymore + * videoplayer.node.destroy(); + * @method destroy + * @return {Boolean} whether it is the first time the destroy being called + */ }); cc.VideoPlayer = module.exports = VideoPlayer; @@ -443,17 +458,3 @@ cc.VideoPlayer = module.exports = VideoPlayer; * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ - -/** - * !#en if you don't need the VideoPlayer and it isn't in any running Scene, you should - * call the destroy method on this component or the associated node explicitly. - * Otherwise, the created DOM element won't be removed from web page. - * !#zh - * 如果你不再使用 VideoPlayer,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。 - * 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。 - * @example - * videoplayer.node.parent = null; // or videoplayer.node.removeFromParent(false); - * // when you don't need videoplayer anymore - * videoplayer.node.destroy(); - * @method destroy - */ From 7cdc0a78f45f349cd284454a0b64195fe94657f4 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 11 Oct 2017 17:19:03 +0800 Subject: [PATCH 06/16] Stop bail out iOS UIWebView for webgl --- cocos2d/core/platform/CCSys.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cocos2d/core/platform/CCSys.js b/cocos2d/core/platform/CCSys.js index f9949dcca1..319b9a35af 100644 --- a/cocos2d/core/platform/CCSys.js +++ b/cocos2d/core/platform/CCSys.js @@ -722,12 +722,6 @@ else { if (cc.create3DContext(document.createElement("CANVAS"))) { _supportWebGL = true; } - if (_supportWebGL && sys.os === sys.OS_IOS && sys.osMainVersion === 9) { - // Not activating WebGL in iOS 9 UIWebView because it may crash when entering background - if (!win.indexedDB) { - _supportWebGL = false; - } - } if (_supportWebGL && sys.os === sys.OS_ANDROID) { var browserVer = parseFloat(sys.browserVersion); switch (sys.browserType) { From 40759491705d2c65b42c75aab6bfd22a49b1b9b0 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 24 Oct 2017 15:36:59 +0800 Subject: [PATCH 07/16] fix CCWebView api error --- cocos2d/core/components/CCWebView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2d/core/components/CCWebView.js b/cocos2d/core/components/CCWebView.js index 26859c98e3..bad9bd0812 100644 --- a/cocos2d/core/components/CCWebView.js +++ b/cocos2d/core/components/CCWebView.js @@ -200,7 +200,7 @@ var WebView = cc.Class({ * Please refer to the official documentation for more details. * !#zh * 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。
- * 注意:只支持 Android 和 iOS ,Web 端用法请前往官方文档查看。 + * 注意:只支持 Android 和 iOS,Web 端用法请前往官方文档查看。 * 详情请参阅官方文档 * @method setOnJSCallback * @param {Function} callback @@ -215,7 +215,7 @@ var WebView = cc.Class({ * !#en * Evaluates JavaScript in the context of the currently displayed page.
* Please refer to the official document for more details
- * Note: Cross domain issues need need to be resolved by yourself
+ * Note: Cross domain issues need to be resolved by yourself
* !#zh * 执行 WebView 内部页面脚本(详情请参阅官方文档)
* 注意:需要自行解决跨域问题 From 92a9d5050758833a6b294f30bb3c6e333450bba1 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Wed, 25 Oct 2017 14:26:21 +0800 Subject: [PATCH 08/16] public inputManager for fireball/issues/6485 --- cocos2d/core/platform/CCInputManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos2d/core/platform/CCInputManager.js b/cocos2d/core/platform/CCInputManager.js index d75ac77a66..fea9a16b73 100644 --- a/cocos2d/core/platform/CCInputManager.js +++ b/cocos2d/core/platform/CCInputManager.js @@ -555,4 +555,5 @@ var inputManager = { } }; +cc.inputManager = inputManager; module.exports = inputManager; From c9d477edf059aec126cd19b0f5411381f5046dc6 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 25 Oct 2017 17:47:18 +0800 Subject: [PATCH 09/16] Fixes str.startswith isn't found on JSC in iOS 8. --- jsb/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsb/index.js b/jsb/index.js index a1712c471a..df61f5f14d 100644 --- a/jsb/index.js +++ b/jsb/index.js @@ -63,6 +63,8 @@ if (CC_DEV) { // polyfills require('../polyfill/misc'); +// str.startswith isn't supported in JavaScriptCore which is shipped with iOS8. +require('../polyfill/string'); if (!(CC_EDITOR && Editor.isMainProcess)) { require('../polyfill/typescript'); } From cb3cf93a7a892f42d7823fe4df220d44c8ede710 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 25 Oct 2017 17:46:52 +0800 Subject: [PATCH 10/16] console.log fix for JavaScriptCore in iOS 8. --- CCDebugger.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/CCDebugger.js b/CCDebugger.js index 66bbca90b3..b7e4ef1a0e 100644 --- a/CCDebugger.js +++ b/CCDebugger.js @@ -96,8 +96,6 @@ cc.DebugMode = Enum({ * @module cc */ -var jsbLog = cc.log || console.log; - /** * !#en Init Debug setting. * !#zh 设置调试模式。 @@ -259,7 +257,14 @@ cc._initDebugSetting = function (mode) { * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. */ if (CC_JSB) { - cc.log = jsbLog; + if (scriptEngineType === "JavaScriptCore") { + // console.log has to use `console` as its context for iOS 8~9. Therefore, apply it. + cc.log = function () { + return console.log.apply(console, arguments); + }; + } else { + cc.log = console.log; + } } else if (console.log.bind) { // use bind to avoid pollute call stacks @@ -283,9 +288,16 @@ cc._initDebugSetting = function (mode) { * @param {any} msg - A JavaScript string containing zero or more substitution strings. * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. */ - cc.info = CC_JSB ? jsbLog : function () { - (console.info || console.log).apply(console, arguments); - }; + if (CC_JSB) { + cc.info = (scriptEngineType === "JavaScriptCore") ? function () { + (console.info || console.log).apply(console, arguments); + } : (console.info || console.log); + } else { + cc.info = function () { + (console.info || console.log).apply(console, arguments); + }; + } + } cc.warnID = genLogFunc(cc.warn, 'Warning'); From 19ee0534b0ab10b8e46941d30bdd1ce82b3ba309 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Wed, 25 Oct 2017 18:28:16 +0800 Subject: [PATCH 11/16] restore getName for fireball/issues/6505 --- cocos2d/deprecated.js | 7 +++++++ jsb/jsb-tex-sprite-frame.js | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cocos2d/deprecated.js b/cocos2d/deprecated.js index 2c7f620613..b7a8108455 100644 --- a/cocos2d/deprecated.js +++ b/cocos2d/deprecated.js @@ -595,6 +595,13 @@ if (CC_DEV) { }); } + cc.js.get(cc.Texture2D.prototype, 'getName', function () { + cc.warnID(1400, 'texture.getName()', 'texture._glID'); + return function () { + return this._glID || null; + }; + }); + //ui if (cc.Layout) { js.obsolete(cc.Layout, 'cc.Layout.ResizeType', 'ResizeMode'); diff --git a/jsb/jsb-tex-sprite-frame.js b/jsb/jsb-tex-sprite-frame.js index ce27f9595c..500e877bcf 100644 --- a/jsb/jsb-tex-sprite-frame.js +++ b/jsb/jsb-tex-sprite-frame.js @@ -152,7 +152,7 @@ prototype.update = function (options) { if (genMipmap) { this.generateMipmap(); } -} +}; prototype.isLoaded = function () { return true; }; @@ -161,6 +161,7 @@ prototype.getPixelHeight = prototype.getPixelsHigh; prototype.description = prototype.getDescription; cc.js.get(prototype, 'pixelWidth', prototype.getPixelWidth); cc.js.get(prototype, 'pixelHeight', prototype.getPixelHeight); +cc.js.get(prototype, '_glID', prototype.getName); // cc.SpriteFrame From f2ddfee76844f1a86f4759fa96a8cbe78eb5408c Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Wed, 25 Oct 2017 21:02:54 +0800 Subject: [PATCH 12/16] fix potential memory leak when node detached from parent without cleanup --- cocos2d/core/utils/scene-graph-helper.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/cocos2d/core/utils/scene-graph-helper.js b/cocos2d/core/utils/scene-graph-helper.js index 734e6bf183..56ec38a13d 100644 --- a/cocos2d/core/utils/scene-graph-helper.js +++ b/cocos2d/core/utils/scene-graph-helper.js @@ -27,15 +27,23 @@ var SceneGraphUtils = { removeSgNode: function () { - var node = this._sgNode; - if (node) { - var parent = node._parent; + var sgNode = this._sgNode; + if (sgNode) { + var parent = sgNode._parent; if (parent) { - parent.removeChild(node); + parent.removeChild(sgNode); } - node.release(); - if (this._sgNode._entity) { - this._sgNode._entity = null; + else { + // cleanup was skipped when its node was detaching + if (CC_JSB) { + sgNode.cleanup(); + } + else { + sgNode.performRecursive(_ccsg.Node.performType.cleanup); + } + } + if (sgNode._entity) { + sgNode._entity = null; } } }, From c0c80948c9b50945f79b88eb5a0cee7bd80ac4bc Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Wed, 25 Oct 2017 21:15:02 +0800 Subject: [PATCH 13/16] typo --- cocos2d/core/utils/misc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2d/core/utils/misc.js b/cocos2d/core/utils/misc.js index f2d26ba72d..c1360b9725 100644 --- a/cocos2d/core/utils/misc.js +++ b/cocos2d/core/utils/misc.js @@ -125,7 +125,7 @@ misc.imagePool.get = function () { }; misc.imagePool._smallImg = "data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="; // Avoid problems on windows IE kernels, Edge, Firefox and Linux Firefox -if ((sys.os === sys.OS_WINDOWS || sys.os === sys.OS_LINUX) && sys.browser !== sys.BROWSER_TYPE_CHROME) { +if ((sys.os === sys.OS_WINDOWS || sys.os === sys.OS_LINUX) && sys.browserType !== sys.BROWSER_TYPE_CHROME) { misc.imagePool.resize(0); } From 44a53f5404e97004fad6ea36c406b7a27d4f876a Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Thu, 26 Oct 2017 10:03:57 +0800 Subject: [PATCH 14/16] fix ci --- cocos2d/core/CCNode.js | 3 +-- test/qunit/unit-es5/test-node.js | 27 --------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 386ef2bf6d..f345764f6a 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -1018,8 +1018,7 @@ var Node = cc.Class({ this._parent = null; } } - else if (CC_TEST ? (/* make CC_JSB mockable*/ Function('return CC_JSB'))() : CC_JSB) { - this._sgNode.release(); + else if (CC_JSB) { this._sgNode._entity = null; this._sgNode = null; } diff --git a/test/qunit/unit-es5/test-node.js b/test/qunit/unit-es5/test-node.js index 8f40d2512c..3b411c84d8 100644 --- a/test/qunit/unit-es5/test-node.js +++ b/test/qunit/unit-es5/test-node.js @@ -365,33 +365,6 @@ test('attach events', function () { cc.engine.off('node-detach-from-scene', onDetach); }); -test('release sg node', function () { - var isJSB = CC_JSB; - CC_JSB = true; - - var parent = new cc.Node(); - var child = new cc.Node(); - child.parent = parent; - - var childReleased = false; - var parentReleased = false; - - child._sgNode.release = function () { - childReleased = true; - }; - parent._sgNode.release = function () { - parentReleased = true; - }; - - parent.destroy(); - cc.Object._deferredDestroy(); - - strictEqual(parentReleased, true, 'should release parent sg node'); - strictEqual(childReleased, true, 'should release child sg node'); - - CC_JSB = isJSB; -}); - test('getBoundingBox', function () { var node = new cc.Node(); node.anchorX = 0.5; From 321470a9c3f51f153a30459a5925faaa916fa8f9 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Thu, 26 Oct 2017 17:08:52 +0800 Subject: [PATCH 15/16] fix CCEditBox event api --- cocos2d/core/components/CCEditBox.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos2d/core/components/CCEditBox.js b/cocos2d/core/components/CCEditBox.js index 65f9b779de..6fe29cd21a 100644 --- a/cocos2d/core/components/CCEditBox.js +++ b/cocos2d/core/components/CCEditBox.js @@ -395,7 +395,7 @@ var EditBox = cc.Class({ /** * !#en The event handler to be called when EditBox began to edit text. * !#zh 开始编辑文本输入框触发的事件回调。 - * @property {Component.EventHandler} editingDidBegan + * @property {Component.EventHandler[]} editingDidBegan */ editingDidBegan: { default: [], @@ -405,7 +405,7 @@ var EditBox = cc.Class({ /** * !#en The event handler to be called when EditBox text changes. * !#zh 编辑文本输入框时触发的事件回调。 - * @property {Component.EventHandler} textChanged + * @property {Component.EventHandler[]} textChanged */ textChanged: { default: [], @@ -415,7 +415,7 @@ var EditBox = cc.Class({ /** * !#en The event handler to be called when EditBox edit ends. * !#zh 结束编辑文本输入框时触发的事件回调。 - * @property {Component.EventHandler} editingDidEnded + * @property {Component.EventHandler[]} editingDidEnded */ editingDidEnded: { default: [], @@ -425,7 +425,7 @@ var EditBox = cc.Class({ /** * !#en The event handler to be called when return key is pressed. Windows is not supported. * !#zh 当用户按下回车按键时的事件回调,目前不支持 windows 平台 - * @property {Component.EventHandler} editingReturn + * @property {Component.EventHandler[]} editingReturn */ editingReturn: { default: [], From 2c9db1b3e64381ceb99755f71efa39550921ff11 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 26 Oct 2017 22:12:21 +0800 Subject: [PATCH 16/16] Removes unused jsb.(un)registerNativeRef --- jsb/jsb-dragonbones.js | 8 ++------ jsb/jsb-loader.js | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/jsb/jsb-dragonbones.js b/jsb/jsb-dragonbones.js index 949a3a359c..fe7b674712 100644 --- a/jsb/jsb-dragonbones.js +++ b/jsb/jsb-dragonbones.js @@ -43,13 +43,9 @@ proto.removeEvent = function(type, listener, target) { var armatureProto = dragonBones.Armature.prototype; armatureProto.addEventListener = function (type, listener, target) { - var display = this.display; - jsb.registerNativeRef(this, display); - display.addEvent(type, listener, target); + this.display.addEvent(type, listener, target); }; armatureProto.removeEventListener = function (type, listener, target) { - var display = this.display; - jsb.unregisterNativeRef(this, display); - display.removeEvent(type, listener, target); + this.display.removeEvent(type, listener, target); }; diff --git a/jsb/jsb-loader.js b/jsb/jsb-loader.js index d380758abc..ad576b35ea 100644 --- a/jsb/jsb-loader.js +++ b/jsb/jsb-loader.js @@ -99,7 +99,6 @@ function loadImage (item, callback) { else { callback && callback(new Error('Load image failed: ' + url)); } - jsb.unregisterNativeRef(cc.textureCache, addImageCallback); }; cc.textureCache._addImageAsync(url, addImageCallback); }