- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / externs.js
1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 // WebKit Web Facing API
32 var console = {}
33 /** @param {...*} vararg */
34 console.warn = function(vararg) {}
35 /** @param {...*} vararg */
36 console.assert = function(vararg) {}
37 /** @param {...*} vararg */
38 console.error = function(vararg) {}
39 console.trace = function() {}
40
41 /** @type {boolean} */
42 Event.prototype.isMetaOrCtrlForTest = false;
43 /** @param {...*} vararg */
44 Event.prototype.initWebKitWheelEvent = function(vararg) {}
45 Event.prototype.stopImmediatePropagation = function() {}
46
47 /**
48  * @constructor
49  * @extends {KeyboardEvent}
50  * @param {string} eventType
51  * @param {Object=} properties
52  */
53 window.KeyboardEvent = function(eventType, properties) {}
54
55 /** @param {Element} element */
56 window.getComputedStyle = function(element) {}
57 /** @param {*} message */
58 function postMessage(message) {}
59
60 /** @type {*} */
61 window.testRunner = null;
62
63 /**
64  * @constructor
65  */
66 function WebKitMutation(callback)
67 {
68     this.type = "";
69     /** @type {Node} */ this.target = null;
70     /** @type {Array.<Node>} */ this.addedNodes = [];
71     /** @type {Array.<Node>} */ this.removedNodes = [];
72 }
73
74 /**
75  * @constructor
76  * @param {function(Array.<WebKitMutation>)} callback
77  */
78 function WebKitMutationObserver(callback) {}
79 /** 
80  * @param {Node} container
81  * @param {Object} options
82  */
83 WebKitMutationObserver.prototype.observe = function(container, options) {}
84 WebKitMutationObserver.prototype.disconnect = function() {}
85
86 /**
87  * @param {string} eventName
88  * @param {Function} listener
89  * @param {boolean=} capturing
90  */
91 function addEventListener(eventName, listener, capturing) {}
92
93 /**
94  * @param {T} value
95  * @param {boolean=} onlyFirst
96  * @this {Array.<T>}
97  * @template T
98  */
99 Array.prototype.remove = function(value, onlyFirst) {}
100 /**
101  * @return {!Object.<string, boolean>}
102  * @this {Array.<*>}
103  */
104 Array.prototype.keySet = function() {}
105 /**
106  * @param {number} index
107  * @return {!Array.<T>}
108  * @this {Array.<T>}
109  * @template T
110  */
111 Array.prototype.rotate = function(index) {}
112 /**
113  * @param {T} object
114  * @param {function(T,S):number=} comparator
115  * @return {number}
116  * @this {Array.<S>}
117  * @template T,S
118  */
119 Array.prototype.lowerBound = function(object, comparator) {}
120 /**
121  * @param {T} object
122  * @param {function(T,S):number=} comparator
123  * @return {number}
124  * @this {Array.<S>}
125  * @template T,S
126  */
127 Array.prototype.upperBound = function(object, comparator) {}
128 /**
129  * @param {T} value
130  * @param {function(T,S):number} comparator
131  * @return {number}
132  * @this {Array.<S>}
133  * @template T,S
134  */
135 Array.prototype.binaryIndexOf = function(value, comparator) {}
136 /**
137  * @param {function(number, number): number} comparator
138  * @param {number} leftBound
139  * @param {number} rightBound
140  * @param {number} sortWindowLeft
141  * @param {number} sortWindowRight
142  * @return {!Array.<number>}
143  * @this {Array.<number>}
144  */
145 Array.prototype.sortRange = function(comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {}
146
147 /**
148  * @this {Array.<number>}
149  * @param {function(number,number):boolean} comparator
150  * @param {number} left
151  * @param {number} right
152  * @param {number} pivotIndex
153  * @return {number}
154  */
155 Array.prototype.partition = function(comparator, left, right, pivotIndex) {}
156
157 /**
158  * @this {Array.<number>}
159  * @param {number} k
160  * @param {function(number,number):boolean=} comparator
161  * @return {number}
162  */
163 Array.prototype.qselect = function(k, comparator) {}
164
165 /**
166  * @param {string} field
167  * @return {!Array.<T>}
168  * @this {Array.<Object.<string,T>>}
169  * @template T
170  */
171 Array.prototype.select = function(field) {}
172
173 /**
174  * @return {T|undefined}
175  * @this {Array.<T>}
176  * @template T
177  */
178 Array.prototype.peekLast = function() {}
179
180 DOMApplicationCache.prototype.UNCACHED = 0;
181 DOMApplicationCache.prototype.IDLE = 1;
182 DOMApplicationCache.prototype.CHECKING = 2;
183 DOMApplicationCache.prototype.DOWNLOADING = 3;
184 DOMApplicationCache.prototype.UPDATEREADY = 4;
185 DOMApplicationCache.prototype.OBSOLETE = 5;
186
187 // File System API
188 /**
189  * @constructor
190  */
191 function DOMFileSystem() {}
192
193 /**
194  * @type {DirectoryEntry}
195  */
196 DOMFileSystem.prototype.root = null;
197
198 /** @type {Node} */
199 Range.prototype.startContainer;
200
201 // Inspector Backend
202 var InspectorBackend = {}
203 InspectorBackend.runAfterPendingDispatches = function(message) {}
204
205 /** @interface */
206 function InspectorFrontendHostAPI() {}
207 /** @param {Function=} callback callback */
208 InspectorFrontendHostAPI.prototype.addFileSystem = function(callback) {}
209 /** @param {Function=} callback callback */
210 InspectorFrontendHostAPI.prototype.append = function(url, content, callback) {}
211 /** @param {Function=} callback callback */
212 InspectorFrontendHostAPI.prototype.indexPath = function(requestId, fileSystemPath, callback) {}
213 /** @param {Function=} callback callback */
214 InspectorFrontendHostAPI.prototype.setWindowBounds = function(x, y, callback) {}
215 /** @param {Function=} callback callback */
216 InspectorFrontendHostAPI.prototype.moveWindowBy = function(x, y, callback) {}
217 /** @param {Function=} callback callback */
218 InspectorFrontendHostAPI.prototype.openInNewTab = function(url, callback) {}
219 /** @param {Function=} callback callback */
220 InspectorFrontendHostAPI.prototype.removeFileSystem = function(fileSystemPath, callback) {}
221 /** @param {Function=} callback callback */
222 InspectorFrontendHostAPI.prototype.requestFileSystems = function(callback) {}
223 /** @param {Function=} callback callback */
224 InspectorFrontendHostAPI.prototype.save = function(url, content, forceSaveAs, callback) {}
225 /** @param {Function=} callback callback */
226 InspectorFrontendHostAPI.prototype.searchInPath = function(requestId, fileSystemPath, query, callback) {}
227 /** @param {Function=} callback callback */
228 InspectorFrontendHostAPI.prototype.stopIndexing = function(requestId, callback) {}
229
230 InspectorFrontendHostAPI.prototype.bringToFront = function() {}
231 InspectorFrontendHostAPI.prototype.close = function(url) {}
232 InspectorFrontendHostAPI.prototype.closeWindow = function() {}
233 InspectorFrontendHostAPI.prototype.copyText = function(text) {}
234 InspectorFrontendHostAPI.prototype.inspectedURLChanged = function(url) {}
235 InspectorFrontendHostAPI.prototype.isolatedFileSystem = function(fileSystemId, registeredName) {}
236 InspectorFrontendHostAPI.prototype.loaded = function() {}
237 InspectorFrontendHostAPI.prototype.localizedStringsURL = function() {}
238 InspectorFrontendHostAPI.prototype.platform = function() {}
239 InspectorFrontendHostAPI.prototype.port = function() {}
240 InspectorFrontendHostAPI.prototype.recordActionTaken = function(actionCode) {}
241 InspectorFrontendHostAPI.prototype.recordPanelShown = function(panelCode) {}
242 InspectorFrontendHostAPI.prototype.recordSettingChanged = function(settingCode) {}
243 InspectorFrontendHostAPI.prototype.requestSetDockSide = function(dockSide) {}
244 InspectorFrontendHostAPI.prototype.sendMessageToBackend = function(message) {}
245 InspectorFrontendHostAPI.prototype.sendMessageToEmbedder = function(message) {}
246 InspectorFrontendHostAPI.prototype.setInjectedScriptForOrigin = function(origin, script) {}
247 InspectorFrontendHostAPI.prototype.setZoomFactor = function(zoom) {}
248 InspectorFrontendHostAPI.prototype.supportsFileSystems = function() {}
249 /** @type {InspectorFrontendHostAPI} */
250 var InspectorFrontendHost;
251
252 /** @constructor */
253 function SourceMapV3()
254 {
255     /** @type {number} */ this.version;
256     /** @type {string} */ this.file;
257     /** @type {Array.<string>} */ this.sources;
258     /** @type {Array.<SourceMapV3.Section>} */ this.sections;
259     /** @type {string} */ this.mappings;
260     /** @type {string} */ this.sourceRoot;
261 }
262
263 /** @constructor */
264 SourceMapV3.Section = function()
265 {
266     /** @type {SourceMapV3} */ this.map;
267     /** @type {SourceMapV3.Offset} */ this.offset;
268 }
269
270 /** @constructor */
271 SourceMapV3.Offset = function()
272 {
273     /** @type {number} */ this.line;
274     /** @type {number} */ this.column;
275 }
276
277 // FIXME: remove everything below.
278 var FormatterWorker = {}
279 var WebInspector = {}
280
281 WebInspector.queryParamsObject = {}
282 WebInspector.toggleSearchingForNode = function() {}
283 WebInspector.panels = {};
284
285 /**
286  * @param {string=} messageLevel
287  * @param {boolean=} showConsole
288  */
289 WebInspector.log = function(message, messageLevel, showConsole) {}
290
291 WebInspector.showErrorMessage = function(error) {}
292
293 WebInspector.addMainEventListeners = function(doc) {}
294
295 WebInspector.openResource = function(url, external) {}
296
297 WebInspector.showConsole = function() {}
298
299 /**
300  * @param {string} expression
301  * @param {boolean=} showResultOnly
302  */
303 WebInspector.evaluateInConsole = function(expression, showResultOnly) {}
304
305 WebInspector.queryParamsObject = {}
306
307 /**
308  * @param {Element} element
309  * @return {boolean}
310  */
311 WebInspector.showAnchorLocation = function(element) {}
312
313 WebInspector.Events = {
314     InspectorLoaded: "InspectorLoaded",
315     InspectorClosing: "InspectorClosing"
316 }
317
318 /** @type {WebInspector.SettingsController} */
319 WebInspector.settingsController;
320
321 /** Extensions API */
322
323 /** @constructor */
324 function AuditCategory() {}
325 /** @constructor */
326 function AuditResult() {}
327 /** @constructor */
328 function EventSink() {}
329 /** @constructor */
330 function ExtensionSidebarPane() {}
331 /** @constructor */
332 function Panel() {}
333 /** @constructor */
334 function PanelWithSidebar() {}
335 /** @constructor */
336 function Request() {}
337 /** @constructor */
338 function Resource() {}
339 /** @constructor */
340 function Timeline() {}
341
342 var extensionServer;
343
344 /** @type {string} */
345 Location.prototype.origin = "";
346
347 /**
348  * @constructor
349  */
350 function ExtensionDescriptor() {
351     this.startPage = "";
352     this.name = "";
353 }
354
355 /**
356  * @constructor
357  */
358 function ExtensionReloadOptions() {
359     this.ignoreCache = false;
360     this.injectedScript = "";
361     this.preprocessingScript = "";
362     this.userAgent = "";
363 }
364
365 WebInspector.showPanel = function(panel)
366 {
367 }
368
369 /**
370  * @param {ExtensionDescriptor} extensionInfo
371  * @return {string}
372  */
373 function buildPlatformExtensionAPI(extensionInfo) {}
374
375 /**
376  * @type {string} 
377  */
378 WebInspector.inspectedPageDomain;
379
380 WebInspector.SourceJavaScriptTokenizer = {}
381 WebInspector.SourceJavaScriptTokenizer.Keywords = {}
382
383 /**
384  * @return {boolean}
385  */
386 WebInspector.isInspectingDevice = function() {}
387
388 var InspectorTest = {}
389
390 /* jsdifflib API */
391 var difflib = {};
392 difflib.stringAsLines = function(text) { return []; }
393 /** @constructor */
394 difflib.SequenceMatcher = function(baseText, newText) { }
395 difflib.SequenceMatcher.prototype.get_opcodes = function() { return []; }
396
397 /** @constructor */
398 var CodeMirror = function() { }
399 CodeMirror.on = function(obj, type, handler) { }
400 CodeMirror.prototype = {
401     addKeyMap: function(map) { },
402     addLineClass: function(handle, where, cls) { },
403     addLineWidget: function(handle, node, options) { },
404     /**
405      * @param {string|Object} spec
406      * @param {Object=} options
407      */
408     addOverlay: function(spec, options) { },
409     addWidget: function(pos, node, scroll, vert, horiz) { },
410     charCoords: function(pos, mode) { },
411     clearGutter: function(gutterID) { },
412     clearHistory: function() { },
413     clipPos: function(pos) { },
414     coordsChar: function(coords, mode) { },
415     cursorCoords: function(start, mode) { },
416     defaultCharWidth: function() { },
417     defaultTextHeight: function() { },
418     deleteH: function(dir, unit) { },
419     eachLine: function(from, to, op) { },
420     execCommand: function(cmd) { },
421     extendSelection: function(from, to) { },
422     findMarksAt: function(pos) { },
423     findMatchingBracket: function() { },
424     findPosH: function(from, amount, unit, visually) { },
425     findPosV: function(from, amount, unit, goalColumn) { },
426     firstLine: function() { },
427     focus: function() { },
428     getAllMarks: function() { },
429     /** @param {string=} start */
430     getCursor: function(start) { },
431     getDoc: function() { },
432     getGutterElement: function() { },
433     getHistory: function() { },
434     getInputField: function(){ },
435     getLine: function(line) { },
436     /**
437      * @return {{wrapClass: string}}
438      */
439     getLineHandle: function(line) { },
440     getLineNumber: function(line) { },
441     getMode: function() { },
442     getOption: function(option) { },
443     getRange: function(from, to, lineSep) { },
444     /**
445      * @return {{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}}
446      */
447     getScrollInfo: function() { },
448     getScrollerElement: function() { },
449     getSelection: function() { },
450     getStateAfter: function(line) { },
451     getTokenAt: function(pos) { },
452     getValue: function(lineSep) { },
453     getViewport: function() { },
454     getWrapperElement: function() { },
455     hasFocus: function() { },
456     historySize: function() { },
457     indentLine: function(n, dir, aggressive) { },
458     indentSelection: function(how) { },
459     indexFromPos: function(coords) { },
460     isClean: function() { },
461     iterLinkedDocs: function(f) { },
462     lastLine: function() { },
463     lineCount: function() { },
464     lineInfo: function(line) { },
465     /**
466      * @param {number} height
467      * @param {string=} mode
468      */
469     lineAtHeight: function(height, mode) { },
470     linkedDoc: function(options) { },
471     markClean: function() { },
472     markText: function(from, to, options) { },
473     moveH: function(dir, unit) { },
474     moveV: function(dir, unit) { },
475     off: function(type, f) { },
476     on: function(type, f) { },
477     operation: function(f) { },
478     posFromIndex: function(off) { },
479     redo: function() { },
480     refresh: function() { },
481     removeKeyMap: function(map) { },
482     removeLine: function(line) { },
483     removeLineClass: function(handle, where, cls) { },
484     removeLineWidget: function(widget) { },
485     removeOverlay: function(spec) { },
486     replaceRange: function(code, from, to, origin) { },
487     replaceSelection: function(code, collapse, origin) { },
488     scrollIntoView: function(pos, margin) { },
489     scrollTo: function(x, y) { },
490     setBookmark: function(pos, options) { },
491     setCursor: function(line, ch, extend) { },
492     setExtending: function(val) { },
493     setGutterMarker: function(line, gutterID, value) { },
494     setHistory: function(histData) { },
495     setLine: function(line, text) { },
496     setOption: function(option, value) { },
497     setSelection: function(anchor, head) { },
498     setSize: function(width, height) { },
499     setValue: function(code) { },
500     somethingSelected: function() { },
501     swapDoc: function(doc) { },
502     undo: function() { },
503     unlinkDoc: function(other) { }
504 }
505 /** @type {number} */
506 CodeMirror.prototype.lineCount;
507 CodeMirror.Pass;
508 CodeMirror.showHint = function(codeMirror, hintintFunction) { };
509 CodeMirror.commands = {};
510 CodeMirror.modes = {};
511 CodeMirror.mimeModes = {};
512 CodeMirror.getMode = function(options, spec) { };
513 CodeMirror.overlayMode = function(mode1, mode2, squashSpans) { };
514 CodeMirror.defineMode = function(modeName, modeConstructor) { };
515 CodeMirror.startState = function(mode) { };
516
517 /** @constructor */
518 CodeMirror.Pos = function(line, ch) { }
519 /** type {number} */
520 CodeMirror.Pos.prototype.line;
521 /** type {number} */
522 CodeMirror.Pos.prototype.ch;
523
524 /** @constructor */
525 CodeMirror.StringStream = function(line)
526 {
527     this.pos = 0;
528     this.start = 0;
529 }
530 CodeMirror.StringStream.prototype = {
531     backUp: function (n) { },
532     column: function () { },
533     current: function () { },
534     eat: function (match) { },
535     eatSpace: function () { },
536     eatWhile: function (match) { },
537     eol: function () { },
538     indentation: function () { },
539     /**
540      * @param {RegExp|string} pattern
541      * @param {boolean=} consume
542      * @param {boolean=} caseInsensitive
543      */
544     match: function (pattern, consume, caseInsensitive) { },
545     next: function () { },
546     peek: function () { },
547     skipTo: function (ch) { },
548     skipToEnd: function () { },
549     sol: function () { }
550 }
551
552 /** @type {Object.<string, Object.<string, string>>} */
553 CodeMirror.keyMap;
554
555 WebInspector.suggestReload = function() { }
556 WebInspector.reload = function() { }
557
558 WebInspector.settings.continuousPainting = /** type {WebInspector.Setting} */ { }
559 WebInspector.settings.showDebugBorders = /** type {WebInspector.Setting} */ { }
560 WebInspector.settings.showScrollBottleneckRects = /** type {WebInspector.Setting} */ { }
561 WebInspector.settings.forceCompositingMode = /** type {WebInspector.Setting} */ { }
562 WebInspector.settings.showFPSCounter = /** type {WebInspector.Setting} */ { }
563 WebInspector.settings.showPaintRects = /** type {WebInspector.Setting} */ { }
564
565 /** @type {boolean} */
566 window.dispatchStandaloneTestRunnerMessages;