1. If Chrome is going to deprecate the background pages, then where exactly are we going to write the code for our extensions? E.g., we'll write the code in 'script.js' and refer to this script from our extension manifest file?
Background pages are being replaced by service workers. The extensions team is actively working on the service worker implementation, so we don't have a final name for the service worker entry point in manifest.json. That said, the current implementation would look like this:
// Current manifest entry
"background": {
"scripts": ["background-script.js"]
}
// Future (maybe???)
"background": {
"service_worker": "background-sw.js"
}
2. How is the 'Native Host Process communication' with extensions going to work with the new 'DeclarativeNetRequest API'? Same as before?
To my knowledge native host messaging should work as it does today in persistent background pages. I'm not sure how declaritiveNetRequest (DNR) would be involved, though. Is there something specific that you're concerned about here?
No, the scenario you described will not be possible.
A key aspect of this API is that its declarative. Unlike blocking webRequest, you will not be able to intercept and block a request. Rather, with this API you define a set of rules and actions to take if those rules are matched, and then hand them off to Chrome for execution. For example, you could create a rule that says something like "if the request has a cookie named 'tracking_*', remove the cookie from the request".
4. The methods being offered right now from https://developers.chrome.com/extensions/declarativeNetRequest are just for adding or removing rules but there is no information about methods that we'd be able to use for obtaining details about the request headers / request data. Am I missing something or those methods are still under development?
You're correct. DNR is not meant as a complete replacement for the webRequest API. Only the blocking capabilities of the webRequest API are deprecated; the observational capabilities will remain. You will still be able to use webRequest to inspect requests but you won't be able to use this API to modify them in flight.
5. API available from https://developers.chrome.com/extensions/declarativeNetRequest is said to "Not fully implemented. You must build Chromium from source to try this API." But I've seen from Google Groups discussions that the Developers will be given time to adapt their code from v2 to v3. Approximately by when will we get this API in release builds?
That note in the DNR API docs ("You must build Chromium from source to try this API") is not completely accurate. Some DNR capabilities are in stable now. That said, this API is still very much a work in progress. I'd recommend using Chrome Canary to experiment with it and let us know what issues you run into.
Simeon - @dotproto
Extensions Developer Advocate