| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains various hacks needed to inform JSCompiler of various | 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 | 6 // WebKit- and Chrome-specific properties and methods. It is used only with |
| 7 // JSCompiler to verify the type-correctness of our code. | 7 // JSCompiler to verify the type-correctness of our code. |
| 8 | 8 |
| 9 /** @type {Array.<string>} */ |
| 10 ClipboardData.prototype.types; |
| 11 |
| 9 /** @type {HTMLElement} */ | 12 /** @type {HTMLElement} */ |
| 10 Document.prototype.activeElement; | 13 Document.prototype.activeElement; |
| 11 | 14 |
| 12 /** @type {Array.<HTMLElement>} */ | 15 /** @type {Array.<HTMLElement>} */ |
| 13 Document.prototype.all; | 16 Document.prototype.all; |
| 14 | 17 |
| 15 /** @type {boolean} */ | 18 /** @type {boolean} */ |
| 16 Document.prototype.hidden; | 19 Document.prototype.hidden; |
| 17 | 20 |
| 18 /** @type {function(string): void} */ | |
| 19 Document.prototype.execCommand = function(command) {}; | |
| 20 | |
| 21 /** @return {void} Nothing. */ | |
| 22 Document.prototype.webkitCancelFullScreen = function() {}; | |
| 23 | |
| 24 /** @return {void} Nothing. */ | 21 /** @return {void} Nothing. */ |
| 25 Document.prototype.exitPointerLock = function() {}; | 22 Document.prototype.exitPointerLock = function() {}; |
| 26 | 23 |
| 27 /** @type {boolean} */ | 24 /** @type {boolean} */ |
| 28 Document.prototype.webkitIsFullScreen; | 25 Document.prototype.webkitIsFullScreen; |
| 29 | 26 |
| 30 /** @type {boolean} */ | 27 /** @type {boolean} */ |
| 31 Document.prototype.webkitHidden; | 28 Document.prototype.webkitHidden; |
| 32 | 29 |
| 33 /** @type {Element} */ | 30 /** @type {Element} */ |
| 34 Document.prototype.firstElementChild; | 31 Document.prototype.firstElementChild; |
| 35 | 32 |
| 36 /** @type {number} */ | |
| 37 Element.ALLOW_KEYBOARD_INPUT; | |
| 38 | |
| 39 /** @param {number} flags | |
| 40 /** @return {void} Nothing. */ | |
| 41 Element.prototype.webkitRequestFullScreen = function(flags) {}; | |
| 42 | |
| 43 /** @return {void} Nothing. */ | 33 /** @return {void} Nothing. */ |
| 44 Element.prototype.requestPointerLock = function() {}; | 34 Element.prototype.requestPointerLock = function() {}; |
| 45 | 35 |
| 46 /** @type {boolean} */ | 36 /** @type {boolean} */ |
| 47 Element.prototype.hidden; | 37 Element.prototype.hidden; |
| 48 | 38 |
| 49 /** @type {string} */ | 39 /** @type {string} */ |
| 50 Element.prototype.localName; | 40 Element.prototype.localName; |
| 51 | 41 |
| 52 /** @type {string} */ | 42 /** @type {string} */ |
| 53 Element.prototype.textContent; | 43 Element.prototype.textContent; |
| 54 | 44 |
| 45 /** @type {DOMTokenList} */ |
| 46 Element.prototype.classList; |
| 55 | 47 |
| 56 /** @constructor | 48 /** @type {boolean} */ |
| 57 @extends {HTMLElement} */ | 49 Element.prototype.checked; |
| 58 var HTMLEmbedElement = function() { }; | |
| 59 | 50 |
| 60 /** @type {number} */ | |
| 61 HTMLEmbedElement.prototype.height; | |
| 62 | |
| 63 /** @type {number} */ | |
| 64 HTMLEmbedElement.prototype.width; | |
| 65 | 51 |
| 66 /** @type {Window} */ | 52 /** @type {Window} */ |
| 67 HTMLIFrameElement.prototype.contentWindow; | 53 HTMLIFrameElement.prototype.contentWindow; |
| 68 | 54 |
| 69 | 55 |
| 70 /** @type {Object} */ | |
| 71 var JSON = {}; | |
| 72 | |
| 73 /** | |
| 74 * @param {string} jsonStr The string to parse. | |
| 75 * @param {(function(string, *) : *)=} opt_reviver | |
| 76 * @return {*} The JSON object. | |
| 77 */ | |
| 78 JSON.parse = function(jsonStr, opt_reviver) {}; | |
| 79 | |
| 80 /** | |
| 81 * @param {*} jsonObj Input object. | |
| 82 * @param {(Array.<string>|(function(string, *) : *)|null)=} opt_replacer | |
| 83 * @param {(number|string)=} opt_space | |
| 84 * @return {string} json string which represents jsonObj. | |
| 85 */ | |
| 86 JSON.stringify = function(jsonObj, opt_replacer, opt_space) {}; | |
| 87 | |
| 88 | |
| 89 /** | 56 /** |
| 90 * @param {string} name | 57 * @param {string} name |
| 91 * @return {string} | 58 * @return {string} |
| 92 */ | 59 */ |
| 93 Node.prototype.getAttribute = function(name) { }; | 60 Node.prototype.getAttribute = function(name) { }; |
| 94 | 61 |
| 95 /** @type {string} */ | 62 /** @type {string} */ |
| 96 Node.prototype.value; | 63 Node.prototype.value; |
| 97 | 64 |
| 98 /** @type {{top: string, left: string, bottom: string, right: string}} */ | 65 /** @type {{top: string, left: string, bottom: string, right: string}} */ |
| 99 Node.prototype.style; | 66 Node.prototype.style; |
| 100 | 67 |
| 101 | 68 /** @type {boolean} */ |
| 102 /** | 69 Node.prototype.hidden; |
| 103 * @constructor | |
| 104 * @param {function(Array.<MutationRecord>):void} callback | |
| 105 */ | |
| 106 var MutationObserver = function(callback) {}; | |
| 107 | |
| 108 /** | |
| 109 * @param {Element} element | |
| 110 * @param {Object} options | |
| 111 */ | |
| 112 MutationObserver.prototype.observe = function(element, options) {}; | |
| 113 | 70 |
| 114 | 71 |
| 115 /** @constructor */ | 72 /** @type {{getRandomValues: function(!ArrayBufferView):!ArrayBufferView}} */ |
| 116 var MutationRecord = function() {}; | |
| 117 | |
| 118 /** @type {string} */ | |
| 119 MutationRecord.prototype.attributeName; | |
| 120 | |
| 121 /** @type {Element} */ | |
| 122 MutationRecord.prototype.target; | |
| 123 | |
| 124 /** @type {string} */ | |
| 125 MutationRecord.prototype.type; | |
| 126 | |
| 127 | |
| 128 /** @type {{getRandomValues: function((Uint16Array|Uint8Array)):void}} */ | |
| 129 Window.prototype.crypto; | 73 Window.prototype.crypto; |
| 130 | 74 |
| 131 /** | |
| 132 * @param {function():void} callback | |
| 133 */ | |
| 134 Window.prototype.requestAnimationFrame = function(callback) {}; | |
| 135 | |
| 136 | 75 |
| 137 /** | 76 /** |
| 138 * @constructor | |
| 139 * @implements {EventTarget} */ | |
| 140 var EventTargetStub = function() {}; | |
| 141 | |
| 142 /** | |
| 143 * @param {string} type | |
| 144 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener | |
| 145 * @param {boolean=} opt_useCapture | |
| 146 */ | |
| 147 EventTargetStub.prototype.addEventListener = | |
| 148 function(type, listener, opt_useCapture) {} | |
| 149 | |
| 150 /** | |
| 151 * @param {string} type | |
| 152 * @param {(EventListener|function(Event): (boolean|undefined|null))} listener | |
| 153 * @param {boolean=} opt_useCapture | |
| 154 */ | |
| 155 EventTargetStub.prototype.removeEventListener = | |
| 156 function(type, listener, opt_useCapture) {} | |
| 157 | |
| 158 /** | |
| 159 * @param {Event} event | |
| 160 */ | |
| 161 EventTargetStub.prototype.dispatchEvent = | |
| 162 function(event) {} | |
| 163 | |
| 164 /** | |
| 165 * @constructor | |
| 166 * @extends {EventTargetStub} | |
| 167 */ | |
| 168 var SourceBuffer = function() {} | |
| 169 | |
| 170 /** @type {boolean} */ | |
| 171 SourceBuffer.prototype.updating; | |
| 172 | |
| 173 /** @type {TimeRanges} */ | |
| 174 SourceBuffer.prototype.buffered; | |
| 175 | |
| 176 /** | |
| 177 * @param {ArrayBuffer} buffer | |
| 178 */ | |
| 179 SourceBuffer.prototype.appendBuffer = function(buffer) {} | |
| 180 | |
| 181 /** | |
| 182 * @param {number} start | |
| 183 * @param {number} end | |
| 184 */ | |
| 185 SourceBuffer.prototype.remove = function(start, end) {} | |
| 186 | |
| 187 /** | |
| 188 * @constructor | |
| 189 * @extends {EventTargetStub} | |
| 190 */ | |
| 191 var MediaSource = function() {} | |
| 192 | |
| 193 /** | |
| 194 * @param {string} format | |
| 195 * @return {SourceBuffer} | |
| 196 */ | |
| 197 MediaSource.prototype.addSourceBuffer = function(format) {} | |
| 198 | |
| 199 /** | |
| 200 * @constructor | |
| 201 * @param {function(function(*), function(*)) : void} init | |
| 202 */ | |
| 203 var Promise = function (init) {}; | |
| 204 | |
| 205 /** | |
| 206 * @param {function(?=) : (Promise|void)} onFulfill | |
| 207 * @param {function(?=) : (Promise|void)=} onReject | |
| 208 * @return {Promise} | |
| 209 */ | |
| 210 Promise.prototype.then = function (onFulfill, onReject) {}; | |
| 211 | |
| 212 /** | |
| 213 * @param {function(*) : void} onReject | |
| 214 * @return {Promise} | |
| 215 */ | |
| 216 Promise.prototype['catch'] = function (onReject) {}; | |
| 217 | |
| 218 /** | |
| 219 * @param {Array.<Promise>} promises | |
| 220 * @return {Promise} | |
| 221 */ | |
| 222 Promise.prototype.race = function (promises) {} | |
| 223 | |
| 224 /** | |
| 225 * @param {Array.<Promise>} promises | |
| 226 * @return {Promise} | |
| 227 */ | |
| 228 Promise.prototype.all = function (promises) {}; | |
| 229 | |
| 230 /** | |
| 231 * @param {*=} reason | |
| 232 * @return {Promise} | |
| 233 */ | |
| 234 Promise.reject = function (reason) {}; | |
| 235 | |
| 236 /** | |
| 237 * @param {*=} value | |
| 238 * @return {Promise} | |
| 239 */ | |
| 240 Promise.resolve = function (value) {}; | |
| 241 | |
| 242 /** | |
| 243 * @type {DataTransfer} | 77 * @type {DataTransfer} |
| 244 */ | 78 */ |
| 245 Event.prototype.dataTransfer = null; | 79 Event.prototype.dataTransfer = null; |
| 246 | 80 |
| 247 /** | 81 /** |
| 248 * @type {number} | 82 * @type {number} |
| 249 */ | 83 */ |
| 250 Event.prototype.movementX = 0; | 84 Event.prototype.movementX = 0; |
| 251 | 85 |
| 252 /** | 86 /** |
| (...skipping 17 matching lines...) Expand all Loading... |
| 270 * @param {boolean} metaKey | 104 * @param {boolean} metaKey |
| 271 * @param {number} button | 105 * @param {number} button |
| 272 * @param {EventTarget} relatedTarget | 106 * @param {EventTarget} relatedTarget |
| 273 */ | 107 */ |
| 274 Event.prototype.initMouseEvent = function( | 108 Event.prototype.initMouseEvent = function( |
| 275 type, canBubble, cancelable, view, detail, | 109 type, canBubble, cancelable, view, detail, |
| 276 screenX, screenY, clientX, clientY, | 110 screenX, screenY, clientX, clientY, |
| 277 ctrlKey, altKey, shiftKey, metaKey, | 111 ctrlKey, altKey, shiftKey, metaKey, |
| 278 button, relatedTarget) {}; | 112 button, relatedTarget) {}; |
| 279 | 113 |
| 280 /** | 114 /** @type {Object} */ |
| 281 * @param {number} begin | 115 Event.prototype.data = {}; |
| 282 * @param {number=} end | |
| 283 * @return {ArrayBuffer} | |
| 284 */ | |
| 285 ArrayBuffer.prototype.slice = function(begin, end) {}; | |
| 286 | |
| 287 /** | |
| 288 * @return {string} | |
| 289 */ | |
| 290 Date.prototype.toISOString = function() {}; | |
| OLD | NEW |