Let's say I have a Chrome extension adding some JS code to each visited page (this is quite common with content_scripts
):
{
"name": "...",
"content_scripts": [
{
"js": ["run.js"],
"matches": ["http://*/*", "https://*/*"],
"run_at": "document_end"
}
]
...
}
Let' say the run.js
has a global templates
variable:
var templates = {0: 'hello world', 1: 'bye bye'}; // default templates
chrome.storage.sync.get("templates", function(obj) {
templates = obj.templates;
});
document.addEventListener("keydown", function(e) {
// add template to textarea if a specific key is pressed
}
Question: can a website I'm visiting scrape all my personal data stored in my templates (because it's in a global variable templates
), and send it via AJAX to their server? If so, how?
Or is it impossible because there is an isolation wall between Chrome extension content_scripts' variables and the page's variables?