ASubtitledDeath

IE9 framework errors on load

Recommended Posts

Hey Everyone,

 

I am developing a game that needs to run in IE9 (unfortunately) and the Phaser framework is throwing errors as soon as the JS file is loaded.  Here is a link to illustrate the issue :

 

http://files.thesecretlocation.com/CRUS/NERD/testGame/indexNew.html

 

All I am loading on the page is an un-minified version of the v2.1.0 framework along with the IE9 dataview-polyfill.js

 

This is the offending code chunk ( from line 64,217 of phaser.js )

var process=require("__browserify_process"),global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},Buffer=require("__browserify_Buffer"),__filename="/..\\node_modules\\poly-decomp\\src\\index.js",__dirname="/..\\node_modules\\poly-decomp\\src";module.exports = {    Polygon : require("./Polygon"),    Point : require("./Point"),};

It looks like there are extra commas being added on the second last line.

 

After some deeper investigation it looks like this is happening throughout the code base which is causing the browser (IE9) to throw the error.

 

Does anyone know a way around this? I started going through and removing the offending commas but there is 80,000 lines of code : /
 

 

thanks,

 

Josh

 

 

NOTE : I am using this version of IE9 in a VM on my mac http://news.softpedia.com/news/How-to-Run-Internet-Explorer-on-Mac-OS-X-391323.shtml

 

Share this post


Link to post
Share on other sites

This error is coming from p2 specifically as I don't use browserify anywhere in Phaser, but Stefan does use it for p2.

 

Do you need to use p2? If not, use a custom build without it (found in the 'custom' folder). If you do then I wonder if there's a way to build p2 from source so it doesn't mess-up IE9. It didn't use to, it used to work fine, so it must be the introduction of browserify into the build process that caused it (at a guess anyway).

Share this post


Link to post
Share on other sites

Hi,

 

Do you really think it's browserify, and not just the extra comma?

 

The troublesome line you found is located in one of the p2 dependencies, poly-decomp (which I also wrote): 

https://github.com/schteppe/poly-decomp.js/blob/master/src/index.js

 

I guess I'll have to use JSHint to detect all of these, throughout p2 and poly-decomp. Thanks for the heads up!

 

Can you try running the minified code instead? Minifying should remove all unnecessary characters anyway.

 

Stefan

Share this post


Link to post
Share on other sites

I assumed browserify had added the commas in, but if not then it might just be a result of the original code yes! There is a minified version provided, so I guess the real test is if that works fine in IE9 (+ the polyfill) then we're all good anyway.

Share this post


Link to post
Share on other sites

Hey Guys,

 

Thanks for the replys.  I did a few more experiments.  These are the variations of the framework I have tried:

 

 

Phaser.min.js - Error Object doesn't support property or method 'defineProperty', line 3, character 2900

http://files.thesecretlocation.com/CRUS/NERD/testGame/min.html

 

phaser-no-libs.js - no errors, but I need physics and Pixi  :(

http://files.thesecretlocation.com/CRUS/NERD/testGame/noLibs.html

 

phaser-arcade-physics.js - Error Object doesn't support property or method 'defineProperty', line 603, character 1

http://files.thesecretlocation.com/CRUS/NERD/testGame/arcade.html

This is the offending code:

Object.defineProperty(PIXI.DisplayObject.prototype, 'interactive', {    get: function() {        return this._interactive;    },    set: function(value) {        this._interactive = value;        // TODO more to be done here..        // need to sort out a re-crawl!        if(this.stage)this.stage.dirty = true;    }});

HOWEVER!!

I added this user agent compatibility tag into the head of the doc and it now works!

<meta http-equiv="x-ua-compatible" content="IE=edge">

http://files.thesecretlocation.com/CRUS/NERD/testGame/arcadeFixed.html

 

I also retro fitted it to the full framework and that fixed it as well.

http://files.thesecretlocation.com/CRUS/NERD/testGame/

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.