Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 34 additions & 11 deletions javascript/externs/web/webstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,40 @@ WindowLocalStorage.prototype.localStorage;
*/
Window.prototype.localStorage;

/**
* @record
* @extends {EventInit}
* @see https://html.spec.whatwg.org/multipage/webstorage.html#dictdef-storageeventinit
*/
function StorageEventInit() {}

/** @type {(?string|undefined)} */
StorageEventInit.prototype.key;

/** @type {(?string|undefined)} */
StorageEventInit.prototype.oldValue;

/** @type {(?string|undefined)} */
StorageEventInit.prototype.newValue;

/** @type {(string|undefined)} */
StorageEventInit.prototype.url;

/** @type {(?Storage|undefined)} */
StorageEventInit.prototype.storageArea;

/**
* This is the storage event interface.
* @see http://www.w3.org/TR/2011/CR-webstorage-20111208/#the-storage-event
* @see https://html.spec.whatwg.org/multipage/webstorage.html#the-storageevent-interface
* @extends {Event}
* @constructor
* @param {string} type
* @param {StorageEventInit=} opt_eventInitDict
*/
function StorageEvent() {}
function StorageEvent(type, opt_eventInitDict) {}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the requested minorAnalysis change note in commit 55dc32272c0.


/**
* @type {string}
* @type {?string}
*/
StorageEvent.prototype.key;

Expand All @@ -132,17 +156,16 @@ StorageEvent.prototype.storageArea;

/**
* @param {string} typeArg
* @param {boolean} canBubbleArg
* @param {boolean} cancelableArg
* @param {string} keyArg
* @param {?string} oldValueArg
* @param {?string} newValueArg
* @param {string} urlArg
* @param {?Storage} storageAreaArg
* @param {boolean=} canBubbleArg
* @param {boolean=} cancelableArg
* @param {?string=} keyArg
* @param {?string=} oldValueArg
* @param {?string=} newValueArg
* @param {string=} urlArg
* @param {?Storage=} storageAreaArg
* @return {void}
*/
StorageEvent.prototype.initStorageEvent = function(typeArg, canBubbleArg,
cancelableArg, keyArg,
oldValueArg, newValueArg,
urlArg, storageAreaArg) {};

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Valid arguments passed to the `StorageEvent` constructor no longer produce alerts from `js/superfluous-trailing-arguments`.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| reflection.js:6:15:6:15 | 1 | Superfluous argument passed to $@. | reflection.js:1:1:1:23 | functio ... eturn;} | function f0 |
| reflection.js:7:15:7:18 | 1 | Superfluous arguments passed to $@. | reflection.js:1:1:1:23 | functio ... eturn;} | function f0 |
| reflection.js:12:18:12:18 | 2 | Superfluous argument passed to $@. | reflection.js:2:1:2:24 | functio ... eturn;} | function f1 |
| storageEvent.js:14:33:14:39 | "extra" | Superfluous argument passed to $@. | externs.js:55:1:55:49 | functio ... ict) {} | function StorageEvent |
| thisparameter.ts:4:11:4:12 | 45 | Superfluous argument passed to $@. | thisparameter.ts:1:1:1:45 | functio ... eturn;} | function foo |
| transformstream.ts:15:33:15:34 | {} | Superfluous argument passed to $@. | externs.js:48:1:48:76 | functio ... egy) {} | function TransformStream |
| tst.js:10:3:10:5 | g() | Superfluous argument passed to $@. | tst.js:1:1:4:1 | functio ... x+19;\\n} | function f |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,11 @@ Number.parseFloat = function(num) {};
*/
function TransformStream(transformer, writableStrategy, readableStrategy) {}

/**
* @constructor
* @param {string} type
* @param {StorageEventInit=} opt_eventInitDict
*/
function StorageEvent(type, opt_eventInitDict) {}

/** @externs */
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
new StorageEvent("storage");
new StorageEvent("storage", {});
new StorageEvent("storage", { key: "k", newValue: "v" });
new StorageEvent("storage", {
key: null,
oldValue: null,
newValue: null,
url: "",
storageArea: null,
bubbles: false,
cancelable: false,
composed: false
});
new StorageEvent("storage", {}, "extra"); // $ Alert
Loading