-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
check if toString is writable #1436
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
base: master
Are you sure you want to change the base?
Conversation
in cases the `Function.prototype` is sealed/frozen, this will throw an error causing any remaining code to abort.
Why and when could it be frozen? |
If some external code call's; |
It's a case of "broken environment". You should load |
unfortunate that's not always an option. I would prefer the build bundle with core-js remainings functioning rather the erroring out. |
Maybe it's rather an issue for the place where this external code comes from? If I accept your PR in the proposed form, it is tens, if not hundreds, of extra bytes to millions of other |
It's definitely an issue from the external code, unfortunate there is not always a control over this, which is indeed specific for our case. If you have suggestions to minimise the impact on file size. Or otherwise maybe the case could be handle by adding a try catch block arround the assignment? |
Can you tell me which project this code comes from? |
we're trying to load our library on a website (https://diep.io), which as first executes this code; <!doctype html><html><head><script>function freeze_object(x)
{
Object.freeze(x);
Object.seal(x);
Object.freeze(x.prototype);
Object.seal(x.prototype);
}
freeze_object(WebSocket);
freeze_object(WebAssembly);
freeze_object(CanvasRenderingContext2D);
freeze_object(HTMLCanvasElement);
freeze_object(Function);
// freeze_object(Object);
freeze_object(Path2D);
freeze_object(ImageData);
freeze_object(ImageBitmap);
window.frozenHasFocus = Object.freeze({ hasFocus: document.hasFocus });</script></head></html>
```
The code of the website is not under our control |
If you distribute a library, |
i agree with that, only |
I'll think about it. You could change your PR to |
thank you for your consideration, and general hard work on |
in cases the
Function.prototype
is sealed/frozen, this will throw an error causing any remaining code to abort.