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.
4
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.
8
9/** @type {HTMLElement} */
10Document.prototype.activeElement;
11
12/** @type {Array.<HTMLElement>} */
13Document.prototype.all;
14
15/** @type {boolean} */
16Document.prototype.hidden;
17
18/** @type {function(string): void} */
19Document.prototype.execCommand = function(command) {};
20
21/** @return {void} Nothing. */
22Document.prototype.webkitCancelFullScreen = function() {};
23
24/** @type {boolean} */
25Document.prototype.webkitIsFullScreen;
26
27/** @type {boolean} */
28Document.prototype.webkitHidden;
29
30
31/** @type {number} */
32Element.ALLOW_KEYBOARD_INPUT;
33
34/** @param {number} flags
35/** @return {void} Nothing. */
36Element.prototype.webkitRequestFullScreen = function(flags) {};
37
38/** @type {boolean} */
39Element.prototype.hidden;
40
41
42/** @constructor
43    @extends {HTMLElement} */
44var HTMLEmbedElement = function() { };
45
46/** @type {number} */
47HTMLEmbedElement.prototype.height;
48
49/** @type {number} */
50HTMLEmbedElement.prototype.width;
51
52/** @type {Window} */
53HTMLIFrameElement.prototype.contentWindow;
54
55
56/** @type {Object} */
57var JSON = {};
58
59/**
60 * @param {string} jsonStr The string to parse.
61 * @param {(function(string, *) : *)=} opt_reviver
62 * @return {*} The JSON object.
63 */
64JSON.parse = function(jsonStr, opt_reviver) {};
65
66/**
67 * @param {*} jsonObj Input object.
68 * @param {(Array.<string>|(function(string, *) : *)|null)=} opt_replacer
69 * @param {(number|string)=} opt_space
70 * @return {string} json string which represents jsonObj.
71 */
72JSON.stringify = function(jsonObj, opt_replacer, opt_space) {};
73
74
75/**
76 * @param {string} name
77 * @return {string}
78 */
79Node.prototype.getAttribute = function(name) { };
80
81/** @type {string} */
82Node.prototype.value;
83
84/** @type {{top: string, left: string, bottom: string, right: string}} */
85Node.prototype.style;
86
87
88/**
89 * @constructor
90 * @param {function(Array.<MutationRecord>):void} callback
91 */
92var MutationObserver = function(callback) {};
93
94/**
95 * @param {Element} element
96 * @param {Object} options
97 */
98MutationObserver.prototype.observe = function(element, options) {};
99
100
101/** @constructor */
102var MutationRecord = function() {};
103
104/** @type {string} */
105MutationRecord.prototype.attributeName;
106
107/** @type {Element} */
108MutationRecord.prototype.target;
109
110/** @type {string} */
111MutationRecord.prototype.type;
112
113
114/** @type {{getRandomValues: function((Uint16Array|Uint8Array)):void}} */
115Window.prototype.crypto;
116
117
118/**
119 * @constructor
120 * @implements {EventTarget} */
121var EventTargetStub = function() {};
122
123/**
124 * @param {string} type
125 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener
126 * @param {boolean=} opt_useCapture
127 */
128EventTargetStub.prototype.addEventListener =
129    function(type, listener, opt_useCapture) {}
130
131/**
132 * @param {string} type
133 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener
134 * @param {boolean=} opt_useCapture
135 */
136EventTargetStub.prototype.removeEventListener =
137    function(type, listener, opt_useCapture) {}
138
139/**
140 * @param {Event} event
141 */
142EventTargetStub.prototype.dispatchEvent =
143    function(event) {}
144
145/**
146 * @constructor
147 * @extends {EventTargetStub}
148 */
149var SourceBuffer = function() {}
150
151/** @type {boolean} */
152SourceBuffer.prototype.updating;
153
154/** @type {TimeRanges} */
155SourceBuffer.prototype.buffered;
156
157/**
158 * @param {ArrayBuffer} buffer
159 */
160SourceBuffer.prototype.appendBuffer = function(buffer) {}
161
162/**
163 * @param {number} start
164 * @param {number} end
165 */
166SourceBuffer.prototype.remove = function(start, end) {}
167
168/**
169 * @constructor
170 * @extends {EventTargetStub}
171 */
172var MediaSource = function() {}
173
174/**
175 * @param {string} format
176 * @return {SourceBuffer}
177 */
178MediaSource.prototype.addSourceBuffer = function(format) {}
179
180/**
181 * @constructor
182 * @param {function(function(*), function(*)) : void} init
183 */
184var Promise = function (init) {};
185
186/**
187 * @param {function(*) : void} onFulfill
188 * @param {function(*) : void} onReject
189 * @return {Promise}
190 */
191Promise.prototype.then = function (onFulfill, onReject) {};
192
193/**
194 * @param {function(*) : void} onReject
195 * @return {Promise}
196 */
197Promise.prototype['catch'] = function (onReject) {};
198
199/**
200 * @param {Array.<Promise>} promises
201 * @return {Promise}
202 */
203Promise.prototype.race = function (promises) {}
204
205/**
206 * @param {Array.<Promise>} promises
207 * @return {Promise}
208 */
209Promise.prototype.all = function (promises) {};
210
211/**
212 * @param {*} reason
213 * @return {Promise}
214 */
215Promise.reject = function (reason) {};
216
217/**
218 * @param {*} value
219 * @return {Promise}
220 */
221Promise.resolve = function (value) {};
222