core icon indicating copy to clipboard operation
core copied to clipboard

Could an update be needed for globalsAllowList

Open 0o001 opened this issue 2 years ago • 5 comments

What problem does this feature solve?

https://github.com/vuejs/core/blob/main/packages/shared/src/globalsAllowList.ts#L3

What does the proposed API look like?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects

Symbol etc.

0o001 avatar Aug 23 '23 13:08 0o001

Why?

LinusBorg avatar Aug 24 '23 11:08 LinusBorg

I think it's a reasonable request.

As Evan said

The template global whitelist has always only included language-level globals (as defined in ECMA-262)

So maybe we can add all of the standard built-in objects. Otherwise, it is difficult to explain why Object, Boolean, String, RegExp, BigInt can be used in the template, but Symbol cannot.

sxzz avatar Aug 24 '23 12:08 sxzz

Symbol itself may be a valuable addition. I was kinda interested in the "etc.", wether there are additional things OP wants to include and why.

LinusBorg avatar Aug 24 '23 13:08 LinusBorg

Symbol itself may be a valuable addition. I was kinda interested in the "etc.", wether there are additional things OP wants to include and why.

Although I'm not certain, I had thought that in addition to Symbol, globalThis, Reflect, WeakMap, and WeakSet could also be included. Also, the reason I shared the MDN link was for you to be able to check if there was anything else that I might have missed or that you would like to add.

0o001 avatar Aug 24 '23 14:08 0o001

how about setTimeout/document/window....

zhangenming avatar Sep 30 '24 10:09 zhangenming