Jump to content

TypeError: type error in Safari 6?


ChubbRck
 Share

Recommended Posts

Hi all,

 

Another weirdo cross-browser problem I am desperate to fix. A tester running Safari 6.03 (not the most current, but not ancient either), keeps having the game freeze with a strange error: "TypeError: type error" -- it traces back to phaser.min.js line 11 but I'm unable to see what in my code is causing the issue. Is this a known thing? Any advice at all would be appreciated - 

 

You guys are the best!

 

Nick

Link to comment
Share on other sites

Thanks Eric. I did that and got this:

 

TypeError: 'undefined' is not an object (evaluating 'this._bindings.length') 

 

It's on line 15335, which is this line (about 7 lines down) in the following chunk: var n = this._bindings.length;

dispatch: function () {        if (!this.active)        {            return;        }        var paramsArr = Array.prototype.slice.call(arguments);        var n = this._bindings.length;        var bindings;        if (this.memorize)        {            this._prevParams = paramsArr;        }        if (!n)        {            //  Should come after memorize            return;        }        bindings = this._bindings.slice(); //clone array in case add/remove items during dispatch        this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch.        //execute all callbacks until end of the list or until a callback returns `false` or stops propagation        //reverse loop since listeners with higher priority will be added at the end of the list        do { n--; } while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false);    }
Link to comment
Share on other sites

So I'm not a Phaser guy so I'm only able to provide some debugging suggestions. I would put 

'console.log(this._bindings);'

on the line above 'var n = this._bindings.length;' and see what it says.

It's strange that only Safari 6 throws this error.

 

edit: I opened up Safari on my machine and simply ran the line "this._bindings.length;" in the console, returning back the exact same error. So clearly in your instance as in mine, this._bindings doesn't exist. I don't know enough about how Phaser works to know if its putting that there or you are. I would say wrap the whole statement in a if(this._bindings){...} to prevent it from trying to run that code when it doesn't exist, but I'm not sure how important this._bindings is to Phaser.

Edited by ericjbasti
Link to comment
Share on other sites

Eric, thanks for your help, unfortunately, I don't know much about the inner workings of Phaser, either.

 

I've found some interesting things out though, it looks like the this._bindings error was unrelated to the original error. The original typeError only occurs with the MINIFIED version of Phaser, not the full version. Does anyone know why this could be?

Link to comment
Share on other sites

Interesting update, I did get the crash to happen on the unminified version of Phaser and this is where the error occurs, on line 32210 of phaser.js

Object.defineProperty(Phaser.BitmapText.prototype, 'text', {    get: function() {        return this._text;    },    set: function(value) {        if (value !== this._text)        {            this._text = value.toString() || ' ';            this.dirty = true;        }    }});
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...