Upstream version 5.34.104.0
[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
33 /** @type {boolean} */
34 Event.prototype.isMetaOrCtrlForTest;
35
36 /**
37  * @constructor
38  * @extends {KeyboardEvent}
39  * @param {string} eventType
40  * @param {!Object=} properties
41  */
42 window.KeyboardEvent = function(eventType, properties) {}
43
44 /**
45  * @type {number}
46  */
47 KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;
48
49 /** @param {*} message */
50 function postMessage(message) {}
51
52 /** @type {*} */
53 window.testRunner ;
54
55 /**
56  * @param {string} eventName
57  * @param {!Function} listener
58  * @param {boolean=} capturing
59  */
60 function addEventListener(eventName, listener, capturing) {}
61
62 /**
63  * @param {!T} value
64  * @param {boolean=} onlyFirst
65  * @this {Array.<T>}
66  * @template T
67  */
68 Array.prototype.remove = function(value, onlyFirst) {}
69 /**
70  * @return {!Object.<string, boolean>}
71  * @this {Array.<T>}
72  * @template T
73  */
74 Array.prototype.keySet = function() {}
75 /**
76  * @param {number} index
77  * @return {!Array.<!T>}
78  * @this {Array.<T>}
79  * @template T
80  */
81 Array.prototype.rotate = function(index) {}
82 /**
83  * @param {!T} object
84  * @param {function(!T,!S):number=} comparator
85  * @return {number}
86  * @this {Array.<S>}
87  * @template T,S
88  */
89 Array.prototype.lowerBound = function(object, comparator) {}
90 /**
91  * @param {!T} object
92  * @param {function(!T,!S):number=} comparator
93  * @return {number}
94  * @this {Array.<S>}
95  * @template T,S
96  */
97 Array.prototype.upperBound = function(object, comparator) {}
98 /**
99  * @param {!T} value
100  * @param {function(!T,!S):number} comparator
101  * @return {number}
102  * @this {Array.<S>}
103  * @template T,S
104  */
105 Array.prototype.binaryIndexOf = function(value, comparator) {}
106 /**
107  * @param {function(number, number): number} comparator
108  * @param {number} leftBound
109  * @param {number} rightBound
110  * @param {number} sortWindowLeft
111  * @param {number} sortWindowRight
112  * @return {!Array.<number>}
113  * @this {Array.<number>}
114  */
115 Array.prototype.sortRange = function(comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {}
116
117 /**
118  * @param {function(!T,!T): number=} comparator
119  * @return {!Array.<T>}
120  * @this {Array.<T>}
121  * @template T
122  */
123 Array.prototype.stableSort = function(comparator) {}
124
125 /**
126  * @this {Array.<number>}
127  * @param {function(number,number):boolean} comparator
128  * @param {number} left
129  * @param {number} right
130  * @param {number} pivotIndex
131  * @return {number}
132  */
133 Array.prototype.partition = function(comparator, left, right, pivotIndex) {}
134
135 /**
136  * @this {Array.<number>}
137  * @param {number} k
138  * @param {function(number,number):boolean=} comparator
139  * @return {number}
140  */
141 Array.prototype.qselect = function(k, comparator) {}
142
143 /**
144  * @param {string} field
145  * @return {!Array.<!T>}
146  * @this {Array.<!Object.<string,T>>}
147  * @template T
148  */
149 Array.prototype.select = function(field) {}
150
151 /**
152  * @return {!T|undefined}
153  * @this {Array.<T>}
154  * @template T
155  */
156 Array.prototype.peekLast = function() {}
157
158 /**
159  * @param {!Array.<T>} array
160  * @param {function(T,T):number} comparator
161  * @return {!Array.<T>}
162  * @this {!Array.<T>}
163  * @template T
164  */
165 Array.prototype.intersectOrdered = function(array, comparator) {}
166
167 /**
168  * @param {!Array.<T>} array
169  * @param {function(T,T):number} comparator
170  * @return {!Array.<T>}
171  * @this {!Array.<T>}
172  * @template T
173  */
174 Array.prototype.mergeOrdered = function(array, comparator) {}
175
176 // File System API
177 /**
178  * @constructor
179  */
180 function DOMFileSystem() {}
181
182 /**
183  * @type {DirectoryEntry}
184  */
185 DOMFileSystem.prototype.root = null;
186
187 /** @interface */
188 function InspectorFrontendHostAPI() {}
189 /** @param {!Function=} callback callback */
190 InspectorFrontendHostAPI.prototype.addFileSystem = function(callback) {}
191 /** @param {!Function=} callback callback */
192 InspectorFrontendHostAPI.prototype.append = function(url, content, callback) {}
193 /** @param {!Function=} callback callback */
194 InspectorFrontendHostAPI.prototype.indexPath = function(requestId, fileSystemPath, callback) {}
195 /** @return {string} */
196 InspectorFrontendHostAPI.prototype.getSelectionBackgroundColor = function() {}
197 /** @return {string} */
198 InspectorFrontendHostAPI.prototype.getSelectionForegroundColor = function() {}
199 /** @return {boolean} */
200 InspectorFrontendHost.isUnderTest = function() {}
201 /**
202  * Requests inspected page to be placed atop of the inspector frontend
203  * with passed insets from the frontend sides, respecting minimum size passed.
204  * @param {{top: number, left: number, right: number, bottom: number}} insets
205  * @param {{width: number, height: number}} minSize
206  */
207 InspectorFrontendHostAPI.prototype.setContentsResizingStrategy = function(insets, minSize) {}
208 InspectorFrontendHostAPI.prototype.inspectElementCompleted = function() {}
209 /** @param {!Function=} callback callback */
210 InspectorFrontendHostAPI.prototype.moveWindowBy = function(x, y, callback) {}
211 /** @param {!Function=} callback callback */
212 InspectorFrontendHostAPI.prototype.openInNewTab = function(url, callback) {}
213 /** @param {!Function=} callback callback */
214 InspectorFrontendHostAPI.prototype.removeFileSystem = function(fileSystemPath, callback) {}
215 /** @param {!Function=} callback callback */
216 InspectorFrontendHostAPI.prototype.requestFileSystems = function(callback) {}
217 /** @param {!Function=} callback callback */
218 InspectorFrontendHostAPI.prototype.save = function(url, content, forceSaveAs, callback) {}
219 /** @param {!Function=} callback callback */
220 InspectorFrontendHostAPI.prototype.searchInPath = function(requestId, fileSystemPath, query, callback) {}
221 /** @param {!Function=} callback callback */
222 InspectorFrontendHostAPI.prototype.stopIndexing = function(requestId, callback) {}
223
224 InspectorFrontendHostAPI.prototype.bringToFront = function() {}
225 InspectorFrontendHostAPI.prototype.closeWindow = function() {}
226 InspectorFrontendHostAPI.prototype.copyText = function(text) {}
227 InspectorFrontendHostAPI.prototype.inspectedURLChanged = function(url) {}
228 InspectorFrontendHostAPI.prototype.isolatedFileSystem = function(fileSystemId, registeredName) {}
229 InspectorFrontendHostAPI.prototype.upgradeDraggedFileSystemPermissions = function(DOMFileSystem) {}
230 InspectorFrontendHostAPI.prototype.platform = function() {}
231 InspectorFrontendHostAPI.prototype.port = function() {}
232 InspectorFrontendHostAPI.prototype.recordActionTaken = function(actionCode) {}
233 InspectorFrontendHostAPI.prototype.recordPanelShown = function(panelCode) {}
234 InspectorFrontendHostAPI.prototype.recordSettingChanged = function(settingCode) {}
235 InspectorFrontendHostAPI.prototype.sendMessageToBackend = function(message) {}
236 InspectorFrontendHostAPI.prototype.sendMessageToEmbedder = function(message) {}
237 InspectorFrontendHostAPI.prototype.setInjectedScriptForOrigin = function(origin, script) {}
238 InspectorFrontendHostAPI.prototype.setIsDocked = function(isDocked) {}
239 InspectorFrontendHostAPI.prototype.setZoomFactor = function(zoom) {}
240 InspectorFrontendHostAPI.prototype.zoomFactor = function() {}
241 InspectorFrontendHostAPI.prototype.zoomIn = function() {}
242 InspectorFrontendHostAPI.prototype.zoomOut = function() {}
243 InspectorFrontendHostAPI.prototype.resetZoom = function() {}
244 /** @type {InspectorFrontendHostAPI} */
245 var InspectorFrontendHost;
246 InspectorFrontendHost.embedderMessageAck = function(id, error) {}
247
248 // FIXME: remove everything below.
249 var FormatterWorker = {}
250 var WebInspector = {}
251
252 WebInspector.queryParamsObject = {}
253 WebInspector.toggleSearchingForNode = function() {}
254 WebInspector.panels = {};
255
256 /**
257  * @param {string=} messageLevel
258  * @param {boolean=} showConsole
259  */
260 WebInspector.log = function(message, messageLevel, showConsole) {}
261
262 WebInspector.showErrorMessage = function(error) {}
263
264 WebInspector.addMainEventListeners = function(doc) {}
265
266 WebInspector.openResource = function(url, external) {}
267
268 WebInspector.showConsole = function() {}
269
270 /**
271  * @param {string} expression
272  * @param {boolean=} showResultOnly
273  */
274 WebInspector.evaluateInConsole = function(expression, showResultOnly) {}
275
276 WebInspector.queryParamsObject = {}
277
278 WebInspector.Events = {
279     InspectorLoaded: "InspectorLoaded"
280 }
281
282 /** Extensions API */
283
284 /** @constructor */
285 function AuditCategory() {}
286 /** @constructor */
287 function AuditResult() {}
288 /** @constructor */
289 function EventSink() {}
290 /** @constructor */
291 function ExtensionSidebarPane() {}
292 /** @constructor */
293 function Panel() {}
294 /** @constructor */
295 function PanelWithSidebar() {}
296 /** @constructor */
297 function Request() {}
298 /** @constructor */
299 function Resource() {}
300 /** @constructor */
301 function Timeline() {}
302
303 var extensionServer;
304
305 /**
306  * @constructor
307  */
308 function ExtensionDescriptor() {
309     this.startPage = "";
310     this.name = "";
311 }
312
313 /**
314  * @constructor
315  */
316 function ExtensionReloadOptions() {
317     this.ignoreCache = false;
318     this.injectedScript = "";
319     this.preprocessingScript = "";
320     this.userAgent = "";
321 }
322
323 WebInspector.showPanel = function(panel)
324 {
325 }
326
327 /**
328  * @type {string} 
329  */
330 WebInspector.inspectedPageDomain;
331
332 WebInspector.SourceJavaScriptTokenizer = {}
333 WebInspector.SourceJavaScriptTokenizer.Keywords = {}
334
335 /**
336  * @return {boolean}
337  */
338 WebInspector.isInspectingDevice = function() {}
339
340 /**
341  * @return {boolean}
342  */
343 WebInspector.isWorkerFrontend = function() {}
344
345 /**
346  * @return {boolean}
347  */
348 WebInspector.isDedicatedWorkerFrontend = function() {}
349
350 var InspectorTest = {}
351
352 /* jsdifflib API */
353 var difflib = {};
354 difflib.stringAsLines = function(text) { return []; }
355 /** @constructor */
356 difflib.SequenceMatcher = function(baseText, newText) { }
357 difflib.SequenceMatcher.prototype.get_opcodes = function() { return []; }
358
359 /** @constructor */
360 var CodeMirror = function() { }
361 CodeMirror.on = function(obj, type, handler) { }
362 CodeMirror.prototype = {
363     addKeyMap: function(map) { },
364     addLineClass: function(handle, where, cls) { },
365     addLineWidget: function(handle, node, options) { },
366     /**
367      * @param {string|!Object} spec
368      * @param {!Object=} options
369      */
370     addOverlay: function(spec, options) { },
371     addWidget: function(pos, node, scroll, vert, horiz) { },
372     charCoords: function(pos, mode) { },
373     clearGutter: function(gutterID) { },
374     clearHistory: function() { },
375     clipPos: function(pos) { },
376     coordsChar: function(coords, mode) { },
377     cursorCoords: function(start, mode) { },
378     defaultCharWidth: function() { },
379     defaultTextHeight: function() { },
380     deleteH: function(dir, unit) { },
381     eachLine: function(from, to, op) { },
382     execCommand: function(cmd) { },
383     extendSelection: function(from, to) { },
384     findMarksAt: function(pos) { },
385     findMatchingBracket: function() { },
386     findPosH: function(from, amount, unit, visually) { },
387     findPosV: function(from, amount, unit, goalColumn) { },
388     firstLine: function() { },
389     focus: function() { },
390     getAllMarks: function() { },
391     /** @param {string=} start */
392     getCursor: function(start) { },
393     getDoc: function() { },
394     getGutterElement: function() { },
395     getHistory: function() { },
396     getInputField: function(){ },
397     getLine: function(line) { },
398     /**
399      * @return {!{wrapClass: string}}
400      */
401     getLineHandle: function(line) { },
402     getLineNumber: function(line) { },
403     getMode: function() { },
404     getOption: function(option) { },
405     getRange: function(from, to, lineSep) { },
406     /**
407      * @return {!{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}}
408      */
409     getScrollInfo: function() { },
410     getScrollerElement: function() { },
411     getSelection: function() { },
412     getStateAfter: function(line) { },
413     getTokenAt: function(pos) { },
414     getValue: function(lineSep) { },
415     getViewport: function() { },
416     getWrapperElement: function() { },
417     hasFocus: function() { },
418     historySize: function() { },
419     indentLine: function(n, dir, aggressive) { },
420     indentSelection: function(how) { },
421     indexFromPos: function(coords) { },
422     isClean: function() { },
423     iterLinkedDocs: function(f) { },
424     lastLine: function() { },
425     lineCount: function() { },
426     lineInfo: function(line) { },
427     /**
428      * @param {number} height
429      * @param {string=} mode
430      */
431     lineAtHeight: function(height, mode) { },
432     linkedDoc: function(options) { },
433     markClean: function() { },
434     markText: function(from, to, options) { },
435     moveH: function(dir, unit) { },
436     moveV: function(dir, unit) { },
437     off: function(type, f) { },
438     on: function(type, f) { },
439     operation: function(f) { },
440     posFromIndex: function(off) { },
441     redo: function() { },
442     refresh: function() { },
443     removeKeyMap: function(map) { },
444     removeLine: function(line) { },
445     removeLineClass: function(handle, where, cls) { },
446     removeLineWidget: function(widget) { },
447     removeOverlay: function(spec) { },
448     replaceRange: function(code, from, to, origin) { },
449     replaceSelection: function(code, collapse, origin) { },
450     scrollIntoView: function(pos, margin) { },
451     scrollTo: function(x, y) { },
452     setBookmark: function(pos, options) { },
453     setCursor: function(line, ch, extend) { },
454     setExtending: function(val) { },
455     setGutterMarker: function(line, gutterID, value) { },
456     setHistory: function(histData) { },
457     setLine: function(line, text) { },
458     setOption: function(option, value) { },
459     setSelection: function(anchor, head) { },
460     setSize: function(width, height) { },
461     setValue: function(code) { },
462     somethingSelected: function() { },
463     swapDoc: function(doc) { },
464     undo: function() { },
465     unlinkDoc: function(other) { }
466 }
467 /** @type {number} */
468 CodeMirror.prototype.lineCount;
469 CodeMirror.Pass;
470 CodeMirror.showHint = function(codeMirror, hintintFunction) { };
471 CodeMirror.commands = {};
472 CodeMirror.modes = {};
473 CodeMirror.mimeModes = {};
474 CodeMirror.getMode = function(options, spec) { };
475 CodeMirror.overlayMode = function(mode1, mode2, squashSpans) { };
476 CodeMirror.defineMode = function(modeName, modeConstructor) { };
477 CodeMirror.startState = function(mode) { };
478
479 /** @constructor */
480 CodeMirror.Pos = function(line, ch) { }
481 /** type {number} */
482 CodeMirror.Pos.prototype.line;
483 /** type {number} */
484 CodeMirror.Pos.prototype.ch;
485
486 /** @constructor */
487 CodeMirror.StringStream = function(line)
488 {
489     this.pos = 0;
490     this.start = 0;
491 }
492 CodeMirror.StringStream.prototype = {
493     backUp: function (n) { },
494     column: function () { },
495     current: function () { },
496     eat: function (match) { },
497     eatSpace: function () { },
498     eatWhile: function (match) { },
499     eol: function () { },
500     indentation: function () { },
501     /**
502      * @param {!RegExp|string} pattern
503      * @param {boolean=} consume
504      * @param {boolean=} caseInsensitive
505      */
506     match: function (pattern, consume, caseInsensitive) { },
507     next: function () { },
508     peek: function () { },
509     skipTo: function (ch) { },
510     skipToEnd: function () { },
511     sol: function () { }
512 }
513
514 /** @type {Object.<string, !Object.<string, string>>} */
515 CodeMirror.keyMap;
516
517 /** @type {{scrollLeft: number, scrollTop: number}} */
518 CodeMirror.doc;
519
520 WebInspector.suggestReload = function() { }
521 WebInspector.reload = function() { }
522 WebInspector._inspectedTabId;
523
524 /** @type {boolean} */
525 window.dispatchStandaloneTestRunnerMessages;