-
Notifications
You must be signed in to change notification settings - Fork 205
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
Incorrect semantics for globals #146
Comments
Hey! 👋 Which version of |
I was just looking into it and commenting out the line which proxies globals fixes it, and I don't see that code anymore on github! The newer code for working with globals looks more reasonable and if it's released, should fix it! Will try it out. Thanks a lot! I was worried this would be a weird esoteric thing but looks like it's straight-forward and already being addressed :) |
I am using version function proxyHasInstance(target, hasInstance, handler) {
return new Proxy(target, {
get(target2, property, receiver) {
if (property === Symbol.hasInstance)
return hasInstance;
return Reflect.get(target2, property, receiver);
},
...handler
});
}
function makeProxiedGlobals(blockCodeGeneration) {
if (!blockCodeGeneration)
blockCodeGeneration = void 0;
return {
Object: proxyHasInstance(Object, isObject),
Array: proxyHasInstance(Array, Array.isArray),
Promise: proxyHasInstance(Promise, import_util.types.isPromise),
RegExp: proxyHasInstance(RegExp, import_util.types.isRegExp),
Error: proxyHasInstance(Error, isError(Error)),
EvalError: proxyHasInstance(EvalError, isError(EvalError)),
RangeError: proxyHasInstance(RangeError, isError(RangeError)),
ReferenceError: proxyHasInstance(ReferenceError, isError(ReferenceError)),
SyntaxError: proxyHasInstance(SyntaxError, isError(SyntaxError)),
TypeError: proxyHasInstance(TypeError, isError(TypeError)),
URIError: proxyHasInstance(URIError, isError(URIError)),
Function: proxyHasInstance(Function, isFunction, blockCodeGeneration && {
construct() {
throw new EvalError("Code generation from strings disallowed for this context");
}
})
};
} |
I've just created the PR to upgrade to |
thanks!
what constitutes a realm here? what real-world use cases would see this problem? I'm assume each module isn't a realm as that would mean object passed across them wouldn't work. where are the realm boundaries? |
The comment at the start of this file goes into detail on this. 🙂 The realm boundary is between stuff running in Node (runtime APIs: KV, etc) and stuff running in Miniflare's |
cool, that's what I figured but wanted to make sure that was right. Shouldn't be a problem for my case, and that tradeoff makes sense! |
These should be true:
They are true in node, browser, and are true in production cloudflare pages/workers. They are not true in miniflare.
(my use case is trying to use ClojureScript compiled code which is using these)
The text was updated successfully, but these errors were encountered: