问题
I was hoping to do some experimentation with the chrome.downloads
api. I downloaded the dev and canary versions of Chrome and created a new extension with the downloads
permission, as well as <all_urls>
.
When I load the extension, the "permissions" link shows I have permission to "Download files" so the permission is being loaded successfully.
When I inspect the "chrome" object in the debugger, chrome.downloads
is set to undefined
. If I go to use the object it causes the extension to unload. It also causes an empty notification to appear in the corner of the screen, but as it doesn't have any content I can't tell if this is meant to be a message informing me that I've not done something I need to.
In addition I downloaded the example extension, Downloads Overwrite Existing Files, which also fails to run on either dev or canary.
Does anyone know how to get this working? As far as I can tell I have done everything that is required.
回答1:
You are probably seeing two unrelated bugs in action. The empty notification is https://code.google.com/p/chromium/issues/detail?id=181191, which is preventing you from seeing the contents: "Downloads Overwrite Existing Files has crashed. Click this balloon to reload the extension." This bug cropped up very recently, and we're looking at it now.
The other bug, as you've probably guessed, is that crash. I just filed it here: https://code.google.com/p/chromium/issues/detail?id=197926.
Sorry for the trouble. This is part of the fun of running on some of the more "exciting" channels. This is a pretty lame answer to your question because it doesn't get you unblocked, but it is a correct explanation of what's going on.
来源:https://stackoverflow.com/questions/15431075/how-do-i-enable-the-chrome-downloads-api-on-the-dev-or-canary-channels