fix(proxy): protect the program when querySelectorAll throws an excep… #547
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
npm run test
通过详细描述
wujie
对子应用中的getElementsByTagName
,getElementsByClassName
,getElementsByName
进行了拦截,并在某些条件下采用了querySelectorAll
进行替代,根据 MDN 上的描述,如果传递给querySelectorAll
是一个非法的字符,那么querySelectorAll
就会抛出异常阻止程序的执行这里需要对程序的运行做一层保护,应对外部传递给
querySelectorAll
的非法参数的情况。举个场景,比如在使用 YouTube Player 的时候,会出现
yt:player
的情况这个时候如果不对
querySelectorAll
的执行过程进行保护,那么就会影响外部程序的执行