我正在尝试使用Webview API将Web应用程序集成到VS Code中。 我有这样的错误,提到无法读取Cookie:
error: any
:
DOMException: Failed to read the 'cookie' property from 'Document': Cookies are disabled inside 'data:' URLs. at HttpXsrfCookieExtractor.push../node_modules/@angular/common/fesm5/http.js.HttpXsrfCookieExtractor.getToken (http://127.0.0.1:8585/vendor.js:7688:37) at ApiXsrfInterceptor.push../src/app/lib/atlasmap-data-mapper/services/api-xsrf-interceptor.service.ts.ApiXsrfInterceptor.intercept (http://127.0.0.1:8585/main.js:8780:45) at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http://127.0.0.1:8585/vendor.js:7129:33) at HttpXsrfInterceptor.push../node_modules/@angular/common/fesm5/http.js.HttpXsrfInterceptor.intercept (http://127.0.0.1:8585/vendor.js:7720:25) at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http://127.0.0.1:8585/vendor.js:7129:33) at HttpInterceptingHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptingHandler.handle (http://127.0.0.1:8585/vendor.js:7764:27) at MergeMapSubscriber.project (http://127.0.0.1:8585/vendor.js:6969:184) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._tryNext (http://127.0.0.1:8585/vendor.js:106781:27) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._next (http://127.0.0.1:8585/vendor.js:106771:18) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (http://127.0.0.1:8585/vendor.js:101228:18)
code
:
18
message
:
"Failed to read the 'cookie' property from 'Document': Cookies are disabled inside 'data:' URLs."
name
:
"SecurityError"
stack
:
"Error: Failed to read the 'cookie' property from 'Document': Cookies are disabled inside 'data:' URLs.↵ at HttpXsrfCookieExtractor.push../node_modules/@angular/common/fesm5/http.js.HttpXsrfCookieExtractor.getToken (http://127.0.0.1:8585/vendor.js:7688:37)↵ at ApiXsrfInterceptor.push../src/app/lib/atlasmap-data-mapper/services/api-xsrf-interceptor.service.ts.ApiXsrfInterceptor.intercept (http://127.0.0.1:8585/main.js:8780:45)↵ at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http://127.0.0.1:8585/vendor.js:7129:33)↵ at HttpXsrfInterceptor.push../node_modules/@angular/common/fesm5/http.js.HttpXsrfInterceptor.intercept (http://127.0.0.1:8585/vendor.js:7720:25)↵ at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http://127.0.0.1:8585/vendor.js:7129:33)↵ at HttpInterceptingHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptingHandler.handle (http://127.0.0.1:8585/vendor.js:7764:27)↵ at MergeMapSubscriber.project (http://127.0.0.1:8585/vendor.js:6969:184)↵ at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._tryNext (http://127.0.0.1:8585/vendor.js:106781:27)↵ at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._next (http://127.0.0.1:8585/vendor.js:106771:18)↵ at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (http://127.0.0.1:8585/vendor.js:101228:18)"
是VS Code Webview API的限制吗?是否需要配置?
作为参考,我尝试集成的项目是https://github.com/atlasmap/atlasmap,其中有一个PR带有“当前状态”(又名不起作用)
答案 0 :(得分:1)
VSCode Webview API也禁用了对本地存储和cookie的评估,这就是您得到错误的原因。