forked from google/closure-compiler
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add closure-library externs for csp, and our own hack file for elemen…
…tal2
- Loading branch information
Showing
2 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* @license | ||
* Copyright The Closure Library Authors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/** | ||
* @fileoverview Externs used by cspviolationobserver.js that are not available | ||
* in the open-source Closure compiler release. This file should be deleted | ||
* once w3c_reporting_observer.js is available in open-source externs. | ||
* | ||
* @externs | ||
*/ | ||
|
||
// TODO(user): Remove this file once w3c_reporting_observer.js is | ||
// available in the open-source Closure compiler. | ||
|
||
/** | ||
* https://w3c.github.io/reporting/#interface-reporting-observer | ||
* @constructor | ||
* @param {!ReportingObserverCallback} callback | ||
* @param {!ReportingObserverOptions} opts | ||
*/ | ||
function ReportingObserver2(callback, opts) {} | ||
/** @return {void} */ | ||
ReportingObserver2.prototype.observe = function() {}; | ||
/** @return {void} */ | ||
ReportingObserver2.prototype.disconnect = function() {}; | ||
/** @return {!Array<!Report>} */ | ||
ReportingObserver2.prototype.takeRecords = function() {}; | ||
|
||
/** | ||
* @typedef {ReportingObserver2|ReportingObserver} | ||
* @suppress {duplicate} | ||
*/ | ||
var ReportingObserver; | ||
|
||
|
||
/** | ||
* @typedef {!function(!Array<Report>, !ReportingObserver): void} | ||
* @suppress {duplicate} | ||
*/ | ||
var ReportingObserverCallback; | ||
|
||
|
||
/** | ||
* @constructor | ||
*/ | ||
function ReportingObserverOptions2() {} | ||
/** @type {undefined|!Array<string>} */ | ||
ReportingObserverOptions2.prototype.types; | ||
/** @type {boolean} */ | ||
ReportingObserverOptions2.prototype.buffered; | ||
|
||
/** | ||
* @typedef {ReportingObserverOptions2|ReportingObserverOptions} | ||
* @suppress {duplicate} | ||
*/ | ||
var ReportingObserverOptions; | ||
|
||
|
||
/** | ||
* @constructor | ||
* @suppress {duplicate} | ||
*/ | ||
function Report2() {} | ||
/** @type {string} */ Report2.prototype.type; | ||
/** @type {string} */ Report2.prototype.url; | ||
/** @type {?ReportBody} */ Report2.prototype.body; | ||
|
||
/** | ||
* @typedef {Report2|Report} | ||
* @suppress {duplicate} | ||
*/ | ||
var Report; | ||
|
||
|
||
/** | ||
* @constructor | ||
*/ | ||
function ReportBody2() {} | ||
|
||
/** | ||
* @typedef {ReportBody2|ReportBody2} | ||
* @suppress {duplicate} | ||
*/ | ||
var ReportBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* @fileoverview Describes types present in elemental2 1.1.0 that are not in closure-compiler, since they aren't | ||
* real browser types. Presently this only contains the `WebWorker` type which never existed as a browser type, | ||
* but showed up in closure-compiler as a typo or early draft or something. As long as elemental2 1.1.0 is | ||
* supported, we must keep this file in our closure-compiler fork. | ||
* | ||
* TODO Remove this once elemental2 1.1.0 is considered to be unsupported by j2cl - this day may not come soon, | ||
* if ever, as it is a "stable" release. | ||
* | ||
* @externs | ||
*/ | ||
|
||
/** | ||
* @see http://dev.w3.org/html5/workers/ | ||
* @constructor | ||
* @implements {EventTarget} | ||
*/ | ||
function WebWorker() {} | ||
|
||
/** @override */ | ||
WebWorker.prototype.addEventListener = function(type, listener, opt_options) {}; | ||
|
||
/** @override */ | ||
WebWorker.prototype.removeEventListener = function( | ||
type, listener, opt_options) {}; | ||
|
||
/** @override */ | ||
WebWorker.prototype.dispatchEvent = function(evt) {}; | ||
|
||
/** | ||
* Stops the worker process | ||
* @return {undefined} | ||
*/ | ||
WebWorker.prototype.terminate = function() {}; | ||
|
||
/** | ||
* Posts a message to the worker thread. | ||
* @param {string} message | ||
* @return {undefined} | ||
*/ | ||
WebWorker.prototype.postMessage = function(message) {}; | ||
|
||
/** | ||
* Sent when the worker thread posts a message to its creator. | ||
* @type {?function(!MessageEvent<*>): void} | ||
*/ | ||
WebWorker.prototype.onmessage; | ||
|
||
/** | ||
* Sent when the worker thread encounters an error. | ||
* @type {?function(!ErrorEvent): void} | ||
*/ | ||
WebWorker.prototype.onerror; | ||
|