Query regarding Cocos2d-JS 3.14.1

Query regarding Cocos2d-JS 3.14.1
0.0 0

#1

Hello I am trying to port my app in JS for making it live on facebook. I have ported it on Cocos2d-JS 3.13.1, it have some issues with GAF liberary so I switched to 3.14.1. On current version of Cococs2d-JS the GAF run smooth but while testing my app I came across two weird behaviors that were not present in 3.13.1, they are:

  1. When I push a scene and pop it back the previous scene stops displaying various images.
  2. When I am uploading my project on facebook and run it always crashes on launch with console log given below

Uncaught DOMException: Blocked a frame with origin “https://apps-191688351208888.apps.fbsbx.com” from accessing a cross-origin frame.
at f.visit (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:486:424)
at f.visit (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:378:109)
at f.drawScene (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:605:454)
at f.mainLoop (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:617:301)
at b (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:53:99)
game.min.js:486 Uncaught DOMException: Blocked a frame with origin “https://apps-191688351208888.apps.fbsbx.com” from accessing a cross-origin frame.
at f.visit (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:486:424)
at f.visit (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:378:109)
at f.drawScene (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:605:454)
at f.mainLoop (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:617:301)
at b (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:53:99)
visit @ game.min.js:486
visit @ game.min.js:378
drawScene @ game.min.js:605
mainLoop @ game.min.js:617
b @ game.min.js:53
game.min.js:486 Uncaught DOMException: Blocked a frame with origin “https://apps-191688351208888.apps.fbsbx.com” from accessing a cross-origin frame.
at f.visit (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:486:424)
at f.visit (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:378:109)
at f.drawScene (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:605:454)
at f.mainLoop (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:617:301)
at b (https://apps-191688351208888.apps.fbsbx.com/bundle/1440992892612428/1443640449000663/game.min.js:53:99)

This error is same with a simple Hello World project too. Is anybody else facing same problem?
@nite @pandamicro can you look in the issue?

Thanks in advance. :]


#2

I had the same issue when was trying to embed the game into iframe. This is a bug in cocos2d-html5,

In your project open the following file:
frameworks/cocos2d-html5/cocos2d/core/layers/CCLayer.js
then on line 250 change
visit: function () {
to
visit: function (parent) {

Actually this is like a typo, developers just missed to name the parameter in the function, and because by default window.parent is the parent frame, the error occurs because your game is trying to request the parent frame which is forbidden on facebook.

Don’t forget to rebuild your game.min.js.


Cocos2d-JS 3.14.1 Facebook canvas issue?
#3

@axln Thanks for the response, I tried the solution and it works fine on facebook.

But it still not working for scene pushing and popping. :frowning:


#4

Great! I’m glad it helped.


#5

Sorry I didn’t note that my reply was to question #2 only. I think these two bugs are not related to each other.


#6

Just got same issue with Facebook canvas:) thanks you fixed it :smiley: so now I can close my issue… I think cocos2d-x team should include test case for it, facebook is #1 place where cocos2d-js should work without issues.