1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file contains various hacks needed to inform JSCompiler of various
6 // WebKit- and Chrome-specific properties and methods. It is used only with
7 // JSCompiler to verify the type-correctness of our code.
9 /** @type {Array<string>} */
10 ClipboardData.prototype.types;
12 /** @type {HTMLElement} */
13 Document.prototype.activeElement;
15 /** @type {Array<HTMLElement>} */
16 Document.prototype.all;
18 /** @type {boolean} */
19 Document.prototype.hidden;
21 /** @return {void} Nothing. */
22 Document.prototype.exitPointerLock = function() {};
24 /** @type {boolean} */
25 Document.prototype.webkitIsFullScreen;
27 /** @type {boolean} */
28 Document.prototype.webkitHidden;
30 /** @type {Element} */
31 Document.prototype.firstElementChild;
33 /** @return {void} Nothing. */
34 Element.prototype.requestPointerLock = function() {};
36 /** @type {boolean} */
37 Element.prototype.disabled;
39 /** @type {boolean} */
40 Element.prototype.hidden;
43 Element.prototype.innerText;
46 Element.prototype.localName;
49 Element.prototype.offsetRight;
52 Element.prototype.offsetBottom;
55 Element.prototype.textContent;
57 /** @type {DOMTokenList} */
58 Element.prototype.classList;
60 /** @type {boolean} */
61 Element.prototype.checked;
64 HTMLIFrameElement.prototype.contentWindow;
67 * @param {string} selector
68 * @return {?HTMLElement}.
70 HTMLElement.prototype.querySelector = function(selector) {};
73 * @param {string} name
76 Node.prototype.getAttribute = function(name) { };
81 /** @type {{top: string, left: string, bottom: string, right: string}} */
84 /** @type {boolean} */
85 Node.prototype.hidden;
88 /** @type {{getRandomValues: function(!ArrayBufferView):!ArrayBufferView}} */
89 Window.prototype.crypto;
93 * @type {DataTransfer}
95 Event.prototype.dataTransfer = null;
100 Event.prototype.movementX = 0;
105 Event.prototype.movementY = 0;
108 * @param {string} type
109 * @param {boolean} canBubble
110 * @param {boolean} cancelable
111 * @param {Window} view
112 * @param {number} detail
113 * @param {number} screenX
114 * @param {number} screenY
115 * @param {number} clientX
116 * @param {number} clientY
117 * @param {boolean} ctrlKey
118 * @param {boolean} altKey
119 * @param {boolean} shiftKey
120 * @param {boolean} metaKey
121 * @param {number} button
122 * @param {EventTarget} relatedTarget
124 Event.prototype.initMouseEvent = function(
125 type, canBubble, cancelable, view, detail,
126 screenX, screenY, clientX, clientY,
127 ctrlKey, altKey, shiftKey, metaKey,
128 button, relatedTarget) {};
130 /** @type {Object} */
131 Event.prototype.data = {};
135 * @return {boolean} whether value is an integer or not.
137 Number.isInteger = function(value) {};
139 // Chrome implements XMLHttpRequest.responseURL starting from Chrome 37.
140 /** @type {string} */
141 XMLHttpRequest.prototype.responseURL = "";
144 /*******************************************************************************
145 * Webview and related declarations
146 ******************************************************************************/
149 * Like chrome.webRequest, but for webview tags.
151 * chrome.webRequest defined in chrome_extensions.js can't be
152 * used because it's not a type.
156 function WebviewWebRequest() {}
158 /** @type {WebRequestEvent} */
159 WebviewWebRequest.prototype.onBeforeSendHeaders;
161 /** @type {WebRequestEvent} */
162 WebviewWebRequest.prototype.onCompleted;
164 /** @type {WebRequestOnErrorOccurredEvent} */
165 WebviewWebRequest.prototype.onErrorOccurred;
168 * Enable access to special APIs of webview DOM element.
171 * @extends {HTMLElement}
173 function Webview() {}
175 /** @type {!WebviewWebRequest} */
176 Webview.prototype.request;
178 /** @type {function(InjectDetails, function(Object))} */
179 Webview.prototype.executeScript;
181 /** @type {Window} */
182 Webview.prototype.contentWindow;
185 * See https://developer.chrome.com/apps/tags/webview#type-InjectDetails
188 * file: (string|undefined),
189 * code: (string|undefined)
194 /*******************************************************************************
195 * ConsoleMessage event
196 ******************************************************************************/
199 * The consolemessage BrowserEvent contains these fields:
200 * e.level: int32, log severity level (for exception/info etc)
201 * e.line: int32, line number
202 * e.message: string, the console message
203 * e.sourceId: string, source identifier (the ones seen in devtools)
208 chrome.ConsoleMessageBrowserEvent = function() {};
210 /** @type {number} */
211 chrome.ConsoleMessageBrowserEvent.prototype.level;
213 /** @type {number} */
214 chrome.ConsoleMessageBrowserEvent.prototype.line;
216 /** @type {string} */
217 chrome.ConsoleMessageBrowserEvent.prototype.message;
219 /** @type {string} */
220 chrome.ConsoleMessageBrowserEvent.prototype.sourceId;