externs.js 17 KB

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