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