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
;
32 Element
.ALLOW_KEYBOARD_INPUT
;
34 /** @param {number} flags
35 /** @return {void} Nothing. */
36 Element
.prototype.webkitRequestFullScreen = function(flags
) {};
38 /** @type {boolean} */
39 Element
.prototype.hidden
;
43 @extends {HTMLElement} */
44 var HTMLEmbedElement = function() { };
47 HTMLEmbedElement
.prototype.height
;
50 HTMLEmbedElement
.prototype.width
;
53 HTMLIFrameElement
.prototype.contentWindow
;
60 * @param {string} jsonStr The string to parse.
61 * @param {(function(string, *) : *)=} opt_reviver
62 * @return {*} The JSON object.
64 JSON
.parse = function(jsonStr
, opt_reviver
) {};
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.
72 JSON
.stringify = function(jsonObj
, opt_replacer
, opt_space
) {};
76 * @param {string} name
79 Node
.prototype.getAttribute = function(name
) { };
84 /** @type {{top: string, left: string, bottom: string, right: string}} */
90 * @param {function(Array.<MutationRecord>):void} callback
92 var MutationObserver = function(callback
) {};
95 * @param {Element} element
96 * @param {Object} options
98 MutationObserver
.prototype.observe = function(element
, options
) {};
102 var MutationRecord = function() {};
104 /** @type {string} */
105 MutationRecord
.prototype.attributeName
;
107 /** @type {Element} */
108 MutationRecord
.prototype.target
;
110 /** @type {string} */
111 MutationRecord
.prototype.type
;
114 /** @type {{getRandomValues: function((Uint16Array|Uint8Array)):void}} */
115 Window
.prototype.crypto
;
120 * @implements {EventTarget} */
121 var EventTargetStub = function() {};
124 * @param {string} type
125 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener
126 * @param {boolean=} opt_useCapture
128 EventTargetStub
.prototype.addEventListener
=
129 function(type
, listener
, opt_useCapture
) {}
132 * @param {string} type
133 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener
134 * @param {boolean=} opt_useCapture
136 EventTargetStub
.prototype.removeEventListener
=
137 function(type
, listener
, opt_useCapture
) {}
140 * @param {Event} event
142 EventTargetStub
.prototype.dispatchEvent
=
147 * @extends {EventTargetStub}
149 var SourceBuffer = function() {}
151 /** @type {boolean} */
152 SourceBuffer
.prototype.updating
;
154 /** @type {TimeRanges} */
155 SourceBuffer
.prototype.buffered
;
158 * @param {ArrayBuffer} buffer
160 SourceBuffer
.prototype.appendBuffer = function(buffer
) {}
163 * @param {number} start
164 * @param {number} end
166 SourceBuffer
.prototype.remove = function(start
, end
) {}
170 * @extends {EventTargetStub}
172 var MediaSource = function() {}
175 * @param {string} format
176 * @return {SourceBuffer}
178 MediaSource
.prototype.addSourceBuffer = function(format
) {}
182 * @param {function(function(*), function(*)) : void} init
184 var Promise = function (init
) {};
187 * @param {function(?=) : (Promise|void)} onFulfill
188 * @param {function(?=) : (Promise|void)=} onReject
191 Promise
.prototype.then = function (onFulfill
, onReject
) {};
194 * @param {function(*) : void} onReject
197 Promise
.prototype['catch'] = function (onReject
) {};
200 * @param {Array.<Promise>} promises
203 Promise
.prototype.race = function (promises
) {}
206 * @param {Array.<Promise>} promises
209 Promise
.prototype.all = function (promises
) {};
215 Promise
.reject = function (reason
) {};
221 Promise
.resolve = function (value
) {};
224 * @param {string} type
225 * @param {boolean} canBubble
226 * @param {boolean} cancelable
227 * @param {Window} view
228 * @param {number} detail
229 * @param {number} screenX
230 * @param {number} screenY
231 * @param {number} clientX
232 * @param {number} clientY
233 * @param {boolean} ctrlKey
234 * @param {boolean} altKey
235 * @param {boolean} shiftKey
236 * @param {boolean} metaKey
237 * @param {number} button
238 * @param {EventTarget} relatedTarget
240 Event
.prototype.initMouseEvent = function(
241 type
, canBubble
, cancelable
, view
, detail
,
242 screenX
, screenY
, clientX
, clientY
,
243 ctrlKey
, altKey
, shiftKey
, metaKey
,
244 button
, relatedTarget
) {};