简体   繁体   English

Chrome devtools为IndexedDB扩展

[英]Chrome devtools extension for IndexedDB

I am trying to build a tool that facilitates CRUD operations ie, a GUI for IndexedDB in Chrome. 我正在尝试构建一个促进CRUD操作的工具,即Chrome中的IndexedDB GUI。 When I opened the database connection in the chrome dev tools panel, I found out that it has a separate IndexedDB store for panel.html for itself. 当我在chrome dev工具面板中打开数据库连接时,我发现它为panel.html提供了一个单独的IndexedDB存储。 Panel cannot access the current page's database. Panel无法访问当前页面的数据库。

Is there any way we can access page's database from a chrome dev tool's extension panel. 我们有什么方法可以从chrome dev工具的扩展面板访问页面的数据库。

The current page's IndexedDB can't be accessed from within the extension (or the extension's dev tools) due to security reasons: 由于安全原因,无法从扩展程序(或扩展程序的dev工具)中访问当前页面的IndexedDB:

"IndexedDB uses the same-origin principle, which means that it ties the store to the origin of the site that creates it (typically, this is the site domain or subdomain)." “IndexedDB使用同源原则,这意味着它将商店与创建它的站点的原点联系起来(通常,这是站点域或子域)。” https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB#Security https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB#Security

But as pointed out by aug it is possible to request cross-origin permissions: 但正如八月所指出的,可以请求跨源权限:

"By adding hosts or host match patterns (or both) to the permissions section of the manifest file, the extension can request access to remote servers outside of its origin." “通过将主机或主机匹配模式(或两者)添加到清单文件的权限部分,扩展可以请求访问其原始数据之外的远程服务器。” https://developer.chrome.com/extensions/xhr#requesting-permission https://developer.chrome.com/extensions/xhr#requesting-permission

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM