google / google/closure-compiler
chrome_extensions.js incomplete for chrome.windows
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
chrome_extensions.js defines chrome.windows.get(), .getAll(), .getCurrent(), .getLastFocused() in such a manner that when using "--compilation_level ADVANCED_OPTIMIZATIONS", the getInfo members are minified, when they shouldn't be. Similar issues for chrome.windows.create() and chrome.windows.update().
I have added 3 @typedef's in my local copy as seen below, which seems to fix the problem, thus leaving these various members unminified. I'll do a pull request if I have the time.
---
```
/**
* @typedef {?{
* url: (string|Array|undefined),
* tabId: (number|undefined),
* left: (number|undefined),
* top: (number|undefined),
* width: (number|undefined),
* height: (number|undefined),
* focused: (boolean|undefined),
* incognito: (boolean|undefined),
* type: (string|undefined),
* state: (string|undefined),
* }}
*/
chrome.windows.CreateDataProperties;
/**
* @param {!chrome.windows.CreateDataProperties} opt_createData May have many keys to specify parameters.
* Or the callback.
* @param {function(ChromeWindow): void=} opt_callback Callback.
* @return {undefined}
*/
chrome.windows.create = function(opt_createData, opt_callback) {};
/**
* @typedef {?{
* populate: (boolean|undefined),
* windowTypes: (Array|undefined)
* }}
*/
chrome.windows.GetInfoProperties;
/**
* @param {number} id Window id.
* @param {!chrome.windows.GetInfoProperties} opt_getInfo May have 'populate' key. Or the callback.
* @param {function(!ChromeWindow): void=} opt_callback Callback when
* opt_getInfo is an object.
* @return {undefined}
*/
chrome.windows.get = function(id, opt_getInfo, opt_callback) {};
/**
* @param {!chrome.windows.GetInfoProperties} opt_getInfo May have 'populate' key. Or the callback.
* @param {function(!Array): void=} opt_callback Callback.
* @return {undefined}
*/
chrome.windows.getAll = function(opt_getInfo, opt_callback) {};
/**
* @param {!chrome.windows.GetInfoProperties} opt_getInfo May have 'populate' key. Or the callback.
* @param {function(ChromeWindow): void=} opt_callback Callback.
* @return {undefined}
*/
chrome.windows.getCurrent = function(opt_getInfo, opt_callback) { };
/**
* @param {!chrome.windows.GetInfoProperties} opt_getInfo May have 'populate' key. Or the callback.
* @param {function(ChromeWindow): void=} opt_callback Callback.
* @return {undefined}
*/
chrome.windows.getLastFocused = function(opt_getInfo, opt_callback) { };
/**
* @param {number} tabId Tab Id.
* @param {function(): void=} opt_callback Callback.
* @return {undefined}
*/
chrome.windows.remove = function(tabId, opt_callback) {};
/**
* @typedef {?{
* left: (number|undefined),
* top: (number|undefined),
* width: (number|undefined),
* height: (number|undefined),
* focused: (boolean|undefined),
* drawAttention: (boolean|undefined),
* state: (string|undefined)
* }}
*/
chrome.windows.UpdateProperties;
/**
* @param {number} tabId Tab Id.
* @param {!chrome.windows.UpdateProperties} updateProperties An object which may have many keys for
* various options.
* @param {function(): void=} opt_callback Callback.
* @return {undefined}
*/
chrome.windows.update = function(tabId, updateProperties, opt_callback) {};
```
Contributor guide
Assessment
This issue has not been assessed yet.