aframe: Custom WebVR Polyfill: Error Loading DPDB because of xhr request to already required JSON

Hi, I’m getting this error-message when I’m opening any Scene that uses A-Frame 0.5.0 on my iPhone 6s.

screen shot 2017-02-14 at 11 55 43

It’s a bug in the WebVR Polyfill, but I’m reporting it here because it looks like this fork of the Polyfill is only used for A-Frame: (probably related to #2008 and #2352 )

In @dmarcos version the path to the dpdb.json is relative, not absolute like in the master of the WebVR Polyfill.

The JSON is getting required by var ONLINE_DPDB_URL = require('./dpdb.json'); so ONLINE_DPDB_URL already is the JSON object, not a path to a JSON file like in the polyfill master.

The Bug is that the url in the xhr-request'GET', ONLINE_DPDB_URL, true); is the required JSON object - not a URL - which is the cause for the 404 error. There’s no need for the xhr-request because the JSON object is already stored in ONLINE_DPDB_URL.

The Bug is in line 22-61

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 15 (9 by maintainers)

Most upvoted comments

it seems to me that the correct solution is: (1) the DPDB JSON file that is to be required should be for DPDB_CACHE, not for ONLINE_DPDB_URL. (2) if the intent is to avoid making an external call and to always use the DPDB cache, the simplest way is to act as if (or actually make sure) fetch_online is set to false; then the XHR will never happen. (3) if the intent is to still make an external call, then ONLINE_DPDB_URL should be set to the appropriate URL string value.