google-chrome-extension

chrome extension - sendResponse not waiting for async function

限于喜欢 提交于 2019-12-31 03:01:20
问题 I am having an issue of asynchronicity (I believe). sendResponse() in contentscript.js does not wait for getThumbnails() to return. I am sending a message in popup.js : chrome.tabs.sendMessage(tabs[0].id, {message: "get_thumbnails", tabUrl: tabs[0].url}, function (respThumbnails) { const thumbUrl = respThumbnails.payload; console.log("payload", thumbUrl) } ); Then, in contentscript.js I listen for this message: chrome.runtime.onMessage.addListener(async function(request,sender,sendResponse) {

chrome extension - sendResponse not waiting for async function

浪尽此生 提交于 2019-12-31 03:01:12
问题 I am having an issue of asynchronicity (I believe). sendResponse() in contentscript.js does not wait for getThumbnails() to return. I am sending a message in popup.js : chrome.tabs.sendMessage(tabs[0].id, {message: "get_thumbnails", tabUrl: tabs[0].url}, function (respThumbnails) { const thumbUrl = respThumbnails.payload; console.log("payload", thumbUrl) } ); Then, in contentscript.js I listen for this message: chrome.runtime.onMessage.addListener(async function(request,sender,sendResponse) {

Chrome Extension: Unsafe JavaScript attempt to access frame with URL Domains, protocols and ports must match

霸气de小男生 提交于 2019-12-31 02:56:05
问题 This answer specifies explains how to access the content of all iframes on gmail.com https://stackoverflow.com/a/9439525/222236 But on mail.google.com it throws this error: Unsafe JavaScript attempt to access frame with URL https://plus.google.com/u/0/_/... from frame with URL https://mail.google.com/mail/u/0/#inbox. Domains, protocols and ports must match. I tried adding *://plus.google.com/* to the matches of the manifest of the extension, but it didn't help. Update: Checking for the url

What are the details can be obtained from webkitStorageInfo.queryUsageAndQuota()

耗尽温柔 提交于 2019-12-31 02:12:13
问题 webkitStorageInfo.queryUsageAndQuota() is used to find out the usage stats of the files that have been stored in the file system using the HTML5 file system API I suppose. Can anyone give me the details that can be obtained in the callback provided to this function. window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.PERSISTENT, function() { //what all details can be obtained in this function as its arguments? }) 回答1: Replace function(){...} with console.log.bind(console) , and you

Google tasks update error

假如想象 提交于 2019-12-31 01:53:13
问题 I am attempting to update a task with the following code: function updtsk(task,id) { var url = 'https://www.googleapis.com/tasks/v1/lists/@default/tasks/'+id; var req = { 'method': 'PUT', 'headers': { 'Content-type': 'application/json' }, 'body': JSON.stringify(task) }; var addDone = function(resp, xhr) { if (xhr.status != 200) { notifyFailure('Couldn\'t update task.', xhr.status); return; } //notifySuccess(task['title']); } oauth.sendSignedRequest(url, addDone, req); } I get the following

When does a run_at: document_idle content script run?

自古美人都是妖i 提交于 2019-12-31 00:49:17
问题 There are three options for running content scripts: document_start - injected at the start of the <head> document_end - injected right after DOMContentLoaded document_idle - injected when??? 回答1: According to the current Chromium source: We try to run idle in two places: here and DidFinishLoad. DidFinishDocumentLoad() corresponds to completing the document's load, whereas DidFinishLoad corresponds to completing the document and all subresources' load. We don't want to hold up script

How do I check if a Google Chrome Extension needs to be updated?

六眼飞鱼酱① 提交于 2019-12-30 18:31:34
问题 I know for extensions hosted on the webstore, when I push updates Google will automatically update the extensions of users but there is a lag (couple of hours). Is there a way for the extension to detect if there is a new update that hasn't been applied? The easiest way to do this would be to somehow query for the current version on the webstore and compare it to the installed version and I was wondering if there was anything in the API for this. I know that chrome.app.getDetails().version

Google chrome extension issue: popup.html interferes with script execution in background.html

一曲冷凌霜 提交于 2019-12-30 12:14:53
问题 I am learning how to extend Google chrome and I have run into the following problem: I have the following manifest file: { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "background_page": "background.html", "browser_action": { "default_icon": "icon.png", "popup": "popup.html" }, "permissions": [ "tabs", "http://*/*", "https://*/*" ] } My background.html file just injects some simple JavaScript into the page: <script> // Called when the user

Security of native messaging?

被刻印的时光 ゝ 提交于 2019-12-30 11:38:32
问题 I have a NPAPI plugin for sign-in data on website. I want to replace it by Native Messaging technology. I have read the documentation, but I have a question : Is this technology safe? Can hackers catch data in transfer from JavaScript to native host app and back? Edit: merging in a better-worded question: How secure is stdio data transfer ? Is there a way for man-in-middle attack for such data transfer ? 回答1: It is, in principle, possible to inspect stdio calls made by an executable. For

chrome extension popup not open immediately

痞子三分冷 提交于 2019-12-30 11:34:15
问题 I'm writing a chrome extension. When i click the browser action button in the first time - all goes well. When i click the browser action button the second time, after several minutes of not clicking it, it takes more than 10 seconds until the popup is shown. I've tried commenting out all of the periodic methods in the background and all of the methods in the load event of the popup, but it still doesn't shown immediately. any suggestions? 回答1: I had a similar issue with the popup when I was