From 833796a20ff1effdaf90369f30914e8750efcf56 Mon Sep 17 00:00:00 2001 From: Imre Kiss Date: Fri, 19 May 2017 14:38:19 +0200 Subject: [PATCH] Fix the getBreakpoint() function in the HTML Debugger client. (#1839) There was a problem around the offset, the function tried to use some invalid object reference. JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com --- jerry-debugger/jerry-client-ws.html | 58 ++++++++++++++--------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/jerry-debugger/jerry-client-ws.html b/jerry-debugger/jerry-client-ws.html index fb3c224ee..d0c609cd1 100644 --- a/jerry-debugger/jerry-client-ws.html +++ b/jerry-debugger/jerry-client-ws.html @@ -520,37 +520,37 @@ function DebuggerClient(address) function getBreakpoint(breakpointData) { - var returnValue = {}; - var func = functions[breakpointData[0]]; - var offset = breakpointData[1]; + var returnValue = {}; + var func = functions[breakpointData[0]]; + var offset = breakpointData[1]; - if (offset in functions) - { - returnValue.breakpoint = func.offsets[offset]; - returnValue.at = true; - return returnValue; - } - - if (offset < functions.firstBreakpointOffset) - { - returnValue.breakpoint = func.offsets[firstBreakpointOffset]; - returnValue.at = true; - return returnValue; - } - - nearest_offset = -1; - - for (var current_offset in func.offsets) - { - if ((current_offset <= offset) && (current_offset > nearest_offset)) - { - nearest_offset = current_offset; - } - } - - returnValue.breakpoint = func.offsets[nearest_offset]; - returnValue.at = false; + if (offset in func.offsets) + { + returnValue.breakpoint = func.offsets[offset]; + returnValue.at = true; return returnValue; + } + + if (offset < func.firstBreakpointOffset) + { + returnValue.breakpoint = func.offsets[func.firstBreakpointOffset]; + returnValue.at = true; + return returnValue; + } + + nearest_offset = -1; + + for (var current_offset in func.offsets) + { + if ((current_offset <= offset) && (current_offset > nearest_offset)) + { + nearest_offset = current_offset; + } + } + + returnValue.breakpoint = func.offsets[nearest_offset]; + returnValue.at = false; + return returnValue; } this.encodeMessage = encodeMessage;