Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1930)

Unified Diff: Source/devtools/scripts/jsdoc-validator/tests/this.js

Issue 203443010: DevTools: [JsDocValidator] Fix checking of receivers specified as arguments (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a suppression hint message Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/scripts/jsdoc-validator/tests/golden.dat ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/scripts/jsdoc-validator/tests/this.js
diff --git a/Source/devtools/scripts/jsdoc-validator/tests/this.js b/Source/devtools/scripts/jsdoc-validator/tests/this.js
index 16af46a6d39a0951cf3dc87394fb6ea3ae6c9e4d..165c165fcdc881c6372bfced0432730d77fb0e83 100644
--- a/Source/devtools/scripts/jsdoc-validator/tests/this.js
+++ b/Source/devtools/scripts/jsdoc-validator/tests/this.js
@@ -228,6 +228,42 @@ ReceiverTest.prototype = {
this.memberTwo(callbackWithThis.bind(null, 2)); // ERROR - Used as argument with no bound receiver (null means "no receiver").
this.memberTwo(callbackNoThis.bind(this)); // ERROR - Bound to a receiver but has no @this annotation.
this.memberTwo(callbackNoThis.bind(foo)); // ERROR - Bound to a receiver but has no @this annotation.
+
+ // Callback receivers specified as arguments.
+
+ array.forEach(callbackWithThis, this);
+ array.forEach(callbackNoThis);
+
+ array.forEach(callbackWithThis); // ERROR - No receiver.
+ array.forEach(callbackNoThis, this); // ERROR - Receiver for callback with no @this annotation.
+
+ var isMultiline = false;
+
+ element.addEventListener("click", callbackNoThis);
+ element.addEventListener("click", callbackNoThis, true);
+ element.addEventListener("click", callbackNoThis, false);
+ element.addEventListener("click", callbackNoThis, isMultiline); // OK - ignored.
+
+ element.addEventListener("click", callbackNoThis, this); // ERROR.
+
+ element.addEventListener("click", callbackWithThis, this);
+ element.addEventListener("click", callbackWithThis, foo); // OK - ignored.
+ element.addEventListener("click", callbackWithThis, isMultiline); // OK - ignored.
+
+ element.addEventListener("click", callbackWithThis, true); // ERROR.
+ element.addEventListener("click", callbackWithThis, false); // ERROR.
+
+ // DevTools-specific.
+
+ /**
+ * @suppressReceiverCheck
+ * @this {Object}
+ */
+ function ignoredCallbackWithThis()
+ {
+ this.foo = 1;
+ }
+ object.callFunction(func, [], ignoredCallbackWithThis); // OK - ignored.
},
memberTwo: function(arg) {}
« no previous file with comments | « Source/devtools/scripts/jsdoc-validator/tests/golden.dat ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698