Skip to content
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

[Firefox] Live URL Viewer: ReferenceError: SharedArrayBuffer is not defined #168

Closed
valenting opened this issue Sep 2, 2020 · 2 comments

Comments

@valenting
Copy link

Uncaught ReferenceError: SharedArrayBuffer is not defined
    [23]< https://jsdom.github.io/whatwg-url/whatwg-url.js:7631
    o https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    o https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    [3]< https://jsdom.github.io/whatwg-url/whatwg-url.js:271
    o https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    o https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    [24]< https://jsdom.github.io/whatwg-url/whatwg-url.js:7777
    o https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    o https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    [12]< https://jsdom.github.io/whatwg-url/whatwg-url.js:2936
    o https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    r https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    <anonymous> https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    <anonymous> https://jsdom.github.io/whatwg-url/whatwg-url.js:1
    <anonymous> https://jsdom.github.io/whatwg-url/whatwg-url.js:1

The code at that location is:

const sabByteLengthGetter =
    Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get;

According to MDN
SharedArrayBuffer objects are in principle always available, but unfortunately the constructor on the global object is hidden, unless the two headers mentioned above are set, for compatibility with web content.

Not sure exactly where the code comes from, but the result is that the live URL viewer doesn't work in Firefox.

@domenic
Copy link
Member

domenic commented Sep 2, 2020

Hmm. whatwg-url itself targets Node.js, but live-url-viewer needs to work everywhere. Maybe we'll add a fake SAB to the global to work around this...

@domenic domenic closed this as completed in 2083a47 Sep 2, 2020
@brentonhouse
Copy link

brentonhouse commented Jan 20, 2021

@domenic - Is there a polyfill for SharedArrayBuffer for those of us that use whatwg-url with non-node.js platforms (such as cross-platform native mobile solutions)? In the meantime, I rolled back to the old version of whatwg-url but would love to be able to keep using future versions of this library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants