diff --git a/contrib/externs/chrome_extensions.js b/contrib/externs/chrome_extensions.js index 3c787fb54c9..4d5c02a83a2 100644 --- a/contrib/externs/chrome_extensions.js +++ b/contrib/externs/chrome_extensions.js @@ -7157,6 +7157,136 @@ chrome.sockets.udp.ReceiveErrorEvent = function() {}; */ chrome.sockets.udp.onReceiveError; +/** + * @const + * @see https://developer.chrome.com/extensions/scripting.html + */ +chrome.scripting = {}; + +/** + * @param {!chrome.scripting.ScriptInjection} injection + * @param {function(Array): void=} callback + * @return {Promise>} + * @see https://developer.chrome.com/extensions/scripting#method-executeScript + */ +chrome.scripting.executeScript = function(injection, callback) {}; + +/** + * @typedef {{ + * args: (!Array|undefined), + * files: (!Array|undefined), + * injectImmediately: (boolean|undefined), + * target: (!chrome.scripting.ScriptInjection), + * world: (string|undefined), + * func: (function()), + * }} + */ +chrome.scripting.ScriptInjection; + + +/** + * @typedef {{ + * allFrames: (boolean|undefined), + * documentIds: (!Array|undefined), + * frameIds: (!Array|undefined), + * tabId: (number|undefined), + * }} + */ +chrome.scripting.InjectionTarget; + +/** + * @typedef {{ + * result: (Object|undefined), + * frameId: (number|undefined), + * documentId: (string|undefined), + * }} + */ +chrome.scripting.InjectionResult; + + +/** + * @param {function(!Array): void=} + * callback + * @return {Promise>} + * @see https://developer.chrome.com/extensions/scripting#method-getRegisteredContentScripts + */ +chrome.scripting.getRegisteredContentScripts = function(callback) {}; + +/** + * @param {!Array} scripts + * @param {function(): void=} callback + * @return {Promise} + * @see https://developer.chrome.com/extensions/scripting#method-registerContentScripts + */ +chrome.scripting.registerContentScripts = function(scripts, callback) {}; + +/** + * @param {!Array} scripts + * @param {function(): void=} callback + * @return {Promise} + * @see https://developer.chrome.com/extensions/scripting#method-unregisterContentScripts + */ +chrome.scripting.updateContentScripts = function(scripts, callback) {}; + +/** + * @param {!chrome.scripting.ContentScriptFilter} filter + * @param {function(): void=} callback + * @return {Promise} + * @see https://developer.chrome.com/extensions/scripting#method-unregisterContentScripts + */ +chrome.scripting.unregisterContentScripts = function(filter, callback) {}; + +/** + * @typedef {{ + * id: string, + * js: (!Array|undefined), + * css: (!Array|undefined), + * matches: (!Array|undefined), + * excludeMatches: (!Array|undefined), + * runAt: (string|undefined), + * world: (string|undefined), + * allFrames: (boolean|undefined), + * matchOriginAsFallback: (boolean|undefined), + * persistAcrossSessions: (boolean|undefined), + * }} + * @see https://developer.chrome.com/extensions/scripting#type-RegisteredContentScript + */ +chrome.scripting.RegisteredContentScript; + +/** + * @typedef {{ + * ids: !Array, + * }} + * @see https://developer.chrome.com/extensions/scripting#type-ContentScriptFilter + */ +chrome.scripting.ContentScriptFilter = function() {}; + +/** + * @param {!chrome.scripting.CSSInjection} injection + * @param {function(): void=} callback + * @return {Promise} + * @see https://developer.chrome.com/extensions/scripting#method-insertCSS + */ +chrome.scripting.insertCSS = function(injection, callback) {}; + +/** + * @param {!chrome.scripting.CSSInjection} injection + * @param {function(): void=} callback + * @return {Promise} + * @see https://developer.chrome.com/extensions/scripting#method-removeCSS + */ +chrome.scripting.removeCSS = function(injection, callback) {}; + +/** + * @typedef {{ + * css: (string|undefined), + * files: (!Array|undefined), + * origin: (string|undefined), + * target: (!chrome.scripting.InjectionTarget|undefined), + * }} + * @see https://developer.chrome.com/extensions/scripting#type-CSSInjection + */ +chrome.scripting.CSSInjection; /** * @const