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