Chrome 扩展:WebQL 数据库未出现在 Inspector 中
Chrome Extension: WebQL database is not appearing in Inspector
我正在尝试在 Chrome 的 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 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();
}
更新
我猜它正在创建:我的扩展 ID 是 bkjajbjnoadlhnhmfekipifehbhgidpg
在 ~/Library/Application Support/Google/Chrome/Default/databases
中我发现:
chrome-extension_bkjajbjnoadlhnhmfekipifehbhgidpg_0
但很奇怪我在 Inspector 中看不到它。
更新#2
事实证明,与页面一样,WebSQL
在 Chrome 中不可见。它向访问的页面显示 Db。现在我不知道如何在 Viewer 中超过 chrome 相关的 Db。
要访问应用程序后台页面的检查器,请转至菜单>设置>扩展并确保它处于开发人员模式。它应该有一个 link 来检查你的应用程序的背景页面。它将在新 window 中打开。
我正在尝试在 Chrome 的 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 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();
}
更新
我猜它正在创建:我的扩展 ID 是 bkjajbjnoadlhnhmfekipifehbhgidpg
在 ~/Library/Application Support/Google/Chrome/Default/databases
中我发现:
chrome-extension_bkjajbjnoadlhnhmfekipifehbhgidpg_0
但很奇怪我在 Inspector 中看不到它。
更新#2
事实证明,与页面一样,WebSQL
在 Chrome 中不可见。它向访问的页面显示 Db。现在我不知道如何在 Viewer 中超过 chrome 相关的 Db。
要访问应用程序后台页面的检查器,请转至菜单>设置>扩展并确保它处于开发人员模式。它应该有一个 link 来检查你的应用程序的背景页面。它将在新 window 中打开。