Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
chakrashim,lib,test: fixing build/test issues
Browse files Browse the repository at this point in the history
* Replaced `==` with `===` and `!=` with `!==` in failing files
* Marked `test-http-pipeline-flood` as flaky

PR-URL: #239
Reviewed-By: Kunal Pathak <Kunal.Pathak@microsoft.com>
Reviewed-By: Sandeep Agarwal <saagarwa@microsoft.com>
  • Loading branch information
kfarnung committed May 8, 2017
1 parent fe44f54 commit 4751de5
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 58 deletions.
92 changes: 46 additions & 46 deletions deps/chakrashim/lib/chakra_debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
var printStr = '';
for (var index in argsArray) {
var obj = argsArray[index];
if (obj != undefined) {
printStr += (typeof obj != 'string') ? JSON.stringify(obj) : obj;
if (obj !== undefined) {
printStr += (typeof obj !== 'string') ? JSON.stringify(obj) : obj;
printStr += ': ';
}
}
Expand Down Expand Up @@ -118,7 +118,7 @@
function AddChildrens(obj) {
if ('display' in obj) {
if (!('value' in obj) || !isFinite(obj['value']) ||
obj['value'] == null || obj['value'] == undefined) {
obj['value'] === null || obj['value'] === undefined) {
obj['value'] = obj['display'];
}
if (!('text' in obj)) {
Expand All @@ -129,7 +129,7 @@
}
}

if ('className' in obj && obj['className'] == 'Object') {
if ('className' in obj && obj['className'] === 'Object') {
obj.constructorFunction = {
'ref': globalExecutionState.GetObjectEvalHandle()
};
Expand All @@ -145,7 +145,7 @@
//var PROPERTY_ATTRIBUTE_READ_ONLY_VALUE = 0x2;

if (('propertyAttributes' in obj) &&
((obj['propertyAttributes'] & PROPERTY_ATTRIBUTE_HAVE_CHILDRENS) ==
((obj['propertyAttributes'] & PROPERTY_ATTRIBUTE_HAVE_CHILDRENS) ===
PROPERTY_ATTRIBUTE_HAVE_CHILDRENS)) {
var objectHandle = obj['handle'];

Expand Down Expand Up @@ -333,7 +333,7 @@
},
GetScriptFromHandle: function(handle) {
for (var i = 0; i < _scripts.length; ++i) {
if (_scripts[i] && _scripts[i].GetHandle() == handle) {
if (_scripts[i] && _scripts[i].GetHandle() === handle) {
return _scripts[i];
}
}
Expand Down Expand Up @@ -383,15 +383,15 @@
};

ExecutionState.prototype.IsAsyncBreak = function() {
return this.type == ExecutionStateType.Async;
return this.type === ExecutionStateType.Async;
};

ExecutionState.prototype.GetBreakScriptId = function() {
return this.breakScriptId;
};

ExecutionState.prototype.GetFrames = function() {
if (!this.frames || this.frames.length == 0) {
if (!this.frames || this.frames.length === 0) {
var _frames = [];
var stackTrace = CallHostFunction(chakraDebug.JsDiagGetStackTrace);
stackTrace.forEach(function(element, index, array) {
Expand Down Expand Up @@ -479,7 +479,7 @@

V8Script.prototype.IsSameFileName = function(fileName) {
if (fileName && this.GetFileName() &&
(this.GetFileName().toLowerCase() == fileName.toLowerCase())) {
(this.GetFileName().toLowerCase() === fileName.toLowerCase())) {
return true;
}
return false;
Expand Down Expand Up @@ -552,11 +552,11 @@
}

V8Breakpoint.prototype.GetTypeString = function() {
if (this.type == Debug.ScriptBreakPointType.ScriptId) {
if (this.type === Debug.ScriptBreakPointType.ScriptId) {
return 'scriptId';
} else if (this.type == Debug.ScriptBreakPointType.ScriptName) {
} else if (this.type === Debug.ScriptBreakPointType.ScriptName) {
return 'scriptName';
} else if (this.type == Debug.ScriptBreakPointType.ScriptRegExp) {
} else if (this.type === Debug.ScriptBreakPointType.ScriptRegExp) {
return 'scriptRegExp';
}
};
Expand Down Expand Up @@ -587,7 +587,7 @@
this.v8breakpoint.script_id = bpObject.scriptId;
this.v8breakpoint.script_name = this.scriptObject.GetScriptName();

if (this.type == Debug.ScriptBreakPointType.ScriptRegExp) {
if (this.type === Debug.ScriptBreakPointType.ScriptRegExp) {
this.v8breakpoint.script_regexp = this.target;
}

Expand Down Expand Up @@ -648,18 +648,18 @@
v8Scripts.forEach(function(element, index, array) {
var found = true;

if (ids != null) {
if (ids !== null) {
found = false;
for (var i = 0; i < ids.length; ++i) {
if (ids[i] == element.GetId()) {
if (ids[i] === element.GetId()) {
found = true;
break;
}
}
}

if (filter != null) {
found = filter == element.GetFileName();
if (filter !== null) {
found = filter === element.GetFileName();
}

if (found) {
Expand Down Expand Up @@ -699,22 +699,22 @@
var clearMemoizedScriptInfo = false;
if (request.arguments && request.arguments.stepaction) {
var jsDiagSetStepType = 0;
if (request.arguments.stepaction == 'in') {
if (request.arguments.stepaction === 'in') {
/* JsDiagStepTypeStepIn */
jsDiagSetStepType = 0;
} else if (request.arguments.stepaction == 'out') {
} else if (request.arguments.stepaction === 'out') {
/* JsDiagStepTypeStepOut */
jsDiagSetStepType = 1;
} else if (request.arguments.stepaction == 'next') {
} else if (request.arguments.stepaction === 'next') {
/* JsDiagStepTypeStepOver */
jsDiagSetStepType = 2;
} else if (request.arguments.stepaction == 'back') {
} else if (request.arguments.stepaction === 'back') {
/* JsDiagStepTypeStepBack */
jsDiagSetStepType = 3;
// We may recreate the script context
// Invalidating scriptIds so clear any memoized info
clearMemoizedScriptInfo = true;
} else if (request.arguments.stepaction == 'reverse') {
} else if (request.arguments.stepaction === 'reverse') {
/* JsDiagStepTypeStepBack */
jsDiagSetStepType = 4;
// We may recreate the script context
Expand Down Expand Up @@ -750,7 +750,7 @@

if (request.arguments) {
var scriptObject;
if (request.arguments.type == 'scriptRegExp') {
if (request.arguments.type === 'scriptRegExp') {
var targetRegex = new RegExp(request.arguments.target);
scriptObject =
DebugManager.ScriptsManager.GetScriptFromMatchingFileName(
Expand All @@ -760,17 +760,17 @@
breakpointType = Debug.ScriptBreakPointType.ScriptRegExp;
breakpointTarget = request.arguments.target;
}
} else if (request.arguments.type == 'script' &&
(request.arguments.target == null ||
request.arguments.target == undefined)) {
} else if (request.arguments.type === 'script' &&
(request.arguments.target === null ||
request.arguments.target === undefined)) {
var breakScriptId = globalExecutionState.GetBreakScriptId();
scriptObject = DebugManager.ScriptsManager.GetScript(breakScriptId);
if (scriptObject) {
breakpointScript = scriptObject;
breakpointType = Debug.ScriptBreakPointType.ScriptId;
breakpointTarget = request.arguments.target;
}
} else if (request.arguments.type == 'script' &&
} else if (request.arguments.type === 'script' &&
request.arguments.target) {
scriptObject = DebugManager.ScriptsManager.GetScriptFromFileName(
request.arguments.target);
Expand All @@ -779,7 +779,7 @@
breakpointType = Debug.ScriptBreakPointType.ScriptName;
breakpointTarget = request.arguments.target;
}
} else if (request.arguments.type == 'scriptId' &&
} else if (request.arguments.type === 'scriptId' &&
request.arguments.target) {
var scriptId = parseInt(request.arguments.target);
scriptObject = DebugManager.ScriptsManager.GetScript(scriptId);
Expand All @@ -790,11 +790,11 @@
}
}

if (typeof request.arguments.line == 'number') {
if (typeof request.arguments.line === 'number') {
line = request.arguments.line;
}

if (typeof request.arguments.column == 'number') {
if (typeof request.arguments.column === 'number') {
column = request.arguments.column;
}
}
Expand All @@ -814,7 +814,7 @@
response.body.breakpoint = v8Breakpoint.Id();
}
} else {
if (optAddToPending != false) {
if (optAddToPending !== false) {
DebugManager.BreakpointManager.AddPendingBreakpoint(request);
}
}
Expand All @@ -826,10 +826,10 @@
var toFrame = frames.length;

if (request.arguments) {
if (request.arguments.fromFrame != undefined) {
if (request.arguments.fromFrame !== undefined) {
fromFrame = request.arguments.fromFrame;
}
if (request.arguments.toFrame != undefined &&
if (request.arguments.toFrame !== undefined &&
request.arguments.toFrame < toFrame) {
toFrame = request.arguments.toFrame;
}
Expand Down Expand Up @@ -893,14 +893,14 @@
var frames = globalExecutionState.GetFrames();
var frame = frames[0];
if (request.arguments) {
if (typeof request.arguments.frame == 'number') {
if (typeof request.arguments.frame === 'number') {
for (var i = 0; i < frames.length; ++i) {
if (request.arguments.frame == frames[i].GetIndex()) {
if (request.arguments.frame === frames[i].GetIndex()) {
frame = frames[i];
break;
}
}
} else if (request.arguments.global == true) {
} else if (request.arguments.global === true) {
frame = frames[frames.length - 1];
}

Expand Down Expand Up @@ -942,11 +942,11 @@
}

if (enabled && request.arguments.type) {
if (request.arguments.type == 'all') {
if (request.arguments.type === 'all') {
// JsDiagBreakOnExceptionAttributeUncaught |
// JsDiagBreakOnExceptionAttributeFirstChance
breakOnExceptionAttribute = 0x1 | 0x2;
} else if (request.arguments.type == 'uncaught') {
} else if (request.arguments.type === 'uncaught') {
// JsDiagBreakOnExceptionAttributeUncaught
breakOnExceptionAttribute = 0x1;
}
Expand All @@ -968,14 +968,14 @@
var frameIndex = -1;
var frame;
for (var i = 0; i < frames.length; ++i) {
if (frames[i].GetIndex() == request.arguments.frameNumber) {
if (frames[i].GetIndex() === request.arguments.frameNumber) {
frameIndex = frames[i].GetIndex();
frame = frames[i];
break;
}
}

if (frameIndex != -1) {
if (frameIndex !== -1) {
var props = frame.GetStackProperties();
var scopes = [];
var refs = [];
Expand Down Expand Up @@ -1072,9 +1072,9 @@
response.success = true;
response.body = {};
response.body.breakpoints = [];
response.body.breakOnExceptions = breakOnExceptionAttribute != 0;
response.body.breakOnExceptions = breakOnExceptionAttribute !== 0;
response.body.breakOnUncaughtExceptions =
(breakOnExceptionAttribute & 0x1) == 0x1;
(breakOnExceptionAttribute & 0x1) === 0x1;

var breakpoints = DebugManager.BreakpointManager.GetBreakpoints();

Expand Down Expand Up @@ -1282,7 +1282,7 @@
try {
var chakraDebugEventProcessor = new ChakraDebugEventProcessor(eventData);
var event = chakraDebugEventProcessor[debugEvent]();
if (typeof event != 'undefined') {
if (typeof event !== 'undefined') {
event = JSON.stringify(event);
}
Logger.LogDebugJson('ProcessDebugEvent debugEvent: ' +
Expand All @@ -1298,9 +1298,9 @@

if (!globalExecutionState) {
shouldContinue = true;
} else if (typeof debugEvent == 'number' &&
((debugEvent == 0 /*JsDiagDebugEventSourceCompile*/) ||
(debugEvent == 1 /*JsDiagDebugEventCompileError*/))) {
} else if (typeof debugEvent === 'number' &&
((debugEvent === 0 /*JsDiagDebugEventSourceCompile*/) ||
(debugEvent === 1 /*JsDiagDebugEventCompileError*/))) {
shouldContinue = true;
} else if (globalExecutionState.IsAsyncBreak()) {
globalExecutionState = undefined;
Expand Down
14 changes: 7 additions & 7 deletions deps/chakrashim/lib/chakra_inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
var printStr = '';
for (var index in argsArray) {
var obj = argsArray[index];
if (obj != undefined) {
printStr += (typeof obj != 'string') ? JSON.stringify(obj) : obj;
if (obj !== undefined) {
printStr += (typeof obj !== 'string') ? JSON.stringify(obj) : obj;
printStr += ': ';
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@

V8Script.prototype.IsSameFileName = function(fileName) {
if (fileName && this.GetFileName() &&
(this.GetFileName().toLowerCase() == fileName.toLowerCase())) {
(this.GetFileName().toLowerCase() === fileName.toLowerCase())) {
return true;
}
return false;
Expand All @@ -197,11 +197,11 @@
}

V8Breakpoint.prototype.GetTypeString = function() {
if (this.type == Debug.ScriptBreakPointType.ScriptId) {
if (this.type === Debug.ScriptBreakPointType.ScriptId) {
return 'scriptId';
} else if (this.type == Debug.ScriptBreakPointType.ScriptName) {
} else if (this.type === Debug.ScriptBreakPointType.ScriptName) {
return 'scriptName';
} else if (this.type == Debug.ScriptBreakPointType.ScriptRegExp) {
} else if (this.type === Debug.ScriptBreakPointType.ScriptRegExp) {
return 'scriptRegExp';
}
};
Expand Down Expand Up @@ -232,7 +232,7 @@
this.v8breakpoint.script_id = bpObject.scriptId;
this.v8breakpoint.script_name = this.scriptObject.GetScriptName();

if (this.type == Debug.ScriptBreakPointType.ScriptRegExp) {
if (this.type === Debug.ScriptBreakPointType.ScriptRegExp) {
this.v8breakpoint.script_regexp = this.target;
}

Expand Down
8 changes: 4 additions & 4 deletions deps/chakrashim/lib/chakra_shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
for (var i = 0; i < splittedStack.length; i++) {
// parseStack has 1 frame lesser than skipDepth. So skip calling .caller
// once. After that, continue calling .caller
if (skipDepth != 1 && curr) {
if (skipDepth !== 1 && curr) {
try {
curr = curr.caller;
} catch (e) {
Expand Down Expand Up @@ -514,10 +514,10 @@
return captureStackTrace({}, undefined)();
};
utils.isMapIterator = function(value) {
return value[mapIteratorProperty] == true;
return value[mapIteratorProperty] === true;
};
utils.isSetIterator = function(value) {
return value[setIteratorProperty] == true;
return value[setIteratorProperty] === true;
};
function compareType(o, expectedType) {
return Object_prototype_toString.call(o) === '[object ' +
Expand Down Expand Up @@ -594,7 +594,7 @@
};
utils.getPropertyAttributes = function(object, value) {
var descriptor = Object_getOwnPropertyDescriptor(object, value);
if (descriptor == undefined) {
if (descriptor === undefined) {
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/trace_mgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ function checkGlobalShouldEmit(emitKind, optInfo) {
} else {
return (emitOptions.emitOnExit === 'error') && (optInfo !== 0);
}
} else if (emitKind == 'emitOnException' || emitKind == 'emitOnSigInt') {
} else if (emitKind === 'emitOnException' || emitKind === 'emitOnSigInt') {
return emitOptions[emitKind];
} else {
if (!emitOptions[emitKind]) {
Expand Down
1 change: 1 addition & 0 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ test-buffer-bindingobj-no-zerofill : PASS,FLAKY
test-regress-GH-12371 : PASS,FLAKY
test-util : PASS,FLAKY
test-zlib-convenience-methods : PASS,FLAKY
test-http-pipeline-flood : PASS,FLAKY

[$jsEngine==chakracore && $arch==x64]
test-buffer-includes : SKIP
Expand Down

0 comments on commit 4751de5

Please sign in to comment.