Chrome扩展程序:WebQL数据库未出现在Inspector中 [英] Chrome Extension: WebQL database is not appearing in Inspector
问题描述
我试图在 background.js
文件中创建数据库和表格,但不知何故它没有被创建。当我在Chrome Inspector> Resources> WebSQL中看到时,我什么都没发现。代码如下:
function fetchData(){
var xhr = new XMLHttpRequest();
xhr.open(GET,http://localhost/php/fetch.php,true);
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
// JSON.parse不会评估攻击者的脚本。
var resp = xhr.responseText;
if(resp!= null){
var json = JSON.parse(resp)
console.log(resp);
var data = json ['data'];
if(data!= null){
openDatabase('documents','1.0','my storage',5 * 1024 * 1024,function(db){
alert('Called '); //这不是被调用的
});
// var dbConnection = openDbConnect();
// createTable(dbConnection);
//下面的代码被称为
(var a = 0; a< = data.length; a ++){
alert(data [a] .title);
}
}
}
}
}
xhr.send();
}
更新
$ b
我猜它正在创建中:我的扩展ID是 bkjajbjnoadlhnhmfekipifehbhgidpg
在〜/ Library / Application Support / Google / Chrome / Default / databases
我发现:
chrome-extension_bkjajbjnoadlhnhmfekipifehbhgidpg_0
但在Inspector中我看不到它。
更新#2
结果表明,像Chrome,Chrome和Chrome这样的页面 WebSQL
不可见。它显示Db到被访问的页面。现在我不知道如何在浏览器中过度使用与Chrome相关的Db。 为解决方案
访问检查器应用程序,进入菜单>设置>扩展,并确保它在开发人员模式。它应该有一个链接来检查你的应用程序的背景页面。它将在新窗口中打开。
I am trying to create database and tables in background.js
file of Chrome but somehow it's not being created. When I see in Chrome Inspector > Resources > WebSQL, I find nothing. Code is given below:
function fetchData(){
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/php/fetch.php", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
// JSON.parse does not evaluate the attacker's scripts.
var resp = xhr.responseText;
if(resp != null) {
var json = JSON.parse(resp)
console.log(resp);
var data = json['data'];
if(data != null) {
openDatabase('documents', '1.0', 'my storage', 5*1024*1024, function (db) {
alert('Called'); //This is not being called.
});
//var dbConnection = openDbConnect();
//createTable(dbConnection);
//Code below is called
for(var a=0;a <= data.length;a++) {
alert(data[a].title);
}
}
}
}
}
xhr.send();
}
Update
I guess it's being created: My Extension ID is bkjajbjnoadlhnhmfekipifehbhgidpg
In ~/Library/Application Support/Google/Chrome/Default/databases
I find:
chrome-extension_bkjajbjnoadlhnhmfekipifehbhgidpg_0
But it's weird I can't see it in Inspector.
Update #2
Turns out that like pages, WebSQL
is not visible across Chrome. It shows Db to the page which is visited. Now I am getting no idea how to excess chrome related Db in Viewer.
To access the inspector for the background page of your app, go to Menu>Settings>Extensions and make sure it's in Developer Mode. It should have a link to inspect the background page of your app in there. It will open up in a new window.
这篇关于Chrome扩展程序:WebQL数据库未出现在Inspector中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!