-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom WebVR Polyfill: Error Loading DPDB because of xhr request to already required JSON #2385
Comments
Also the commit referenced here |
@Stefie The commit referred by the |
Hi @dmarcos , On desktop i can reproduce the Bug when I use the Custom User Agent "iPhone" in the 'Responsive Design Mode' in the Firefox Dev Tools. This makes the polyfill return true when running the isMobile and isIOS checks.
When I do this, I'm getting the same error-messages that I get on my iPhone:
|
A possible Bugfix when requiring the online DPDB with a relative path: // XHR to fetch online DPDB file, if requested.
if (fetchOnline) {
// Set the callback.
this.onDeviceParamsUpdated = onDeviceParamsUpdated;
// BUGFIX: Use the JSON object already stored in ONLINE_DPDB_URL
// after requiring './dpdb.json' instead of making a XMLHttpRequest with the Object as URL
this.dpdb = ONLINE_DPDB_URL;
if (this.dpdb) {
this.recalculateDeviceParams_();
} else {
// Error loading the DPDB.
console.error('Error loading online DPDB!');
}
/**
var xhr = new XMLHttpRequest();
var obj = this;
////////////////////
// BUG: This is where the request to [object Object] happens and the cause for the 404
///////////////////
xhr.open('GET', ONLINE_DPDB_URL, true);
xhr.addEventListener('load', function() {
obj.loading = false;
if (xhr.status >= 200 && xhr.status <= 299) {
// Success.
obj.dpdb = JSON.parse(xhr.response);
obj.recalculateDeviceParams_();
} else {
// Error loading the DPDB.
console.error('Error loading online DPDB!');
}
});
xhr.send();
**/
} |
Got the same error on Chrome running on Android... |
I've had the same error on Chrome on Android too, didn't have a chance to find a solution... switched back to A-Frame 0.4.0 instead for the time being, not sure if the error actually breaks anything but was having a different plugin issue which also was fixed by dropping to 0.4.0. Whatever the issue is, wasn't there in 0.4.0. It doesn't come up on desktop for me. But comes up on Chrome for Android and I think I also saw it when testing on iOS safari. |
it seems to me that the correct solution is: |
I have the same issue on Chrome 56.0.2924.87 on Android 6.0.1 (Samsung S5; tested with aframe master and 0.5.0). Also the examples on aframe.io does not work with Chrome 56 only with Chrome Dev, I guess the latter supports the WebVR API and don't have to use the polyfill. |
I tried the bugfix suggested by @Stefie and it resolves the issue. But another error occured afterwards:
also this call: https://github.com/aframevr/aframe/blob/v0.5.0/src/core/scene/a-scene.js#L190 failed on my Samsung S5 with Chrome 56. Regrettably, I don't have the exact error message anymore. I resolved the issue by replacing I don't know the root cause of the problem. I also compared the entry for my device in the https://github.com/googlevr/webvr-polyfill/blob/master/src/dpdb/dpdb-cache.js with the one in the "dmarcos/webvr-polyfill#a02a8089b" fork, but they are the same. I also tested the current aframe master version (which cause the issue on my device) on a Google Pixel with the same browser version but Android 7 and it runs without problems on the Pixel. Update: even the fixed version leads to a Chrome crash on my S5. But on a Pixel phone and a Nexus 5x it works fine. |
So, basically -
I can think of three fixes, in order of work required:
|
I've created a PR to fix this issue over in the webvr-polyfill fork. If anyone could take the time to look at it, that'd be really helpful: aframevr/webvr-polyfill#3. |
Cool, thanks! Anyone knows the procedure to update the polyfill hosted on https://storage.googleapis.com/cardboard-dpdb/dpdb.json ? Does any one know who's the point of contact? I don't mind hosting a |
@cvan and I have been working on syncing up @thoragio's initiative at webvrrocks/webvr-polyfill-dpdb which publishes the DPDB at https://dpdb.webvr.rocks/dpdb.json instead of the no-longer-updated https://storage.googleapis.com/cardboard-dpdb/dpdb.json. The latest version of webvr-polyfill is in sync with this, as well as has the correct online URL, so #2700 will fix this issue |
#2700 fixed |
Hi,
I'm getting this error-message when I'm opening any Scene that uses A-Frame 0.5.0 on my iPhone 6s.
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:
https://github.com/dmarcos/webvr-polyfill#a02a808 (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
xhr.open('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 https://github.com/dmarcos/webvr-polyfill/blob/master/src/dpdb/dpdb.js#L22 line 22-61
The text was updated successfully, but these errors were encountered: