From d79cd80b940c91f9db9d5eecce76b64ed1dea527 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 18 Feb 2016 23:19:00 +0800 Subject: [PATCH] Fix JSB bugs --- jsb/jsb-etc.js | 4 +++- jsb/jsb-event.js | 8 +++++++- jsb/jsb-game.js | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/jsb/jsb-etc.js b/jsb/jsb-etc.js index b7bc76e563..a63c5e5439 100644 --- a/jsb/jsb-etc.js +++ b/jsb/jsb-etc.js @@ -24,6 +24,8 @@ 'use strict'; +var NORMALIZE_RE = /[^\.\/]+\/\.\.\//; + // cc.path cc.js.mixin(cc.path, { //todo make public after verification @@ -33,7 +35,7 @@ cc.js.mixin(cc.path, { //removing all ../ do { oldUrl = url; - url = url.replace(this.normalizeRE, ''); + url = url.replace(NORMALIZE_RE, ''); } while (oldUrl.length !== url.length); return url; }, diff --git a/jsb/jsb-event.js b/jsb/jsb-event.js index 8fd9800e43..3300871878 100644 --- a/jsb/jsb-event.js +++ b/jsb/jsb-event.js @@ -77,7 +77,13 @@ cc.js.mixin(cc.Event.prototype, { // cc.Event.EventCustom cc.Event.EventCustom = function (type, bubbles) { - cc.Event.call(this, cc.Event.CUSTOM); + this.target = null; + this.currentTarget = null; + this.eventPhase = 0; + this._defaultPrevented = false; + this._propagationStopped = false; + this._propagationImmediateStopped = false; + this.type = type; this.bubbles = bubbles || false; this.detail = null; diff --git a/jsb/jsb-game.js b/jsb/jsb-game.js index 628ecf2933..25e8ed4f05 100644 --- a/jsb/jsb-game.js +++ b/jsb/jsb-game.js @@ -133,7 +133,7 @@ cc.js.mixin(cc.game, { cc.game.onStart = onStart; } } - + cc.director.startAnimation(); this.prepare(cc.game.onStart && cc.game.onStart.bind(cc.game)); },