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 {HTMLElement} */
10 Document.prototype.activeElement;
12 /** @type {Array.<HTMLElement>} */
13 Document.prototype.all;
15 /** @type {boolean} */
16 Document.prototype.hidden;
18 /** @type {function(string): void} */
19 Document.prototype.execCommand = function(command) {};
21 /** @return {void} Nothing. */
22 Document.prototype.webkitCancelFullScreen = function() {};
24 /** @type {boolean} */
25 Document.prototype.webkitIsFullScreen;
27 /** @type {boolean} */
28 Document.prototype.webkitHidden;
30 /** @type {Element} */
31 Document.prototype.firstElementChild;
34 Element.ALLOW_KEYBOARD_INPUT;
36 /** @param {number} flags
37 /** @return {void} Nothing. */
38 Element.prototype.webkitRequestFullScreen = function(flags) {};
40 /** @type {boolean} */
41 Element.prototype.hidden;
44 Element.prototype.localName;
47 Element.prototype.textContent;
51 @extends {HTMLElement} */
52 var HTMLEmbedElement = function() { };
55 HTMLEmbedElement.prototype.height;
58 HTMLEmbedElement.prototype.width;
61 HTMLIFrameElement.prototype.contentWindow;
68 * @param {string} jsonStr The string to parse.
69 * @param {(function(string, *) : *)=} opt_reviver
70 * @return {*} The JSON object.
72 JSON.parse = function(jsonStr, opt_reviver) {};
75 * @param {*} jsonObj Input object.
76 * @param {(Array.<string>|(function(string, *) : *)|null)=} opt_replacer
77 * @param {(number|string)=} opt_space
78 * @return {string} json string which represents jsonObj.
80 JSON.stringify = function(jsonObj, opt_replacer, opt_space) {};
84 * @param {string} name
87 Node.prototype.getAttribute = function(name) { };
92 /** @type {{top: string, left: string, bottom: string, right: string}} */
98 * @param {function(Array.<MutationRecord>):void} callback
100 var MutationObserver = function(callback) {};
103 * @param {Element} element
104 * @param {Object} options
106 MutationObserver.prototype.observe = function(element, options) {};
110 var MutationRecord = function() {};
112 /** @type {string} */
113 MutationRecord.prototype.attributeName;
115 /** @type {Element} */
116 MutationRecord.prototype.target;
118 /** @type {string} */
119 MutationRecord.prototype.type;
122 /** @type {{getRandomValues: function((Uint16Array|Uint8Array)):void}} */
123 Window.prototype.crypto;
128 * @implements {EventTarget} */
129 var EventTargetStub = function() {};
132 * @param {string} type
133 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener
134 * @param {boolean=} opt_useCapture
136 EventTargetStub.prototype.addEventListener =
137 function(type, listener, opt_useCapture) {}
140 * @param {string} type
141 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener
142 * @param {boolean=} opt_useCapture
144 EventTargetStub.prototype.removeEventListener =
145 function(type, listener, opt_useCapture) {}
148 * @param {Event} event
150 EventTargetStub.prototype.dispatchEvent =
155 * @extends {EventTargetStub}
157 var SourceBuffer = function() {}
159 /** @type {boolean} */
160 SourceBuffer.prototype.updating;
162 /** @type {TimeRanges} */
163 SourceBuffer.prototype.buffered;
166 * @param {ArrayBuffer} buffer
168 SourceBuffer.prototype.appendBuffer = function(buffer) {}
171 * @param {number} start
172 * @param {number} end
174 SourceBuffer.prototype.remove = function(start, end) {}
178 * @extends {EventTargetStub}
180 var MediaSource = function() {}
183 * @param {string} format
184 * @return {SourceBuffer}
186 MediaSource.prototype.addSourceBuffer = function(format) {}
190 * @param {function(function(*), function(*)) : void} init
192 var Promise = function (init) {};
195 * @param {function(?=) : (Promise|void)} onFulfill
196 * @param {function(?=) : (Promise|void)=} onReject
199 Promise.prototype.then = function (onFulfill, onReject) {};
202 * @param {function(*) : void} onReject
205 Promise.prototype['catch'] = function (onReject) {};
208 * @param {Array.<Promise>} promises
211 Promise.prototype.race = function (promises) {}
214 * @param {Array.<Promise>} promises
217 Promise.prototype.all = function (promises) {};
223 Promise.reject = function (reason) {};
229 Promise.resolve = function (value) {};
232 * @param {string} type
233 * @param {boolean} canBubble
234 * @param {boolean} cancelable
235 * @param {Window} view
236 * @param {number} detail
237 * @param {number} screenX
238 * @param {number} screenY
239 * @param {number} clientX
240 * @param {number} clientY
241 * @param {boolean} ctrlKey
242 * @param {boolean} altKey
243 * @param {boolean} shiftKey
244 * @param {boolean} metaKey
245 * @param {number} button
246 * @param {EventTarget} relatedTarget
248 Event.prototype.initMouseEvent = function(
249 type, canBubble, cancelable, view, detail,
250 screenX, screenY, clientX, clientY,
251 ctrlKey, altKey, shiftKey, metaKey,
252 button, relatedTarget) {};
255 * @param {number} begin
256 * @param {number=} end
257 * @return {ArrayBuffer}
259 ArrayBuffer.prototype.slice = function(begin, end) {};