Permalink
Browse files

Merge pull request #1631 from ajaxorg/multi_concurrency_bug

Simple concurrency bug detection
  • Loading branch information...
2 parents 04537b9 + 8f2f178 commit 222f5492e119ca5462a749d7030c8845715cea10 @zefhemel zefhemel committed Jun 1, 2012
Showing with 41 additions and 0 deletions.
  1. +41 −0 plugins-client/ext.console/console.js
@@ -444,6 +444,47 @@ module.exports = ext.register("ext/console/console", {
this.createNodeProcessLog(message.pid);
return;
case "node-data":
+ if (message.data && message.data.indexOf("Tip: you can") === 0) {
+ (function () {
+ var prjmatch = message.data.match(/http\:\/\/([\w_-]+)\.([\w_-]+)\./);
+ if (!prjmatch) return;
+
+ var user = prjmatch[2];
+ var project = prjmatch[1];
+
+ var urlPath = window.location.pathname.split("/").filter(function (f) { return !!f; });
+
+ if (project !== ide.projectName) {
+ // concurrency bug, project does not match
+ apf.ajax("/api/debug", {
+ method: "POST",
+ contentType: "application/json",
+ data: JSON.stringify({
+ agent: navigator.userAgent,
+ type: "Concurrency bug, project does not match",
+ e: [user, project, urlPath],
+ workspaceId: ide.workspaceId
+ })
+ });
+ }
+ else if (urlPath.length && user !== urlPath[0]) {
+ // concurrency bug, user does not match
+ apf.ajax("/api/debug", {
+ method: "POST",
+ contentType: "application/json",
+ data: JSON.stringify({
+ agent: navigator.userAgent,
+ type: "Concurrency bug, user does not match",
+ e: [user, project, urlPath],
+ workspaceId: ide.workspaceId
+ })
+ });
+ }
+
+ return;
+ }());
+ }
+
logger.logNodeStream(message.data, message.stream, this.getLogStreamOutObject(message.pid, true), ide);
return;
case "node-exit":

0 comments on commit 222f549

Please sign in to comment.